diff --git a/bridge_ui/package-lock.json b/bridge_ui/package-lock.json
index b26b2c820..141069d46 100644
--- a/bridge_ui/package-lock.json
+++ b/bridge_ui/package-lock.json
@@ -10,9 +10,9 @@
"dependencies": {
"@alephium/token-list": "0.0.12",
"@alephium/walletconnect-qrcode-modal": "0.1.0",
- "@alephium/web3": "^1.11.0",
- "@alephium/web3-react": "^1.11.0",
- "@alephium/wormhole-sdk": "^0.3.7",
+ "@alephium/web3": "^1.11.1",
+ "@alephium/web3-react": "^1.11.1",
+ "@alephium/wormhole-sdk": "^0.4.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
@@ -100,11 +100,11 @@
}
},
"node_modules/@alephium/get-extension-wallet": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/get-extension-wallet/-/get-extension-wallet-1.11.0.tgz",
- "integrity": "sha512-ORmYq4SE4eWs3vVpxB86fjVEc6blAxOB/foC0D2CHliMloHCpXsHDGz5D/Cch5KmDNjLZjJ7yGok3PgrazNTUg==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/get-extension-wallet/-/get-extension-wallet-1.11.1.tgz",
+ "integrity": "sha512-echynHnFKtdx5PbZDgNxtfOTM/UfPrfxR8KLncGb94PinOKCXYfcQZO2C/tJ4hCHJKVVmpPhCAohFwF3vVIIcA==",
"dependencies": {
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"bowser": "^2.11.0"
}
},
@@ -167,12 +167,12 @@
}
},
"node_modules/@alephium/walletconnect-provider": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/walletconnect-provider/-/walletconnect-provider-1.11.0.tgz",
- "integrity": "sha512-Wc86+PSjMfwVesJQwaAcytasbvdw309AvZzMWlyqfgFSadXBBo7TXB2IcgcUnBVCWunPLA3zjydEreC6pYc/Lg==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/walletconnect-provider/-/walletconnect-provider-1.11.1.tgz",
+ "integrity": "sha512-1cnd5JMS3Go1UJxnybqOWLF+aMAVjTkqc2rf8ndNFWxlBVEqwwT+J8AevCuCBE70/l7oyHWsCpVUC6ev0HOaiA==",
"dependencies": {
- "@alephium/web3": "^1.11.0",
- "@alephium/web3-wallet": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
+ "@alephium/web3-wallet": "^1.11.1",
"@walletconnect/core": "2.17.2",
"@walletconnect/keyvaluestorage": "1.1.1",
"@walletconnect/sign-client": "2.17.2",
@@ -586,9 +586,9 @@
}
},
"node_modules/@alephium/web3": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3/-/web3-1.11.0.tgz",
- "integrity": "sha512-vT4Kd/5sGUuKdfHzy+BLenOuVMPPpZXV7arNEgNZYdgYs5AnT3MTzCmJBbVosn9WeEipfb/p2x4xjAjMKffMYQ==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3/-/web3-1.11.1.tgz",
+ "integrity": "sha512-aAyxLw2OfsQD4t33T7gE6wfeFXqeQApgp1x5pLYWbKgn+DMlJbEC/jFrxTuOztQByrv9Fr3ApxNZ5CISWkJQCA==",
"dependencies": {
"@noble/secp256k1": "1.7.1",
"base-x": "4.0.0",
@@ -608,12 +608,12 @@
}
},
"node_modules/@alephium/web3-react": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3-react/-/web3-react-1.11.0.tgz",
- "integrity": "sha512-KX7xyU/vyKOKx9OBVHCG7TsWEwlUHWRb4oO/mXp/ma6fjzOf1+JjcU5Q+FQxWm4DyRDMmjg6qO1YUcY7lC+2Ww==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3-react/-/web3-react-1.11.1.tgz",
+ "integrity": "sha512-g/qj6XadlFhb/BdGJltWen47rC9lEQ4oLz7kiflKbSyquELIvJe81T0ktQhoFDkvQTEzwnXWGCnNGGmy1BKw6Q==",
"dependencies": {
- "@alephium/get-extension-wallet": "^1.11.0",
- "@alephium/walletconnect-provider": "^1.11.0",
+ "@alephium/get-extension-wallet": "^1.11.1",
+ "@alephium/walletconnect-provider": "^1.11.1",
"@alephium/walletconnect-qrcode-modal": "^0.1.0",
"buffer": "^6.0.3",
"detect-browser": "^5.3.0",
@@ -647,11 +647,11 @@
}
},
"node_modules/@alephium/web3-wallet": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3-wallet/-/web3-wallet-1.11.0.tgz",
- "integrity": "sha512-6xtcB7ip++YMYZaOcDidvXJ/S8NDdS1pKuyTma363odRRO7T3ksuhkGw5Nhl96FA/muLjZCTtwT1RcJdqtNZ+w==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3-wallet/-/web3-wallet-1.11.1.tgz",
+ "integrity": "sha512-ysWUl379yhmMn3mi0KkCH2Y6tki+KxpJQyL+rWmt8GVea+TuRZbtXw0YG9Vx3Ok59iLGiZJIcU98/LDtVeMB+g==",
"dependencies": {
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"@noble/secp256k1": "1.7.1",
"@types/node": "^16.18.23",
"bip32": "3.1.0",
@@ -766,18 +766,13 @@
}
},
"node_modules/@alephium/wormhole-sdk": {
- "version": "0.3.7",
- "resolved": "https://registry.npmjs.org/@alephium/wormhole-sdk/-/wormhole-sdk-0.3.7.tgz",
- "integrity": "sha512-viPppas59caIJpOhW6X78Rh9cdsOUYQ65MQz4z+E1eiwYUpETrkm/k+X4c9HI9APQTc5CIfJ/nvQJmvl5qiBJg==",
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@alephium/wormhole-sdk/-/wormhole-sdk-0.4.0.tgz",
+ "integrity": "sha512-Za2KueU5qMLoQpXyn+fgmZMmHQz6TogDJpwlk9lFjTTC4w38wRViN4Ea2GiBpA5z9IiK28bCJSL3qAs+XtZJ+g==",
"dependencies": {
"@alephium/token-list": "0.0.11",
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"@improbable-eng/grpc-web": "^0.14.0",
- "@solana/spl-token": "^0.1.8",
- "@solana/web3.js": "^1.24.0",
- "@terra-money/terra.js": "^3.0.7",
- "algosdk": "2.4.0",
- "axios": "^0.24.0",
"bech32": "^2.0.0",
"bs58": "^5.0.0",
"ethers": "^5.6.8",
@@ -810,14 +805,6 @@
"google-protobuf": "^3.14.0"
}
},
- "node_modules/@alephium/wormhole-sdk/node_modules/axios": {
- "version": "0.24.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
- "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
- "dependencies": {
- "follow-redirects": "^1.14.4"
- }
- },
"node_modules/@alephium/wormhole-sdk/node_modules/bech32": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
@@ -7876,6 +7863,7 @@
"node_modules/@terra-money/terra.js": {
"version": "3.0.7",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@terra-money/terra.proto": "^0.1.7",
"axios": "^0.24.0",
@@ -7898,17 +7886,20 @@
"node_modules/@terra-money/terra.js/node_modules/axios": {
"version": "0.24.0",
"license": "MIT",
+ "peer": true,
"dependencies": {
"follow-redirects": "^1.14.4"
}
},
"node_modules/@terra-money/terra.js/node_modules/bech32": {
"version": "2.0.0",
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/@terra-money/terra.proto": {
"version": "0.1.7",
"license": "Apache-2.0",
+ "peer": true,
"dependencies": {
"google-protobuf": "^3.17.3",
"long": "^4.0.0",
@@ -42069,6 +42060,7 @@
"node_modules/tmp": {
"version": "0.2.1",
"license": "MIT",
+ "peer": true,
"dependencies": {
"rimraf": "^3.0.0"
},
@@ -45584,11 +45576,11 @@
}
},
"@alephium/get-extension-wallet": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/get-extension-wallet/-/get-extension-wallet-1.11.0.tgz",
- "integrity": "sha512-ORmYq4SE4eWs3vVpxB86fjVEc6blAxOB/foC0D2CHliMloHCpXsHDGz5D/Cch5KmDNjLZjJ7yGok3PgrazNTUg==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/get-extension-wallet/-/get-extension-wallet-1.11.1.tgz",
+ "integrity": "sha512-echynHnFKtdx5PbZDgNxtfOTM/UfPrfxR8KLncGb94PinOKCXYfcQZO2C/tJ4hCHJKVVmpPhCAohFwF3vVIIcA==",
"requires": {
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"bowser": "^2.11.0"
}
},
@@ -45638,12 +45630,12 @@
}
},
"@alephium/walletconnect-provider": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/walletconnect-provider/-/walletconnect-provider-1.11.0.tgz",
- "integrity": "sha512-Wc86+PSjMfwVesJQwaAcytasbvdw309AvZzMWlyqfgFSadXBBo7TXB2IcgcUnBVCWunPLA3zjydEreC6pYc/Lg==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/walletconnect-provider/-/walletconnect-provider-1.11.1.tgz",
+ "integrity": "sha512-1cnd5JMS3Go1UJxnybqOWLF+aMAVjTkqc2rf8ndNFWxlBVEqwwT+J8AevCuCBE70/l7oyHWsCpVUC6ev0HOaiA==",
"requires": {
- "@alephium/web3": "^1.11.0",
- "@alephium/web3-wallet": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
+ "@alephium/web3-wallet": "^1.11.1",
"@walletconnect/core": "2.17.2",
"@walletconnect/keyvaluestorage": "1.1.1",
"@walletconnect/sign-client": "2.17.2",
@@ -45909,9 +45901,9 @@
}
},
"@alephium/web3": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3/-/web3-1.11.0.tgz",
- "integrity": "sha512-vT4Kd/5sGUuKdfHzy+BLenOuVMPPpZXV7arNEgNZYdgYs5AnT3MTzCmJBbVosn9WeEipfb/p2x4xjAjMKffMYQ==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3/-/web3-1.11.1.tgz",
+ "integrity": "sha512-aAyxLw2OfsQD4t33T7gE6wfeFXqeQApgp1x5pLYWbKgn+DMlJbEC/jFrxTuOztQByrv9Fr3ApxNZ5CISWkJQCA==",
"requires": {
"@noble/secp256k1": "1.7.1",
"base-x": "4.0.0",
@@ -45983,12 +45975,12 @@
}
},
"@alephium/web3-react": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3-react/-/web3-react-1.11.0.tgz",
- "integrity": "sha512-KX7xyU/vyKOKx9OBVHCG7TsWEwlUHWRb4oO/mXp/ma6fjzOf1+JjcU5Q+FQxWm4DyRDMmjg6qO1YUcY7lC+2Ww==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3-react/-/web3-react-1.11.1.tgz",
+ "integrity": "sha512-g/qj6XadlFhb/BdGJltWen47rC9lEQ4oLz7kiflKbSyquELIvJe81T0ktQhoFDkvQTEzwnXWGCnNGGmy1BKw6Q==",
"requires": {
- "@alephium/get-extension-wallet": "^1.11.0",
- "@alephium/walletconnect-provider": "^1.11.0",
+ "@alephium/get-extension-wallet": "^1.11.1",
+ "@alephium/walletconnect-provider": "^1.11.1",
"@alephium/walletconnect-qrcode-modal": "^0.1.0",
"buffer": "^6.0.3",
"detect-browser": "^5.3.0",
@@ -46015,11 +46007,11 @@
}
},
"@alephium/web3-wallet": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/@alephium/web3-wallet/-/web3-wallet-1.11.0.tgz",
- "integrity": "sha512-6xtcB7ip++YMYZaOcDidvXJ/S8NDdS1pKuyTma363odRRO7T3ksuhkGw5Nhl96FA/muLjZCTtwT1RcJdqtNZ+w==",
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/@alephium/web3-wallet/-/web3-wallet-1.11.1.tgz",
+ "integrity": "sha512-ysWUl379yhmMn3mi0KkCH2Y6tki+KxpJQyL+rWmt8GVea+TuRZbtXw0YG9Vx3Ok59iLGiZJIcU98/LDtVeMB+g==",
"requires": {
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"@noble/secp256k1": "1.7.1",
"@types/node": "^16.18.23",
"bip32": "3.1.0",
@@ -46054,18 +46046,13 @@
}
},
"@alephium/wormhole-sdk": {
- "version": "0.3.7",
- "resolved": "https://registry.npmjs.org/@alephium/wormhole-sdk/-/wormhole-sdk-0.3.7.tgz",
- "integrity": "sha512-viPppas59caIJpOhW6X78Rh9cdsOUYQ65MQz4z+E1eiwYUpETrkm/k+X4c9HI9APQTc5CIfJ/nvQJmvl5qiBJg==",
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/@alephium/wormhole-sdk/-/wormhole-sdk-0.4.0.tgz",
+ "integrity": "sha512-Za2KueU5qMLoQpXyn+fgmZMmHQz6TogDJpwlk9lFjTTC4w38wRViN4Ea2GiBpA5z9IiK28bCJSL3qAs+XtZJ+g==",
"requires": {
"@alephium/token-list": "0.0.11",
- "@alephium/web3": "^1.11.0",
+ "@alephium/web3": "^1.11.1",
"@improbable-eng/grpc-web": "^0.14.0",
- "@solana/spl-token": "^0.1.8",
- "@solana/web3.js": "^1.24.0",
- "@terra-money/terra.js": "^3.0.7",
- "algosdk": "2.4.0",
- "axios": "^0.24.0",
"bech32": "^2.0.0",
"bs58": "^5.0.0",
"ethers": "^5.6.8",
@@ -46091,14 +46078,6 @@
"browser-headers": "^0.4.1"
}
},
- "axios": {
- "version": "0.24.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
- "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
- "requires": {
- "follow-redirects": "^1.14.4"
- }
- },
"bech32": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz",
@@ -50714,6 +50693,7 @@
},
"@terra-money/terra.js": {
"version": "3.0.7",
+ "peer": true,
"requires": {
"@terra-money/terra.proto": "^0.1.7",
"axios": "^0.24.0",
@@ -50732,17 +50712,20 @@
"dependencies": {
"axios": {
"version": "0.24.0",
+ "peer": true,
"requires": {
"follow-redirects": "^1.14.4"
}
},
"bech32": {
- "version": "2.0.0"
+ "version": "2.0.0",
+ "peer": true
}
}
},
"@terra-money/terra.proto": {
"version": "0.1.7",
+ "peer": true,
"requires": {
"google-protobuf": "^3.17.3",
"long": "^4.0.0",
@@ -74697,6 +74680,7 @@
},
"tmp": {
"version": "0.2.1",
+ "peer": true,
"requires": {
"rimraf": "^3.0.0"
}
diff --git a/bridge_ui/package.json b/bridge_ui/package.json
index 18fef52bd..7eb9b8ebe 100644
--- a/bridge_ui/package.json
+++ b/bridge_ui/package.json
@@ -4,9 +4,9 @@
"private": true,
"dependencies": {
"@alephium/token-list": "0.0.12",
- "@alephium/web3": "^1.11.0",
- "@alephium/web3-react": "^1.11.0",
- "@alephium/wormhole-sdk": "^0.3.7",
+ "@alephium/web3": "^1.11.1",
+ "@alephium/web3-react": "^1.11.1",
+ "@alephium/wormhole-sdk": "^0.4.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
diff --git a/bridge_ui/src/App.js b/bridge_ui/src/App.js
index 4127bf374..3b9409bd4 100644
--- a/bridge_ui/src/App.js
+++ b/bridge_ui/src/App.js
@@ -1,8 +1,3 @@
-import {
- CHAIN_ID_BSC,
- CHAIN_ID_ETH,
- CHAIN_ID_SOLANA,
-} from "@alephium/wormhole-sdk";
import {
AppBar,
Container,
@@ -29,9 +24,6 @@ import {
import Attest from "./components/Attest";
import Footer from "./components/Footer";
import HeaderText from "./components/HeaderText";
-import Migration from "./components/Migration";
-import EvmQuickMigrate from "./components/Migration/EvmQuickMigrate";
-import SolanaQuickMigrate from "./components/Migration/SolanaQuickMigrate";
import Recovery from "./components/Recovery";
import Stats from "./components/Stats";
import CustodyAddresses from "./components/Stats/CustodyAddresses";
@@ -39,7 +31,6 @@ import TokenOriginVerifier from "./components/TokenOriginVerifier";
import Transactions from "./components/Transactions";
import Transfer from "./components/Transfer";
import UnwrapNative from "./components/UnwrapNative";
-import WithdrawTokensTerra from "./components/WithdrawTokensTerra";
import { useBetaContext } from "./contexts/BetaContext";
import Alephium from "./icons/alephium.svg";
import { CLUSTER } from "./utils/consts";
@@ -280,30 +271,9 @@ function App() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/bridge_ui/src/components/Attest/Create.tsx b/bridge_ui/src/components/Attest/Create.tsx
index 95070d1d5..cff41e614 100644
--- a/bridge_ui/src/components/Attest/Create.tsx
+++ b/bridge_ui/src/components/Attest/Create.tsx
@@ -1,4 +1,3 @@
-import { CHAIN_ID_TERRA } from "@alephium/wormhole-sdk";
import { CircularProgress, makeStyles } from "@material-ui/core";
import { useTranslation } from "react-i18next";
import { useSelector } from "react-redux";
@@ -12,7 +11,6 @@ import {
} from "../../store/selectors";
import ButtonWithLoader from "../ButtonWithLoader";
import KeyAndBalance from "../KeyAndBalance";
-import TerraFeeDenomPicker from "../TerraFeeDenomPicker";
import WaitingForWalletMessage from "./WaitingForWalletMessage";
const useStyles = makeStyles((theme) => ({
@@ -47,9 +45,6 @@ function Create() {
return (
<>
- {targetChain === CHAIN_ID_TERRA && (
-
- )}
{foreignAssetInfo.isFetching ? (
<>
diff --git a/bridge_ui/src/components/Attest/Send.tsx b/bridge_ui/src/components/Attest/Send.tsx
index e5bb70de2..6b5e28ed4 100644
--- a/bridge_ui/src/components/Attest/Send.tsx
+++ b/bridge_ui/src/components/Attest/Send.tsx
@@ -1,4 +1,4 @@
-import { CHAIN_ID_ALEPHIUM, CHAIN_ID_SOLANA, CHAIN_ID_TERRA, waitAlphTxConfirmed } from "@alephium/wormhole-sdk";
+import { CHAIN_ID_ALEPHIUM, CHAIN_ID_SOLANA, waitAlphTxConfirmed } from "@alephium/wormhole-sdk";
import { Alert } from "@material-ui/lab";
import { Link, makeStyles } from "@material-ui/core";
import { useCallback, useMemo, useState } from "react";
@@ -18,7 +18,6 @@ import KeyAndBalance from "../KeyAndBalance";
import TransactionProgress from "../TransactionProgress";
import WaitingForWalletMessage from "./WaitingForWalletMessage";
import { ALEPHIUM_ATTEST_TOKEN_CONSISTENCY_LEVEL, SOLANA_TOKEN_METADATA_PROGRAM_URL } from "../../utils/consts";
-import TerraFeeDenomPicker from "../TerraFeeDenomPicker";
import { createLocalTokenPool } from "../../utils/alephium";
import { useWallet } from "@alephium/web3-react";
import { useSnackbar } from "notistack";
@@ -125,9 +124,6 @@ function Send() {
return (
<>
- {sourceChain === CHAIN_ID_TERRA && (
-
- )}
({
- spacer: {
- height: "2rem",
- },
- containerDiv: {
- textAlign: "center",
- padding: theme.spacing(2),
- },
- lineItem: {
- display: "flex",
- flexWrap: "nowrap",
- justifyContent: "space-between",
- "& > *": {
- alignSelf: "flex-start",
- width: "max-content",
- },
- },
- flexGrow: {
- flewGrow: 1,
- },
- mainPaper: {
- backgroundColor: COLORS.whiteWithTransparency,
- textAlign: "center",
- padding: "2rem",
- "& > h, p ": {
- margin: ".5rem",
- },
- },
- hidden: {
- display: "none",
- },
- divider: {
- margin: "2rem 0rem 2rem 0rem",
- },
- balance: {
- display: "inline-block",
- },
- convertButton: {
- alignSelf: "flex-end",
- },
-}));
-
-//TODO move elsewhere
-export const compareWithDecimalOffset = (
- valueA: string,
- decimalsA: number,
- valueB: string,
- decimalsB: number
-) => {
- //find which is larger, and offset by that amount
- const decimalsBasis = decimalsA > decimalsB ? decimalsA : decimalsB;
- const normalizedA = parseUnits(valueA, decimalsBasis).toBigInt();
- const normalizedB = parseUnits(valueB, decimalsBasis).toBigInt();
-
- if (normalizedA < normalizedB) {
- return -1;
- } else if (normalizedA === normalizedB) {
- return 0;
- } else {
- return 1;
- }
-};
-
-function EvmMigrationLineItem({
- chainId,
- migratorAddress,
- onLoadComplete,
-}: {
- chainId: ChainId;
- migratorAddress: string;
- onLoadComplete: () => void;
-}) {
- const { t } = useTranslation();
- const classes = useStyles();
- const { enqueueSnackbar } = useSnackbar();
- const { signer, signerAddress } = useEthereumProvider();
- const poolInfo = useEthereumMigratorInformation(
- migratorAddress,
- signer,
- signerAddress,
- false
- );
- const [loaded, setLoaded] = useState(false);
- const [migrationIsProcessing, setMigrationIsProcessing] = useState(false);
- const [transaction, setTransaction] = useState("");
- const [error, setError] = useState("");
- const fromSymbol = poolInfo?.data?.fromSymbol;
- const toSymbol = poolInfo?.data?.toSymbol;
-
- const sufficientPoolBalance =
- poolInfo.data &&
- compareWithDecimalOffset(
- poolInfo.data.fromWalletBalance,
- poolInfo.data.fromDecimals,
- poolInfo.data.toPoolBalance,
- poolInfo.data.toDecimals
- ) !== 1;
-
- useEffect(() => {
- if (!loaded && (poolInfo.data || poolInfo.error)) {
- onLoadComplete();
- setLoaded(true);
- }
- }, [loaded, poolInfo, onLoadComplete]);
-
- //TODO use transaction loader
- const migrateTokens = useCallback(async () => {
- if (!poolInfo.data) {
- enqueueSnackbar(null, {
- content: {t("Could not migrate the tokens.")},
- }); //Should never be hit
- return;
- }
- try {
- const migrationAmountAbs = parseUnits(
- poolInfo.data.fromWalletBalance,
- poolInfo.data.fromDecimals
- );
- setMigrationIsProcessing(true);
- await poolInfo.data.fromToken.approve(
- poolInfo.data.migrator.address,
- migrationAmountAbs
- );
- const transaction = await poolInfo.data.migrator.migrate(
- migrationAmountAbs
- );
- await transaction.wait();
- setTransaction(transaction.hash);
- enqueueSnackbar(null, {
- content: (
- {t("Successfully migrated the tokens.")}
- ),
- });
- setMigrationIsProcessing(false);
- } catch (e) {
- console.error(e);
- enqueueSnackbar(null, {
- content: {t("Could not migrate the tokens.")},
- });
- setMigrationIsProcessing(false);
- setError("Failed to send the transaction.");
- }
- }, [poolInfo.data, enqueueSnackbar, t]);
-
- if (!poolInfo.data) {
- return null;
- } else if (transaction) {
- return (
-
-
-
- {t("Successfully migrated your tokens. They will become available once this transaction confirms.")}
-
-
-
-
- );
- } else {
- return (
-
-
-
- {t("Current Token")}
-
-
- {poolInfo.data.fromWalletBalance}
-
-
-
-
-
- {t("will become")}
-
-
-
-
-
- {t("Wormhole Token")}
-
-
- {poolInfo.data.fromWalletBalance}
-
-
-
-
-
- {t("Convert")}
-
-
-
- );
- }
-}
-
-const getAddressBalances = async (
- signer: Signer,
- signerAddress: string,
- addresses: string[]
-): Promise