@weblock-wallet/sdk 0.1.35 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104316,6 +104316,7 @@ var WalletService = class {
|
|
|
104316
104316
|
async getTokenBalance(tokenAddress, walletAddress, chainId) {
|
|
104317
104317
|
const erc20 = new Interface(ERC20_ABI);
|
|
104318
104318
|
const data = erc20.encodeFunctionData("balanceOf", [walletAddress]);
|
|
104319
|
+
console.log("getTokenBalance data:", data);
|
|
104319
104320
|
const rawBalance = await this.rpcClient.sendRpc({
|
|
104320
104321
|
chainId,
|
|
104321
104322
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104327,7 +104328,9 @@ var WalletService = class {
|
|
|
104327
104328
|
"latest"
|
|
104328
104329
|
]
|
|
104329
104330
|
});
|
|
104331
|
+
console.log("getTokenBalance rawBalance:", rawBalance);
|
|
104330
104332
|
const decimalsData = erc20.encodeFunctionData("decimals", []);
|
|
104333
|
+
console.log("getTokenBalance decimalsData:", decimalsData);
|
|
104331
104334
|
const decimalsRes = await this.rpcClient.sendRpc({
|
|
104332
104335
|
chainId,
|
|
104333
104336
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104339,8 +104342,11 @@ var WalletService = class {
|
|
|
104339
104342
|
"latest"
|
|
104340
104343
|
]
|
|
104341
104344
|
});
|
|
104345
|
+
console.log("getTokenBalance decimalsRes:", decimalsRes);
|
|
104342
104346
|
const decimals = parseInt(decimalsRes.result, 16);
|
|
104347
|
+
console.log("getTokenBalance decimals:", decimals);
|
|
104343
104348
|
const symbolData = erc20.encodeFunctionData("symbol", []);
|
|
104349
|
+
console.log("getTokenBalance symbolData:", symbolData);
|
|
104344
104350
|
const symbolRes = await this.rpcClient.sendRpc({
|
|
104345
104351
|
chainId,
|
|
104346
104352
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104352,7 +104358,9 @@ var WalletService = class {
|
|
|
104352
104358
|
"latest"
|
|
104353
104359
|
]
|
|
104354
104360
|
});
|
|
104361
|
+
console.log("getTokenBalance symbolRes:", symbolRes);
|
|
104355
104362
|
const symbol = erc20.decodeFunctionResult("symbol", symbolRes.result)[0];
|
|
104363
|
+
console.log("getTokenBalance symbol:", symbol);
|
|
104356
104364
|
return {
|
|
104357
104365
|
raw: rawBalance.result,
|
|
104358
104366
|
formatted: TokenAmount.format(rawBalance.result, decimals),
|