Closed francelwebdev closed 7 months ago
yes since we don't have a function called as getTokenBalance, we have only getNativeBalance function which returns your native balance on the sw. For fetching token balances, please refer the example 05-get-account-balances.ts which has an optional parameter called as tokens
while calling the function primeSdk.getAccountBalance
I get this error when I use :
const result = await primeSdk.getAccountBalances({
// account?: string;
tokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
],
chainId: 1,
// provider?: string;
});
29 | var ApolloError = (function (_super) { 30 | tslib.__extends(ApolloError, _super); 31 | function ApolloError(_a) { 32 | var graphQLErrors = _a.graphQLErrors, protocolErrors = _a.protocolErrors, clientErrors = _a.clientErrors, networkError = _a.networkError, errorMessage = _a.errorMessage, extraInfo = _a.extraInfo; 33 | var _this = _super.call(this, errorMessage) || this; ^ ApolloError: Response not successful: Received status code 400 at new ApolloError (/home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/errors/errors.cjs:33:20) at /home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/core/core.cjs:1987:18 at both (/home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/utilities/utilities.cjs:1263:30) at /home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/utilities/utilities.cjs:1254:71 at new Promise (:1:20) at then (/home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/utilities/utilities.cjs:1254:23) at /home/francel/Bureau/etherspot_prime_test/node_modules/@apollo/client/utilities/utilities.cjs:1265:35 at notifySubscription (/home/francel/Bureau/etherspot_prime_test/node_modules/zen-observable/lib/Observable.js:140:15) at onNotify (/home/francel/Bureau/etherspot_prime_test/node_modules/zen-observable/lib/Observable.js:179:2) at error (/home/francel/Bureau/etherspot_prime_test/node_modules/zen-observable/lib/Observable.js:240:6)
Describe the bug
I want to get the balance of an token of a SCW address. When i call the function getTokenBalance on the instance of PrimeSdk i get :Property 'getTokenBalance' does not exist on type 'PrimeSdk'.ts(2339)
Expected behavior
I found the function getTokenBalance(tokenAddress: string) in the documentation and I expected the function to exist and return the balance
Steps to reproduce
No response
Additional context
No response
Operating system
Linux
Prime SDK version or commit hash
latest