Wallet
This part of the guide will cover how to show the user's wallet balance and activity.
This data will be retrieved from the Slyk API inside a Next.js getServerSideProps
method using the Slyk SDK.
Get the list of assets
One thing you'll need is the list of assets. This includes formatting information, like the asset's symbol and decimal places.
The assets can be retrieved with the slyk.asset.list
method. Be sure to request all the enabled assets, like shown in the following snippet:
Get the user's balance
Then request the user's balance. For this you'll first need to validate the JWT using slyk.auth.validate
. This will give you the user object. With this you can now request the balance of the user's primary wallet using the slyk.wallet.balance
method, which gives you the list of balances in that wallet on each asset. Please note that balances only appear after the wallet is first credited.
Get the wallet activity
Get the featured products
Put it all together
Last updated
Was this helpful?