Skip to content

Commit

Permalink
fix: get balance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonberg1997 committed Jan 20, 2025
1 parent c09d91f commit e007c61
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/plugin-bnb/src/actions/getBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ export class GetBalanceAction {
token as `0x${string}`
);
} else {
if (chainId != 56) {
throw new Error(
"Only BSC mainnet is supported for querying balance by token symbol"
);
}

this.walletProvider.configureLiFiSdk(chain);
const tokenInfo = await getToken(chainId, token);
amount = await this.getERC20TokenBalance(
Expand Down Expand Up @@ -120,15 +126,6 @@ export class GetBalanceAction {
params.address
);
}

if (params.token.startsWith("0x")) {
// if token contract address is not provided, only BSC mainnet is supported
if (params.chain != "bsc") {
throw new Error(
"Only BSC mainnet is supported for querying balance by token symbol"
);
}
}
}
}

Expand Down

0 comments on commit e007c61

Please sign in to comment.