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