In order to use the function below, you need to import the hooks for React or React native.
Returns a url of a widget where the user can buy a Token using a credit / debit card see the Token Checkout integration guidelines for more details about this feature.
Copy await sdk . token .buyWithFiat ({
tokenId : '1' ,
toWalletAddress : '0x123456789' ,
amount : '1' ,
})
Returns the current balance of tokens in the user's wallet for multiple blockchains
Copy Promise <{
[blockchainId : string ] : {
value : string
tokenMetadata : {
tokenAddress : string
tokenDecimals : string
tokenName : string
tokenSymbol : string
}
}[]
}>
Copy const { data , error , loading } = await hooks .useTokenBalance ()
// or
const { data , error , loading } = await hooks .useTokenBalance ({ blockchainIds : [ 'ethereum' , 'polygon' ] })
Copy {
"ethereum" : [
{
"value" : "0.12" ,
"tokenMetadata" : {
"tokenAddress" : "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0" ,
"tokenDecimals" : "18" ,
"tokenName" : "Polygon Matic" ,
"tokenSymbol" : "MATIC"
}
}
] ,
"polygon" : []
}
Copy Promise <{
[blockchainId : string ] : {
createdAt : string
value : string
tokenMetadata : {
tokenDecimals : string
tokenName : string
tokenSymbol : string
}
toAddress : string ,
fromAddress : string
direction : string
gasUsed : string
gasLimit : number
gasPrice : string
id : string
status : string
type : "buy" | "fund" | "receive" | "sell" | "send"
}[]
}>
Copy const { data , error , loading } = hooks .useTokenTransactions ()
// or
const { data , error , loading } = await hooks .useTokenTransactions ({ blockchainIds : [ 'ethereum' , 'polygon' ] })
Copy {
"tezosGhost" : [
{
"createdAt" : "2023-06-29T07:48:00Z" ,
"value" : "3.0" ,
"tokenMetadata" : {
"tokenAddress" : "KT1AfUy48JvqVvtcXKxBDy1guDTJSWd1n8Uv" ,
"tokenDecimals" : "18" ,
"tokenName" : "Kolibri USD" ,
"tokenSymbol" : "kUSD"
} ,
"nonce" : "16941458" ,
"direction" : "incoming" ,
"toAddress" : "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho" ,
"fromAddress" : "tz1Vr7wLtVvpCdmLTTNPgt8rP9vjmFxRMSWg" ,
"gasUsed" : "3219" ,
"id" : "opaoXY13tkcrYeok4BmXRAFGTffCD5RyyWhWrB9kubR1aduPPC3" ,
"gasPrice" : "0" ,
"status" : "completed" ,
"type" : "receive"
} ,
{
"createdAt" : "2023-06-29T07:47:41Z" ,
"value" : "3.0" ,
"tokenMetadata" : {
"tokenAddress" : "KT1H9hKtcqcMHuCoaisu8Qy7wutoUPFELcLm" ,
"tokenDecimals" : "6" ,
"tokenName" : "Tether USD" ,
"tokenSymbol" : "USDT"
} ,
"gas" : "3619" ,
"nonce" : "16941457" ,
"direction" : "incoming" ,
"toAddress" : "tz1NpGHrD9qNZNnXWTyVYkPgq3DvdhC7hDho" ,
"fromAddress" : "tz1Vr7wLtVvpCdmLTTNPgt8rP9vjmFxRMSWg" ,
"gasUsed" : "3619" ,
"id" : "oovjQ5YiHaD3Tsw7ukF9qYzsB1iSm6PWooDUPXh13FeMkja1Sm4" ,
"gasPrice" : "0" ,
"status" : "completed" ,
"type" : "receive"
}
] ,
"ethereumSepolia" : [
{
"fromAddress" : "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b" ,
"toAddress" : "0x2f42ee19146b55f624ebd9ea66d3919ba13eec8b" ,
"value" : "1.0" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be" ,
"gasUsed" : "52155" ,
"gasPrice" : "4926498365" ,
"direction" : "incoming" ,
"createdAt" : "2023-06-28T08:17:58Z" ,
"tokenMetadata" : {
"tokenSymbol" : "TW" ,
"tokenName" : "Tweed" ,
"tokenDecimals" : "18" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be"
} ,
"id" : "0x01e3183570f73a714cdc876916e6d83d8246b8aa0ad8da7975f5bc258822c4bc" ,
"nonce" : "1" ,
"status" : "completed" ,
"type" : "send"
} ,
{
"fromAddress" : "0x0000000000000000000000000000000000000000" ,
"toAddress" : "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b" ,
"value" : "2000000.0" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be" ,
"gasUsed" : "37081" ,
"gasPrice" : "15684032508" ,
"direction" : "incoming" ,
"createdAt" : "2023-06-28T08:17:58Z" ,
"tokenMetadata" : {
"tokenSymbol" : "TW" ,
"tokenName" : "Tweed" ,
"tokenDecimals" : "18" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be"
} ,
"id" : "0xd07bbacb39570e8442207a3a8dcd4392294ec9ba37d089e67206ee5a9e58f084" ,
"nonce" : "10" ,
"status" : "completed" ,
"type" : "receive"
} ,
{
"fromAddress" : "0x0000000000000000000000000000000000000000" ,
"toAddress" : "0x3a27c671c01be1b8ba8fd0be94e8cfe5f77fc67b" ,
"value" : "0.0000000002" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be" ,
"gasUsed" : "71221" ,
"gasPrice" : "13720111665" ,
"direction" : "incoming" ,
"createdAt" : "2023-06-28T08:17:58Z" ,
"tokenMetadata" : {
"tokenSymbol" : "TW" ,
"tokenName" : "Tweed" ,
"tokenDecimals" : "18" ,
"tokenAddress" : "0xe15501dd8857a885defe240147ea3b1c998855be"
} ,
"id" : "0x29b1be7296483450ef8e437911e1900832ca10ec88caeb5c05d15f3fd60b0769" ,
"nonce" : "9" ,
"status" : "completed" ,
"type" : "receive"
}
]
}