@weblock-wallet/sdk 0.1.35 → 0.1.37
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.cjs
CHANGED
|
@@ -104361,6 +104361,7 @@ var WalletService = class {
|
|
|
104361
104361
|
async getTokenBalance(tokenAddress, walletAddress, chainId) {
|
|
104362
104362
|
const erc20 = new import_ethers2.Interface(ERC20_ABI);
|
|
104363
104363
|
const data = erc20.encodeFunctionData("balanceOf", [walletAddress]);
|
|
104364
|
+
console.log("getTokenBalance data:", data);
|
|
104364
104365
|
const rawBalance = await this.rpcClient.sendRpc({
|
|
104365
104366
|
chainId,
|
|
104366
104367
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104372,7 +104373,9 @@ var WalletService = class {
|
|
|
104372
104373
|
"latest"
|
|
104373
104374
|
]
|
|
104374
104375
|
});
|
|
104376
|
+
console.log("getTokenBalance rawBalance:", rawBalance);
|
|
104375
104377
|
const decimalsData = erc20.encodeFunctionData("decimals", []);
|
|
104378
|
+
console.log("getTokenBalance decimalsData:", decimalsData);
|
|
104376
104379
|
const decimalsRes = await this.rpcClient.sendRpc({
|
|
104377
104380
|
chainId,
|
|
104378
104381
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104384,8 +104387,11 @@ var WalletService = class {
|
|
|
104384
104387
|
"latest"
|
|
104385
104388
|
]
|
|
104386
104389
|
});
|
|
104390
|
+
console.log("getTokenBalance decimalsRes:", decimalsRes);
|
|
104387
104391
|
const decimals = parseInt(decimalsRes.result, 16);
|
|
104392
|
+
console.log("getTokenBalance decimals:", decimals);
|
|
104388
104393
|
const symbolData = erc20.encodeFunctionData("symbol", []);
|
|
104394
|
+
console.log("getTokenBalance symbolData:", symbolData);
|
|
104389
104395
|
const symbolRes = await this.rpcClient.sendRpc({
|
|
104390
104396
|
chainId,
|
|
104391
104397
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104397,7 +104403,9 @@ var WalletService = class {
|
|
|
104397
104403
|
"latest"
|
|
104398
104404
|
]
|
|
104399
104405
|
});
|
|
104406
|
+
console.log("getTokenBalance symbolRes:", symbolRes);
|
|
104400
104407
|
const symbol = erc20.decodeFunctionResult("symbol", symbolRes.result)[0];
|
|
104408
|
+
console.log("getTokenBalance symbol:", symbol);
|
|
104401
104409
|
return {
|
|
104402
104410
|
raw: rawBalance.result,
|
|
104403
104411
|
formatted: TokenAmount.format(rawBalance.result, decimals),
|