bridge_ui: fetch destination asset balance
Change-Id: Ib7581e8d4c6cae57ba50d2280badb79619dfe4ff
This commit is contained in:
parent
0ef1bf4374
commit
666a4d12d5
|
@ -61,32 +61,35 @@ function useGetBalanceEffect(sourceOrTarget: "source" | "target") {
|
|||
let cancelled = false;
|
||||
|
||||
if (lookupChain === CHAIN_ID_TERRA && terraWallet) {
|
||||
lcd.bank.balance(terraWallet.terraAddress).then((value) => {
|
||||
console.log(lookupAsset);
|
||||
console.log(value.toIntCoins());
|
||||
});
|
||||
|
||||
lcd.wasm
|
||||
.contractQuery(lookupAsset, {
|
||||
token_info: {},
|
||||
})
|
||||
.then((info: any) =>
|
||||
lcd.wasm
|
||||
.contractQuery(lookupAsset, {
|
||||
balance: {
|
||||
address: terraWallet.walletAddress,
|
||||
},
|
||||
})
|
||||
.then((balance: any) => {
|
||||
if (balance && info) {
|
||||
dispatch(
|
||||
setAction(
|
||||
// TODO: Replace with the following once LCD lookup in place.
|
||||
// createParsedTokenAccount(
|
||||
// undefined,
|
||||
// n.toString(),
|
||||
// decimals,
|
||||
// Number(formatUnits(n, decimals)),
|
||||
// formatUnits(n, decimals)
|
||||
// )
|
||||
createParsedTokenAccount(
|
||||
"",
|
||||
"",
|
||||
"100000",
|
||||
5,
|
||||
Number(formatUnits(100000, 5)),
|
||||
formatUnits(100000, 5)
|
||||
balance.balance.toString(),
|
||||
info.decimals,
|
||||
Number(formatUnits(balance.balance, info.decimals)),
|
||||
formatUnits(balance.balance, info.decimals)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
if (lookupChain === CHAIN_ID_SOLANA && solPK) {
|
||||
let mint;
|
||||
try {
|
||||
|
@ -158,15 +161,16 @@ function useGetBalanceEffect(sourceOrTarget: "source" | "target") {
|
|||
};
|
||||
}, [
|
||||
dispatch,
|
||||
solanaWallet,
|
||||
terraWallet,
|
||||
sourceOrTarget,
|
||||
setAction,
|
||||
lookupChain,
|
||||
lcd,
|
||||
lookupAsset,
|
||||
solPK,
|
||||
lookupChain,
|
||||
provider,
|
||||
setAction,
|
||||
signerAddress,
|
||||
solanaWallet,
|
||||
solPK,
|
||||
sourceOrTarget,
|
||||
terraWallet,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import {
|
|||
} from "@certusone/wormhole-sdk";
|
||||
import { WalletContextState } from "@solana/wallet-adapter-react";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
import * as bech32 from "bech32";
|
||||
import {
|
||||
ConnectedWallet,
|
||||
useConnectedWallet,
|
||||
|
|
Loading…
Reference in New Issue