Get a User's Native Token Balance

Use this method to get User's Native Balance (like BNB, ETH, MATIC)

Usage in your script

GetUserBalance
  .Initialize(destroyAtEnd: true)
  .SetParameters(
    chainId: "97",
    userAddress: "0x01dw4...",
  )
  .OnError(error => Debug.Log(error))
  .OnComplete(result => Debug.Log(result.balance))
  .Run();

Member Functions

.Initialize()

ParameterTypeRequiredDescription

destroyAtEnd

bool

Optional

defines if this component will be destroyed after .Run()

.SetParameters()

ParameterTypeRequiredDescription

chainId

String

Yes

The chain id

userAddress

String

Yes

address of the user

.onError()

Action on Error: returns error information.

.onComplete()

Action on successful: returns balance of user.

.Run()

Runs the API call and fills the corresponding model in the component on success.

Last updated