bridge_ui: terra2 testnet
This commit is contained in:
parent
2144d68a09
commit
0a9e2b12ff
|
@ -8,7 +8,7 @@
|
|||
"name": "test_ui",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.4.2",
|
||||
"@certusone/wormhole-sdk": "^0.4.3",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
@ -2132,9 +2132,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@certusone/wormhole-sdk": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.2.tgz",
|
||||
"integrity": "sha512-2OQOq6Rb9VZ4bKT3LIQfayO5p3Z/EMrvUl58dpMv6DIJH/QbgWeCM24Of9f6nJ7Tky/UTCEJzKI2oAAbDyLN0A==",
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.3.tgz",
|
||||
"integrity": "sha512-2rjH30gzbSWsMBcUOHT1ql9/1x5R2/WQwXFATU/9Vg3qcTKJn8z/kbvU/doHAHuX4OYeoFj3QXQ3qDuwkJl3ig==",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
|
@ -46765,9 +46765,9 @@
|
|||
}
|
||||
},
|
||||
"@certusone/wormhole-sdk": {
|
||||
"version": "0.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.2.tgz",
|
||||
"integrity": "sha512-2OQOq6Rb9VZ4bKT3LIQfayO5p3Z/EMrvUl58dpMv6DIJH/QbgWeCM24Of9f6nJ7Tky/UTCEJzKI2oAAbDyLN0A==",
|
||||
"version": "0.4.3",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.4.3.tgz",
|
||||
"integrity": "sha512-2rjH30gzbSWsMBcUOHT1ql9/1x5R2/WQwXFATU/9Vg3qcTKJn8z/kbvU/doHAHuX4OYeoFj3QXQ3qDuwkJl3ig==",
|
||||
"requires": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.4.2",
|
||||
"@certusone/wormhole-sdk": "^0.4.3",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
|
|
@ -34,7 +34,6 @@ function Source() {
|
|||
const handleSourceChange = useCallback(
|
||||
(event) => {
|
||||
dispatch(setSourceChain(event.target.value));
|
||||
console.log(event.target.value);
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
CHAIN_ID_ACALA,
|
||||
CHAIN_ID_KARURA,
|
||||
CHAIN_ID_TERRA,
|
||||
hexToNativeAssetString,
|
||||
isEVMChain,
|
||||
isTerraChain,
|
||||
|
@ -306,7 +307,7 @@ function FeeMethodSelector() {
|
|||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
{(isEVMChain(targetChain) || isTerraChain(targetChain)) && (
|
||||
{(isEVMChain(targetChain) || targetChain === CHAIN_ID_TERRA) && (
|
||||
<GasEstimateSummary
|
||||
methodType="transfer"
|
||||
chainId={targetChain}
|
||||
|
|
|
@ -12,9 +12,14 @@ import {
|
|||
selectAttestSignedVAAHex,
|
||||
selectTransferOriginAsset,
|
||||
selectTransferOriginChain,
|
||||
selectTransferSourceAsset,
|
||||
selectTransferTargetChain,
|
||||
} from "../../store/selectors";
|
||||
import { ChainId, hexToNativeAssetString } from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_TERRA2,
|
||||
hexToNativeAssetString,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
||||
export function RegisterNowButtonCore({
|
||||
originChain,
|
||||
|
@ -29,19 +34,30 @@ export function RegisterNowButtonCore({
|
|||
const history = useHistory();
|
||||
// user might be in the middle of a different attest
|
||||
const signedVAAHex = useSelector(selectAttestSignedVAAHex);
|
||||
const sourceAsset = useSelector(selectTransferSourceAsset);
|
||||
const canSwitch = originChain && originAsset && !signedVAAHex;
|
||||
const handleClick = useCallback(() => {
|
||||
const nativeAsset =
|
||||
originChain && hexToNativeAssetString(originAsset, originChain);
|
||||
const nativeAsset = originChain
|
||||
? originChain === CHAIN_ID_TERRA2
|
||||
? sourceAsset // use the preimage address for terra2
|
||||
: hexToNativeAssetString(originAsset, originChain)
|
||||
: undefined;
|
||||
if (originChain && originAsset && nativeAsset && canSwitch) {
|
||||
dispatch(setSourceChain(originChain));
|
||||
console.log(originChain);
|
||||
dispatch(setSourceAsset(nativeAsset));
|
||||
dispatch(setTargetChain(targetChain));
|
||||
dispatch(setStep(2));
|
||||
history.push("/register");
|
||||
}
|
||||
}, [dispatch, canSwitch, originChain, originAsset, targetChain, history]);
|
||||
}, [
|
||||
dispatch,
|
||||
canSwitch,
|
||||
originChain,
|
||||
originAsset,
|
||||
targetChain,
|
||||
history,
|
||||
sourceAsset,
|
||||
]);
|
||||
if (!canSwitch) return null;
|
||||
return (
|
||||
<Button
|
||||
|
|
|
@ -125,7 +125,6 @@ function Source() {
|
|||
const handleSourceChange = useCallback(
|
||||
(event) => {
|
||||
dispatch(setSourceChain(event.target.value));
|
||||
console.log(event.target.value);
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
|
|
@ -65,7 +65,6 @@ function Transfer() {
|
|||
return;
|
||||
}
|
||||
if (sourceChain) {
|
||||
console.log(sourceChain);
|
||||
dispatch(setSourceChain(sourceChain));
|
||||
}
|
||||
if (targetChain) {
|
||||
|
|
|
@ -134,7 +134,6 @@ function useCheckIfWormholeWrapped(nft?: boolean) {
|
|||
const wrappedInfo = makeStateSafe(
|
||||
await getOriginalAssetCosmWasm(lcd, sourceAsset, sourceChain)
|
||||
);
|
||||
console.log(wrappedInfo);
|
||||
if (!cancelled) {
|
||||
dispatch(setSourceWormholeWrappedInfo(wrappedInfo));
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ function useFetchTargetAsset(nft?: boolean) {
|
|||
const originAsset = useSelector(
|
||||
nft ? selectNFTOriginAsset : selectTransferOriginAsset
|
||||
);
|
||||
console.log(originAsset);
|
||||
const originTokenId = useSelector(selectNFTOriginTokenId);
|
||||
const tokenId = originTokenId || ""; // this should exist by this step for NFT transfers
|
||||
const targetChain = useSelector(
|
||||
|
@ -258,7 +257,6 @@ function useFetchTargetAsset(nft?: boolean) {
|
|||
originChain,
|
||||
originAsset
|
||||
);
|
||||
console.log("foreign asset algo:", asset);
|
||||
if (!cancelled) {
|
||||
dispatch(
|
||||
setTargetAsset(
|
||||
|
|
|
@ -235,7 +235,7 @@ async function terra(
|
|||
) {
|
||||
dispatch(setIsSending(true));
|
||||
try {
|
||||
const tokenBridgeAddress = getTokenBridgeAddressForChain(chainId)
|
||||
const tokenBridgeAddress = getTokenBridgeAddressForChain(chainId);
|
||||
const msg = await attestFromTerra(
|
||||
tokenBridgeAddress,
|
||||
wallet.terraAddress,
|
||||
|
@ -257,9 +257,7 @@ async function terra(
|
|||
if (!sequence) {
|
||||
throw new Error("Sequence not found");
|
||||
}
|
||||
const emitterAddress = await getEmitterAddressTerra(
|
||||
tokenBridgeAddress,
|
||||
);
|
||||
const emitterAddress = await getEmitterAddressTerra(tokenBridgeAddress);
|
||||
enqueueSnackbar(null, {
|
||||
content: <Alert severity="info">Fetching VAA</Alert>,
|
||||
});
|
||||
|
|
|
@ -228,7 +228,6 @@ function useOriginalAsset(
|
|||
if (!cancelled) {
|
||||
setIsLoading(false);
|
||||
setArgs();
|
||||
console.log("setting", result.assetAddress);
|
||||
setOriginAddress(
|
||||
hexToNativeAssetString(
|
||||
uint8ArrayToHex(result.assetAddress),
|
||||
|
|
|
@ -28,7 +28,6 @@ export default function useTerraNativeBalances(
|
|||
setIsLoading(true);
|
||||
setBalances(undefined);
|
||||
const lcd = new LCDClient(getTerraConfig(chainId));
|
||||
console.log(lcd);
|
||||
lcd.bank
|
||||
.balance(walletAddress)
|
||||
.then(([coins]) => {
|
||||
|
|
|
@ -416,7 +416,7 @@ export function GasEstimateSummary({
|
|||
priceQuote={priceQuote}
|
||||
/>
|
||||
);
|
||||
} else if (chainId === CHAIN_ID_TERRA) { // TODO: terra2 support
|
||||
} else if (chainId === CHAIN_ID_TERRA) {
|
||||
return <TerraGasEstimateSummary methodType={methodType} />;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -30,7 +30,6 @@ export const formatNativeDenom = (
|
|||
denom: string,
|
||||
chainId: TerraChainId
|
||||
): string => {
|
||||
console.log(denom, chainId);
|
||||
const unit = denom.slice(1).toUpperCase();
|
||||
const isValidTerra = isNativeTerra(denom);
|
||||
return denom === "uluna"
|
||||
|
|
Loading…
Reference in New Issue