Skip to content

Commit

Permalink
fix erc20 contract call
Browse files Browse the repository at this point in the history
  • Loading branch information
Rihyx committed Mar 21, 2024
1 parent c3712a8 commit 7aafa02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/sdk/src/contract/contracts/Erc20/Erc20Public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Erc20Public implements BalanceContractInterface {
const data = await this.#publicClient.readContract({
abi,
address: this.#config.address as `0x${string}`,
args: [this.address],
args: this.#config.args,
functionName: 'balanceOf',
});

Expand Down
4 changes: 3 additions & 1 deletion packages/sdk/src/getTransferData/getTransferData.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export async function getBalance({
chain as EvmParachain,
) as BalanceContractInterface;

return contract.getBalance();
const balance = await contract.getBalance();

return balance;
}

export async function getDecimals({
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/tests/acceptance/__snapshots__/sdk.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ exports[`sdk getParachainBalances should get expected balances for HydraDX for s
exports[`sdk getParachainBalances should get expected balances for Moonbase Alpha 1`] = `
[
r {
"amount": 0n,
"amount": 1234567890000000000n,
"decimals": 18,
"key": "ftmwh",
"originSymbol": "FTM.wh",
Expand Down Expand Up @@ -264,7 +264,7 @@ exports[`sdk getParachainBalances should get expected balances for Moonbase Alph
"symbol": "ALAN",
},
r {
"amount": 0n,
"amount": 6543210000000000000n,
"decimals": 18,
"key": "dev",
"originSymbol": "DEV",
Expand Down Expand Up @@ -386,7 +386,7 @@ exports[`sdk getParachainBalances should get expected balances for Moonbeam 1`]
"symbol": "USDT.Wh",
},
r {
"amount": 374573n,
"amount": 0n,
"decimals": 6,
"key": "usdcwh",
"originSymbol": "USDC.Wh",
Expand Down

0 comments on commit 7aafa02

Please sign in to comment.