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