From cc930300c4566a77fb66ba51192e240cb23b4695 Mon Sep 17 00:00:00 2001 From: Kevin Peters Date: Fri, 28 Jun 2024 10:12:07 -0500 Subject: [PATCH] resurrect bridge and relay routes --- wormhole-connect/package-lock.json | 728 +++---- wormhole-connect/package.json | 4 +- wormhole-connect/src/config/index.ts | 5 +- wormhole-connect/src/config/testnet/chains.ts | 53 - .../src/config/testnet/gasEstimates.ts | 93 - wormhole-connect/src/config/testnet/rpcs.ts | 10 - wormhole-connect/src/config/testnet/tokens.ts | 1941 ++++------------- wormhole-connect/src/config/types.ts | 1 - wormhole-connect/src/env.d.ts | 5 - .../hooks/useCheckInboundQueuedTransfer.ts | 5 +- wormhole-connect/src/hooks/useComputeQuote.ts | 142 ++ .../src/hooks/useComputeReceiveAmount.ts | 92 - .../src/hooks/useDeliveryStatus.ts | 2 + .../src/hooks/usePorticoRelayerFee.ts | 1 + .../src/hooks/useTrackTransfer.ts | 44 +- .../src/routes/abstracts/index.ts | 2 - .../src/routes/abstracts/relayAbstract.ts | 18 - .../src/routes/abstracts/routeAbstract.ts | 201 -- .../src/routes/bridge/baseRoute.ts | 317 --- wormhole-connect/src/routes/bridge/index.ts | 1 - wormhole-connect/src/routes/index.ts | 1 - wormhole-connect/src/routes/mappings.ts | 18 +- wormhole-connect/src/routes/operator.ts | 313 +-- wormhole-connect/src/routes/relay/types.ts | 4 +- wormhole-connect/src/routes/sdkv2/route.ts | 456 ++-- wormhole-connect/src/routes/sdkv2/signer.ts | 14 +- wormhole-connect/src/routes/types.ts | 12 +- wormhole-connect/src/routes/utils.ts | 63 +- .../src/sdklegacy/config/TESTNET.ts | 111 - wormhole-connect/src/store/redeem.ts | 21 +- wormhole-connect/src/utils/gas.ts | 3 +- wormhole-connect/src/utils/index.ts | 1 + wormhole-connect/src/utils/sdk.ts | 51 +- .../src/utils/transferValidation.ts | 17 - wormhole-connect/src/utils/vaa.ts | 13 +- wormhole-connect/src/views/Bridge/Bridge.tsx | 14 +- .../src/views/Bridge/Inputs/AmountInput.tsx | 2 +- .../src/views/Bridge/Inputs/From.tsx | 73 +- .../src/views/Bridge/NativeGasSlider.tsx | 385 +--- wormhole-connect/src/views/Bridge/Preview.tsx | 59 +- .../src/views/Bridge/RouteOptions.tsx | 16 +- wormhole-connect/src/views/Bridge/Send.tsx | 132 +- .../src/views/Redeem/Confirmations.tsx | 18 +- wormhole-connect/src/views/Redeem/Redeem.tsx | 27 +- .../src/views/Redeem/SendFrom.tsx | 19 +- wormhole-connect/src/views/Redeem/SendTo.tsx | 110 +- wormhole-connect/src/views/Redeem/Tag.tsx | 11 +- wormhole-connect/src/views/TxSearch.tsx | 63 +- 48 files changed, 1554 insertions(+), 4138 deletions(-) create mode 100644 wormhole-connect/src/hooks/useComputeQuote.ts delete mode 100644 wormhole-connect/src/hooks/useComputeReceiveAmount.ts delete mode 100644 wormhole-connect/src/routes/abstracts/index.ts delete mode 100644 wormhole-connect/src/routes/abstracts/relayAbstract.ts delete mode 100644 wormhole-connect/src/routes/abstracts/routeAbstract.ts delete mode 100644 wormhole-connect/src/routes/bridge/baseRoute.ts delete mode 100644 wormhole-connect/src/routes/bridge/index.ts diff --git a/wormhole-connect/package-lock.json b/wormhole-connect/package-lock.json index 37dca5ff7..71b2761fa 100644 --- a/wormhole-connect/package-lock.json +++ b/wormhole-connect/package-lock.json @@ -30,8 +30,8 @@ "@reduxjs/toolkit": "^1.9.1", "@solana/wallet-adapter-wallets": "^0.19.25", "@solana/web3.js": "^1.73.0", - "@wormhole-foundation/sdk": "^0.7.0-beta.3", - "@wormhole-foundation/sdk-definitions": "^0.7.0-beta.3", + "@wormhole-foundation/sdk": "^0.7.3-beta.0", + "@wormhole-foundation/sdk-definitions": "^0.7.3-beta.0", "@wormhole-foundation/sdk-definitions-ntt": "^0.0.1-beta.5", "@wormhole-foundation/sdk-icons": "^0.6.8", "@xlabs-libs/wallet-aggregator-aptos": "^0.0.1-alpha.14", @@ -3589,13 +3589,13 @@ } }, "node_modules/@injectivelabs/exceptions": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/exceptions/-/exceptions-1.14.11.tgz", - "integrity": "sha512-oNVBtNYML3Fvh6qaUsqNcyBwjyG9hUy0/eSIiK2kOKWdpxeQ9Ctxre3sxoSiDy99o4mi1ynB2wh2F/kx6gsgAg==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/exceptions/-/exceptions-1.14.13.tgz", + "integrity": "sha512-yFtB0jQtZI6D3AuaP6ObYtlVgDB4vriCWuV+6GY3frduv7i3kz1ZYVsPKsKSKBCOD5QegZXcEmGJL4RiDi1OKA==", "hasInstallScript": true, "dependencies": { "@injectivelabs/grpc-web": "^0.0.1", - "@injectivelabs/ts-types": "^1.14.11", + "@injectivelabs/ts-types": "^1.14.13", "http-status-codes": "^2.2.0", "link-module-alias": "^1.2.0", "shx": "^0.3.2" @@ -3707,14 +3707,14 @@ } }, "node_modules/@injectivelabs/networks": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/networks/-/networks-1.14.11.tgz", - "integrity": "sha512-wiw1vWyHhFmS8FsXsSvB6EXRJEcf89yugKD6vB0WjXq9haulxJlTpuuzmAo0/v80KkZJOeCjoOOdOWAK02/9JQ==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/networks/-/networks-1.14.13.tgz", + "integrity": "sha512-P+eCQXWpbk4LbPxgTmi2gY7OzdZTNsIEUvDoh59Ma0CkqSFaYMtgB8fZVxpkKM0UPla587EDlEEIVxprDBcnZg==", "hasInstallScript": true, "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", "link-module-alias": "^1.2.0", "shx": "^0.3.2" } @@ -3973,9 +3973,9 @@ } }, "node_modules/@injectivelabs/test-utils": { - "version": "1.14.5", - "resolved": "https://registry.npmjs.org/@injectivelabs/test-utils/-/test-utils-1.14.5.tgz", - "integrity": "sha512-f34yWpFYXNdqruBJo6cbR7hKW5xn6lWENR49zk/PA3CDiQjs9ywVcVofWGyOGnpKQvAOzfF75yQgRc7tqL71lw==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/test-utils/-/test-utils-1.14.13.tgz", + "integrity": "sha512-wa5TQcWLvORRm36mw4Hee+XF7lBlArVK3DM1ebC0uBvVcUgrmm3g/nh1pV/NzLN16WtrLLsvnTsE5uiNEcgYdw==", "hasInstallScript": true, "dependencies": { "axios": "^1.6.4", @@ -4006,9 +4006,9 @@ } }, "node_modules/@injectivelabs/ts-types": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/ts-types/-/ts-types-1.14.11.tgz", - "integrity": "sha512-Vao54GARdWSSc4w434pDA3hj/i3u9dTTfTPZMx5YBr1vO+z7dypi7NXZAJT0yzLyR9cUFZ4KRWUWmecRxCxwsQ==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/ts-types/-/ts-types-1.14.13.tgz", + "integrity": "sha512-jkR4+JnQ91n7LWAdt+cZuvXFfqhv9RVlTE2pezAjZab7z7VeDonYwktjia5OcbqTKjlirvVHFALIZ0pmYd0j+A==", "hasInstallScript": true, "dependencies": { "link-module-alias": "^1.2.0", @@ -4016,13 +4016,13 @@ } }, "node_modules/@injectivelabs/utils": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/utils/-/utils-1.14.11.tgz", - "integrity": "sha512-OjzEhD5kWo1M+VZVW9IMQvY0TnKNMQPor/DJ+2CJNxJH84D0J1rz/vPGgyGkqGIeBZ7O3fit1zGPxFtBrV4VhA==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/utils/-/utils-1.14.13.tgz", + "integrity": "sha512-djmSq28R7HDSb2Mezan+EFjqQgmDRydY+fLOmkODwOCYA04xOGQo7yna+WVovV85aKpwPjn864AWPy65xiHUZg==", "hasInstallScript": true, "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", "axios": "^1.6.4", "bignumber.js": "^9.0.1", "http-status-codes": "^2.2.0", @@ -11923,46 +11923,46 @@ } }, "node_modules/@wormhole-foundation/sdk": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk/-/sdk-0.7.0.tgz", - "integrity": "sha512-+cirNaT6UN7KlnO5s6TFNXiww90zp9ecvR1ylOaVryTFZjaIzy4JGcNtRr5BxlIez50JVqEx8k0hFu7BvzD2qA==", - "dependencies": { - "@wormhole-foundation/sdk-algorand": "0.7.0", - "@wormhole-foundation/sdk-algorand-core": "0.7.0", - "@wormhole-foundation/sdk-algorand-tokenbridge": "0.7.0", - "@wormhole-foundation/sdk-aptos": "0.7.0", - "@wormhole-foundation/sdk-aptos-core": "0.7.0", - "@wormhole-foundation/sdk-aptos-tokenbridge": "0.7.0", - "@wormhole-foundation/sdk-base": "0.7.0", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm-core": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm-ibc": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm-tokenbridge": "0.7.0", - "@wormhole-foundation/sdk-definitions": "0.7.0", - "@wormhole-foundation/sdk-evm": "0.7.0", - "@wormhole-foundation/sdk-evm-cctp": "0.7.0", - "@wormhole-foundation/sdk-evm-core": "0.7.0", - "@wormhole-foundation/sdk-evm-portico": "0.7.0", - "@wormhole-foundation/sdk-evm-tokenbridge": "0.7.0", - "@wormhole-foundation/sdk-solana": "0.7.0", - "@wormhole-foundation/sdk-solana-cctp": "0.7.0", - "@wormhole-foundation/sdk-solana-core": "0.7.0", - "@wormhole-foundation/sdk-solana-tokenbridge": "0.7.0", - "@wormhole-foundation/sdk-sui": "0.7.0", - "@wormhole-foundation/sdk-sui-core": "0.7.0", - "@wormhole-foundation/sdk-sui-tokenbridge": "0.7.0" + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk/-/sdk-0.7.3-beta.0.tgz", + "integrity": "sha512-5mqK2Hdgk4klQOSoJxFAJNqKNdMOdFSQsw/azjqFVvpTnfhsjSSUhFlj/IdXNP3ebQxr17EgUg7mW+5ylTMDRg==", + "dependencies": { + "@wormhole-foundation/sdk-algorand": "0.7.3-beta.0", + "@wormhole-foundation/sdk-algorand-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-algorand-tokenbridge": "0.7.3-beta.0", + "@wormhole-foundation/sdk-aptos": "0.7.3-beta.0", + "@wormhole-foundation/sdk-aptos-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-aptos-tokenbridge": "0.7.3-beta.0", + "@wormhole-foundation/sdk-base": "0.7.3-beta.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm-ibc": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm-tokenbridge": "0.7.3-beta.0", + "@wormhole-foundation/sdk-definitions": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-cctp": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-portico": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-tokenbridge": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana-cctp": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana-tokenbridge": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui-tokenbridge": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-algorand": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand/-/sdk-algorand-0.7.0.tgz", - "integrity": "sha512-mGXsOJUDhlTaOmwX+Bhf8wUSstcFhDgcLH8ISp4xtzGtTgOvabQviUQPoJCsgDqQ0KeksnszhUPybykbLQq9eg==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand/-/sdk-algorand-0.7.3-beta.0.tgz", + "integrity": "sha512-D6yapuOJ2lMMsQe0HycwnhlcAStuousS1Sq4hiIqnMe81nMIgowSwfUon2m6QzXoDBQJZHSTGVHc+gWJnG1vEg==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", "algosdk": "2.7.0" }, "engines": { @@ -11970,36 +11970,36 @@ } }, "node_modules/@wormhole-foundation/sdk-algorand-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand-core/-/sdk-algorand-core-0.7.0.tgz", - "integrity": "sha512-FdSr9Yryh7id5SHRDRYgeJGFoGv0NJrq2tZX6YtPQRcvBe57k5ZCJNnmuuWQgurrhqIBaXMiquSEtqJHMmTJKA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand-core/-/sdk-algorand-core-0.7.3-beta.0.tgz", + "integrity": "sha512-c6lgQ18G4/Yipicj9BpRcVx5Slk8saUVvla/v2B5wdDETarWQHvj/qukkGttl4+G8nwyx0piwLg+GESb/tp0tg==", "dependencies": { - "@wormhole-foundation/sdk-algorand": "0.7.0", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-algorand": "0.7.3-beta.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-algorand-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand-tokenbridge/-/sdk-algorand-tokenbridge-0.7.0.tgz", - "integrity": "sha512-uZP+w7A4r20OC13dWBTWA7u44QXBNtVFgZ4V7xK9e9+COjI8/NugVD6CeRHAaJ70WVC9O16eyouxMDIjFHXmbA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-algorand-tokenbridge/-/sdk-algorand-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-Mc14zC3Yx89M8KZelAA42Y9tqYlr7kEDYzzEZA+Gjh4G06FoojLncr+zSx3uL77TCEVk8teM/gq7b0XFPqiGUQ==", "dependencies": { - "@wormhole-foundation/sdk-algorand": "0.7.0", - "@wormhole-foundation/sdk-algorand-core": "0.7.0", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-algorand": "0.7.3-beta.0", + "@wormhole-foundation/sdk-algorand-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-aptos": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos/-/sdk-aptos-0.7.0.tgz", - "integrity": "sha512-LHmZjQWXI8NS4A0mutbOaHpsDCabq66CuCyQR2Mlu+pjQ/C1kWDmcknBiHjnGM/9EC3dImRL6yJL5XnQiO47eg==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos/-/sdk-aptos-0.7.3-beta.0.tgz", + "integrity": "sha512-t3AheF2En4koP5cgYBFO9L/xkzgBhqAnNDfcNQmjOD+j8Kj5p7k9JbUMMEHHVken2sCoOK4VfYMZkJ0TlRxNwQ==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", "aptos": "1.21.0" }, "engines": { @@ -12007,24 +12007,24 @@ } }, "node_modules/@wormhole-foundation/sdk-aptos-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos-core/-/sdk-aptos-core-0.7.0.tgz", - "integrity": "sha512-iDKf9d86/6HM8ZVA1GtACEjrHgTa4kvdEnLgMQaggnmsSs4GutYP4kxyrCd4mbmQ9VlQutiDM9Yf/9zxc3EcVw==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos-core/-/sdk-aptos-core-0.7.3-beta.0.tgz", + "integrity": "sha512-N3Yk8WsmsoXnGvRfxugOGOu/dt7pxy9hlSL/flOb/5gBPDn+FfL3pet6wpIzs3U9P0gQrKaLxCbz9uNQZt0fAg==", "dependencies": { - "@wormhole-foundation/sdk-aptos": "0.7.0", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-aptos": "0.7.3-beta.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-aptos-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos-tokenbridge/-/sdk-aptos-tokenbridge-0.7.0.tgz", - "integrity": "sha512-trWFznAOWNeXzFmAXXpYx7q+4Ez/svEKjxBbq+hiAjTkSgdbLecDEeZBxSuW2q9KhKOfLBS4JmCF60oad1F37g==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-aptos-tokenbridge/-/sdk-aptos-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-ppDre53unMGLS/MQzrM6R8V0DZA1VQD+GcTHGqh75O2orHxGzJ99mQkl8bO/+tegAeB0TPviI3sKIDQwdgPZqw==", "dependencies": { - "@wormhole-foundation/sdk-aptos": "0.7.0", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-aptos": "0.7.3-beta.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -12083,28 +12083,36 @@ } }, "node_modules/@wormhole-foundation/sdk-connect": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-connect/-/sdk-connect-0.7.0.tgz", - "integrity": "sha512-yZQqcBdIkQ2Zno0/u89ScICDYJGd6E10kLN++uVrlnweZ5Eh5w+aWylyn6+OfeskSWZx3QNXDFA+3zRstOEKGA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-connect/-/sdk-connect-0.7.3-beta.0.tgz", + "integrity": "sha512-e5EegxsfxngMZKIJQUHbFjYXXi3ZFiAEpbHJQPK/Yp/TdBMEdJg+g7oDfzLlbD/uGT3LkH9jfduHED60Okvvag==", "dependencies": { - "@wormhole-foundation/sdk-base": "0.7.0", - "@wormhole-foundation/sdk-definitions": "0.7.0", + "@wormhole-foundation/sdk-base": "0.7.3-beta.0", + "@wormhole-foundation/sdk-definitions": "0.7.3-beta.0", "axios": "^1.4.0" }, "engines": { "node": ">=16" } }, + "node_modules/@wormhole-foundation/sdk-connect/node_modules/@wormhole-foundation/sdk-base": { + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-base/-/sdk-base-0.7.3-beta.0.tgz", + "integrity": "sha512-sRiSAjooD3BehiV/dlLdmQSRbnca6Qkm9ibdgoI18tEslCGb3zpBgdNxPBHW3/JOO8ppq2yPR5sMKKmsMKoTIA==", + "dependencies": { + "@scure/base": "^1.1.3" + } + }, "node_modules/@wormhole-foundation/sdk-cosmwasm": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm/-/sdk-cosmwasm-0.7.0.tgz", - "integrity": "sha512-+anJb6jRKuVwNBs8ITx1C+3zaZ/wxVr20wAuwg+K/wSQ2+jlAWU33hyH9nkzZeYxxTsnAE5E1RNoPBTKEMP+Bw==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm/-/sdk-cosmwasm-0.7.3-beta.0.tgz", + "integrity": "sha512-u2tTckiXiwsgud8drarjbnbYloJh4I+HnVmiRRkkkwfVAy6GOqd1uwMODYOJ6sFBmgBC3QQyS4RfP5+NsKSd8Q==", "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.0", "@cosmjs/proto-signing": "^0.32.0", "@cosmjs/stargate": "^0.32.0", - "@injectivelabs/sdk-ts": "^1.14.4", - "@wormhole-foundation/sdk-connect": "0.7.0", + "@injectivelabs/sdk-ts": "^1.14.13-beta.2", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", "cosmjs-types": "^0.9.0" }, "engines": { @@ -12112,15 +12120,15 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-core/-/sdk-cosmwasm-core-0.7.0.tgz", - "integrity": "sha512-1kmM0JursGslCFb8u1/EpleXmlQuNxNk1iAhMktK8uFj1nUwtW+adJVYGz8NOt2BXXE0poCnSYwUX0wqYEQOAw==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-core/-/sdk-cosmwasm-core-0.7.3-beta.0.tgz", + "integrity": "sha512-dQEjuZ/fwi9tzcMlWKZLfoE4emTau2/NS39YDb6csyq0lCHCcexILQF/PAe0GL3E9hSCFQ5yPmxMC21ICSpbBg==", "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.0", "@cosmjs/stargate": "^0.32.0", - "@injectivelabs/sdk-ts": "^1.14.4", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm": "0.7.0" + "@injectivelabs/sdk-ts": "^1.14.13-beta.2", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -12300,9 +12308,9 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-core/node_modules/@injectivelabs/sdk-ts": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.11.tgz", - "integrity": "sha512-26WVglSfGdh3cTmMX2yE3tzdbKDIxfBIYiyACT3GMTImu2O4hAX2/4yooH4WhMBkpYB+AJIrdZT8eg6CAqLJ+Q==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", + "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", "hasInstallScript": true, "dependencies": { "@apollo/client": "^3.5.8", @@ -12312,17 +12320,16 @@ "@ethersproject/bytes": "^5.7.0", "@injectivelabs/core-proto-ts": "^0.0.21", "@injectivelabs/dmm-proto-ts": "1.0.20", - "@injectivelabs/exceptions": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", "@injectivelabs/indexer-proto-ts": "1.11.42", "@injectivelabs/mito-proto-ts": "1.0.65", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/test-utils": "^1.14.5", - "@injectivelabs/token-metadata": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", + "@injectivelabs/networks": "^1.14.13", + "@injectivelabs/test-utils": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", "@metamask/eth-sig-util": "^4.0.0", "@noble/curves": "^1.4.0", "axios": "^1.6.4", @@ -12330,7 +12337,7 @@ "bip39": "^3.0.4", "cosmjs-types": "^0.9.0", "ethereumjs-util": "^7.1.4", - "ethers": "^5.7.2", + "ethers": "^6.5.1", "google-protobuf": "^3.21.0", "graphql": "^16.3.0", "http-status-codes": "^2.2.0", @@ -12348,72 +12355,6 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-core/node_modules/@injectivelabs/token-metadata": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/token-metadata/-/token-metadata-1.14.11.tgz", - "integrity": "sha512-WKJlvjKiTRHxpOeez4kYrzIwgWmpspD1IMxWclkTysAcwGltUfUsvUhu1cKuACleIjFFWmiZv/HoGRFdvEAZ8w==", - "hasInstallScript": true, - "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", - "@types/lodash.values": "^4.3.6", - "copyfiles": "^2.4.1", - "jsonschema": "^1.4.0", - "link-module-alias": "^1.2.0", - "lodash": "^4.17.21", - "lodash.values": "^4.3.0", - "shx": "^0.3.2" - } - }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-core/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, "node_modules/@wormhole-foundation/sdk-cosmwasm-core/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -12443,16 +12384,16 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-ibc": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-ibc/-/sdk-cosmwasm-ibc-0.7.0.tgz", - "integrity": "sha512-3kNxNslku0PiGipXaCfp7HvMJXQaRp7Ca4TdevEGLpsDk+s81QkqxUC+vXdPeuYQhWD+OhFdfwEUCnikfELxiA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-ibc/-/sdk-cosmwasm-ibc-0.7.3-beta.0.tgz", + "integrity": "sha512-WC8K5JqaIj1l1SzfMhe9JhYxZeR5s1rbhD3EUVFMfka78XE3NKLuKNPIaKqdsRadKjbPTvgs4ok+sIHqpy2RZQ==", "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.0", "@cosmjs/stargate": "^0.32.0", - "@injectivelabs/sdk-ts": "^1.14.4", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm-core": "0.7.0", + "@injectivelabs/sdk-ts": "^1.14.13-beta.2", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm-core": "0.7.3-beta.0", "cosmjs-types": "^0.9.0" }, "engines": { @@ -12633,9 +12574,9 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-ibc/node_modules/@injectivelabs/sdk-ts": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.11.tgz", - "integrity": "sha512-26WVglSfGdh3cTmMX2yE3tzdbKDIxfBIYiyACT3GMTImu2O4hAX2/4yooH4WhMBkpYB+AJIrdZT8eg6CAqLJ+Q==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", + "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", "hasInstallScript": true, "dependencies": { "@apollo/client": "^3.5.8", @@ -12645,17 +12586,16 @@ "@ethersproject/bytes": "^5.7.0", "@injectivelabs/core-proto-ts": "^0.0.21", "@injectivelabs/dmm-proto-ts": "1.0.20", - "@injectivelabs/exceptions": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", "@injectivelabs/indexer-proto-ts": "1.11.42", "@injectivelabs/mito-proto-ts": "1.0.65", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/test-utils": "^1.14.5", - "@injectivelabs/token-metadata": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", + "@injectivelabs/networks": "^1.14.13", + "@injectivelabs/test-utils": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", "@metamask/eth-sig-util": "^4.0.0", "@noble/curves": "^1.4.0", "axios": "^1.6.4", @@ -12663,7 +12603,7 @@ "bip39": "^3.0.4", "cosmjs-types": "^0.9.0", "ethereumjs-util": "^7.1.4", - "ethers": "^5.7.2", + "ethers": "^6.5.1", "google-protobuf": "^3.21.0", "graphql": "^16.3.0", "http-status-codes": "^2.2.0", @@ -12681,72 +12621,6 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-ibc/node_modules/@injectivelabs/token-metadata": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/token-metadata/-/token-metadata-1.14.11.tgz", - "integrity": "sha512-WKJlvjKiTRHxpOeez4kYrzIwgWmpspD1IMxWclkTysAcwGltUfUsvUhu1cKuACleIjFFWmiZv/HoGRFdvEAZ8w==", - "hasInstallScript": true, - "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", - "@types/lodash.values": "^4.3.6", - "copyfiles": "^2.4.1", - "jsonschema": "^1.4.0", - "link-module-alias": "^1.2.0", - "lodash": "^4.17.21", - "lodash.values": "^4.3.0", - "shx": "^0.3.2" - } - }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-ibc/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, "node_modules/@wormhole-foundation/sdk-cosmwasm-ibc/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -12776,14 +12650,14 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-tokenbridge/-/sdk-cosmwasm-tokenbridge-0.7.0.tgz", - "integrity": "sha512-zyRfzuZvRwyL9NLU8wFEAKl36w8CTGJDu7qaAQTW4qxJUrzY/LWRP/UH7FsVR2GrpcpviIMwl1IabZmJZyKnWA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-cosmwasm-tokenbridge/-/sdk-cosmwasm-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-idTB0OU+U612RfGobYSWpt11Vxoo0/pymVfF9OUWogGcD4KNjWrbn6+3YKGYLhmFSKknDR7Q80cgMf3IVibZWw==", "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.32.0", - "@injectivelabs/sdk-ts": "^1.14.4", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-cosmwasm": "0.7.0" + "@injectivelabs/sdk-ts": "^1.14.13-beta.2", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-cosmwasm": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -12963,9 +12837,9 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm-tokenbridge/node_modules/@injectivelabs/sdk-ts": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.11.tgz", - "integrity": "sha512-26WVglSfGdh3cTmMX2yE3tzdbKDIxfBIYiyACT3GMTImu2O4hAX2/4yooH4WhMBkpYB+AJIrdZT8eg6CAqLJ+Q==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", + "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", "hasInstallScript": true, "dependencies": { "@apollo/client": "^3.5.8", @@ -12975,17 +12849,16 @@ "@ethersproject/bytes": "^5.7.0", "@injectivelabs/core-proto-ts": "^0.0.21", "@injectivelabs/dmm-proto-ts": "1.0.20", - "@injectivelabs/exceptions": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", "@injectivelabs/indexer-proto-ts": "1.11.42", "@injectivelabs/mito-proto-ts": "1.0.65", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/test-utils": "^1.14.5", - "@injectivelabs/token-metadata": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", + "@injectivelabs/networks": "^1.14.13", + "@injectivelabs/test-utils": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", "@metamask/eth-sig-util": "^4.0.0", "@noble/curves": "^1.4.0", "axios": "^1.6.4", @@ -12993,7 +12866,7 @@ "bip39": "^3.0.4", "cosmjs-types": "^0.9.0", "ethereumjs-util": "^7.1.4", - "ethers": "^5.7.2", + "ethers": "^6.5.1", "google-protobuf": "^3.21.0", "graphql": "^16.3.0", "http-status-codes": "^2.2.0", @@ -13011,72 +12884,6 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-tokenbridge/node_modules/@injectivelabs/token-metadata": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/token-metadata/-/token-metadata-1.14.11.tgz", - "integrity": "sha512-WKJlvjKiTRHxpOeez4kYrzIwgWmpspD1IMxWclkTysAcwGltUfUsvUhu1cKuACleIjFFWmiZv/HoGRFdvEAZ8w==", - "hasInstallScript": true, - "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", - "@types/lodash.values": "^4.3.6", - "copyfiles": "^2.4.1", - "jsonschema": "^1.4.0", - "link-module-alias": "^1.2.0", - "lodash": "^4.17.21", - "lodash.values": "^4.3.0", - "shx": "^0.3.2" - } - }, - "node_modules/@wormhole-foundation/sdk-cosmwasm-tokenbridge/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, "node_modules/@wormhole-foundation/sdk-cosmwasm-tokenbridge/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -13279,9 +13086,9 @@ } }, "node_modules/@wormhole-foundation/sdk-cosmwasm/node_modules/@injectivelabs/sdk-ts": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.11.tgz", - "integrity": "sha512-26WVglSfGdh3cTmMX2yE3tzdbKDIxfBIYiyACT3GMTImu2O4hAX2/4yooH4WhMBkpYB+AJIrdZT8eg6CAqLJ+Q==", + "version": "1.14.13", + "resolved": "https://registry.npmjs.org/@injectivelabs/sdk-ts/-/sdk-ts-1.14.13.tgz", + "integrity": "sha512-qcLoIu+hEMpuvdG0iXGNJvWQD05NkcO59tL3ijEhYmshlJWBMWJtpJJGt/E/hV9YxJfNTl20Rhi/5i7l0y8Hfg==", "hasInstallScript": true, "dependencies": { "@apollo/client": "^3.5.8", @@ -13291,17 +13098,16 @@ "@ethersproject/bytes": "^5.7.0", "@injectivelabs/core-proto-ts": "^0.0.21", "@injectivelabs/dmm-proto-ts": "1.0.20", - "@injectivelabs/exceptions": "^1.14.11", + "@injectivelabs/exceptions": "^1.14.13", "@injectivelabs/grpc-web": "^0.0.1", "@injectivelabs/grpc-web-node-http-transport": "^0.0.2", "@injectivelabs/grpc-web-react-native-transport": "^0.0.2", "@injectivelabs/indexer-proto-ts": "1.11.42", "@injectivelabs/mito-proto-ts": "1.0.65", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/test-utils": "^1.14.5", - "@injectivelabs/token-metadata": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", + "@injectivelabs/networks": "^1.14.13", + "@injectivelabs/test-utils": "^1.14.13", + "@injectivelabs/ts-types": "^1.14.13", + "@injectivelabs/utils": "^1.14.13", "@metamask/eth-sig-util": "^4.0.0", "@noble/curves": "^1.4.0", "axios": "^1.6.4", @@ -13309,7 +13115,7 @@ "bip39": "^3.0.4", "cosmjs-types": "^0.9.0", "ethereumjs-util": "^7.1.4", - "ethers": "^5.7.2", + "ethers": "^6.5.1", "google-protobuf": "^3.21.0", "graphql": "^16.3.0", "http-status-codes": "^2.2.0", @@ -13327,72 +13133,6 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" }, - "node_modules/@wormhole-foundation/sdk-cosmwasm/node_modules/@injectivelabs/token-metadata": { - "version": "1.14.11", - "resolved": "https://registry.npmjs.org/@injectivelabs/token-metadata/-/token-metadata-1.14.11.tgz", - "integrity": "sha512-WKJlvjKiTRHxpOeez4kYrzIwgWmpspD1IMxWclkTysAcwGltUfUsvUhu1cKuACleIjFFWmiZv/HoGRFdvEAZ8w==", - "hasInstallScript": true, - "dependencies": { - "@injectivelabs/exceptions": "^1.14.11", - "@injectivelabs/networks": "^1.14.11", - "@injectivelabs/ts-types": "^1.14.11", - "@injectivelabs/utils": "^1.14.11", - "@types/lodash.values": "^4.3.6", - "copyfiles": "^2.4.1", - "jsonschema": "^1.4.0", - "link-module-alias": "^1.2.0", - "lodash": "^4.17.21", - "lodash.values": "^4.3.0", - "shx": "^0.3.2" - } - }, - "node_modules/@wormhole-foundation/sdk-cosmwasm/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" - } - }, "node_modules/@wormhole-foundation/sdk-cosmwasm/node_modules/long": { "version": "5.2.3", "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", @@ -13422,13 +13162,13 @@ } }, "node_modules/@wormhole-foundation/sdk-definitions": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-definitions/-/sdk-definitions-0.7.0.tgz", - "integrity": "sha512-AJQtlNCwJXQ2GmUIZHt5GiUBnHrivilnZk4wqNtLu4m0yvPOqdM81KdlLHIH++95HAlFHkwmLv1+IWCZNHTDYA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-definitions/-/sdk-definitions-0.7.3-beta.0.tgz", + "integrity": "sha512-HzPWJxnEkvYblnu2EE7dGMqUwpAmdnU8+7Dzw9pY4VVkEnvyNQ+uHxsHcBOzFBC38tgwCsJ2qC8tk5wEedzvhQ==", "dependencies": { "@noble/curves": "^1.4.0", "@noble/hashes": "^1.3.1", - "@wormhole-foundation/sdk-base": "0.7.0" + "@wormhole-foundation/sdk-base": "0.7.3-beta.0" } }, "node_modules/@wormhole-foundation/sdk-definitions-ntt": { @@ -13441,12 +13181,30 @@ "@wormhole-foundation/sdk-definitions": "0.6.5" } }, + "node_modules/@wormhole-foundation/sdk-definitions-ntt/node_modules/@wormhole-foundation/sdk-definitions": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-definitions/-/sdk-definitions-0.7.2.tgz", + "integrity": "sha512-oVvE/cSq5eMJPI+f7i3CfZZxrO+llAN0QMTmMzns3OFPU0a0PAy0Cu/lNTXjuqApkpMTQI4iaWks7KL3A5rbgQ==", + "dependencies": { + "@noble/curves": "^1.4.0", + "@noble/hashes": "^1.3.1", + "@wormhole-foundation/sdk-base": "0.7.2" + } + }, + "node_modules/@wormhole-foundation/sdk-definitions/node_modules/@wormhole-foundation/sdk-base": { + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-base/-/sdk-base-0.7.3-beta.0.tgz", + "integrity": "sha512-sRiSAjooD3BehiV/dlLdmQSRbnca6Qkm9ibdgoI18tEslCGb3zpBgdNxPBHW3/JOO8ppq2yPR5sMKKmsMKoTIA==", + "dependencies": { + "@scure/base": "^1.1.3" + } + }, "node_modules/@wormhole-foundation/sdk-evm": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm/-/sdk-evm-0.7.0.tgz", - "integrity": "sha512-S4y6ClcqGpi8o5lZdTtDMl2jB4J5RDM3Yy4ZLQrKgzhO+JOlB1+vQOFf/nSCm9YzW+2OeFHP4ne9uonn1IFNZw==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm/-/sdk-evm-0.7.3-beta.0.tgz", + "integrity": "sha512-VG/oA+ZMeVevGhKJ7gVRjp2I8NsPnWvj6u99BWHlu1ZESqdlWwoqryYAIsOle8HInX5G5uuA6zoI6zhZMdXgTw==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", "ethers": "^6.5.1" }, "engines": { @@ -13454,12 +13212,12 @@ } }, "node_modules/@wormhole-foundation/sdk-evm-cctp": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-cctp/-/sdk-evm-cctp-0.7.0.tgz", - "integrity": "sha512-mFT8589CqD5YmMx0EHLgeCeI0KwMzjmf7rXYb7GRaY8WzxfL+OtHggu4QPRugIjn+SIJPixEp4jYYCQUIEq/QA==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-cctp/-/sdk-evm-cctp-0.7.3-beta.0.tgz", + "integrity": "sha512-hoU8wxHh3U6kcDQbSLfdlntr5uBTXgC1Ri8Ad2hUxI3HRgTxrtjGPTReQmg1TPRDtcb8PqFBqZW5VKg9TdEStA==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-evm": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm": "0.7.3-beta.0", "ethers": "^6.5.1" }, "engines": { @@ -13467,12 +13225,12 @@ } }, "node_modules/@wormhole-foundation/sdk-evm-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-core/-/sdk-evm-core-0.7.0.tgz", - "integrity": "sha512-TF8Rj8OPBlsUvmv1eDdFqLBbh2xzL6rwxbJpTuIdWzMxtSrIh2IuQy2snNbmMpnnIQHY9iu3BYblnWyn9I/h8g==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-core/-/sdk-evm-core-0.7.3-beta.0.tgz", + "integrity": "sha512-0llCUTzls3ezn2OgZQlw/R6OSo5A2ZKz2WGy7grqIY60Hlm+NaxJNUvcq35DG2EK8YXD6HzCb5C15oh1Hj1Apw==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-evm": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm": "0.7.3-beta.0", "ethers": "^6.5.1" }, "engines": { @@ -13480,14 +13238,14 @@ } }, "node_modules/@wormhole-foundation/sdk-evm-portico": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-portico/-/sdk-evm-portico-0.7.0.tgz", - "integrity": "sha512-3LXDq1b3pTlPJ5k9OuafRXqjSsxZiJdhMGCynIIAQYw0lBbvy1Y3MnhaN11ORu/0UWtHVXN5R15+vVM2CutwgQ==", - "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-evm": "0.7.0", - "@wormhole-foundation/sdk-evm-core": "0.7.0", - "@wormhole-foundation/sdk-evm-tokenbridge": "0.7.0", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-portico/-/sdk-evm-portico-0.7.3-beta.0.tgz", + "integrity": "sha512-OxgYx94x4Z0RmQyss88k4mdij2Jv+F9hNAdi7uMWBm3hCJPJBgfPyYQVJAfhaxUR4q0Q0r2nTfdyTe9qYrn/3Q==", + "dependencies": { + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-core": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-tokenbridge": "0.7.3-beta.0", "ethers": "^6.5.1" }, "engines": { @@ -13495,13 +13253,13 @@ } }, "node_modules/@wormhole-foundation/sdk-evm-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-tokenbridge/-/sdk-evm-tokenbridge-0.7.0.tgz", - "integrity": "sha512-CHgL1ZFFXqefdxVI3/WAAT3lC2MGMTRZhR9AcEJ6CAlr5bZa8vxeuksTlc+DU97Hh2vD7dxKQQgyo2dohFTN2w==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-evm-tokenbridge/-/sdk-evm-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-zjDavanmGraPo4AELHL6shFteFneHzLE5PcVMJViXVdQ3rcCjxrd84EG/UBhVWHAUPsIYuQMTIgg8Qgr0/2D7A==", "dependencies": { - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-evm": "0.7.0", - "@wormhole-foundation/sdk-evm-core": "0.7.0", + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm": "0.7.3-beta.0", + "@wormhole-foundation/sdk-evm-core": "0.7.3-beta.0", "ethers": "^6.5.1" }, "engines": { @@ -13525,30 +13283,30 @@ } }, "node_modules/@wormhole-foundation/sdk-solana": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana/-/sdk-solana-0.7.0.tgz", - "integrity": "sha512-N2xfHlIqDwDTBdecX/DvmRwBbStqKIBCuFu2RzrR3syOxOhpUyIaXKNt1Mzat2Niic6pAiAm38+MODiKOSTB3w==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana/-/sdk-solana-0.7.3-beta.0.tgz", + "integrity": "sha512-j+yqECIJ2U4iVsMgjg5ysGzrpX1OQvt31ZHQNkEypv42xDoVs6yNhzK88+s1JOQZwA3fWFFQBxJ6LEyoKTV4EA==", "dependencies": { "@coral-xyz/anchor": "0.29.0", "@coral-xyz/borsh": "0.29.0", "@solana/spl-token": "0.3.9", "@solana/web3.js": "1.91.7", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-solana-cctp": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-cctp/-/sdk-solana-cctp-0.7.0.tgz", - "integrity": "sha512-qFQdJrIaaQ49OJG4miJGA51fB/J+lAdFcvmXNMZoLgD9bgUpPlX44kY0Uh2OKUqcvHq8W8aqbVoCYmIOSVW60g==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-cctp/-/sdk-solana-cctp-0.7.3-beta.0.tgz", + "integrity": "sha512-piOEKDBjU1t5AFLLqJjSE4IoaXFaXULNlzMlICJroHcDHwJILubUI15Z7mpagLUbY69ewVRbSxC4gR8AjTv2dA==", "dependencies": { "@coral-xyz/anchor": "0.29.0", "@solana/spl-token": "0.3.9", "@solana/web3.js": "1.91.7", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-solana": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -13582,15 +13340,15 @@ "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" }, "node_modules/@wormhole-foundation/sdk-solana-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-core/-/sdk-solana-core-0.7.0.tgz", - "integrity": "sha512-dho22g8IGR7412YMdQrqKAAQqaJWcbVunliqD0Ri2IFmXbgeydgL+6qoszC/MofY/G2Oxv7OEJY+SNPubD2p2g==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-core/-/sdk-solana-core-0.7.3-beta.0.tgz", + "integrity": "sha512-08iYwv0PpsPzwtc11XMGY7lW2oGdM7RUsfH0Ylrm/30o4M3Ly3bofCFE3uP2C75oPkC2gUKyVhAqRaUjH4TPzA==", "dependencies": { "@coral-xyz/anchor": "0.29.0", "@coral-xyz/borsh": "0.29.0", "@solana/web3.js": "1.91.7", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-solana": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -13624,16 +13382,16 @@ "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" }, "node_modules/@wormhole-foundation/sdk-solana-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-tokenbridge/-/sdk-solana-tokenbridge-0.7.0.tgz", - "integrity": "sha512-GGU9FiaVVL9d8cHw6bn7e4AsM0aIpDgVDDgW7VGqfc+Al81ZtKTKcxQnTvSQJ9JD8h+/jIyTlCcH2yEl+7NkLg==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-solana-tokenbridge/-/sdk-solana-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-H7r3SLUJxgTfSpD90A2RB7YzXY2RgRsIcxipFS4iQY36FqQG98gGjZjJScSLcaMc9ihYGk2NkLfiDfl4D0m9LQ==", "dependencies": { "@coral-xyz/anchor": "0.29.0", "@solana/spl-token": "0.3.9", "@solana/web3.js": "1.91.7", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-solana": "0.7.0", - "@wormhole-foundation/sdk-solana-core": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana": "0.7.3-beta.0", + "@wormhole-foundation/sdk-solana-core": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -13694,25 +13452,25 @@ "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" }, "node_modules/@wormhole-foundation/sdk-sui": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui/-/sdk-sui-0.7.0.tgz", - "integrity": "sha512-B6Ojo7dlDfGPhFYLJvtBudnPfVq4KTTznT0KdQRhk6H8fY7DTawEeJHKuOCJyvVXViQTS3zwnXcN3knNZ/Oimw==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui/-/sdk-sui-0.7.3-beta.0.tgz", + "integrity": "sha512-WUjsbDFtWzhkCt3i/XNwP0pokde6MzzvHonR9cS9y/p2/T0EowPDHSb68EauRpr4VflLfXnH+zJmMwOo5bkPtQ==", "dependencies": { "@mysten/sui.js": "^0.50.1", - "@wormhole-foundation/sdk-connect": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0" }, "engines": { "node": ">=16" } }, "node_modules/@wormhole-foundation/sdk-sui-core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui-core/-/sdk-sui-core-0.7.0.tgz", - "integrity": "sha512-kUJgu0GcToTgKUWdpwrqz52YWQVbDSCTO4wKiAKBCsFTKKyVqFT9qU6ZH/dyNfroXgJyW7K3eSKzJMvK49LAJQ==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui-core/-/sdk-sui-core-0.7.3-beta.0.tgz", + "integrity": "sha512-7CBjlAm3fInZoPnMdXstcHaEWmaojIp2t/DS+Sj7g6pYLsVkgI+qt5uxkYDYKbqDU7NFzTbc94VKFASxIJB8zQ==", "dependencies": { "@mysten/sui.js": "^0.50.1", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-sui": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -13775,14 +13533,14 @@ } }, "node_modules/@wormhole-foundation/sdk-sui-tokenbridge": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui-tokenbridge/-/sdk-sui-tokenbridge-0.7.0.tgz", - "integrity": "sha512-LO570zefBgB3l1YCBXnYz6Us2YK1KzrPxVrA467zXk3G+crYTyYXCwuQMAjwo7I4DnXApACJfFBXOhSE3Gmdag==", + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-sui-tokenbridge/-/sdk-sui-tokenbridge-0.7.3-beta.0.tgz", + "integrity": "sha512-pgF/8nuDaoatvOmT9KUsUK0ExwvsBYD8OFIDYPkJl2ZN+cfCj/cjuo2aPfvO0VWAB7docOoKummKhfLwW9nXGA==", "dependencies": { "@mysten/sui.js": "^0.50.1", - "@wormhole-foundation/sdk-connect": "0.7.0", - "@wormhole-foundation/sdk-sui": "0.7.0", - "@wormhole-foundation/sdk-sui-core": "0.7.0" + "@wormhole-foundation/sdk-connect": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui": "0.7.3-beta.0", + "@wormhole-foundation/sdk-sui-core": "0.7.3-beta.0" }, "engines": { "node": ">=16" @@ -13900,6 +13658,14 @@ "node": ">=14.0.0" } }, + "node_modules/@wormhole-foundation/sdk/node_modules/@wormhole-foundation/sdk-base": { + "version": "0.7.3-beta.0", + "resolved": "https://registry.npmjs.org/@wormhole-foundation/sdk-base/-/sdk-base-0.7.3-beta.0.tgz", + "integrity": "sha512-sRiSAjooD3BehiV/dlLdmQSRbnca6Qkm9ibdgoI18tEslCGb3zpBgdNxPBHW3/JOO8ppq2yPR5sMKKmsMKoTIA==", + "dependencies": { + "@scure/base": "^1.1.3" + } + }, "node_modules/@wry/caches": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@wry/caches/-/caches-1.0.1.tgz", diff --git a/wormhole-connect/package.json b/wormhole-connect/package.json index d8b9b7324..179f3386b 100644 --- a/wormhole-connect/package.json +++ b/wormhole-connect/package.json @@ -39,8 +39,8 @@ "@reduxjs/toolkit": "^1.9.1", "@solana/wallet-adapter-wallets": "^0.19.25", "@solana/web3.js": "^1.73.0", - "@wormhole-foundation/sdk": "^0.7.0-beta.3", - "@wormhole-foundation/sdk-definitions": "^0.7.0-beta.3", + "@wormhole-foundation/sdk": "^0.7.3-beta.0", + "@wormhole-foundation/sdk-definitions": "^0.7.3-beta.0", "@wormhole-foundation/sdk-definitions-ntt": "^0.0.1-beta.5", "@wormhole-foundation/sdk-icons": "^0.6.8", "@xlabs-libs/wallet-aggregator-aptos": "^0.0.1-alpha.14", diff --git a/wormhole-connect/src/config/index.ts b/wormhole-connect/src/config/index.ts index 622b60b10..d3425481f 100644 --- a/wormhole-connect/src/config/index.ts +++ b/wormhole-connect/src/config/index.ts @@ -129,7 +129,10 @@ export function buildConfig( : true; }), gasEstimates: networkData.gasEstimates, - routes: customConfig?.routes ?? Object.values(Route), + // TODO: disabling all routes except Bridge and Relay until they are fully implemented + routes: (customConfig?.routes ?? Object.values(Route)).filter((r) => + [Route.Bridge, Route.Relay].includes(r as Route), + ), // UI details cta: customConfig?.cta, diff --git a/wormhole-connect/src/config/testnet/chains.ts b/wormhole-connect/src/config/testnet/chains.ts index bc05d3164..3a34d4bed 100644 --- a/wormhole-connect/src/config/testnet/chains.ts +++ b/wormhole-connect/src/config/testnet/chains.ts @@ -4,28 +4,6 @@ import { ChainsConfig, Icon } from '../types'; const { chains } = CONFIG.TESTNET; export const TESTNET_CHAINS: ChainsConfig = { - goerli: { - ...chains.goerli!, - displayName: 'Goerli', - explorerUrl: 'https://goerli.etherscan.io/', - explorerName: 'Etherscan', - gasToken: 'ETH', - chainId: 5, - icon: Icon.ETH, - automaticRelayer: true, - maxBlockSearch: 2000, - }, - mumbai: { - ...chains.mumbai!, - displayName: 'Mumbai', - explorerUrl: 'https://mumbai.polygonscan.com/', - explorerName: 'Polygonscan', - gasToken: 'MATIC', - chainId: 80001, - icon: Icon.POLYGON, - automaticRelayer: true, - maxBlockSearch: 1000, - }, bsc: { ...chains.bsc!, displayName: 'BSC', @@ -113,17 +91,6 @@ export const TESTNET_CHAINS: ChainsConfig = { icon: Icon.APT, maxBlockSearch: 0, }, - basegoerli: { - ...chains.basegoerli!, - displayName: 'Base Goerli', - explorerUrl: 'https://goerli.basescan.org/', - explorerName: 'BaseScan', - gasToken: 'ETHbase', - chainId: 84531, - icon: Icon.BASE, - automaticRelayer: true, - maxBlockSearch: 2000, - }, klaytn: { ...chains.klaytn!, displayName: 'Klaytn', @@ -167,26 +134,6 @@ export const TESTNET_CHAINS: ChainsConfig = { automaticRelayer: false, maxBlockSearch: 0, }, - arbitrumgoerli: { - ...chains.arbitrumgoerli!, - displayName: 'Arbitrum Goerli', - explorerUrl: 'https://testnet.arbiscan.io/', - explorerName: 'Arbitrum Goerli Explorer', - gasToken: 'ETHarbitrum', - chainId: 421613, - icon: Icon.ARBITRUM, - maxBlockSearch: 2000, - }, - optimismgoerli: { - ...chains.optimismgoerli!, - displayName: 'Optimism Goerli', - explorerUrl: 'https://goerli-optimism.etherscan.io/', - explorerName: 'Optimistic Goerli Explorer', - gasToken: 'ETHoptimism', - chainId: 420, - icon: Icon.OPTIMISM, - maxBlockSearch: 2000, - }, cosmoshub: { ...chains.cosmoshub!, displayName: 'Cosmoshub', diff --git a/wormhole-connect/src/config/testnet/gasEstimates.ts b/wormhole-connect/src/config/testnet/gasEstimates.ts index 58c85bc58..5658ffb6d 100644 --- a/wormhole-connect/src/config/testnet/gasEstimates.ts +++ b/wormhole-connect/src/config/testnet/gasEstimates.ts @@ -1,43 +1,6 @@ import { GasEstimates, Route } from '../types'; export const TESTNET_GAS_ESTIMATES: GasEstimates = { - goerli: { - [Route.Bridge]: { - sendNative: 100000, - sendToken: 150000, - claim: 200000, - }, - [Route.Relay]: { - sendNative: 200000, - sendToken: 300000, - }, - [Route.CCTPManual]: { - sendToken: 150000, - claim: 300000, - }, - [Route.CCTPRelay]: { - sendToken: 300000, - }, - [Route.TBTC]: { - sendToken: 150000, - claim: 200000, - }, - }, - mumbai: { - [Route.Bridge]: { - sendNative: 200000, - sendToken: 150000, - claim: 200000, - }, - [Route.Relay]: { - sendNative: 200000, - sendToken: 250000, - }, - [Route.TBTC]: { - sendToken: 200000, - claim: 300000, - }, - }, bsc: { [Route.Bridge]: { sendNative: 100000, @@ -151,28 +114,6 @@ export const TESTNET_GAS_ESTIMATES: GasEstimates = { claim: 1000000, }, }, - basegoerli: { - [Route.Bridge]: { - sendNative: 100000, - sendToken: 1000000, - claim: 1000000, - }, - [Route.Relay]: { - sendNative: 300000, - sendToken: 300000, - }, - [Route.CCTPManual]: { - sendToken: 300000, - claim: 500000, - }, - [Route.CCTPRelay]: { - sendToken: 300000, - }, - [Route.TBTC]: { - sendToken: 300000, - claim: 500000, - }, - }, klaytn: { [Route.Bridge]: { sendNative: 2000000, @@ -194,40 +135,6 @@ export const TESTNET_GAS_ESTIMATES: GasEstimates = { claim: 0, }, }, - arbitrumgoerli: { - [Route.Bridge]: { - sendNative: 100000, - sendToken: 150000, - claim: 150000, - }, - [Route.CCTPManual]: { - sendToken: 150000, - }, - [Route.CCTPRelay]: { - sendToken: 300000, - }, - [Route.TBTC]: { - sendToken: 150000, - claim: 300000, - }, - }, - optimismgoerli: { - [Route.Bridge]: { - sendNative: 100000, - sendToken: 100000, - claim: 100000, - }, - [Route.CCTPManual]: { - sendToken: 150000, - }, - [Route.CCTPRelay]: { - sendToken: 300000, - }, - [Route.TBTC]: { - sendToken: 150000, - claim: 300000, - }, - }, cosmoshub: { [Route.Bridge]: { sendNative: 0, diff --git a/wormhole-connect/src/config/testnet/rpcs.ts b/wormhole-connect/src/config/testnet/rpcs.ts index ab5847281..128efd436 100644 --- a/wormhole-connect/src/config/testnet/rpcs.ts +++ b/wormhole-connect/src/config/testnet/rpcs.ts @@ -1,8 +1,6 @@ import { populateRpcField } from '../utils'; const { - REACT_APP_GOERLI_RPC, REACT_APP_SEPOLIA_RPC, - REACT_APP_MUMBAI_RPC, REACT_APP_BSC_TESTNET_RPC, REACT_APP_FUJI_RPC, REACT_APP_FANTOM_TESTNET_RPC, @@ -12,7 +10,6 @@ const { REACT_APP_SUI_TESTNET_RPC, REACT_APP_APTOS_TESTNET_RPC, REACT_APP_SEI_TESTNET_RPC, - REACT_APP_BASE_GOERLI_RPC, REACT_APP_BASE_SEPOLIA_RPC, REACT_APP_OSMOSIS_TESTNET_RPC, REACT_APP_INJECTIVE_TESTNET_RPC, @@ -23,9 +20,7 @@ const { REACT_APP_KLAYTN_TESTNET_RPC, REACT_APP_SEI_REST, REACT_APP_EVMOS_REST, - REACT_APP_ARBITRUM_GOERLI_RPC, REACT_APP_ARBITRUM_SEPOLIA_RPC, - REACT_APP_OPTIMISM_GOERLI_RPC, REACT_APP_OPTIMISM_SEPOLIA_RPC, REACT_APP_APTOS_TESTNET_GRAPHQL, REACT_APP_SCROLL_TESTNET_RPC, @@ -34,9 +29,7 @@ const { } = import.meta.env; export const TESTNET_RPC_MAPPING = { - ...populateRpcField('goerli', REACT_APP_GOERLI_RPC), ...populateRpcField('sepolia', REACT_APP_SEPOLIA_RPC), - ...populateRpcField('mumbai', REACT_APP_MUMBAI_RPC), ...populateRpcField('bsc', REACT_APP_BSC_TESTNET_RPC), ...populateRpcField('fuji', REACT_APP_FUJI_RPC), ...populateRpcField('fantom', REACT_APP_FANTOM_TESTNET_RPC), @@ -46,13 +39,10 @@ export const TESTNET_RPC_MAPPING = { ...populateRpcField('sui', REACT_APP_SUI_TESTNET_RPC), ...populateRpcField('aptos', REACT_APP_APTOS_TESTNET_RPC), ...populateRpcField('sei', REACT_APP_SEI_TESTNET_RPC), - ...populateRpcField('basegoerli', REACT_APP_BASE_GOERLI_RPC), ...populateRpcField('base_sepolia', REACT_APP_BASE_SEPOLIA_RPC), ...populateRpcField('osmosis', REACT_APP_OSMOSIS_TESTNET_RPC), ...populateRpcField('wormchain', REACT_APP_WORMCHAIN_TESTNET_RPC), - ...populateRpcField('arbitrumgoerli', REACT_APP_ARBITRUM_GOERLI_RPC), ...populateRpcField('arbitrum_sepolia', REACT_APP_ARBITRUM_SEPOLIA_RPC), - ...populateRpcField('optimismgoerli', REACT_APP_OPTIMISM_GOERLI_RPC), ...populateRpcField('optimism_sepolia', REACT_APP_OPTIMISM_SEPOLIA_RPC), ...populateRpcField('cosmoshub', REACT_APP_COSMOSHUB_TESTNET_RPC), ...populateRpcField('evmos', REACT_APP_EVMOS_TESTNET_RPC), diff --git a/wormhole-connect/src/config/testnet/tokens.ts b/wormhole-connect/src/config/testnet/tokens.ts index 988e73eb1..04ce506a8 100644 --- a/wormhole-connect/src/config/testnet/tokens.ts +++ b/wormhole-connect/src/config/testnet/tokens.ts @@ -1,1881 +1,743 @@ import { Icon, TokensConfig } from '../types'; export const TESTNET_TOKENS: TokensConfig = { - ETH: { - key: 'ETH', - symbol: 'ETH', - nativeChain: 'goerli', - icon: Icon.ETH, - coinGeckoId: 'ethereum', - color: '#62688F', + BNB: { + key: 'BNB', + symbol: 'BNB', + nativeChain: 'bsc', + icon: Icon.BNB, + coinGeckoId: 'binancecoin', + color: '#F3BA30', decimals: { Ethereum: 18, default: 8, }, - wrappedAsset: 'WETH', + wrappedAsset: 'WBNB', }, - WETH: { - key: 'WETH', - symbol: 'WETH', - nativeChain: 'goerli', - icon: Icon.ETH, + WBNB: { + key: 'WBNB', + symbol: 'WBNB', + nativeChain: 'bsc', + icon: Icon.BNB, tokenId: { - chain: 'goerli', - address: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6', + chain: 'bsc', + address: '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd', }, - coinGeckoId: 'ethereum', - color: '#62688F', + coinGeckoId: 'binancecoin', + color: '#F3BA30', decimals: { Ethereum: 18, default: 8, }, foreignAssets: { - mumbai: { - address: '0xc6735cc74553Cc2caeB9F5e1Ea0A4dAe12ef4632', - decimals: 18, - }, - bsc: { - address: '0x064a85eac6b4Bd7190BCAd3458dBD9459989c37B', - decimals: 18, - }, fuji: { - address: '0xbB5A2dC896Ec4E2fa77F40FA630582ed9c6D0172', + address: '0x10F1053bF2884b28ee0Bd7a2dDBa237Af3511d29', decimals: 18, }, fantom: { - address: '0x758FEebDDeC06f4bCcEc8F756C8efBD35d5b7124', + address: '0xfB174b43228950C2055CFc25AE93f2DCe8E2beF0', decimals: 18, }, alfajores: { - address: '0x898471a82737dFFfB61915F9e8381e279076D72b', + address: '0xa8050be9389466c3c524F10F131f244ACbf21A0D', decimals: 18, }, moonbasealpha: { - address: '0xd27d8883E31FAA11B2613b14BE83ad8951C8783C', + address: '0x6097E80331B0c6aF4F74D7F2363E70Cb2Fd078A5', decimals: 18, }, solana: { - address: '7VPWjBhCXrpYYBiRKZh1ubh9tLZZNkZGp2ReRphEV4Mc', + address: 'BaGfF51MQ3a61papTRDYaNefBgTQ9ywnVne5fCff4bxT', decimals: 8, }, sui: { address: - '0x72831f626b1f0e11be201893d5cb641917730b1ccac778e4a77f8ab2052f0784::coin::COIN', + '0xddcf8680a8a4b8a527d8c85ec203274991590c2ea898d1c4635b70164d9c584b::coin::COIN', decimals: 8, }, aptos: { address: - '0x381775005cb32cdd3dbf935ae1b978ed40d309c72b009cd4a812aab6d991418a::coin::T', + '0xa5894f5ddb8647e6143102aa336ff07374f7b32e88c1c703aef5b7c9a370bf80::coin::T', decimals: 8, }, - basegoerli: { - address: '0x44D627f900da8AdaC7561bD73aA745F132450798', - decimals: 18, - }, sei: { address: - 'sei13pzlt9etk44hj22lckncvampq2qu2gxv6r6774f3hma4vc07wqgsmftjx7', + 'sei10a7see3f9t2j9l8fdweur3aqy4zgvz583a268hhhln3yzps6l5mqnl4ua6', decimals: 8, }, - arbitrumgoerli: { - address: '0x285d75E04D78F53f4Ed29A506a7e8479EEf3035f', - decimals: 18, - }, - optimismgoerli: { - address: '0x33Db338718aC89Cd8DB13B56af05be3a3029BBE5', - decimals: 18, - }, wormchain: { address: - 'wormhole1vguuxez2h5ekltfj9gjd62fs5k4rl2zy5hfrncasykzw08rezpfs63pmq2', + 'wormhole1335rlmhujm0gj5e9gh7at9jpqvqckz0mpe4v284ar4lw5mlkryzsnetfsj', decimals: 8, }, - osmosis: { + cosmoshub: { address: - 'ibc/A4A8B6AE885DACD75B228031C0D18AD7EE1B914CED30C9F6F4230DDBD4A1CF2B', + 'ibc/5B0D5974A56332468DD4B2D07C96A7386FCF8FE7303FF41234F90E410EF51937', decimals: 8, }, - cosmoshub: { + osmosis: { address: - 'ibc/77FE9153FA76C3107CB9F6633AC33509A58529E9622327F216BA8107C79C2DE3', + 'ibc/65A67BA10DE2378B32AC5A822321E370966D3D4E180DEFB4C3C5245B21088DDF', decimals: 8, }, }, }, - USDCeth: { - key: 'USDCeth', - symbol: 'USDC', - nativeChain: 'goerli', - icon: Icon.USDC, + AVAX: { + key: 'AVAX', + symbol: 'AVAX', + nativeChain: 'fuji', + icon: Icon.AVAX, + coinGeckoId: 'avalanche-2', + color: '#E84141', + decimals: { + Ethereum: 18, + default: 8, + }, + wrappedAsset: 'WAVAX', + }, + WAVAX: { + key: 'WAVAX', + symbol: 'WAVAX', + nativeChain: 'fuji', + icon: Icon.AVAX, tokenId: { - chain: 'goerli', - address: '0x07865c6E87B9F70255377e024ace6630C1Eaa37F', + chain: 'fuji', + address: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c', }, - coinGeckoId: 'usd-coin', - color: '#2774CA', + coinGeckoId: 'avalanche-2', + color: '#E84141', decimals: { - default: 6, + Ethereum: 18, + default: 8, }, foreignAssets: { - mumbai: { - address: '0x543237045a106D7fd2eE3e2B44b5728e70BDe9c3', - decimals: 6, - }, bsc: { - address: '0x861B5C16A2EcED022241072A7beA9D530b99EB6f', - decimals: 6, - }, - fuji: { - address: '0x63A30f239DC8d1c17Bf6653a68Fc6C2F83641E6d', - decimals: 6, + address: '0x6cE9E2c8b59bbcf65dA375D3d8AB503c8524caf7', + decimals: 18, }, fantom: { - address: '0xDF7928AF5B33F7de592594958D8d6Ff8472Eb407', - decimals: 6, + address: '0x0f545Be981C37fB15ab7c65404648761e99016e4', + decimals: 18, }, alfajores: { - address: '0xB0524bEF6c61c6150B340b2828a890fD8dEa60C0', - decimals: 6, + address: '0x502c8C83008D9Dd812a7C5fB886C063060C73Dbf', + decimals: 18, }, moonbasealpha: { - address: '0xE5dE10C4b744bac6b783fAF8d9B9fDFF14Acc3c9', - decimals: 6, + address: '0x2E8afeCC19842229358f3650cc3F091908dcbaB4', + decimals: 18, }, solana: { - address: '2BAqec7Qof3Y7VJatwFsRHUNSQBSkzaEsT1V5bW6dbZY', - decimals: 6, - }, - basegoerli: { - address: '0x5010B0988a035915C91a2a432085824FcB3D8d3f', - decimals: 6, + address: '3Ftc5hTz9sG4huk79onufGiebJNDMZNL8HYgdMJ9E7JR', + decimals: 8, }, - sei: { + sui: { address: - 'sei1nj32y0h0vzam33ay42h2majlfk7tdkqcuk84srn0v2a52kmujgfsyfe78f', - decimals: 6, + '0xa600741c469fb57ed01497ddf101e798fa79a9c529bd176675c5c4d970811f80::coin::COIN', + decimals: 8, }, - arbitrumgoerli: { - address: '0x42A212A2E7eA8feF4ED28F439F16A6ABDd34DA35', - decimals: 6, + aptos: { + address: + '0xbe8f4301c0b54e870902b9a23eeb95ce74ac190531782aa3262337ceb145401a::coin::T', + decimals: 8, }, - optimismgoerli: { - address: '0x0382F518AcE1a86224c78B7CDfa67B9774055A1b', - decimals: 6, + sei: { + address: + 'sei1mgpq67pj7p2acy5x7r5lz7fulxmuxr3uh5f0szyvqgvru3glufzsxk8tnx', + decimals: 8, }, wormchain: { address: - 'wormhole1rl8su3hadqqq2v86lscpuklsh2mh84cxqvjdew4jt9yd07dzekyqkmcy3p', - decimals: 6, + 'wormhole1tqwwyth34550lg2437m05mjnjp8w7h5ka7m70jtzpxn4uh2ktsmq8dv649', + decimals: 8, }, cosmoshub: { address: - 'ibc/D0EC31D1176BB69EA1A7CF7172CA0380B7AF488AFC6D55B101B8363C2141CD4F', - decimals: 6, + 'ibc/BAEAC83736444C09656FBE666FB625974FCCDEE566EB700EBFD2642C5F6CF13A', + decimals: 8, }, osmosis: { address: - 'ibc/3BB8C4BD1C90599B2FA5B5839DD0813EF7B94B0BD0904C4C5A61498AE81E0EE9', - decimals: 6, - }, - sui: { - address: - '0x9e4396c19ec1c5f2214c79d3af3f31e59869640305560f8f2499c36fa9c8e0f2::coin::COIN', - decimals: 6, + 'ibc/99EAD53D49EC7CC4E2E2EB26C22CF81C16727DF0C4BF7F7ACBF0D22D910DB5DE', + decimals: 8, }, }, }, - WBTC: { - key: 'WBTC', - symbol: 'WBTC', - nativeChain: 'goerli', - icon: Icon.WBTC, - tokenId: { - chain: 'goerli', - address: '0xC04B0d3107736C32e19F1c62b2aF67BE61d63a05', - }, - coinGeckoId: 'wrapped-bitcoin', - color: '#ffffff', - decimals: { - default: 8, - }, - }, - USDT: { - key: 'USDT', - symbol: 'USDT', - nativeChain: 'goerli', - icon: Icon.USDT, + USDCavax: { + key: 'USDCavax', + symbol: 'USDC', + nativeChain: 'fuji', + icon: Icon.USDC, tokenId: { - chain: 'goerli', - address: '0xC2C527C0CACF457746Bd31B2a698Fe89de2b6d49', + chain: 'fuji', + address: '0x5425890298aed601595a70AB815c96711a31Bc65', }, - coinGeckoId: 'tether', - color: '#ffffff', + coinGeckoId: 'usd-coin', + color: '#2774CA', decimals: { default: 6, }, foreignAssets: { - mumbai: { - address: '0x02E30E84161BE1aBfcBB2b154B11De4C2b5E0a32', + bsc: { + address: '0x1cfeCf72bcBE1E429A21A5B11E708C7c397AaC54', decimals: 6, }, - bsc: { - address: '0xe94AaBAdB6F833f65B8A9AdDD030985B775188c9', + fantom: { + address: '0x6BC4E8D8c1d54656D1DeBCa96efc53aFd1408aD2', + decimals: 6, + }, + alfajores: { + address: '0xDDB349c976cA2C873644F21f594767Eb5390C831', decimals: 6, }, moonbasealpha: { - address: '0x7f5Ca1bcFb38fDF4c0E0646FCbf3FA87740ff65D', + address: '0x6533CE14804D113b1F494dC56c5D60A43cb5C3b5', decimals: 6, }, - arbitrumgoerli: { - address: '0x2B732F5ad6117818Ad3b7aC73C16033F6ECD78E5', + solana: { + address: 'GQtMXZxnuacCFTXVeTvyHi6P9F6chbtzhVc8JgD8hv7c', decimals: 6, }, - fantom: { - address: '0x32eF19C4b3DF65a24972A489e70AdDef5E54262C', + sui: { + address: + '0x2aa8c885d04e676c4e87b7d0f94d4f3b243b1b5d93239d1cc41d5528ce1714c1::coin::COIN', + decimals: 6, + }, + aptos: { + address: + '0x02ef7697bdb33361ca39d228671203afc0dea3202e792d79d2072b761d87c834::coin::T', + decimals: 6, + }, + sei: { + address: + 'sei1uyce5s6cc8hveg0maq2lg7wm6v6fvwqmznypj559nzf9wr9tmw3qnd3ce7', decimals: 6, }, wormchain: { address: - 'wormhole1v2efcqkp2qtev06t0ksjnx6trxdd0f7fxg2zdrtzr8cr9wdpjkyqkv9ch6', + 'wormhole1qum2tr7hh4y7ruzew68c64myjec0dq2s2njf6waja5t0w879lutqv2exs9', decimals: 6, }, cosmoshub: { address: - 'ibc/755FBC53FFB46FB505B5269F9BEDF47041F2A0EF2FF8D0520315403E5925C80A', + 'ibc/F09E98FA8682FF39130F171E9D89A948B0C3A452F2A31F22B6CC54A3AAE1CD4A', decimals: 6, }, osmosis: { address: - 'ibc/1941ED1147121BA7DF35559597B6EB3251844DBBBE4557337D957CB95E0978C2', + 'ibc/EC9FA5074F34F0644A025BB0263FDAE8F364C5E08523F6464465EF1010FF5A3A', decimals: 6, }, }, }, - DAI: { - key: 'DAI', - symbol: 'DAI', - nativeChain: 'goerli', - icon: Icon.DAI, + FTM: { + key: 'FTM', + symbol: 'FTM', + nativeChain: 'fantom', + icon: Icon.FANTOM, + coinGeckoId: 'fantom', + color: '#12B4EC', + decimals: { + Ethereum: 18, + default: 8, + }, + wrappedAsset: 'WFTM', + }, + WFTM: { + key: 'WFTM', + symbol: 'WFTM', + nativeChain: 'fantom', + icon: Icon.FANTOM, tokenId: { - chain: 'goerli', - address: '0x11fE4B6AE13d2a6055C8D9cF65c55bac32B5d844', + chain: 'fantom', + address: '0xf1277d1Ed8AD466beddF92ef448A132661956621', }, - coinGeckoId: 'dai', - color: '#FEFEFD', + coinGeckoId: 'fantom', + color: '#12B4EC', decimals: { Ethereum: 18, default: 8, }, foreignAssets: { - mumbai: { - address: '0x87374d35C5F1bD78c2b1da383F460e154e7D3E5e', - decimals: 18, - }, bsc: { - address: '0x45082C9Fc6BBCa72288F47Fad21dE0BECC75759E', + address: '0x9aB305B792DBdb8253bEE909E7006611Cb45175b', decimals: 18, }, fuji: { - address: '0x3989C9c4bdd30400E6Aa90990683EAd6a1638A16', - decimals: 18, - }, - fantom: { - address: '0xE4FE5DF2084f9D81595e4fcba2399020FBE7b233', + address: '0x094cB577C21Ab1360178beE74B9591fa12216dAD', decimals: 18, }, alfajores: { - address: '0xeBB3fF6E5d61d3793Fdb60f7942BA78E636019f6', + address: '0xE6F8710cA14CFe7F5aAAD3A799C3d1D92dCba938', decimals: 18, }, moonbasealpha: { - address: '0xc31EC0108D8e886be58808B4C2C53f8365f1885D', + address: '0x566c1cebc6A4AFa1C122E039C4BEBe77043148Ee', decimals: 18, }, solana: { - address: '3WK3mEDNPrNuQReBvM28NcsqrExMnPxD9pPJmgrUeKKH', + address: 'DMw2tLaq1bVoAEKtkoUtieSk9bfCPUvubYLatTMsSVop', decimals: 8, }, - basegoerli: { - address: '0x31B2BAEE47Dc5Fc06baEC1BF73C124031b44fB97', - decimals: 18, - }, sui: { address: - '0xe6fc78aa2b52b785bdcb67901cd85793a0b593248f315cb755974d23d0fcb837::coin::COIN', + '0x14e756ff65e0ac810a5f69ca5276ef5b899a6df3c4717de1f85559d8b5ae6ea6::coin::COIN', decimals: 8, }, - wormchain: { + sei: { address: - 'wormhole1uuwad4khwek2h05gmkktzmh8l4t0ep54yydlsqg0l4y2uh3tqfyq3an9k6', + 'sei1cr3j7rxq0dhq04ksftmj8n2w096w9g7ck8fngkvk2lrmy3qwz56q9thu9u', decimals: 8, }, - cosmoshub: { + aptos: { + address: + '0x533c6ade00d15d1e014c41e29e34853e87df92c4e01a6a3f41318dbd098048d6::coin::T', + decimals: 8, + }, + wormchain: { address: - 'ibc/5F21E975410DA22AF565B1772DC45AD0BD5F6DA004981EBE291763F3D2C72A96', + 'wormhole1808lz8dp2c39vhm9gnemt7zzj95nvrmjepxp7v3w4skzrlyzcmnsxkduxf', decimals: 8, }, osmosis: { address: - 'ibc/2864B3418775DDB90EE1410EFF822FDA94E9F0FF77FC8771644761C79EDFE7A3', + 'ibc/145C6B688F70B0C2F6D87546A5974A75CE75B3A2940275B750E65797B2996157', + decimals: 8, + }, + cosmoshub: { + address: + 'ibc/919D8F138B7E71BB067C7301AB5C2D48415E8C3A2D9187861245CEC668F88E3C', decimals: 8, }, }, }, - MATIC: { - key: 'MATIC', - symbol: 'MATIC', - nativeChain: 'mumbai', - icon: Icon.POLYGON, - coinGeckoId: 'matic-network', - color: '#8247E5', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WMATIC', - }, - WMATIC: { - key: 'WMATIC', - symbol: 'WMATIC', - nativeChain: 'mumbai', - icon: Icon.POLYGON, + CELO: { + key: 'CELO', + symbol: 'CELO', + nativeChain: 'alfajores', + icon: Icon.CELO, tokenId: { - chain: 'mumbai', - address: '0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889', + chain: 'alfajores', + address: '0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9', }, - coinGeckoId: 'matic-network', - color: '#8247E5', + coinGeckoId: 'celo', + color: '#35D07E', decimals: { Ethereum: 18, default: 8, }, foreignAssets: { - goerli: { - address: '0x7cd0e8ff09cEB653813bD3d63d0554c1CB4BFdf6', - decimals: 18, - }, bsc: { - address: '0x7FCDA925f0994121752ca14C334297BeC3d0eA9E', + address: '0x1471698cBD9cAB0228F2EEA9303A2b3aA0ABDC2B', decimals: 18, }, fuji: { - address: '0x78554394273957d7e55afC841aeA27Cce469AEd4', + address: '0xC66d9c2b33c347d4A4441975f4688fcD5DD4c441', decimals: 18, }, fantom: { - address: '0x47a4C4c0f96D6CBe5b5C0A46CB0E22d6A17F1430', - decimals: 18, - }, - alfajores: { - address: '0x7a56409988BBF8758b3ba412b9c7E3FE504C8544', + address: '0xB18E73a69c3Aaea39a610372537Cf8482622d199', decimals: 18, }, moonbasealpha: { - address: '0xD2888f015BcB76CE3d27b6024cdEFA16836d0dbb', + address: '0x3406a9b09adf0cb36DC04c1523C4b294C6b79513', decimals: 18, }, solana: { - address: 'ACbmcQxbbhiXWM1GmapUSMmBYKMvnFLfAAXKqdo8xKwo', + address: '84F2QX9278ToDmA98u4A86xSV9hz1ovazr8zwGaX6qjS', decimals: 8, }, sui: { address: - '0xa516bcbf83b29a2944bb53ec9f934ea7d78c3626d3ae411d2fb9dcb977522e67::coin::COIN', + '0x81868174a6b11e1acc337b3414f9912455435d486609fb8d50b34312865085f2::coin::COIN', decimals: 8, }, aptos: { address: - '0x5f229253e2b2d03fb909f565feca49452582bd633a5816e5ce30aa593cb49d8a::coin::T', + '0xecbb0f7e7d049499ca83ca1358344f56557886f6f7adc740d6734cce7bfc9a14::coin::T', decimals: 8, }, - basegoerli: { - address: '0xFFB5d863d5132523d013338845A1Bb01EDd440f4', - decimals: 18, - }, sei: { address: - 'sei1dc94as3vgxn3qkr5h0lnnrep69mtfku6jg4t94gfkunuyzr5g5eqyqvj9p', + 'sei1yw4wv2zqg9xkn67zvq3azye0t8h0x9kgyg3d53jym24gxt49vdyswk5upj', decimals: 8, }, - arbitrumgoerli: { - address: '0x50FD4064cC536a964E2E0Dc7B3fE2313Ab386bEA', - decimals: 18, - }, - optimismgoerli: { - address: '0x427B5a0b0384D7FD3AF81805A166a2d9C1116D7d', - decimals: 18, - }, wormchain: { address: - 'wormhole1vhjnzk9ly03dugffvzfcwgry4dgc8x0sv0nqqtfxj3ajn7rn5ghq6whn2p', + 'wormhole1e8z2wjelypwxw5sey62jvwjyup88w55q3h6m0x8jtwjf6sx5c7ys4mzydk', decimals: 8, }, - cosmoshub: { + osmosis: { address: - 'ibc/37FB599287C6963C413E915FDE83EFA69A3CE8147675DD5A7F974B45F39C8A31', + 'ibc/3A4EA3F8096856C0802F86B218DD74213B4C10224AA44BBD54AEAAA2ABF078BA', decimals: 8, }, - osmosis: { + cosmoshub: { address: - 'ibc/43F15553F8598186394E81E18604B8B4532B2D7E855D9FFE68A2EF6802C18BE4', + 'ibc/009206915358A002C852A2A2CBEDB8446D2D02E519C815087A01F8BDB4DF77BA', decimals: 8, }, }, }, - USDCpolygon: { - key: 'USDCpolygon', - symbol: 'USDC', - nativeChain: 'mumbai', + USDCalfajores: { + key: 'USDCalfajores', + symbol: 'USDC.e', + nativeChain: 'alfajores', icon: Icon.USDC, tokenId: { - chain: 'mumbai', - address: '0x9999f7Fea5938fD3b1E26A12c3f2fb024e194f97', + chain: 'alfajores', + address: '0x72CAaa7e9889E0a63e016748179b43911A3ec9e5', }, coinGeckoId: 'usd-coin', color: '#2774CA', decimals: { default: 6, }, - foreignAssets: {}, }, - BNB: { - key: 'BNB', - symbol: 'BNB', - nativeChain: 'bsc', - icon: Icon.BNB, - coinGeckoId: 'binancecoin', - color: '#F3BA30', + GLMR: { + key: 'GLMR', + symbol: 'GLMR', + nativeChain: 'moonbasealpha', + icon: Icon.GLMR, + coinGeckoId: 'moonbeam', + color: '#e1147b', decimals: { Ethereum: 18, default: 8, }, - wrappedAsset: 'WBNB', + wrappedAsset: 'WGLMR', }, - WBNB: { - key: 'WBNB', - symbol: 'WBNB', - nativeChain: 'bsc', - icon: Icon.BNB, + WGLMR: { + key: 'WGLMR', + symbol: 'WGLMR', + nativeChain: 'moonbasealpha', + icon: Icon.GLMR, tokenId: { - chain: 'bsc', - address: '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd', + chain: 'moonbasealpha', + address: '0xD909178CC99d318e4D46e7E66a972955859670E1', }, - coinGeckoId: 'binancecoin', - color: '#F3BA30', + coinGeckoId: 'moonbeam', + color: '#e1147b', decimals: { Ethereum: 18, default: 8, }, foreignAssets: { - goerli: { - address: '0xB19693FEB013Bab65866dE0a845a9511064230cE', - decimals: 18, - }, - mumbai: { - address: '0x0C63D8ADB69204b2946DcB945a6f16d97C255eE2', + bsc: { + address: '0x5C31B36599ED7f06b09c0ffC7A2F928cE496F046', decimals: 18, }, fuji: { - address: '0x10F1053bF2884b28ee0Bd7a2dDBa237Af3511d29', + address: '0xf080782DF38eD5228D2FC2882d13D56c8f1D6f21', decimals: 18, }, fantom: { - address: '0xfB174b43228950C2055CFc25AE93f2DCe8E2beF0', + address: '0x41E3CFDFC255A4bF3C8D3560Bc8D3D9b5080338e', decimals: 18, }, alfajores: { - address: '0xa8050be9389466c3c524F10F131f244ACbf21A0D', - decimals: 18, - }, - moonbasealpha: { - address: '0x6097E80331B0c6aF4F74D7F2363E70Cb2Fd078A5', + address: '0x132D2172D89cd9CfD480A8887c6bF92360fB460e', decimals: 18, }, solana: { - address: 'BaGfF51MQ3a61papTRDYaNefBgTQ9ywnVne5fCff4bxT', + address: '8987WGkYa5viiZ9DD8sS3PB5XghKmWjkEgmzvwDuoAEc', decimals: 8, }, sui: { address: - '0xddcf8680a8a4b8a527d8c85ec203274991590c2ea898d1c4635b70164d9c584b::coin::COIN', + '0xeffae382de96981f7ddd2d294429924827e8f325d612487a12d6a0b249171002::coin::COIN', decimals: 8, }, - aptos: { + sei: { address: - '0xa5894f5ddb8647e6143102aa336ff07374f7b32e88c1c703aef5b7c9a370bf80::coin::T', + 'sei140m6xagmw0zesejzhsvk46zprgscr7tu94h36rwsutcsxcs4fmds9sevym', decimals: 8, }, - basegoerli: { - address: '0x9DeF11E63C23c71dE3716b81dD2Fdad2B24b8b7F', - decimals: 18, - }, - sei: { + aptos: { address: - 'sei10a7see3f9t2j9l8fdweur3aqy4zgvz583a268hhhln3yzps6l5mqnl4ua6', + '0x338373b6694f71dbeac5ca4a30503bf5f083888d71678aed31255de416be37c0::coin::T', decimals: 8, }, - arbitrumgoerli: { - address: '0xB039aC4Fa8Ed99d30C2f7D791294A9d5FAd698eF', - decimals: 18, - }, wormchain: { address: - 'wormhole1335rlmhujm0gj5e9gh7at9jpqvqckz0mpe4v284ar4lw5mlkryzsnetfsj', + 'wormhole10sfpr8ykh9xn93u8xec4ed3990nmvh86e0vaegkauqhlkxspysyqwavrxx', decimals: 8, }, cosmoshub: { address: - 'ibc/5B0D5974A56332468DD4B2D07C96A7386FCF8FE7303FF41234F90E410EF51937', + 'ibc/1EEDF447A6B046B20C00B1497BED5947219AEEBE0D9A85235C85133A554DF7A4', decimals: 8, }, osmosis: { address: - 'ibc/65A67BA10DE2378B32AC5A822321E370966D3D4E180DEFB4C3C5245B21088DDF', + 'ibc/7DB06BB67428510AFC3967DC90F5632C679D55D8C487A951A0EEC3160AF492A6', decimals: 8, }, }, }, - AVAX: { - key: 'AVAX', - symbol: 'AVAX', - nativeChain: 'fuji', - icon: Icon.AVAX, - coinGeckoId: 'avalanche-2', - color: '#E84141', + SOL: { + key: 'SOL', + symbol: 'SOL', + nativeChain: 'solana', + icon: Icon.SOLANA, + coinGeckoId: 'solana', + color: '#8457EF', decimals: { - Ethereum: 18, + Ethereum: 9, + Solana: 9, default: 8, }, - wrappedAsset: 'WAVAX', + wrappedAsset: 'WSOL', }, - WAVAX: { - key: 'WAVAX', - symbol: 'WAVAX', - nativeChain: 'fuji', - icon: Icon.AVAX, + WSOL: { + key: 'WSOL', + symbol: 'WSOL', + nativeChain: 'solana', tokenId: { - chain: 'fuji', - address: '0xd00ae08403B9bbb9124bB305C09058E32C39A48c', + chain: 'solana', + address: 'So11111111111111111111111111111111111111112', }, - coinGeckoId: 'avalanche-2', - color: '#E84141', + icon: Icon.SOLANA, + coinGeckoId: 'solana', + color: '#8457EF', decimals: { - Ethereum: 18, + Ethereum: 9, + Solana: 9, default: 8, }, foreignAssets: { - goerli: { - address: '0x4C1b727f6df3B075E682C41a25687A69846aaC04', - decimals: 18, - }, - mumbai: { - address: '0x51f3D34651523dD8CC4872ee261A1B0B3f73AceF', - decimals: 18, - }, bsc: { - address: '0x6cE9E2c8b59bbcf65dA375D3d8AB503c8524caf7', - decimals: 18, - }, - fantom: { - address: '0x0f545Be981C37fB15ab7c65404648761e99016e4', - decimals: 18, - }, - alfajores: { - address: '0x502c8C83008D9Dd812a7C5fB886C063060C73Dbf', - decimals: 18, - }, - moonbasealpha: { - address: '0x2E8afeCC19842229358f3650cc3F091908dcbaB4', - decimals: 18, - }, - solana: { - address: '3Ftc5hTz9sG4huk79onufGiebJNDMZNL8HYgdMJ9E7JR', - decimals: 8, - }, - sui: { - address: - '0xa600741c469fb57ed01497ddf101e798fa79a9c529bd176675c5c4d970811f80::coin::COIN', - decimals: 8, - }, - aptos: { - address: - '0xbe8f4301c0b54e870902b9a23eeb95ce74ac190531782aa3262337ceb145401a::coin::T', - decimals: 8, - }, - basegoerli: { - address: '0x410B0EE532EFfB18fa4d90cc095B1CD58aC43d5a', - decimals: 18, - }, - sei: { - address: - 'sei1mgpq67pj7p2acy5x7r5lz7fulxmuxr3uh5f0szyvqgvru3glufzsxk8tnx', - decimals: 8, - }, - arbitrumgoerli: { - address: '0x92b0C4D27a05921Ded4BB117755990F567aEe049', - decimals: 18, - }, - wormchain: { - address: - 'wormhole1tqwwyth34550lg2437m05mjnjp8w7h5ka7m70jtzpxn4uh2ktsmq8dv649', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/BAEAC83736444C09656FBE666FB625974FCCDEE566EB700EBFD2642C5F6CF13A', - decimals: 8, - }, - osmosis: { - address: - 'ibc/99EAD53D49EC7CC4E2E2EB26C22CF81C16727DF0C4BF7F7ACBF0D22D910DB5DE', - decimals: 8, - }, - }, - }, - USDCavax: { - key: 'USDCavax', - symbol: 'USDC', - nativeChain: 'fuji', - icon: Icon.USDC, - tokenId: { - chain: 'fuji', - address: '0x5425890298aed601595a70AB815c96711a31Bc65', - }, - coinGeckoId: 'usd-coin', - color: '#2774CA', - decimals: { - default: 6, - }, - foreignAssets: { - goerli: { - address: '0xF6699D3f725C4b64Cc6010F2DF77B4B05C76Cd5C', - decimals: 6, - }, - mumbai: { - address: '0xcc048C353Fdc2f5c378B7BCab9B240Ca2b619f1c', - decimals: 6, + address: '0x30f19eBba919954FDc020B8A20aEF13ab5e02Af0', + decimals: 9, }, - bsc: { - address: '0x1cfeCf72bcBE1E429A21A5B11E708C7c397AaC54', - decimals: 6, + fuji: { + address: '0xb10563644a6AB8948ee6d7f5b0a1fb15AaEa1E03', + decimals: 9, }, fantom: { - address: '0x6BC4E8D8c1d54656D1DeBCa96efc53aFd1408aD2', - decimals: 6, + address: '0xED1a08Fc69A7008d225890A96aaE258c465CC7ad', + decimals: 9, }, alfajores: { - address: '0xDDB349c976cA2C873644F21f594767Eb5390C831', - decimals: 6, - }, - moonbasealpha: { - address: '0x6533CE14804D113b1F494dC56c5D60A43cb5C3b5', - decimals: 6, - }, - solana: { - address: 'GQtMXZxnuacCFTXVeTvyHi6P9F6chbtzhVc8JgD8hv7c', - decimals: 6, + address: '0x05EEF2AE1A7A938D78598F7d9e8b97A9bED0c9eC', + decimals: 9, }, sui: { address: - '0x2aa8c885d04e676c4e87b7d0f94d4f3b243b1b5d93239d1cc41d5528ce1714c1::coin::COIN', - decimals: 6, - }, - aptos: { - address: - '0x02ef7697bdb33361ca39d228671203afc0dea3202e792d79d2072b761d87c834::coin::T', - decimals: 6, - }, - basegoerli: { - address: '0x4C5208246676486064c501E1DAF2dD21596Bc5f5', - decimals: 6, - }, - sei: { - address: - 'sei1uyce5s6cc8hveg0maq2lg7wm6v6fvwqmznypj559nzf9wr9tmw3qnd3ce7', - decimals: 6, - }, - arbitrumgoerli: { - address: '0xb39697B8BA5df91A169690DfEf88B911436619F2', - decimals: 6, - }, - wormchain: { - address: - 'wormhole1qum2tr7hh4y7ruzew68c64myjec0dq2s2njf6waja5t0w879lutqv2exs9', - decimals: 6, - }, - cosmoshub: { - address: - 'ibc/F09E98FA8682FF39130F171E9D89A948B0C3A452F2A31F22B6CC54A3AAE1CD4A', - decimals: 6, - }, - osmosis: { - address: - 'ibc/EC9FA5074F34F0644A025BB0263FDAE8F364C5E08523F6464465EF1010FF5A3A', - decimals: 6, - }, - }, - }, - FTM: { - key: 'FTM', - symbol: 'FTM', - nativeChain: 'fantom', - icon: Icon.FANTOM, - coinGeckoId: 'fantom', - color: '#12B4EC', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WFTM', - }, - WFTM: { - key: 'WFTM', - symbol: 'WFTM', - nativeChain: 'fantom', - icon: Icon.FANTOM, - tokenId: { - chain: 'fantom', - address: '0xf1277d1Ed8AD466beddF92ef448A132661956621', - }, - coinGeckoId: 'fantom', - color: '#12B4EC', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0x0d7A9Cdbb7C21E64825cF81750A5081a32aFb5d4', - decimals: 18, - }, - mumbai: { - address: '0x84aa9100a36D6c3514605F62342abF3cE77D5b97', - decimals: 18, - }, - bsc: { - address: '0x9aB305B792DBdb8253bEE909E7006611Cb45175b', - decimals: 18, - }, - fuji: { - address: '0x094cB577C21Ab1360178beE74B9591fa12216dAD', - decimals: 18, - }, - alfajores: { - address: '0xE6F8710cA14CFe7F5aAAD3A799C3d1D92dCba938', - decimals: 18, - }, - moonbasealpha: { - address: '0x566c1cebc6A4AFa1C122E039C4BEBe77043148Ee', - decimals: 18, - }, - solana: { - address: 'DMw2tLaq1bVoAEKtkoUtieSk9bfCPUvubYLatTMsSVop', - decimals: 8, - }, - sui: { - address: - '0x14e756ff65e0ac810a5f69ca5276ef5b899a6df3c4717de1f85559d8b5ae6ea6::coin::COIN', - decimals: 8, - }, - basegoerli: { - address: '0xB4808E58713112AbAbB8167C7187F8988df38bbD', - decimals: 18, - }, - sei: { - address: - 'sei1cr3j7rxq0dhq04ksftmj8n2w096w9g7ck8fngkvk2lrmy3qwz56q9thu9u', - decimals: 8, - }, - arbitrumgoerli: { - address: '0xa507f7566B8aDE000E886166B95964677ef3b3Ef', - decimals: 18, - }, - aptos: { - address: - '0x533c6ade00d15d1e014c41e29e34853e87df92c4e01a6a3f41318dbd098048d6::coin::T', - decimals: 8, - }, - wormchain: { - address: - 'wormhole1808lz8dp2c39vhm9gnemt7zzj95nvrmjepxp7v3w4skzrlyzcmnsxkduxf', - decimals: 8, - }, - osmosis: { - address: - 'ibc/145C6B688F70B0C2F6D87546A5974A75CE75B3A2940275B750E65797B2996157', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/919D8F138B7E71BB067C7301AB5C2D48415E8C3A2D9187861245CEC668F88E3C', - decimals: 8, - }, - optimismgoerli: { - address: '0x81BA80f5820273AA965086e710042d737993f12c', - decimals: 18, - }, - }, - }, - CELO: { - key: 'CELO', - symbol: 'CELO', - nativeChain: 'alfajores', - icon: Icon.CELO, - tokenId: { - chain: 'alfajores', - address: '0xF194afDf50B03e69Bd7D057c1Aa9e10c9954E4C9', - }, - coinGeckoId: 'celo', - color: '#35D07E', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0xe092525a787CD56B901279b5864a224c22B95B72', - decimals: 18, - }, - mumbai: { - address: '0xAd027790A64331A11bd1b651739450cC9Dc0098F', - decimals: 18, - }, - bsc: { - address: '0x1471698cBD9cAB0228F2EEA9303A2b3aA0ABDC2B', - decimals: 18, - }, - fuji: { - address: '0xC66d9c2b33c347d4A4441975f4688fcD5DD4c441', - decimals: 18, - }, - fantom: { - address: '0xB18E73a69c3Aaea39a610372537Cf8482622d199', - decimals: 18, - }, - moonbasealpha: { - address: '0x3406a9b09adf0cb36DC04c1523C4b294C6b79513', - decimals: 18, - }, - solana: { - address: '84F2QX9278ToDmA98u4A86xSV9hz1ovazr8zwGaX6qjS', - decimals: 8, - }, - sui: { - address: - '0x81868174a6b11e1acc337b3414f9912455435d486609fb8d50b34312865085f2::coin::COIN', - decimals: 8, - }, - aptos: { - address: - '0xecbb0f7e7d049499ca83ca1358344f56557886f6f7adc740d6734cce7bfc9a14::coin::T', - decimals: 8, - }, - basegoerli: { - address: '0x72C56041ea5fe8bDE99b2A123fb5964cDE8C7FE9', - decimals: 18, - }, - sei: { - address: - 'sei1yw4wv2zqg9xkn67zvq3azye0t8h0x9kgyg3d53jym24gxt49vdyswk5upj', - decimals: 8, - }, - arbitrumgoerli: { - address: '0x9592eE6eD1D9E611b7aa6F20CCbD7Ba571Be8bdd', - decimals: 18, - }, - wormchain: { - address: - 'wormhole1e8z2wjelypwxw5sey62jvwjyup88w55q3h6m0x8jtwjf6sx5c7ys4mzydk', - decimals: 8, - }, - osmosis: { - address: - 'ibc/3A4EA3F8096856C0802F86B218DD74213B4C10224AA44BBD54AEAAA2ABF078BA', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/009206915358A002C852A2A2CBEDB8446D2D02E519C815087A01F8BDB4DF77BA', - decimals: 8, - }, - }, - }, - USDCalfajores: { - key: 'USDCalfajores', - symbol: 'USDC.e', - nativeChain: 'alfajores', - icon: Icon.USDC, - tokenId: { - chain: 'alfajores', - address: '0x72CAaa7e9889E0a63e016748179b43911A3ec9e5', - }, - coinGeckoId: 'usd-coin', - color: '#2774CA', - decimals: { - default: 6, - }, - }, - GLMR: { - key: 'GLMR', - symbol: 'GLMR', - nativeChain: 'moonbasealpha', - icon: Icon.GLMR, - coinGeckoId: 'moonbeam', - color: '#e1147b', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WGLMR', - }, - WGLMR: { - key: 'WGLMR', - symbol: 'WGLMR', - nativeChain: 'moonbasealpha', - icon: Icon.GLMR, - tokenId: { - chain: 'moonbasealpha', - address: '0xD909178CC99d318e4D46e7E66a972955859670E1', - }, - coinGeckoId: 'moonbeam', - color: '#e1147b', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0x0dc83BB61008A5E1194fe50fA9E474713C1AEcD7', - decimals: 18, - }, - mumbai: { - address: '0x693b9AC2199d989bDA8C9C5b5d7A3680B4f40dAa', - decimals: 18, - }, - bsc: { - address: '0x5C31B36599ED7f06b09c0ffC7A2F928cE496F046', - decimals: 18, - }, - fuji: { - address: '0xf080782DF38eD5228D2FC2882d13D56c8f1D6f21', - decimals: 18, - }, - fantom: { - address: '0x41E3CFDFC255A4bF3C8D3560Bc8D3D9b5080338e', - decimals: 18, - }, - alfajores: { - address: '0x132D2172D89cd9CfD480A8887c6bF92360fB460e', - decimals: 18, - }, - solana: { - address: '8987WGkYa5viiZ9DD8sS3PB5XghKmWjkEgmzvwDuoAEc', - decimals: 8, - }, - sui: { - address: - '0xeffae382de96981f7ddd2d294429924827e8f325d612487a12d6a0b249171002::coin::COIN', - decimals: 8, - }, - basegoerli: { - address: '0xCEc03b5710a464F4354AF35ebD0310238F656DFf', - decimals: 18, - }, - sei: { - address: - 'sei140m6xagmw0zesejzhsvk46zprgscr7tu94h36rwsutcsxcs4fmds9sevym', - decimals: 8, - }, - optimismgoerli: { - address: '0x99436d62259532E0407A7aE78A3b48D119B13903', - decimals: 18, - }, - aptos: { - address: - '0x338373b6694f71dbeac5ca4a30503bf5f083888d71678aed31255de416be37c0::coin::T', - decimals: 8, - }, - wormchain: { - address: - 'wormhole10sfpr8ykh9xn93u8xec4ed3990nmvh86e0vaegkauqhlkxspysyqwavrxx', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/1EEDF447A6B046B20C00B1497BED5947219AEEBE0D9A85235C85133A554DF7A4', - decimals: 8, - }, - osmosis: { - address: - 'ibc/7DB06BB67428510AFC3967DC90F5632C679D55D8C487A951A0EEC3160AF492A6', - decimals: 8, - }, - }, - }, - SOL: { - key: 'SOL', - symbol: 'SOL', - nativeChain: 'solana', - icon: Icon.SOLANA, - coinGeckoId: 'solana', - color: '#8457EF', - decimals: { - Ethereum: 9, - Solana: 9, - default: 8, - }, - wrappedAsset: 'WSOL', - }, - WSOL: { - key: 'WSOL', - symbol: 'WSOL', - nativeChain: 'solana', - tokenId: { - chain: 'solana', - address: 'So11111111111111111111111111111111111111112', - }, - icon: Icon.SOLANA, - coinGeckoId: 'solana', - color: '#8457EF', - decimals: { - Ethereum: 9, - Solana: 9, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0x494701CE895389d917a938f0ea202D4eB9684Eab', - decimals: 9, - }, - mumbai: { - address: '0x0284B4994456Fae4cb56E4d33228d51B674EAD1b', - decimals: 9, - }, - bsc: { - address: '0x30f19eBba919954FDc020B8A20aEF13ab5e02Af0', - decimals: 9, - }, - fuji: { - address: '0xb10563644a6AB8948ee6d7f5b0a1fb15AaEa1E03', - decimals: 9, - }, - fantom: { - address: '0xED1a08Fc69A7008d225890A96aaE258c465CC7ad', - decimals: 9, - }, - alfajores: { - address: '0x05EEF2AE1A7A938D78598F7d9e8b97A9bED0c9eC', - decimals: 9, - }, - sui: { - address: - '0xbc03aaab4c11eb84df8bf39fdc714fa5d5b65b16eb7d155e22c74a68c8d4e17f::coin::COIN', - decimals: 8, - }, - aptos: { - address: - '0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T', - decimals: 8, - }, - basegoerli: { - address: '0x6Fb1dE2372e48fe66c84cf37cc2fb54EaEe62988', - decimals: 9, - }, - sei: { - address: - 'sei1at3xuugacwgu3ppx7fxzmtr3q6m3ztjuean9r2mwcnqupw28yezs7unxgz', - decimals: 8, - }, - arbitrumgoerli: { - address: '0xF8cbdc4E54281b801f182039c250Ad6d13818250', - decimals: 9, - }, - optimismgoerli: { - address: '0x06EcAF6638070Ccf3b3dEA421b3becAA57f3e559', - decimals: 9, - }, - wormchain: { - address: - 'wormhole1gryz69gzl6mz2m66a4twg922jtlc47nlx73sxv88lvq86du5zvyqz3mt23', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/D3EA463A51E31B2B30BED1978575CAC145DBAB354B8A0EA5D4CFB12D737AF790', - decimals: 8, - }, - osmosis: { - address: - 'ibc/B5D53105A7AA2BEC4DA4B3304228F3856219AE7CF84A9023043C481629E3E319', - decimals: 8, - }, - }, - }, - USDCsol: { - key: 'USDCsol', - symbol: 'USDC', - nativeChain: 'solana', - tokenId: { - chain: 'solana', - address: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU', - }, - icon: Icon.USDC, - coinGeckoId: 'usd-coin', - color: '#2774CA', - decimals: { - default: 6, - }, - foreignAssets: { - bsc: { - address: '0x51a3cc54eA30Da607974C5D07B8502599801AC08', - decimals: 6, - }, - wormchain: { - address: - 'wormhole1ced9v4plkf25q8c6k9gz0guq6l4xyjujpjlvxfg8lpaqywkmamashswq7p', - decimals: 6, - }, - cosmoshub: { - address: - 'ibc/26D8D6C63C8D37A5127591DDA905E04CC69CBD3A64F9DA3B1DA3FB0B6A7D9FA5', - decimals: 6, - }, - osmosis: { - address: - 'ibc/35A0467DE5744662078DE8B36CBBE0CF0EAA022565A3E6630CB375DDEBB96E05', - decimals: 6, - }, - }, - }, - SUI: { - key: 'SUI', - symbol: 'SUI', - nativeChain: 'sui', - tokenId: { - chain: 'sui', - address: '0x2::sui::SUI', - }, - icon: Icon.SUI, - coinGeckoId: 'sui', - color: '#8457EF', - decimals: { - Ethereum: 9, - Sui: 9, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0x70F7360C49D227ccBbb98fB7B69B7CDB651195bb', - decimals: 9, - }, - mumbai: { - address: '0x3dadA6f29f80A0427C4989E17a5a2ada17441841', - decimals: 9, - }, - bsc: { - address: '0x5A73D76e09Af2E428EC64aE10F91B78AC990B298', - decimals: 9, - }, - fuji: { - address: '0xfc5128F8556a6F059466E67740e6cC31EE5C2C47', - decimals: 9, - }, - fantom: { - address: '0xd882AB49372eC093E8697B5153f54ab5e7738e3b', - decimals: 9, - }, - alfajores: { - address: '0xa40d9E69ca9867C4bFbeC11Ce79C939991e9bf26', - decimals: 9, - }, - solana: { - address: 'BJZ72CjPQojVoH68mzrd4VQ4nr6KuhbAGnhZEZCujKxY', - decimals: 8, - }, - aptos: { - address: - '0x7b22d0e02f653d4fd1caddcfa4719a2b329da56eb81d8f27db703f02466c26a5::coin::T', - decimals: 8, - }, - basegoerli: { - address: '0xEe0fC8BECD593B41AACBd93936fDAbc2A444370A', - decimals: 9, - }, - sei: { - address: - 'sei1rhpcprr2pffe6ydf078a0qeslhnlywxh2t3wjax4489z0m29cj9swj5khc', - decimals: 8, - }, - arbitrumgoerli: { - address: '0xe64e2139fdf6Ee7e3795FE51955e21bA3d9eB9F7', - decimals: 9, - }, - moonbasealpha: { - address: '0x2ed4B5B1071A3C676664E9085C0e3826542C1b27', - decimals: 9, - }, - wormchain: { - address: - 'wormhole1yf4p93xu68j5fseupm4laj4k6f60gy7ynx6r5vvyr9c0hl3uy8vqpqd6h0', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/129EC6B8A41BE07F94DD267F552F4AE1D5EAEBB51634A1468556AF06C10C2692', - decimals: 8, - }, - osmosis: { - address: - 'ibc/30778BA41ADF2D8A70B90DB53C2E0251731A40276EF6737215BB1A6ED9E90078', - decimals: 8, - }, - }, - }, - APT: { - key: 'APT', - symbol: 'APT', - nativeChain: 'aptos', - tokenId: { - chain: 'aptos', - address: '0x1::aptos_coin::AptosCoin', - }, - icon: Icon.APT, - coinGeckoId: 'aptos', - color: '#8457EF', - decimals: { - Ethereum: 8, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0xd7A89a8DD20Cb4F252c7FB96B6421b37d82cE506', - decimals: 8, - }, - mumbai: { - address: '0x226B436043B537BD158e84fA199E2Aa36bf364f8', - decimals: 8, - }, - bsc: { - address: '0x4A7Bd5E135f421057F97BbA8BCeeE5c18334f454', - decimals: 8, - }, - fuji: { - address: '0x996a3f12C1FcD7339Ea8801f629201e4d42EAD04', - decimals: 8, - }, - fantom: { - address: '0xAb2297E8994149BA91737944E40891881aF762a4', - decimals: 8, - }, - alfajores: { - address: '0xAC0a2fF7DD597de863878a3372142b07B614C125', - decimals: 8, - }, - moonbasealpha: { - address: '0xCaa2A1d3BbbA0D1466571e83b4E2CbE04252593D', - decimals: 8, - }, - solana: { - address: '7EvFD3JKCJVdtkAYdaSVKJsrPEJCzy2neJha7TREGrCa', - decimals: 8, - }, - basegoerli: { - address: '0xd934A15FfA3945DD0Ba2cb7b4174024261A14874', - decimals: 8, - }, - sei: { - address: - 'sei1em74y5sts4h8y5zuhfdn4w5g8zs285qld3kczpk6rh32jpvjyqqsvv0pdt', - decimals: 8, - }, - arbitrumgoerli: { - address: '0xa81C3BEf2d6f10213b860458DC119666C0ba13bf', - decimals: 8, - }, - wormchain: { - address: - 'wormhole1u8rft0gee23fa6a0t4t88ualrza5lj8ses4aur0l66c7efpvjezqchv34j', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/0CCA5EB15BC2FE474E71DBC9698302CDE260B6F6548F91C30002F7CBF228197B', - decimals: 8, - }, - osmosis: { - address: - 'ibc/7C495BD95757ED662A897C139F1C9F18275A86EE7203A0B073E2DB12B1E19D63', - decimals: 8, - }, - sui: { - address: - '0x812d6feb8b84e55d47a0bfcae9fb6a4e7e09be5ec86ce0a729e0f67d5f59f477::coin::COIN', - decimals: 8, - }, - }, - }, - ETHarbitrum: { - key: 'ETHarbitrum', - symbol: 'ETH', - displayName: 'ETH (Arbitrum)', - nativeChain: 'arbitrumgoerli', - icon: Icon.ETH, - coinGeckoId: 'ethereum', - color: '#5794EC', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WETHarbitrum', - }, - WETHarbitrum: { - key: 'WETHarbitrum', - symbol: 'WETH', - displayName: 'WETH (Arbitrum)', - nativeChain: 'arbitrumgoerli', - icon: Icon.ETH, - tokenId: { - chain: 'arbitrumgoerli', - address: '0xEe01c0CD76354C383B8c7B4e65EA88D00B06f36f', - }, - coinGeckoId: 'ethereum', - color: '#5794EC', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - bsc: { - address: '0x60845E2503Fcd945b3A6f0bC077a31CC913E654D', - decimals: 18, - }, - fuji: { - address: '0x36Bd1562F874941eE62Ebb2b3A45B4A88A9df90e', - decimals: 18, - }, - fantom: { - address: '0x456e08952f9091B6c268dC0cECad53d141152C59', - decimals: 18, - }, - moonbasealpha: { - address: '0x15025b956969DD8F1d0CD69959Ad97128F8f6D69', - decimals: 18, - }, - basegoerli: { - address: '0x8eD43aBdc4f836aa60933177B31AC358ea09f27E', - decimals: 18, - }, - sei: { - address: - 'sei1pf5j3dgngm8yj2xkwmvmvt87g4vyc0szpjz92q8ly9erh23ytn4s983htv', - decimals: 8, - }, - wormchain: { - address: - 'wormhole186k0cp83c3wyvapgh8fxf66ededemzrfujvjfsx0xw3vr0u9g8sq2y30vx', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/AB4046AF5B6F146C006DE4DECAD929D24F762A701E09EC8B29000EC63A6E649B', - decimals: 8, - }, - osmosis: { - address: - 'ibc/221A4AADF7972F3BB8F48A6CA984FF0AE65B5D973FF1A695B9642AD702F51789', - decimals: 8, - }, - }, - }, - USDCarbitrum: { - key: 'USDCarbitrum', - symbol: 'USDC', - nativeChain: 'arbitrumgoerli', - icon: Icon.USDC, - tokenId: { - chain: 'arbitrumgoerli', - address: '0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63', - }, - coinGeckoId: 'usd-coin', - color: '#2774CA', - decimals: { - default: 6, - }, - foreignAssets: { - goerli: { - address: '0xd962F26D93c4eF609Ba00Ed6101326A1490B9489', - decimals: 6, - }, - alfajores: { - address: '0x0C4AbF95Ff3d82d1F02f55e65050eA5bA062606E', - decimals: 6, - }, - wormchain: { - address: - 'wormhole1s3pk90ccfl6ueehnj8s9pdgyjjlspmr3m5rv46arjh5v4g08dd0qrchjrk', - decimals: 6, - }, - cosmoshub: { - address: - 'ibc/6D1B6A7A9EF692A279A6B5994C98C0D598D003D9203BE8309F14B6E57A58506E', - decimals: 6, - }, - aptos: { - address: - '0x3f0fdd44d96dae888d6c576218cf655458316a27c7bdc46537f61e531b10d3df::coin::T', - decimals: 6, - }, - osmosis: { - address: - 'ibc/06ED2700071B5A9C582F51A556537DA94E69EF547E7E6CCD8BFA3D95C818A525', - decimals: 6, - }, - bsc: { - address: '0xe3aA397cb6d93Cce4fAd9Cc9E796CCa5E50FB5ED', - decimals: 6, - }, - }, - }, - ETHoptimism: { - key: 'ETHoptimism', - symbol: 'ETH', - displayName: 'ETH (Optimism)', - nativeChain: 'optimismgoerli', - icon: Icon.ETH, - coinGeckoId: 'ethereum', - color: '#D53424', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WETHoptimism', - }, - WETHoptimism: { - key: 'WETHoptimism', - symbol: 'WETH', - displayName: 'WETH (Optimism)', - nativeChain: 'optimismgoerli', - icon: Icon.ETH, - tokenId: { - chain: 'optimismgoerli', - address: '0x4200000000000000000000000000000000000006', - }, - coinGeckoId: 'ethereum', - color: '#D53424', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - mumbai: { - address: '0xC77d781f38Cf52F8Ea0b4c0F22312bB9A34911b5', - decimals: 18, - }, - fuji: { - address: '0x301587BF484756441de43E522027e3751871237B', - decimals: 18, - }, - alfajores: { - address: '0x28E768a51D19dcB753a24B79D1e89c92fee094Ba', - decimals: 18, - }, - basegoerli: { - address: '0x5c443C05C72F0660502d88642c807020cc9b71A2', - decimals: 18, - }, - arbitrumgoerli: { - address: '0xFd903eA23Bf65f26FdAf2eeb589cf007b108882E', - decimals: 18, - }, - wormchain: { - address: - 'wormhole12eu6c7f67l8gdl2lt0hz0dgdh24dhune6wjgy5t0es3tpfzhc3yspwnpfy', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/A0298483510D803A045AA7F49CCBD0F9D01010FE0B1A346EBDFFF4BA820C3D21', - decimals: 8, - }, - osmosis: { - address: - 'ibc/80B3FECB24A4CE94537444E5BF937AC4C08A39BF90D59620D278FA185BD2B148', - decimals: 8, - }, - }, - }, - USDCoptimism: { - key: 'USDCoptimism', - symbol: 'USDC', - nativeChain: 'optimismgoerli', - icon: Icon.USDC, - tokenId: { - chain: 'optimismgoerli', - address: '0xe05606174bac4A6364B31bd0eCA4bf4dD368f8C6', - }, - coinGeckoId: 'usd-coin', - color: '#2774CA', - decimals: { - default: 6, - }, - foreignAssets: { - moonbasealpha: { - address: '0xf98E630a3DD4F21Cab7a37Bb01209cb62959169D', - decimals: 6, - }, - fantom: { - address: '0x685B29e17440c42758Ab3F80FD3603EF01bebe9A', - decimals: 6, - }, - wormchain: { - address: - 'wormhole1u5z7097gm57zvun9wqsx6jxej2gpdjhg9l9xfe58rhpm29rtjmfqfnl4yv', - decimals: 6, - }, - cosmoshub: { - address: - 'ibc/CE3F2FE630DA6A1187F085CDC8D59BA8B20DA48F4866F2D71C5AB7A1D5859933', - decimals: 6, - }, - osmosis: { - address: - 'ibc/0A98A3947189D7C368170C76C3EF49486DDBE095F34B72A3C7F92AEBE1013A1D', - decimals: 6, - }, - aptos: { - address: - '0xcff1d9820851201436ad225dcc4374a2d15f52a74109283eb9881be799677e92::coin::T', - decimals: 6, - }, - sui: { - address: - '0xbbc39df58a11072ceeac1f685393ca912d1a1bfd6e772053ec5a544f36124da::coin::COIN', - decimals: 6, - }, - }, - }, - ETHbase: { - key: 'ETHbase', - symbol: 'ETH', - displayName: 'ETH (Base)', - nativeChain: 'basegoerli', - icon: Icon.ETH, - coinGeckoId: 'ethereum', - color: '#62688F', - decimals: { - Ethereum: 18, - default: 8, - }, - wrappedAsset: 'WETHbase', - }, - WETHbase: { - key: 'WETHbase', - symbol: 'WETH', - displayName: 'WETH (Base)', - nativeChain: 'basegoerli', - icon: Icon.ETH, - tokenId: { - chain: 'basegoerli', - address: '0x4200000000000000000000000000000000000006', - }, - coinGeckoId: 'ethereum', - color: '#62688F', - decimals: { - Ethereum: 18, - default: 8, - }, - foreignAssets: { - goerli: { - address: '0x76e39239e40857030D6f4D8545EFbd71F904d344', - decimals: 18, - }, - mumbai: { - address: '0x68C4365d5229A44D9A59058B65500365492b5307', - decimals: 18, - }, - bsc: { - address: '0x63108fC941F3cCE0B484De19746B5Af949EAF6eE', - decimals: 18, - }, - fuji: { - address: '0xc07c754ef7473d315D973F7D9F7858C2eCe0a0a6', - decimals: 18, - }, - fantom: { - address: '0x01950A33DfFa63E6Bc23b5dB440505581A4cc0e7', - decimals: 18, - }, - solana: { - address: 'EKZqcBZ3Y7YTDinpecA7SxRp9B4s1m99VHJ9jpvyTwzW', + '0xbc03aaab4c11eb84df8bf39fdc714fa5d5b65b16eb7d155e22c74a68c8d4e17f::coin::COIN', decimals: 8, }, aptos: { address: - '0x5b5f14781164cf77185a7b6acd8e4f3cbb7e7cfb1cd5760d2b8af81075fc153d::coin::T', + '0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T', decimals: 8, }, - arbitrumgoerli: { - address: '0xbC4CB3CD7186fD457C072298C48d0eDf7213CAEa', - decimals: 18, - }, sei: { address: - 'sei1kdqylzcv86t7slg8m30mlfgna9xsrusghdgnavvurkv0rku7jvqqta7lka', - decimals: 8, - }, - sui: { - address: - '0x7b442b988864149dedfb9b6a75a88c7c33b9ddd3d15a87bf25104e1fcdd680ab::coin::COIN', + 'sei1at3xuugacwgu3ppx7fxzmtr3q6m3ztjuean9r2mwcnqupw28yezs7unxgz', decimals: 8, }, wormchain: { address: - 'wormhole10p89p4zh00dwdg8h52sysrqm0l2j47jj3kmg93pnz2a039ucw7esgl5vl9', + 'wormhole1gryz69gzl6mz2m66a4twg922jtlc47nlx73sxv88lvq86du5zvyqz3mt23', decimals: 8, }, cosmoshub: { address: - 'ibc/97035986A4BD0AF555713355A02EA31A4526616B6543E019E0D750007FABE06C', + 'ibc/D3EA463A51E31B2B30BED1978575CAC145DBAB354B8A0EA5D4CFB12D737AF790', decimals: 8, }, osmosis: { address: - 'ibc/A45069EA82C933945973E66E4222EEE4624498D4483508FE9BEBF9D519F2132F', + 'ibc/B5D53105A7AA2BEC4DA4B3304228F3856219AE7CF84A9023043C481629E3E319', decimals: 8, }, - optimismgoerli: { - address: '0x04b559971c90Dfb12D9795E95883e55f2fcf34Ed', - decimals: 18, - }, }, }, - USDCbase: { - key: 'USDCbase', + USDCsol: { + key: 'USDCsol', symbol: 'USDC', - nativeChain: 'basegoerli', - icon: Icon.USDC, + nativeChain: 'solana', tokenId: { - chain: 'basegoerli', - address: '0xF175520C52418dfE19C8098071a252da48Cd1C19', + chain: 'solana', + address: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU', }, + icon: Icon.USDC, coinGeckoId: 'usd-coin', color: '#2774CA', decimals: { default: 6, }, foreignAssets: { - moonbasealpha: { - address: '0x7480641F5B00b4Fc39d6AaeC4Cd851EdEA7f31CF', - decimals: 6, - }, - goerli: { - address: '0x5aA392243437dDC8b4d86bfC90DF296908740A41', + bsc: { + address: '0x51a3cc54eA30Da607974C5D07B8502599801AC08', decimals: 6, }, wormchain: { address: - 'wormhole1ja4txt6m0jjq0gmjtmv442f8wk0r5f5apaya0z55wwlrpg3p5xaq3qxw7h', + 'wormhole1ced9v4plkf25q8c6k9gz0guq6l4xyjujpjlvxfg8lpaqywkmamashswq7p', decimals: 6, }, cosmoshub: { address: - 'ibc/8560BA5F45C95AE716C05978E364F50C98347ACBEC745840C30F91611FA36698', + 'ibc/26D8D6C63C8D37A5127591DDA905E04CC69CBD3A64F9DA3B1DA3FB0B6A7D9FA5', decimals: 6, }, osmosis: { address: - 'ibc/2E4F8BC7F7AF33752CF7E290CAD4417EE67CD18FFC0D099E6519A440E588E0CE', - decimals: 6, - }, - aptos: { - address: - '0xcfaabb3cb08ad612905dd6b2593d044ce857dfe5360148333b4635fb57d4d13f::coin::T', - decimals: 6, - }, - sui: { - address: - '0x4125940814a0ca87465a1a59092a7344633ad03b48ad7cda36d799d8558012c1::coin::COIN', - decimals: 6, - }, - sei: { - address: - 'sei1lf6ghmrkd7gn5jlj6xw64suycpjy7g4s5q92fc2gef4f8q3znanq95mmgv', + 'ibc/35A0467DE5744662078DE8B36CBBE0CF0EAA022565A3E6630CB375DDEBB96E05', decimals: 6, }, }, }, - OSMO: { - key: 'OSMO', - symbol: 'OSMO', - nativeChain: 'osmosis', - tokenId: { - chain: 'osmosis', - address: 'uosmo', - }, - icon: Icon.OSMO, - coinGeckoId: 'osmosis', - color: '#FFFFFF', - decimals: { - default: 6, - }, - }, - tBTC: { - key: 'tBTC', - symbol: 'tBTC', - nativeChain: 'goerli', + SUI: { + key: 'SUI', + symbol: 'SUI', + nativeChain: 'sui', tokenId: { - chain: 'goerli', - address: '0x679874fBE6D4E7Cc54A59e315FF1eB266686a937', + chain: 'sui', + address: '0x2::sui::SUI', }, - icon: Icon.TBTC, - coinGeckoId: 'tbtc', - color: '#000000', + icon: Icon.SUI, + coinGeckoId: 'sui', + color: '#8457EF', decimals: { + Ethereum: 9, + Sui: 9, default: 8, - Ethereum: 18, }, foreignAssets: { - mumbai: { - address: '0xf6CC0Cc8D54a4b1A63a0E9745663e0c844Ee4D48', - decimals: 18, - }, bsc: { - address: '0xE7176110261ef2FfC885dd568C1093f58F0aEee9', - decimals: 18, + address: '0x5A73D76e09Af2E428EC64aE10F91B78AC990B298', + decimals: 9, }, fuji: { - address: '0x7E1779F65B644E5f98DdC4D2cB0A0106a7E6d9e1', - decimals: 18, + address: '0xfc5128F8556a6F059466E67740e6cC31EE5C2C47', + decimals: 9, }, fantom: { - address: '0x66E080407407620844fE2083c33108BE55E087bc', - decimals: 18, + address: '0xd882AB49372eC093E8697B5153f54ab5e7738e3b', + decimals: 9, }, alfajores: { - address: '0x01a050Fc725F4E99aAD43Eb6f8481f38ee6231aD', - decimals: 18, - }, - moonbasealpha: { - address: '0xf82E21cE03471983Afb9c2E3789Aa13a2d7242E8', - decimals: 18, + address: '0xa40d9E69ca9867C4bFbeC11Ce79C939991e9bf26', + decimals: 9, }, solana: { - address: 'FMYvcyMJJ22whB9m3T5g1oPKwM6jpLnFBXnrY6eXmCrp', + address: 'BJZ72CjPQojVoH68mzrd4VQ4nr6KuhbAGnhZEZCujKxY', decimals: 8, }, - sui: { + aptos: { address: - '0xacf6784120b221a077ab0b84acc0b76930779eb55f157ea2492be4a60b808f6::coin::COIN', + '0x7b22d0e02f653d4fd1caddcfa4719a2b329da56eb81d8f27db703f02466c26a5::coin::T', decimals: 8, }, - aptos: { + sei: { address: - '0x6e2d5d1a6d6d0e0c5db506ce64ead0530847a48b96516abbb08cdebe43fe3036::coin::T', + 'sei1rhpcprr2pffe6ydf078a0qeslhnlywxh2t3wjax4489z0m29cj9swj5khc', decimals: 8, }, - basegoerli: { - address: '0x0219441240d89fAc3fD708d06d8fD3A072C02FB6', - decimals: 18, + moonbasealpha: { + address: '0x2ed4B5B1071A3C676664E9085C0e3826542C1b27', + decimals: 9, }, - arbitrumgoerli: { - address: '0x97B5fE27a82b2B187D9a19C5782d9eB93B82DaC3', - decimals: 18, + wormchain: { + address: + 'wormhole1yf4p93xu68j5fseupm4laj4k6f60gy7ynx6r5vvyr9c0hl3uy8vqpqd6h0', + decimals: 8, }, - optimismgoerli: { - address: '0x5D89a5BcB86F15a2CCAb05e7E3bEE23fDF246a64', - decimals: 18, + cosmoshub: { + address: + 'ibc/129EC6B8A41BE07F94DD267F552F4AE1D5EAEBB51634A1468556AF06C10C2692', + decimals: 8, }, - }, - }, - tBTCpolygon: { - key: 'tBTCpolygon', - symbol: 'tBTC', - nativeChain: 'mumbai', - tokenId: { - chain: 'mumbai', - address: '0xBcD7917282E529BAA6f232DdDc75F3901245A492', - }, - icon: Icon.TBTC, - coinGeckoId: 'tbtc', - color: '#000000', - decimals: { - default: 8, - Ethereum: 18, - }, - foreignAssets: { - optimismgoerli: { - address: '0xE04e0F5f2C6ce45A40482C3AB92CA91D6741D717', - decimals: 18, + osmosis: { + address: + 'ibc/30778BA41ADF2D8A70B90DB53C2E0251731A40276EF6737215BB1A6ED9E90078', + decimals: 8, }, }, }, - tBTCoptimism: { - key: 'tBTCoptimism', - symbol: 'tBTC', - nativeChain: 'optimismgoerli', + APT: { + key: 'APT', + symbol: 'APT', + nativeChain: 'aptos', tokenId: { - chain: 'optimismgoerli', - address: '0x1a53759DE2eADf73bd0b05c07a4F1F5B7912dA3d', + chain: 'aptos', + address: '0x1::aptos_coin::AptosCoin', }, - icon: Icon.TBTC, - coinGeckoId: 'tbtc', - color: '#000000', + icon: Icon.APT, + coinGeckoId: 'aptos', + color: '#8457EF', decimals: { + Ethereum: 8, default: 8, - Ethereum: 18, }, foreignAssets: { - solana: { - address: 'HsPvRT3J7kuitNvNHogyZeSEagcqAqwwq2FPgrGfgApy', + bsc: { + address: '0x4A7Bd5E135f421057F97BbA8BCeeE5c18334f454', decimals: 8, }, - }, - }, - tBTCarbitrum: { - key: 'tBTCarbitrum', - symbol: 'tBTC', - nativeChain: 'arbitrumgoerli', - tokenId: { - chain: 'arbitrumgoerli', - address: '0x85727F4725A4B2834e00Db1AA8e1b843a188162F', - }, - icon: Icon.TBTC, - coinGeckoId: 'tbtc', - color: '#000000', - decimals: { - default: 8, - Ethereum: 18, - }, - foreignAssets: { fuji: { - address: '0x4beDc7471374d7479120E44ea9593eBB85f48AD9', - decimals: 18, + address: '0x996a3f12C1FcD7339Ea8801f629201e4d42EAD04', + decimals: 8, }, - goerli: { - address: '0x575D93A2278FbF4E8Bd3d51B539a6E237C3F17c5', - decimals: 18, + fantom: { + address: '0xAb2297E8994149BA91737944E40891881aF762a4', + decimals: 8, + }, + alfajores: { + address: '0xAC0a2fF7DD597de863878a3372142b07B614C125', + decimals: 8, + }, + moonbasealpha: { + address: '0xCaa2A1d3BbbA0D1466571e83b4E2CbE04252593D', + decimals: 8, + }, + solana: { + address: '7EvFD3JKCJVdtkAYdaSVKJsrPEJCzy2neJha7TREGrCa', + decimals: 8, + }, + sei: { + address: + 'sei1em74y5sts4h8y5zuhfdn4w5g8zs285qld3kczpk6rh32jpvjyqqsvv0pdt', + decimals: 8, }, wormchain: { address: - 'wormhole1rm8ztmk20lrd6ex8uqq3yu7a6eyfjwvg53pcuuj22ffe2y8r3yzqr8j4v9', + 'wormhole1u8rft0gee23fa6a0t4t88ualrza5lj8ses4aur0l66c7efpvjezqchv34j', + decimals: 8, + }, + cosmoshub: { + address: + 'ibc/0CCA5EB15BC2FE474E71DBC9698302CDE260B6F6548F91C30002F7CBF228197B', + decimals: 8, + }, + osmosis: { + address: + 'ibc/7C495BD95757ED662A897C139F1C9F18275A86EE7203A0B073E2DB12B1E19D63', + decimals: 8, + }, + sui: { + address: + '0x812d6feb8b84e55d47a0bfcae9fb6a4e7e09be5ec86ce0a729e0f67d5f59f477::coin::COIN', decimals: 8, }, }, }, - tBTCbase: { - key: 'tBTCbase', - symbol: 'tBTC', - nativeChain: 'basegoerli', + OSMO: { + key: 'OSMO', + symbol: 'OSMO', + nativeChain: 'osmosis', tokenId: { - chain: 'basegoerli', - address: '0x783349cd20f26CE12e747b1a17bC38D252c9e119', + chain: 'osmosis', + address: 'uosmo', }, - icon: Icon.TBTC, - coinGeckoId: 'tbtc', - color: '#000000', + icon: Icon.OSMO, + coinGeckoId: 'osmosis', + color: '#FFFFFF', decimals: { - default: 8, - Ethereum: 18, + default: 6, }, }, tBTCsol: { @@ -1894,18 +756,6 @@ export const TESTNET_TOKENS: TokensConfig = { Ethereum: 18, }, foreignAssets: { - goerli: { - address: '0x57A52B6F0b393AF7d36116183cA83E584e636eA4', - decimals: 8, - }, - arbitrumgoerli: { - address: '0x227115F659f7c2939D23FedE68583F5291c395A6', - decimals: 8, - }, - basegoerli: { - address: '0x9dA16Ae62De05bcb4606c4BFbB54046872501Bd0', - decimals: 8, - }, sei: { address: 'sei1aj3uu9ejt8fk6rpjfhzluqnzqmv3enlndjmt8llkr7dn2dtz55xst4s3mn', @@ -1913,39 +763,6 @@ export const TESTNET_TOKENS: TokensConfig = { }, }, }, - wstETH: { - key: 'wstETH', - symbol: 'wstETH', - nativeChain: 'goerli', - tokenId: { - chain: 'goerli', - address: '0x6320cD32aA674d2898A68ec82e869385Fc5f7E2f', - }, - icon: Icon.WSTETH, - coinGeckoId: 'wrapped-steth', - color: '#3AA3FF', - decimals: { - default: 8, - Ethereum: 18, - }, - foreignAssets: { - wormchain: { - address: - 'wormhole1u2zdjcczjrenwmf57fmrpensk4the84azdm05m3unm387rm8asdsxqwfeu', - decimals: 8, - }, - cosmoshub: { - address: - 'ibc/5BB02667F9F0C8284FCF7716065C2779039817FBCB91E937F5149FE89FD8F202', - decimals: 8, - }, - osmosis: { - address: - 'ibc/C66B7DB3ED665D2F5FE8ED15E88B5913A37D80601E161C5E53A743DE12C0FB85', - decimals: 8, - }, - }, - }, SEI: { key: 'SEI', symbol: 'SEI', @@ -1961,14 +778,6 @@ export const TESTNET_TOKENS: TokensConfig = { default: 6, }, foreignAssets: { - goerli: { - address: '0xd68df72136207E9471C915cf1B6Cf43D587D4E0A', - decimals: 6, - }, - mumbai: { - address: '0xc5C0229B38564E1E8083031405Be8d6E6e3Bc462', - decimals: 6, - }, bsc: { address: '0x79A8FFFCED130314eCC8782C846c4d8d4867A900', decimals: 6, @@ -2003,18 +812,6 @@ export const TESTNET_TOKENS: TokensConfig = { '0xcae0ba0b7a435730ab65f1c8357d213e5cf9d4b377b96761745a8edaf9c9df6d::coin::T', decimals: 6, }, - basegoerli: { - address: '0x7B5edB2B3d2BeA8057a736B82AC6EF35c70bdadD', - decimals: 6, - }, - arbitrumgoerli: { - address: '0x90eC817A1f7C1Eb18dD2985C534A78dD88747F47', - decimals: 6, - }, - optimismgoerli: { - address: '0xE12be3D96fE101246bF2d290184B0eC6D35d02CA', - decimals: 6, - }, }, }, ATOM: { @@ -2094,14 +891,6 @@ export const TESTNET_TOKENS: TokensConfig = { default: 8, }, foreignAssets: { - mumbai: { - address: '0x7b34f3711705eB2963fB856cda063C979de4749e', - decimals: 18, - }, - goerli: { - address: '0x327e0c7D5cFa65d4f9E358dC9fA4446C49dBcB6C', - decimals: 18, - }, bsc: { address: '0x79D34FDb686B5D139949E4F92D83EEe376489176', decimals: 18, diff --git a/wormhole-connect/src/config/types.ts b/wormhole-connect/src/config/types.ts index c342860d5..bd0e76c44 100644 --- a/wormhole-connect/src/config/types.ts +++ b/wormhole-connect/src/config/types.ts @@ -59,7 +59,6 @@ export enum Icon { export enum Route { Bridge = 'bridge', Relay = 'relay', - // Hashflow = 'hashflow', CosmosGateway = 'cosmosGateway', CCTPManual = 'cctpManual', CCTPRelay = 'cctpRelay', diff --git a/wormhole-connect/src/env.d.ts b/wormhole-connect/src/env.d.ts index 37b05ffc7..e395867c6 100644 --- a/wormhole-connect/src/env.d.ts +++ b/wormhole-connect/src/env.d.ts @@ -33,8 +33,6 @@ interface ImportMetaEnv { REACT_APP_APTOS_GRAPHQL: string; // testnet - REACT_APP_GOERLI_RPC: string; - REACT_APP_MUMBAI_RPC: string; REACT_APP_BSC_TESTNET_RPC: string; REACT_APP_FUJI_RPC: string; REACT_APP_FANTOM_TESTNET_RPC: string; @@ -44,16 +42,13 @@ interface ImportMetaEnv { REACT_APP_SUI_TESTNET_RPC: string; REACT_APP_APTOS_TESTNET_RPC: string; REACT_APP_SEI_TESTNET_RPC: string; - REACT_APP_BASE_GOERLI_RPC: string; REACT_APP_OSMOSIS_TESTNET_RPC: string; REACT_APP_WORMCHAIN_TESTNET_RPC: string; REACT_APP_EVMOS_TESTNET_RPC: string; REACT_APP_COSMOSHUB_TESTNET_RPC: string; REACT_APP_KUJIRA_TESTNET_RPC: string; - REACT_APP_ARBITRUM_GOERLI_RPC: string; REACT_APP_INJECTIVE_TESTNET_REST: string; REACT_APP_INJECTIVE_TESTNET_RPC: string; - REACT_APP_OPTIMISM_GOERLI_RPC: string; REACT_APP_APTOS_TESTNET_GRAPHQL: string; // devnet diff --git a/wormhole-connect/src/hooks/useCheckInboundQueuedTransfer.ts b/wormhole-connect/src/hooks/useCheckInboundQueuedTransfer.ts index 0ce9f3816..4c4121ccb 100644 --- a/wormhole-connect/src/hooks/useCheckInboundQueuedTransfer.ts +++ b/wormhole-connect/src/hooks/useCheckInboundQueuedTransfer.ts @@ -18,9 +18,6 @@ import { NttBase } from 'routes/ntt/nttBase'; const useCheckInboundQueuedTransfer = (): void => { //const dispatch = useDispatch(); const route = useSelector((state: RootState) => state.redeem.route); - const signedMessage = useSelector( - (state: RootState) => state.redeem.signedMessage, - ); const transferComplete = useSelector( (state: RootState) => state.redeem.transferComplete, ); @@ -67,7 +64,7 @@ const useCheckInboundQueuedTransfer = (): void => { return () => { //active = false; }; - }, [route, transferComplete, signedMessage]); + }, [route, transferComplete]); }; export default useCheckInboundQueuedTransfer; diff --git a/wormhole-connect/src/hooks/useComputeQuote.ts b/wormhole-connect/src/hooks/useComputeQuote.ts new file mode 100644 index 000000000..383ef0de6 --- /dev/null +++ b/wormhole-connect/src/hooks/useComputeQuote.ts @@ -0,0 +1,142 @@ +import { useEffect } from 'react'; +import { useDispatch } from 'react-redux'; + +import { + setReceiveAmount, + setFetchingReceiveAmount, + setReceiveAmountError, +} from 'store/transferInput'; + +import type { Route } from 'config/types'; +import type { ChainName } from 'sdklegacy'; +import type { PorticoBridgeState } from 'store/porticoBridge'; +import { getRoute } from 'routes/mappings'; +import { setReceiveNativeAmt, setRelayerFee } from 'store/relay'; +import { amount as sdkAmount } from '@wormhole-foundation/sdk'; +import { getTokenDecimals } from 'utils'; +import config from 'config'; +import { toChainId } from 'utils/sdk'; +import { toDecimals } from 'utils/balance'; + +type Props = { + sourceChain: ChainName | undefined; + sourceToken: string; + destChain: ChainName | undefined; + destToken: string; + route: Route | undefined; + amount: string; + portico: PorticoBridgeState; + toNativeToken: number; + relayerFee: number | undefined; +}; + +export const useComputeQuote = (props: Props): void => { + const { + sourceChain, + destChain, + sourceToken, + destToken, + amount, + portico, + route, + toNativeToken, + } = props; + + const dispatch = useDispatch(); + + useEffect(() => { + if ( + !route || + !amount || + !sourceToken || + !destToken || + !sourceChain || + !destChain + ) { + return; + } + + let isActive = true; + const computeQuote = async () => { + try { + dispatch(setFetchingReceiveAmount()); + + const parsedAmount = Number.parseFloat(amount); + if (Number.isNaN(parsedAmount)) { + dispatch(setReceiveAmount('0')); + dispatch(setReceiveNativeAmt(0)); + dispatch(setRelayerFee(0)); + return; + } + + const r = getRoute(route); + const quote = await r.computeQuote( + parsedAmount, + sourceToken, + destToken, + sourceChain, + destChain, + { nativeGas: toNativeToken }, + ); + + if (!quote.success) { + if (isActive) { + dispatch(setReceiveAmountError(quote.error.message)); + dispatch(setReceiveNativeAmt(0)); + dispatch(setRelayerFee(0)); + } + return; + } + + if (isActive) { + dispatch( + setReceiveAmount( + sdkAmount.whole(quote.destinationToken.amount).toString(), + ), + ); + if (quote.destinationNativeGas) { + dispatch( + setReceiveNativeAmt(sdkAmount.whole(quote.destinationNativeGas)), + ); + } else { + dispatch(setReceiveNativeAmt(0)); + } + if (quote.relayFee) { + const { token, amount } = quote.relayFee; + const feeToken = config.sdkConverter.toTokenIdV1(token); + const decimals = getTokenDecimals(toChainId(sourceChain), feeToken); + const formattedFee = Number.parseFloat( + toDecimals(amount.amount, decimals, 6), + ); + dispatch(setRelayerFee(formattedFee)); + } else { + dispatch(setRelayerFee(0)); + } + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (e: any) { + if (isActive) { + dispatch(setReceiveAmountError(e.message)); + dispatch(setReceiveNativeAmt(0)); + dispatch(setRelayerFee(0)); + } + } + }; + + computeQuote(); + + return () => { + isActive = false; + }; + }, [ + amount, + toNativeToken, + route, + sourceToken, + destToken, + destChain, + sourceChain, + portico, + dispatch, + ]); +}; diff --git a/wormhole-connect/src/hooks/useComputeReceiveAmount.ts b/wormhole-connect/src/hooks/useComputeReceiveAmount.ts deleted file mode 100644 index 67cafb62c..000000000 --- a/wormhole-connect/src/hooks/useComputeReceiveAmount.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { useEffect } from 'react'; -import { useDispatch } from 'react-redux'; - -import { isPorticoRoute } from 'routes/porticoBridge/utils'; -import RouteOperator from 'routes/operator'; - -import { - setReceiveAmount, - setFetchingReceiveAmount, - setReceiveAmountError, -} from 'store/transferInput'; - -import type { Route } from 'config/types'; -import type { ChainName } from 'sdklegacy'; -import type { PorticoBridgeState } from 'store/porticoBridge'; - -type Props = { - sourceChain: ChainName | undefined; - sourceToken: string; - destChain: ChainName | undefined; - destToken: string; - route: Route | undefined; - amount: string; - portico: PorticoBridgeState; - toNativeToken: number; - relayerFee: number | undefined; -}; - -export const useComputeReceiveAmount = (props: Props): void => { - const { - sourceChain, - destChain, - sourceToken, - destToken, - amount, - portico, - route, - toNativeToken, - relayerFee, - } = props; - - const dispatch = useDispatch(); - - useEffect(() => { - if ( - !route || - !amount || - !sourceToken || - !destToken || - !sourceChain || - !destChain - ) { - return; - } - - const recomputeReceive = async () => { - try { - const routeOptions = isPorticoRoute(route) - ? portico - : { toNativeToken, relayerFee }; - - dispatch(setFetchingReceiveAmount()); - - const newReceiveAmount = await RouteOperator.computeReceiveAmount( - route, - Number.parseFloat(amount), - sourceToken, - destToken, - sourceChain, - destChain, - routeOptions, - ); - dispatch(setReceiveAmount(newReceiveAmount.toString())); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (e: any) { - dispatch(setReceiveAmountError(e.message)); - } - }; - recomputeReceive(); - }, [ - amount, - toNativeToken, - relayerFee, - route, - sourceToken, - destToken, - destChain, - sourceChain, - portico, - dispatch, - ]); -}; diff --git a/wormhole-connect/src/hooks/useDeliveryStatus.ts b/wormhole-connect/src/hooks/useDeliveryStatus.ts index b232c3958..22ddd9f3f 100644 --- a/wormhole-connect/src/hooks/useDeliveryStatus.ts +++ b/wormhole-connect/src/hooks/useDeliveryStatus.ts @@ -1,3 +1,4 @@ +/* import { DeliveryStatus } from 'utils/sdk'; import axios from 'axios'; import { Route } from 'config/types'; @@ -80,3 +81,4 @@ const useDeliveryStatus = (): void => { }; export default useDeliveryStatus; +*/ diff --git a/wormhole-connect/src/hooks/usePorticoRelayerFee.ts b/wormhole-connect/src/hooks/usePorticoRelayerFee.ts index 4542188ca..a57391581 100644 --- a/wormhole-connect/src/hooks/usePorticoRelayerFee.ts +++ b/wormhole-connect/src/hooks/usePorticoRelayerFee.ts @@ -62,6 +62,7 @@ export const usePorticoRelayerFee = (): void => { toChain, token, destToken, + '0', ); if (!cancelled && result) { dispatch(setRelayerFee(result.fee.toString())); diff --git a/wormhole-connect/src/hooks/useTrackTransfer.ts b/wormhole-connect/src/hooks/useTrackTransfer.ts index d07ff4e47..f837f3f56 100644 --- a/wormhole-connect/src/hooks/useTrackTransfer.ts +++ b/wormhole-connect/src/hooks/useTrackTransfer.ts @@ -2,7 +2,7 @@ import { isCompleted } from '@wormhole-foundation/sdk'; import { RouteContext } from 'contexts/RouteContext'; import { useContext, useEffect } from 'react'; import { useDispatch } from 'react-redux'; -import { setTransferComplete } from 'store/redeem'; +import { setRedeemTx, setTransferComplete } from 'store/redeem'; import { sleep } from 'utils'; const TRACK_TIMEOUT = 120 * 1000; @@ -21,21 +21,37 @@ const useTrackTransfer = (): void => { if (!route || !receipt) { return; } - while (isActive && !isCompleted(receipt)) { + let stateChanged = false; + while (isActive && !isCompleted(receipt) && !stateChanged) { try { - // TODO: the timeout may be longer for chains with slower finality times - // but we will retry so maybe it doesn't matter - const result = await route.track(receipt, TRACK_TIMEOUT).next(); - if (result.done || !isActive) { - break; - } - const currentReceipt = result.value; - if (currentReceipt.state !== receipt.state) { - routeContext.setReceipt(currentReceipt); - if (isCompleted(currentReceipt)) { - dispatch(setTransferComplete(true)); + // We need to consume all of the values the track generator yields in case any of them + // update the receipt state. + // When the receipt state is updated, we set the new receipt in the route context + // and break out of the loop. + // The hook will then be re-run and the new receipt will be used to continue tracking + // unless the transfer is completed. + console.log(`Current state: ${receipt.state}`); + console.log(receipt); + for await (const currentReceipt of route.track( + receipt, + TRACK_TIMEOUT, + )) { + if (!isActive) { + break; + } + if (currentReceipt.state !== receipt.state) { + routeContext.setReceipt(currentReceipt); + console.log('Updated receipt:', currentReceipt.state); + if (isCompleted(currentReceipt)) { + dispatch(setTransferComplete(true)); + const lastTx = currentReceipt.destinationTxs?.slice(-1)[0]; + if (lastTx) { + dispatch(setRedeemTx(lastTx.txid)); + } + } + stateChanged = true; + break; } - break; } } catch (e) { console.error('Error tracking transfer:', e); diff --git a/wormhole-connect/src/routes/abstracts/index.ts b/wormhole-connect/src/routes/abstracts/index.ts deleted file mode 100644 index c680fc251..000000000 --- a/wormhole-connect/src/routes/abstracts/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './relayAbstract'; -export * from './routeAbstract'; diff --git a/wormhole-connect/src/routes/abstracts/relayAbstract.ts b/wormhole-connect/src/routes/abstracts/relayAbstract.ts deleted file mode 100644 index e169df4e1..000000000 --- a/wormhole-connect/src/routes/abstracts/relayAbstract.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ChainId, ChainName, TokenId } from 'sdklegacy'; -import { BigNumber } from 'ethers5'; - -export abstract class RelayAbstract { - // swap information (native gas slider) - abstract nativeTokenAmount( - destChain: ChainName | ChainId, - token: TokenId, - amount: BigNumber, - walletAddress: string, - ): Promise; - - abstract maxSwapAmount( - destChain: ChainName | ChainId, - token: TokenId, - walletAddress: string, - ): Promise; -} diff --git a/wormhole-connect/src/routes/abstracts/routeAbstract.ts b/wormhole-connect/src/routes/abstracts/routeAbstract.ts deleted file mode 100644 index d21314a66..000000000 --- a/wormhole-connect/src/routes/abstracts/routeAbstract.ts +++ /dev/null @@ -1,201 +0,0 @@ -import { ChainId, ChainName, TokenId } from 'sdklegacy'; -import { Route, TokenConfig } from 'config/types'; -import { - UnsignedMessage, - SignedMessage, - TransferDestInfoBaseParams, - TransferDisplayData, - TransferInfoBaseParams, - TransferDestInfo, - RelayerFee, -} from '../types'; -import { ParsedRelayerMessage, ParsedMessage } from 'utils/sdk'; -import { TokenPrices } from 'store/tokenPrices'; - -export abstract class RouteAbstract { - abstract readonly NATIVE_GAS_DROPOFF_SUPPORTED: boolean; - abstract readonly AUTOMATIC_DEPOSIT: boolean; - abstract readonly TYPE: Route; - // protected abstract sendGasFallback: { [key: ChainName]: TokenConfig }; - // protected abstract claimGasFallback: { [key: ChainName]: TokenConfig }; - - // Is this route supported for the given chain, token and amount specifications? - public abstract isRouteSupported( - sourceToken: string, - destToken: string, - amount: string, - sourceChain: ChainName | ChainId, - destChain: ChainName | ChainId, - ): Promise; - - // Is this route available for the given chain, fee and amount specifications? - public abstract isRouteAvailable( - sourceToken: string, - destToken: string, - amount: string, - sourceChain: ChainName | ChainId, - destChain: ChainName | ChainId, - ): Promise; - - public abstract isSupportedChain(chain: ChainName): boolean; - - public abstract isSupportedSourceToken( - token?: TokenConfig, - destToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise; - public abstract isSupportedDestToken( - token?: TokenConfig, - sourceToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise; - - public abstract supportedSourceTokens( - tokens: TokenConfig[], - destToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise; - public abstract supportedDestTokens( - tokens: TokenConfig[], - sourceToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise; - - // Calculate the amount a user would expect to receive if sending a certain amount - // This may or may not include fees depending on the route - public abstract computeReceiveAmount( - sendAmount: number, - token: string, - destToken: string, - sendingChain: ChainName | undefined, - recipientChain: ChainName | undefined, - routeOptions: any, - ): Promise; - - // Calculate the amount a user would expect to receive if sending a certain amount - // This always includes fees (if relevant to the route) - public abstract computeReceiveAmountWithFees( - sendAmount: number, - token: string, - destToken: string, - sendingChain: ChainName | undefined, - recipientChain: ChainName | undefined, - routeOptions: any, - ): Promise; - - // Calculate the amount a user would need to send in order to receive a certain amount - public abstract computeSendAmount( - receiveAmount: number | undefined, - routeOptions: any, - ): Promise; - - // Validate a transfer before sending via the chosen route - public abstract validate( - token: TokenId | 'native', - amount: string, - sendingChain: ChainName | ChainId, - senderAddress: string, - recipientChain: ChainName | ChainId, - recipientAddress: string, - routeOptions: any, - ): Promise; - - /* - * TODO SDKV2 - // estimate send gas fees - public abstract estimateSendGas( - token: TokenId | 'native', - amount: string, - sendingChain: ChainName | ChainId, - senderAddress: string, - recipientChain: ChainName | ChainId, - recipientAddress: string, - routeOptions?: any, - ): Promise; - - // estimate claim gas fees, return 0 if none - public abstract estimateClaimGas( - destChain: ChainName | ChainId, - signedMessage?: SignedMessage, - ): Promise; - */ - - /** - * These operations have to be implemented in subclasses. - */ - public abstract getMinSendAmount( - token: TokenId | 'native', - recipientChain: ChainName | ChainId, - routeOptions: any, - ): number; - public abstract getMaxSendAmount(): number; - - public abstract send( - token: TokenConfig, - amount: string, - sendingChain: ChainName | ChainId, - senderAddress: string, - recipientChain: ChainName | ChainId, - recipientAddress: string, - destToken: string, - routeOptions: any, - ): Promise; - - public abstract redeem( - destChain: ChainName | ChainId, - messageInfo: SignedMessage, - recipient: string, - ): Promise; - - public abstract getPreview( - token: TokenConfig, - destToken: TokenConfig, - amount: number, - sendingChain: ChainName | ChainId, - receipientChain: ChainName | ChainId, - sendingGasEst: string, - claimingGasEst: string, - receiveAmount: string, - tokenPrices: TokenPrices, - routeOptions?: any, - ): Promise; - public abstract getTransferSourceInfo( - params: T, - ): Promise; - public abstract getTransferDestInfo( - params: T, - ): Promise; - - // send, validate, estimate gas, isRouteAvailable, parse data from VAA/fetch data, claim - abstract getRelayerFee( - sourceChain: ChainName | ChainId, - destChain: ChainName | ChainId, - token: string, - destToken: string, - ): Promise; - - abstract getForeignAsset( - token: TokenId, - chain: ChainName | ChainId, - destToken?: TokenConfig, - ): Promise; - - abstract getMessage( - tx: string, - chain: ChainName | ChainId, - ): Promise; - abstract getSignedMessage(message: UnsignedMessage): Promise; - - abstract isTransferCompleted( - destChain: ChainName | ChainId, - messageInfo: SignedMessage, - ): Promise; - - abstract tryFetchRedeemTx( - txData: ParsedMessage | ParsedRelayerMessage, - ): Promise; -} diff --git a/wormhole-connect/src/routes/bridge/baseRoute.ts b/wormhole-connect/src/routes/bridge/baseRoute.ts deleted file mode 100644 index 76488d716..000000000 --- a/wormhole-connect/src/routes/bridge/baseRoute.ts +++ /dev/null @@ -1,317 +0,0 @@ -import { ChainId, ChainName, TokenId } from 'sdklegacy'; -import { TokenConfig } from 'config/types'; -import { - MAX_DECIMALS, - calculateUSDPrice, - getDisplayName, - getTokenDecimals, - getWrappedToken, - toNormalizedDecimals, -} from 'utils'; -import { RouteAbstract } from '../abstracts'; -import { toChainId } from 'utils/sdk'; -import config from 'config'; -import { - TransferDisplayData, - TransferInfoBaseParams, - TransferDestInfoBaseParams, - SignedMessage, - isSignedWormholeMessage, - TransferDestInfo, -} from 'routes/types'; -import { isIlliquidDestToken } from 'routes/utils'; -import { toDecimals } from 'utils/balance'; -import { NO_INPUT } from 'utils/style'; -import { hexlify } from 'ethers5/lib/utils.js'; -import { TokenPrices } from 'store/tokenPrices'; - -export abstract class BaseRoute extends RouteAbstract { - async isSupportedSourceToken( - token?: TokenConfig, - destToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise { - if (!token) return false; - // if (destToken) { - // const wrapped = getWrappedToken(token); - // return wrapped.key === destToken.key; - // } - - if (!sourceChain) return true; - const chainName = config.wh.toChainName(sourceChain); - if (!token.tokenId && token.nativeChain !== chainName) { - return false; - } - /* TODO SDKV2 - if (isTBTCToken(token) && token.nativeChain !== chainName) { - return false; - } - */ - return true; - } - - async isSupportedDestToken( - token?: TokenConfig, - sourceToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise { - if (!token) return false; - if (!token.tokenId) return false; - if (destChain && isIlliquidDestToken(token, destChain)) return false; - /* TODO SDKV2 - if (isTBTCToken(token)) return false; - */ - if (sourceToken) { - const wrapped = getWrappedToken(sourceToken); - return wrapped.key === token.key; - } - return true; - } - - async supportedSourceTokens( - tokens: TokenConfig[], - destToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise { - const shouldAdd = await Promise.allSettled( - tokens.map((token) => - this.isSupportedSourceToken(token, destToken, sourceChain, destChain), - ), - ); - return tokens.filter((_token, i) => { - const res = shouldAdd[i]; - return res.status === 'fulfilled' && res.value; - }); - } - - async supportedDestTokens( - tokens: TokenConfig[], - sourceToken?: TokenConfig, - sourceChain?: ChainName | ChainId, - destChain?: ChainName | ChainId, - ): Promise { - const shouldAdd = await Promise.allSettled( - tokens.map((token) => - this.isSupportedDestToken(token, sourceToken, sourceChain, destChain), - ), - ); - return tokens.filter((_token, i) => { - const res = shouldAdd[i]; - return res.status === 'fulfilled' && res.value; - }); - } - - async isRouteAvailable( - sourceToken: string, - destToken: string, - amount: string, - sourceChain: ChainName | ChainId, - destChain: ChainName | ChainId, - ): Promise { - return true; - } - - async getPreview( - token: TokenConfig, - destToken: TokenConfig, - amount: number, - sendingChain: ChainName | ChainId, - receipientChain: ChainName | ChainId, - sendingGasEst: string, - claimingGasEst: string, - receiveAmount: string, - tokenPrices: TokenPrices, - routeOptions?: any, - ): Promise { - const sendingChainName = config.wh.toChainName(sendingChain); - const receipientChainName = config.wh.toChainName(receipientChain); - const sourceGasToken = config.chains[sendingChainName]?.gasToken; - const destinationGasToken = config.chains[receipientChainName]?.gasToken; - const sourceGasTokenSymbol = sourceGasToken - ? getDisplayName(config.tokens[sourceGasToken]) - : ''; - const destinationGasTokenSymbol = destinationGasToken - ? getDisplayName(config.tokens[destinationGasToken]) - : ''; - - // Calculate the USD value of the gas - const sendingGasEstPrice = calculateUSDPrice( - sendingGasEst, - tokenPrices, - config.tokens[sourceGasToken || ''], - ); - const claimingGasEstPrice = calculateUSDPrice( - claimingGasEst, - tokenPrices, - config.tokens[destinationGasToken || ''], - ); - - return [ - { - title: 'Amount', - value: `${!isNaN(amount) ? amount : '0'} ${getDisplayName(destToken)}`, - valueUSD: calculateUSDPrice(amount, tokenPrices, destToken), - }, - { - title: 'Total fee estimates', - value: - sendingGasEst && claimingGasEst - ? `${sendingGasEst} ${sourceGasTokenSymbol} & ${claimingGasEst} ${destinationGasTokenSymbol}` - : '', - valueUSD: - sendingGasEst && claimingGasEst - ? `${sendingGasEstPrice || NO_INPUT} & ${ - claimingGasEstPrice || NO_INPUT - }` - : '', - rows: [ - { - title: 'Source chain gas estimate', - value: sendingGasEst - ? `~ ${sendingGasEst} ${sourceGasTokenSymbol}` - : 'Not available', - valueUSD: sendingGasEstPrice, - }, - { - title: 'Destination chain gas estimate', - value: claimingGasEst - ? `~ ${claimingGasEst} ${destinationGasTokenSymbol}` - : 'Not available', - valueUSD: claimingGasEstPrice, - }, - ], - }, - ]; - } - - async getTransferSourceInfo( - params: T, - ): Promise { - const { tokenKey, amount, tokenDecimals, fromChain, gasFee } = - params.txData; - const tokenPrices = params.tokenPrices; - const formattedAmt = toNormalizedDecimals( - amount, - tokenDecimals, - MAX_DECIMALS, - ); - const { gasToken: sourceGasTokenKey } = config.chains[fromChain]!; - const sourceGasToken = config.tokens[sourceGasTokenKey]; - const decimals = getTokenDecimals( - toChainId(sourceGasToken.nativeChain), - 'native', - ); - const formattedGas = gasFee && toDecimals(gasFee, decimals, MAX_DECIMALS); - const token = config.tokens[tokenKey]; - - return [ - { - title: 'Amount', - value: `${formattedAmt} ${getDisplayName(token)}`, - valueUSD: calculateUSDPrice(formattedAmt, tokenPrices, token), - }, - { - title: 'Gas fee', - value: formattedGas - ? `${formattedGas} ${getDisplayName(sourceGasToken)}` - : NO_INPUT, - valueUSD: calculateUSDPrice(formattedGas, tokenPrices, sourceGasToken), - }, - ]; - } - - async getTransferDestInfo( - params: T, - ): Promise { - const { - txData: { tokenKey, amount, tokenDecimals, toChain }, - tokenPrices, - receiveTx, - gasEstimate, - } = params; - const token = config.tokens[tokenKey]; - const { gasToken } = config.chains[toChain]!; - - const gas = gasEstimate; - /* - TODO SDKV2 - if (receiveTx) { - const gasFee = await config.wh.getTxGasFee(toChain, receiveTx); - if (gasFee) { - gas = formatGasFee(toChain, gasFee); - } - } - */ - - const formattedAmt = toNormalizedDecimals( - amount, - tokenDecimals, - MAX_DECIMALS, - ); - - return { - route: this.TYPE, - displayData: [ - { - title: 'Amount', - value: `${formattedAmt} ${getDisplayName(token)}`, - valueUSD: calculateUSDPrice(formattedAmt, tokenPrices, token), - }, - { - title: receiveTx ? 'Gas fee' : 'Gas estimate', - value: gas - ? `${gas} ${getDisplayName(config.tokens[gasToken])}` - : NO_INPUT, - valueUSD: calculateUSDPrice( - gas, - tokenPrices, - config.tokens[gasToken], - ), - }, - ], - }; - } - - async isTransferCompleted( - destChain: ChainName | ChainId, - messageInfo: SignedMessage, - ): Promise { - if (!isSignedWormholeMessage(messageInfo)) { - throw new Error('Invalid signed message'); - } - return config.wh.isTransferCompleted(destChain, hexlify(messageInfo.vaa)); - } - - async computeReceiveAmountWithFees( - sendAmount: number, - token: string, - destToken: string, - sendingChain: ChainName | undefined, - recipientChain: ChainName | undefined, - routeOptions: any, - ): Promise { - return this.computeReceiveAmount( - sendAmount, - token, - destToken, - sendingChain, - recipientChain, - routeOptions, - ); - } - - getMaxSendAmount(): number { - return Infinity; - } - - getMinSendAmount( - token: TokenId | 'native', - recipientChain: ChainName | ChainId, - routeOptions: any, - ): number { - return 0; - } -} diff --git a/wormhole-connect/src/routes/bridge/index.ts b/wormhole-connect/src/routes/bridge/index.ts deleted file mode 100644 index b980a4982..000000000 --- a/wormhole-connect/src/routes/bridge/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './baseRoute'; diff --git a/wormhole-connect/src/routes/index.ts b/wormhole-connect/src/routes/index.ts index ececbd0bb..6d5a6ef49 100644 --- a/wormhole-connect/src/routes/index.ts +++ b/wormhole-connect/src/routes/index.ts @@ -1,3 +1,2 @@ -export * from './abstracts'; export * from './types'; export * from './utils'; diff --git a/wormhole-connect/src/routes/mappings.ts b/wormhole-connect/src/routes/mappings.ts index 1211fb3f5..340fbf972 100644 --- a/wormhole-connect/src/routes/mappings.ts +++ b/wormhole-connect/src/routes/mappings.ts @@ -4,28 +4,14 @@ import { Route } from 'config/types'; import { routes } from '@wormhole-foundation/sdk'; import { SDKv2Route } from './sdkv2/route'; -// Legacy routes -//import { RouteAbstract } from './abstracts/routeAbstract'; -//import { ETHBridge } from './porticoBridge/ethBridge'; -//import { wstETHBridge } from './porticoBridge/wstETHBridge'; - export function getRoute(route: Route): SDKv2Route { switch (route) { // Migrated routes: case Route.Bridge: return new SDKv2Route(routes.TokenBridgeRoute, Route.Bridge); case Route.Relay: - return new SDKv2Route(routes.AutomaticTokenBridgeRoute, Route.Bridge); - - // Legacy routes: - /* - case Route.ETHBridge: - return new ETHBridge(); - case Route.wstETHBridge: - return new wstETHBridge(); - */ - // TODO SDKV2 + return new SDKv2Route(routes.AutomaticTokenBridgeRoute, Route.Relay); default: - return new SDKv2Route(routes.TokenBridgeRoute, Route.Bridge); + throw new Error(`Unsupported route: ${route}`); } } diff --git a/wormhole-connect/src/routes/operator.ts b/wormhole-connect/src/routes/operator.ts index 5ae09f1bf..269248b42 100644 --- a/wormhole-connect/src/routes/operator.ts +++ b/wormhole-connect/src/routes/operator.ts @@ -1,14 +1,10 @@ /*import { PublicKey } from '@solana/web3.js';*/ import { ChainId, ChainName, TokenId } from 'sdklegacy'; -import { BigNumber } from 'ethers5'; +import { ParsedMessage } from 'utils/sdk'; import config from 'config'; import { TokenConfig, Route } from 'config/types'; -// import { HashflowRoute } from './hashflow'; -import { RouteAbstract } from './abstracts/routeAbstract'; import { - UnsignedMessage, - SignedMessage, TransferDisplayData, TransferInfoBaseParams, TransferDestInfo, @@ -16,16 +12,172 @@ import { } from './types'; import { TokenPrices } from 'store/tokenPrices'; -import { Network, routes } from '@wormhole-foundation/sdk'; +import { + Chain, + Network, + routes, + SourceInitiatedTransferReceipt, + TransferState, +} from '@wormhole-foundation/sdk'; import { getRoute } from './mappings'; +import axios from 'axios'; +import SDKv2Route from './sdkv2'; + +export interface TxInfo { + route: Route; + tokenChain: Chain; + tokenAddress: string; + amount: string; + receipt: SourceInitiatedTransferReceipt; +} export class Operator { - getRoute(route: Route): RouteAbstract { + getRoute(route: Route): SDKv2Route { return getRoute(route); } - async getRouteFromTx(txHash: string, chain: ChainName): Promise { + async getRouteFromTx(txHash: string, chain: Chain): Promise { + const url = `https://api.${ + config.isMainnet ? '' : 'testnet.' + }wormholescan.io/api/v1/operations?page=0&pageSize=1&sortOrder=DESC&txHash=${txHash}`; + + interface Operations { + operations: Operation[]; + } + + interface Operation { + id: string; + emitterChain: number; + emitterAddress: { + hex: string; + native: string; + }; + sequence: string; + //vaa: { + // raw: string; + // guardianSetIndex: number; + // isDuplicated: boolean; + //}; + content: { + //payload: { + // amount: string; + // fee: string; + // fromAddress: null; + // parsedPayload: null; + // payload: string; + // payloadType: number; + // toAddress: string; + // toChain: number; + // tokenAddress: string; + // tokenChain: number; + //}; + standarizedProperties: { + appIds: string[]; + fromChain: number; + fromAddress: string; + toChain: number; + toAddress: string; + tokenChain: number; + tokenAddress: string; + amount: string; + feeAddress: string; + feeChain: number; + fee: string; + }; + }; + sourceChain: { + chainId: number; + timestamp: string; + transaction: { + txHash: string; + }; + from: string; + status: string; + }; + data: { + symbol: string; + tokenAmount: string; + usdAmount: string; + }; + } + + //https://github.com/XLabs/wormscan-ui/blob/b96ad4c44d367cbf7c7e1c39d655e9fda3e0c3d9/src/consts.ts#L173-L185 + //export const UNKNOWN_APP_ID = 'UNKNOWN'; + //export const CCTP_APP_ID = 'CCTP_WORMHOLE_INTEGRATION'; + //export const CCTP_MANUAL_APP_ID = 'CCTP_MANUAL'; + const CONNECT_APP_ID = 'CONNECT'; + //export const GATEWAY_APP_ID = 'WORMCHAIN_GATEWAY_TRANSFER'; + const PORTAL_APP_ID = 'PORTAL_TOKEN_BRIDGE'; + //export const PORTAL_NFT_APP_ID = 'PORTAL_NFT_BRIDGE'; + //export const ETH_BRIDGE_APP_ID = 'ETH_BRIDGE'; + //export const USDT_TRANSFER_APP_ID = 'USDT_TRANSFER'; + //export const NTT_APP_ID = 'NATIVE_TOKEN_TRANSFER'; + //export const GR_APP_ID = 'GENERIC_RELAYER'; + //export const MAYAN_APP_ID = 'MAYAN'; + //export const TBTC_APP_ID = 'TBTC'; + + const { data } = await axios.get(url); + if (data.operations.length === 0) + throw new Error('No route found for txHash'); + const operation = data.operations[0]; + const { appIds, tokenChain, tokenAddress, toChain, amount, fromChain } = + operation.content.standarizedProperties; + if (config.sdkConverter.toChainV2(fromChain as ChainId) !== chain) { + // TODO: wormholescan can return transactions from other chains + // with the same txHash + throw new Error('Chain mismatch'); + } + const details = { + tokenChain: config.sdkConverter.toChainV2(tokenChain as ChainId), + tokenAddress, // TODO: convert to SDK address (non-serializable in redux)? + amount, // TODO: is amount expressed in source chain decimals? + receipt: { + from: chain, + to: config.sdkConverter.toChainV2(toChain as ChainId), + state: TransferState.SourceInitiated, + originTxs: [ + { + chain, + // TODO: right format for all chains? + txid: operation.sourceChain.transaction.txHash, + }, + ], + } satisfies SourceInitiatedTransferReceipt, + }; + if (appIds.length === 1) { + switch (appIds[0]) { + case PORTAL_APP_ID: + return { + ...details, + route: Route.Bridge, + }; + // case ETH_BRIDGE_APP_ID: + // return Route.ETHBridge; + //case USDT_TRANSFER_APP_ID: + // return Route.CCTPManual; + //case NTT_APP_ID: + // return Route.NttManual; + //case GR_APP_ID: + // return Route.GenericRelayer; + //case MAYAN_APP_ID: + // return Route.Mayan; + //case TBTC_APP_ID: + // return Route.TBTC; + //case GATEWAY_APP_ID: + // return Route.CosmosGateway; + //case CCTP_APP_ID: + // return Route.CCTPRelay; + } + } + if (appIds.length === 2) { + if (appIds.includes(PORTAL_APP_ID) && appIds.includes(CONNECT_APP_ID)) { + return { + ...details, + route: Route.Relay, + }; + } + } /* if (isGatewayChain(chain)) { return Route.CosmosGateway; @@ -137,7 +289,8 @@ export class Operator { // TODO SDKV2 // relied on getMessage - return Route.Bridge; + // return Route.Bridge; + throw new Error('No route found for txHash'); } async isRouteSupported( @@ -174,6 +327,7 @@ export class Operator { amount: string, sourceChain: ChainName | ChainId, destChain: ChainName | ChainId, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { if (!config.routes.includes(route)) { return false; @@ -186,8 +340,10 @@ export class Operator { amount, sourceChain, destChain, + options, ); } + allSupportedChains(): ChainName[] { const supported = new Set(); for (const key in config.chains) { @@ -310,7 +466,7 @@ export class Operator { destToken: string, sendingChain: ChainName | undefined, recipientChain: ChainName | undefined, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { const r = this.getRoute(route); return await r.computeReceiveAmount( @@ -319,7 +475,7 @@ export class Operator { destToken, sendingChain, recipientChain, - routeOptions, + options, ); } @@ -330,7 +486,7 @@ export class Operator { destToken: string, sendingChain: ChainName | undefined, recipientChain: ChainName | undefined, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { const r = this.getRoute(route); return await r.computeReceiveAmountWithFees( @@ -339,17 +495,17 @@ export class Operator { destToken, sendingChain, recipientChain, - routeOptions, + options, ); } async computeSendAmount( route: Route, receiveAmount: number | undefined, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { const r = this.getRoute(route); - return await r.computeSendAmount(receiveAmount, routeOptions); + return await r.computeSendAmount(receiveAmount, options); } async validate( @@ -360,7 +516,7 @@ export class Operator { senderAddress: string, recipientChain: ChainName | ChainId, recipientAddress: string, - routeOptions: any, + options: routes.AutomaticTokenBridgeRoute.Options, ): Promise { const r = this.getRoute(route); return await r.validate( @@ -370,7 +526,7 @@ export class Operator { senderAddress, recipientChain, recipientAddress, - routeOptions, + options, ); } @@ -419,7 +575,7 @@ export class Operator { recipientChain: ChainName | ChainId, recipientAddress: string, destToken: string, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise<[routes.Route, routes.Receipt]> { const r = this.getRoute(route); return await r.send( @@ -430,32 +586,23 @@ export class Operator { recipientChain, recipientAddress, destToken, - routeOptions, + options, ); } - async redeem( - route: Route, - destChain: ChainName | ChainId, - signed: SignedMessage, - payer: string, - ): Promise { - const r = this.getRoute(route); - return await r.redeem(destChain, signed, payer); - } - async getPreview( route: Route, token: TokenConfig, destToken: TokenConfig, amount: number, sendingChain: ChainName | ChainId, - receipientChain: ChainName | ChainId, + recipientChain: ChainName | ChainId, sendingGasEst: string, claimingGasEst: string, receiveAmount: string, tokenPrices: TokenPrices, - routeOptions?: any, + relayerFee?: number, + receiveNativeAmt?: number, ): Promise { const r = this.getRoute(route); return await r.getPreview( @@ -463,12 +610,13 @@ export class Operator { destToken, amount, sendingChain, - receipientChain, + recipientChain, sendingGasEst, claimingGasEst, receiveAmount, tokenPrices, - routeOptions, + relayerFee, + receiveNativeAmt, ); } @@ -478,9 +626,10 @@ export class Operator { destChain: ChainName | ChainId, token: string, destToken: string, + amount: string, ): Promise { const r = this.getRoute(route); - return r.getRelayerFee(sourceChain, destChain, token, destToken); + return r.getRelayerFee(sourceChain, destChain, token, destToken, amount); } async getForeignAsset( @@ -493,33 +642,6 @@ export class Operator { return r.getForeignAsset(tokenId, chain, destToken); } - async isTransferCompleted( - route: Route, - destChain: ChainName | ChainId, - message: SignedMessage, - ): Promise { - const r = this.getRoute(route); - return r.isTransferCompleted(destChain, message); - } - - async getMessage( - route: Route, - tx: string, - chain: ChainName | ChainId, - unsigned?: boolean, - ): Promise { - const r = this.getRoute(route); - return r.getMessage(tx, chain); - } - - async getSignedMessage( - route: Route, - message: UnsignedMessage, - ): Promise { - const r = this.getRoute(route); - return r.getSignedMessage(message); - } - getTransferSourceInfo( route: Route, params: T, @@ -536,76 +658,9 @@ export class Operator { return r.getTransferDestInfo(params); } - // swap information (native gas slider) - nativeTokenAmount( - route: Route, - destChain: ChainName | ChainId, - token: TokenId, - amount: BigNumber, - walletAddress: string, - ): Promise { - throw new Error('TODO SDKv2'); - /* - const r = this.getRoute(route); - if (r.AUTOMATIC_DEPOSIT) { - return (r as RelayRoute).nativeTokenAmount( - destChain, - token, - amount, - walletAddress, - ); - } else { - throw new Error('route does not support native gas dropoff'); - } - */ - } - - maxSwapAmount( - route: Route, - destChain: ChainName | ChainId, - token: TokenId, - walletAddress: string, - ): Promise { - throw new Error('TODO SDKv2'); - /* - const r = this.getRoute(route); - if (r.AUTOMATIC_DEPOSIT) { - return (r as RelayRoute).maxSwapAmount(destChain, token, walletAddress); - } else { - throw new Error('route does not support swap for native gas dropoff'); - } - */ - } - - async minSwapAmountNative( - route: Route, - destChain: ChainName | ChainId, - token: TokenId, - walletAddress: string, - ): Promise { - /* - * TODO SDKV2 - const chainName = config.wh.toChainName(destChain); - if (chainName === 'solana') { - const context = solanaContext(); - // an non-existent account cannot be sent less than the rent exempt amount - // in order to create the wallet, it must be sent at least the rent exemption minimum - const acctExists = - (await context.connection!.getAccountInfo( - new PublicKey(walletAddress), - )) !== null; - if (acctExists) return BigNumber.from(0); - const minBalance = - await context.connection!.getMinimumBalanceForRentExemption(0); - return BigNumber.from(minBalance); - } - */ - return BigNumber.from(0); - } - tryFetchRedeemTx( route: Route, - txData: UnsignedMessage, + txData: ParsedMessage, ): Promise { const r = this.getRoute(route); return r.tryFetchRedeemTx(txData); diff --git a/wormhole-connect/src/routes/relay/types.ts b/wormhole-connect/src/routes/relay/types.ts index ad7589e00..dfb936052 100644 --- a/wormhole-connect/src/routes/relay/types.ts +++ b/wormhole-connect/src/routes/relay/types.ts @@ -1,5 +1,5 @@ import { TokenPrices } from 'store/tokenPrices'; -import { ParsedMessage, ParsedRelayerMessage } from 'utils/sdk'; +import { ParsedMessage } from 'utils/sdk'; export type RelayOptions = { relayerFee?: number; @@ -8,7 +8,7 @@ export type RelayOptions = { }; export interface TransferDestInfoParams { - txData: ParsedMessage | ParsedRelayerMessage; + txData: ParsedMessage; tokenPrices: TokenPrices; receiveTx?: string; transferComplete?: boolean; diff --git a/wormhole-connect/src/routes/sdkv2/route.ts b/wormhole-connect/src/routes/sdkv2/route.ts index e1bd117f8..cbc85e1cb 100644 --- a/wormhole-connect/src/routes/sdkv2/route.ts +++ b/wormhole-connect/src/routes/sdkv2/route.ts @@ -11,18 +11,15 @@ import { } from '@wormhole-foundation/sdk'; import { ChainId, ChainName, TokenId as TokenIdV1 } from 'sdklegacy'; import { Route, TokenConfig } from 'config/types'; -import { RouteAbstract } from 'routes/abstracts'; import { RelayerFee, - SignedMessage, TransferDestInfo, TransferDestInfoBaseParams, TransferDisplayData, TransferInfoBaseParams, - UnsignedMessage, } from 'routes/types'; import { TokenPrices } from 'store/tokenPrices'; -import { ParsedMessage, ParsedRelayerMessage } from 'utils/sdk'; +import { ParsedMessage } from 'utils/sdk'; import { SDKv2Signer } from './signer'; @@ -32,15 +29,23 @@ import { SourceFinalizedTransferReceipt, } from '@wormhole-foundation/sdk'; import config, { getWormholeContextV2 } from 'config'; +import { calculateUSDPrice, getDisplayName } from 'utils'; +import { BigNumber } from 'ethers5'; +import { toFixedDecimals } from 'utils/balance'; +import { TransferWallet } from 'utils/wallet'; -export class SDKv2Route extends RouteAbstract { +export class SDKv2Route { TYPE: Route; NATIVE_GAS_DROPOFF_SUPPORTED = false; AUTOMATIC_DEPOSIT = false; constructor(readonly rc: routes.RouteConstructor, routeType: Route) { - super(); this.TYPE = routeType; + // TODO: get this info from the SDK + if (routeType === Route.Relay) { + this.NATIVE_GAS_DROPOFF_SUPPORTED = true; + this.AUTOMATIC_DEPOSIT = true; + } } async getV2ChainContext( @@ -76,20 +81,17 @@ export class SDKv2Route extends RouteAbstract { // We need to identifying which token address this is actually referring to // on the given chain by checking 'foreignAssets' key in token configs const getTokenIdV2 = ( - symbol: string, + tokenKey: string, chain: ChainName | ChainId, ): TokenIdV2 | undefined => { - const tc = config.tokens[symbol]; + const tc = config.tokens[tokenKey]; const chainName = config.wh.toChainName(chain); if (tc.nativeChain === chainName) { return config.sdkConverter.toTokenIdV2(tc); } else { - /* @ts-ignore */ - const fa = tc.foreignAssets[chainName]; - if (fa) { - /* @ts-ignore */ - const foreignAddr = tc.foreignAssets[chain].address; - return config.sdkConverter.tokenIdV2(chainName, foreignAddr); + const foreignAddress = tc?.foreignAssets?.[chainName]?.address; + if (foreignAddress) { + return config.sdkConverter.tokenIdV2(chainName, foreignAddress); } else { return undefined; } @@ -148,8 +150,45 @@ export class SDKv2Route extends RouteAbstract { amount: string, sourceChain: ChainName | ChainId, destChain: ChainName | ChainId, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { - // TODO + try { + // The route should be available when no amount is set + if (!amount) return true; + const wh = await getWormholeContextV2(); + const route = new this.rc(wh); + console.log(options); + if (routes.isAutomatic(route)) { + const req = await this.createRequest( + amount, + sourceToken, + destToken, + sourceChain, + destChain, + ); + const available = await route.isAvailable(req); + if (!available) { + return false; + } + } + const [, quote] = await this.getQuote( + amount, + sourceToken, + destToken, + sourceChain, + destChain, + options, + ); + if (!quote.success) { + return false; + } + } catch (e) { + console.error(e); + // TODO is this the right place to try/catch these? + // or deeper inside SDKv2Route? + return false; + } + return true; } @@ -173,13 +212,9 @@ export class SDKv2Route extends RouteAbstract { return !!supportedTokens.find((tokenId) => { return isSameToken(tokenId, tokenV2); }); - } catch (e: any) { - // Route not supported for this chain - if (e.message.includes('No protocols registered')) { - return false; - } else { - throw e; - } + } catch (e) { + console.error(e); + return false; } } @@ -210,6 +245,7 @@ export class SDKv2Route extends RouteAbstract { return isSameToken(tokenId, destTokenV2); }); } catch (e) { + console.error(e); return false; } } @@ -254,32 +290,30 @@ export class SDKv2Route extends RouteAbstract { .filter((tc) => tc != undefined) as TokenConfig[]; } - private async getQuote( + async getQuote( amount: string, - sourceToken: TokenIdV2, - destToken: TokenIdV2, - sourceChain: ChainContext, - destChain: ChainContext, - options: any, - ): Promise<[routes.Route, routes.QuoteResult]> { - const wh = await getWormholeContextV2(); - console.log(sourceToken, destToken, sourceChain, destChain); - const req = await routes.RouteTransferRequest.create( - wh, - /* @ts-ignore */ - { - source: sourceToken, - destination: destToken, - }, - sourceChain, - destChain, + sourceTokenV1: string, + destTokenV1: string, + sourceChainV1: ChainName | ChainId, + destChainV1: ChainName | ChainId, + options?: routes.AutomaticTokenBridgeRoute.Options, + ): Promise< + [ + routes.Route, + routes.QuoteResult, + routes.RouteTransferRequest, + ] + > { + const req = await this.createRequest( + amount, + sourceTokenV1, + destTokenV1, + sourceChainV1, + destChainV1, ); - - console.log(req); - - const route = new this.rc(wh, req); - - const validationResult = await route.validate({ + const wh = await getWormholeContextV2(); + const route = new this.rc(wh); + const validationResult = await route.validate(req, { amount, options, }); @@ -288,7 +322,57 @@ export class SDKv2Route extends RouteAbstract { throw validationResult.error; } - return [route, await route.quote(validationResult.params)]; + const quote = await route.quote(req, validationResult.params); + console.log('Got quote', quote); + + return [route, quote, req]; + } + + async createRequest( + amount: string, + sourceTokenV1: string, + destTokenV1: string, + sourceChainV1: ChainName | ChainId, + destChainV1: ChainName | ChainId, + ): Promise> { + const sourceTokenV2: TokenIdV2 | undefined = + config.sdkConverter.getTokenIdV2ForKey( + sourceTokenV1, + sourceChainV1, + config.tokens, + ); + + const destTokenV2: TokenIdV2 | undefined = + config.sdkConverter.getTokenIdV2ForKey( + destTokenV1, + destChainV1, + config.tokens, + ); + + if (sourceTokenV2 === undefined) { + throw new Error(`Failed to find TokenId for ${sourceTokenV1}`); + } + if (destTokenV2 === undefined) { + throw new Error(`Failed to find TokenId for ${destTokenV1}`); + } + + const sourceChainV2 = (await this.getV2ChainContext(sourceChainV1)).context; + const destChainV2 = (await this.getV2ChainContext(destChainV1)).context; + + const wh = await getWormholeContextV2(); + console.log(sourceTokenV2, destTokenV2, sourceChainV2, destChainV2); + const req = await routes.RouteTransferRequest.create( + wh, + /* @ts-ignore */ + { + source: sourceTokenV2, + destination: destTokenV2, + }, + sourceChainV2, + destChainV2, + ); + console.log(req); + return req; } async computeReceiveAmount( @@ -297,7 +381,7 @@ export class SDKv2Route extends RouteAbstract { destToken: string, fromChainV1: ChainName | undefined, toChainV1: ChainName | undefined, - options: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { console.log(sourceToken, fromChainV1, destToken, toChainV1); @@ -308,36 +392,12 @@ export class SDKv2Route extends RouteAbstract { if (!fromChainV1 || !toChainV1) throw new Error('Need both chains to get a quote from SDKv2'); - const srcTokenV2: TokenIdV2 | undefined = - config.sdkConverter.getTokenIdV2ForKey( - sourceToken, - fromChainV1, - config.tokens, - ); - - const dstTokenV2: TokenIdV2 | undefined = - config.sdkConverter.getTokenIdV2ForKey( - destToken, - toChainV1, - config.tokens, - ); - - if (srcTokenV2 === undefined) { - throw new Error(`Failed to find TokenId for ${sourceToken}`); - } - if (dstTokenV2 === undefined) { - throw new Error(`Failed to find TokenId for ${destToken}`); - } - - const srcChain = (await this.getV2ChainContext(fromChainV1)).context; - const dstChain = (await this.getV2ChainContext(toChainV1)).context; - - const [_route, quote] = await this.getQuote( + const [, quote] = await this.getQuote( amountIn.toString(), - srcTokenV2, - dstTokenV2, - srcChain, - dstChain, + sourceToken, + destToken, + fromChainV1, + toChainV1, options, ); @@ -354,7 +414,7 @@ export class SDKv2Route extends RouteAbstract { destToken: string, fromChainV1: ChainName | undefined, toChainV1: ChainName | undefined, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { if (!fromChainV1 || !toChainV1) throw new Error('Need both chains to get a quote from SDKv2'); @@ -366,15 +426,44 @@ export class SDKv2Route extends RouteAbstract { destToken, fromChainV1, toChainV1, - routeOptions, + options, ); } + async computeQuote( + amountIn: number, + sourceToken: string, + destToken: string, + fromChainV1: ChainName | undefined, + toChainV1: ChainName | undefined, + options?: routes.AutomaticTokenBridgeRoute.Options, + ): Promise> { + console.log(sourceToken, fromChainV1, destToken, toChainV1); + + if (!fromChainV1 || !toChainV1) + throw new Error('Need both chains to get a quote from SDKv2'); + + const [, quote] = await this.getQuote( + amountIn.toString(), + sourceToken, + destToken, + fromChainV1, + toChainV1, + options, + ); + + if (!quote.success) { + throw quote.error; + } + + return quote; + } + // Unused method, don't bother implementing // TODO Get rid of this public computeSendAmount( receiveAmount: number | undefined, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { throw new Error('Method not implemented.'); } @@ -386,12 +475,14 @@ export class SDKv2Route extends RouteAbstract { senderAddress: string, recipientChain: ChainName | ChainId, recipientAddress: string, - routeOptions: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise { throw new Error('Method not implemented.'); } - public getMinSendAmount(routeOptions: any): number { + public getMinSendAmount( + options?: routes.AutomaticTokenBridgeRoute.Options, + ): number { return 0; } @@ -402,47 +493,27 @@ export class SDKv2Route extends RouteAbstract { async send( sourceToken: TokenConfig, amount: string, - fromChainV1: ChainName, + fromChainV1: ChainName | ChainId, senderAddress: string, toChainV1: ChainName | ChainId, recipientAddress: string, destToken: string, - options: any, + options?: routes.AutomaticTokenBridgeRoute.Options, ): Promise< [ routes.Route, SourceInitiatedTransferReceipt | SourceFinalizedTransferReceipt, ] > { - const fromChainV2 = await this.getV2ChainContext(fromChainV1); - const toChainV2 = await this.getV2ChainContext(toChainV1); - - const sourceTokenV2 = config.sdkConverter.toTokenIdV2( - sourceToken, - fromChainV1, - ); - - const destTokenV2 = config.sdkConverter.getTokenIdV2ForKey( + const [route, quote, req] = await this.getQuote( + amount.toString(), + sourceToken.key, destToken, + fromChainV1, toChainV1, - config.tokens, - ); - - console.log(sourceToken, sourceTokenV2, destTokenV2); - - if (!destTokenV2) throw new Error(`Couldn't find destToken`); - - const [route, quote] = await this.getQuote( - amount.toString(), - sourceTokenV2, - destTokenV2, - fromChainV2.context, - toChainV2.context, options, ); - console.log(quote); - if (!quote.success) { throw quote.error; } @@ -451,11 +522,13 @@ export class SDKv2Route extends RouteAbstract { fromChainV1, senderAddress, options, + TransferWallet.SENDING, ); console.log(signer); let receipt = await route.initiate( + req, signer, quote, Wormhole.chainAddress( @@ -480,7 +553,7 @@ export class SDKv2Route extends RouteAbstract { public async redeem( destChain: ChainName | ChainId, - messageInfo: SignedMessage, + messageInfo: any, recipient: string, ): Promise { throw new Error('Method not implemented.'); @@ -491,45 +564,111 @@ export class SDKv2Route extends RouteAbstract { destToken: TokenConfig, amount: number, sendingChain: ChainName | ChainId, - receipientChain: ChainName | ChainId, + recipientChain: ChainName | ChainId, sendingGasEst: string, claimingGasEst: string, receiveAmount: string, tokenPrices: TokenPrices, - routeOptions?: any, + relayerFee?: number, + receiveNativeAmt?: number, ): Promise { - return [ - { - title: 'test', - value: 'testvalue', - valueUSD: '23', - }, + const displayData = [ + this.createDisplayItem('Amount', amount, destToken, tokenPrices), ]; + + if (relayerFee) { + displayData.push( + this.createDisplayItem('Relayer fee', relayerFee, token, tokenPrices), + ); + } + + if (receiveNativeAmt) { + const destChainName = config.wh.toChainName(recipientChain); + const destGasToken = + config.tokens[config.chains[destChainName]?.gasToken || '']; + displayData.push( + this.createDisplayItem( + 'Native gas on destination', + Number(toFixedDecimals(receiveNativeAmt.toString(), 6)), + destGasToken, + tokenPrices, + ), + ); + } + + return displayData; + } + + createDisplayItem( + title: string, + amount: number, + token: TokenConfig, + tokenPrices: TokenPrices, + ) { + return { + title, + value: `${!isNaN(amount) ? amount : '0'} ${getDisplayName(token)}`, + valueUSD: calculateUSDPrice(amount, tokenPrices, token), + }; } async getTransferSourceInfo( params: T, ): Promise { - return [ - { - title: 'test', - value: 'testvalue', - }, + const txData = params.txData as ParsedMessage; + const token = config.tokens[txData.tokenKey]; + const displayData = [ + this.createDisplayItem( + 'Amount', + Number(txData.amount), + token, + params.tokenPrices, + ), ]; + const relayerFee = Number.parseFloat(txData.relayerFee || '0'); + if (relayerFee > 0) { + displayData.push( + this.createDisplayItem( + 'Relayer fee', + relayerFee, + token, + params.tokenPrices, + ), + ); + } + return displayData; } async getTransferDestInfo( params: T, ): Promise { - return { + const info: TransferDestInfo = { route: this.TYPE, - displayData: [ - { - title: 'test', - value: 'testvalue', - }, - ], + displayData: [], }; + const txData = params.txData as ParsedMessage; + const token = config.tokens[txData.tokenKey]; + if (txData.receiveAmount) { + info.displayData.push( + this.createDisplayItem( + 'Amount', + Number(txData.receiveAmount), + token, + params.tokenPrices, + ), + ); + } + if (txData.receiveNativeAmount && txData.receiveNativeAmount > 0) { + info.displayData.push( + this.createDisplayItem( + 'Native gas amount', + Number(txData.receiveNativeAmount.toFixed(6)), + config.tokens[config.chains[txData.toChain]?.gasToken || ''], + params.tokenPrices, + ), + ); + } + return info; } async getRelayerFee( @@ -537,8 +676,29 @@ export class SDKv2Route extends RouteAbstract { destChain: ChainName | ChainId, token: string, destToken: string, + amount: string, ): Promise { - return null; + const [, quote] = await this.getQuote( + amount, + token, + destToken, + sourceChain, + destChain, + ); + if (!quote.success) { + throw quote.error; + } + if (!quote.relayFee) { + return null; + } + const { token: feeTokenV2, amount: feeAmount } = quote.relayFee; + const feeToken = config.sdkConverter.toTokenIdV1(feeTokenV2); + if (!feeToken) throw new Error('Failed to convert fee token'); + const relayerFee = { + feeToken, + fee: BigNumber.from(feeAmount.amount), + }; + return relayerFee; } async getForeignAsset( @@ -549,41 +709,7 @@ export class SDKv2Route extends RouteAbstract { return 'test'; } - async getMessage( - tx: string, - chain: ChainName | ChainId, - ): Promise { - /* - let { context } = await this.getV2ChainContext(chain); - switch (this.TYPE) { - case 'bridge': - case 'relay': - let vaa = (await context.getProtocol('TokenBridge') - - - } - - let vaas = await (await context.getProtocol('WormholeCore')).parseMessages(tx); - console.log(vaas); - debugger; - */ - throw new Error('Method not implemented'); - } - - getSignedMessage(message: UnsignedMessage): Promise { - throw new Error('Method not implemented.'); - } - - isTransferCompleted( - destChain: ChainName | ChainId, - messageInfo: SignedMessage, - ): Promise { - throw new Error('Method not implemented.'); - } - - tryFetchRedeemTx( - txData: ParsedMessage | ParsedRelayerMessage, - ): Promise { + tryFetchRedeemTx(txData: ParsedMessage): Promise { throw new Error('Method not implemented.'); } } diff --git a/wormhole-connect/src/routes/sdkv2/signer.ts b/wormhole-connect/src/routes/sdkv2/signer.ts index 681d81826..1f9b52f23 100644 --- a/wormhole-connect/src/routes/sdkv2/signer.ts +++ b/wormhole-connect/src/routes/sdkv2/signer.ts @@ -20,23 +20,27 @@ export class SDKv2Signer _chainContextV2: ChainContext; _address: string; _options: any; + _walletType: TransferWallet; constructor( chainNameV1: ChainName, chainContextV2: ChainContext, address: string, options: any, + walletType: TransferWallet, ) { this._chainNameV1 = chainNameV1; this._chainContextV2 = chainContextV2; this._address = address; this._options = options; + this._walletType = walletType; } static async fromChainV1( chainV1: ChainName | ChainId, address: string, options: any, + walletType: TransferWallet, ): Promise> { const wh = await getWormholeContextV2(); const chainNameV1 = config.wh.toChainName(chainV1); @@ -45,7 +49,13 @@ export class SDKv2Signer .getPlatform(chainToPlatform(chainV2)) .getChain(chainV2) as ChainContext; - return new SDKv2Signer(chainNameV1, chainContextV2, address, options); + return new SDKv2Signer( + chainNameV1, + chainContextV2, + address, + options, + walletType, + ); } async signAndSend(txs: UnsignedTransaction[]): Promise { @@ -55,7 +65,7 @@ export class SDKv2Signer const txId = await signAndSendTransaction( this._chainNameV1, tx, - TransferWallet.SENDING, + this._walletType, this._options, ); txHashes.push(txId); diff --git a/wormhole-connect/src/routes/types.ts b/wormhole-connect/src/routes/types.ts index 13178e1ef..c93fe67f4 100644 --- a/wormhole-connect/src/routes/types.ts +++ b/wormhole-connect/src/routes/types.ts @@ -1,17 +1,15 @@ import { Route } from 'config/types'; -import { ParsedMessage, ParsedRelayerMessage } from '../utils/sdk'; +import { ParsedMessage } from '../utils/sdk'; import { TokenPrices } from 'store/tokenPrices'; import { BigNumber } from 'ethers5'; import { TokenId } from 'sdklegacy'; +/* export type TokenTransferMessage = ParsedMessage; -export type RelayTransferMessage = ParsedRelayerMessage; export interface CCTPMessage { message: string; } export type ManualCCTPMessage = CCTPMessage & ParsedMessage; -export type RelayCCTPMessage = CCTPMessage & ParsedRelayerMessage; -export type UnsignedCCTPMessage = ManualCCTPMessage | RelayCCTPMessage; export type TBTCMessage = TokenTransferMessage & { to: string }; export enum NttRelayingType { Standard, @@ -26,7 +24,6 @@ export type UnsignedNttMessage = ParsedMessage & { }; export type UnsignedMessage = | TokenTransferMessage - | RelayTransferMessage | UnsignedCCTPMessage | TBTCMessage | UnsignedNttMessage; @@ -72,14 +69,15 @@ export const isSignedNttMessage = ( message: SignedMessage, ): message is SignedNttMessage => isSignedWormholeMessage(message) && isUnsignedNttMessage(message); + */ export interface TransferInfoBaseParams { - txData: ParsedMessage | ParsedRelayerMessage; + txData: ParsedMessage; tokenPrices: TokenPrices; } export interface TransferDestInfoBaseParams { - txData: ParsedMessage | ParsedRelayerMessage; + txData: ParsedMessage; tokenPrices: TokenPrices; receiveTx?: string; gasEstimate?: string; diff --git a/wormhole-connect/src/routes/utils.ts b/wormhole-connect/src/routes/utils.ts index 326dc51d8..c583860e2 100644 --- a/wormhole-connect/src/routes/utils.ts +++ b/wormhole-connect/src/routes/utils.ts @@ -1,69 +1,8 @@ -import { - ChainName, - ChainId, - MAINNET_CHAINS, - ParsedMessage as SdkParsedMessage, - ParsedRelayerMessage as SdkParsedRelayerMessage, -} from 'sdklegacy'; +import { ChainName, ChainId } from 'sdklegacy'; import { BigNumber, BigNumberish, utils } from 'ethers5'; import config from 'config'; import { toFixedDecimals } from 'utils/balance'; -import { ParsedMessage, ParsedRelayerMessage, PayloadType } from 'utils/sdk'; -import { getTokenById } from 'utils'; import { Route, TokenConfig } from 'config/types'; -import { getDecimals } from 'utils/sdkv2'; - -// adapts the sdk returned parsed message to the type that -// wh connect uses -export const adaptParsedMessage = async ( - parsed: SdkParsedMessage | SdkParsedRelayerMessage, -): Promise => { - const tokenId = { - address: parsed.tokenAddress, - chain: parsed.tokenChain, - }; - const decimals = await getDecimals( - config.sdkConverter.toTokenIdV2(tokenId), - config.sdkConverter.toChainV2(parsed.fromChain), - ); - const token = getTokenById(tokenId); - - const base: ParsedMessage = { - ...parsed, - amount: parsed.amount.toString(), - tokenKey: token?.key || '', - tokenDecimals: decimals, - receivedTokenKey: token?.key || '', - sequence: parsed.sequence?.toString(), - gasFee: parsed.gasFee ? parsed.gasFee.toString() : undefined, - }; - // get wallet address of associated token account for Solana - // the recipient is the wallet address for the automatic payload type - const toChainId = config.wh.toChainId(parsed.toChain); - if ( - toChainId === MAINNET_CHAINS.solana && - parsed.payloadID === PayloadType.Manual - ) { - try { - throw 1; - /* - * TODO SDKV2 - const accountOwner = await solanaContext().getTokenAccountOwner( - parsed.recipient, - ); - base.recipient = accountOwner; - */ - } catch (e: any) { - if (e.name === 'TokenAccountNotFoundError') { - // we'll promp them to create it before claiming it - base.recipient = ''; - } else { - throw e; - } - } - } - return base; -}; export const formatGasFee = (chain: ChainName | ChainId, gasFee: BigNumber) => { const chainName = config.wh.toChainName(chain); diff --git a/wormhole-connect/src/sdklegacy/config/TESTNET.ts b/wormhole-connect/src/sdklegacy/config/TESTNET.ts index 65be3d61c..ca3e169e6 100644 --- a/wormhole-connect/src/sdklegacy/config/TESTNET.ts +++ b/wormhole-connect/src/sdklegacy/config/TESTNET.ts @@ -5,9 +5,7 @@ import { WormholeConfig, Context, ChainConfig } from '../types'; */ export const TESTNET_CHAINS = { solana: 1, - goerli: 2, bsc: 4, - mumbai: 5, fuji: 6, fantom: 10, klaytn: 13, @@ -16,9 +14,6 @@ export const TESTNET_CHAINS = { injective: 19, sui: 21, aptos: 22, - arbitrumgoerli: 23, - optimismgoerli: 24, - basegoerli: 30, sei: 32, scroll: 34, blast: 36, @@ -47,21 +42,6 @@ export type TestnetChainId = (typeof TESTNET_CHAINS)[TestnetChainName]; */ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = { - goerli: { - key: 'goerli', - id: 2, - context: Context.ETH, - /* - * TODO SDKV2 - contracts: { - ...CONTRACTS.TESTNET.ethereum, - relayer: '0x9563a59c15842a6f322b10f69d1dd88b41f2e97b', - }, - */ - finalityThreshold: 64, - nativeTokenDecimals: 18, - cctpDomain: 0, - }, solana: { key: 'solana', id: 1, @@ -82,28 +62,6 @@ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = { nativeTokenDecimals: 9, cctpDomain: 5, }, - mumbai: { - key: 'mumbai', - id: 5, - context: Context.ETH, - /* - * TODO SDKV2 - contracts: { - ...CONTRACTS.TESTNET.polygon, - relayer: '0x9563a59c15842a6f322b10f69d1dd88b41f2e97b', - tbtcGateway: '0x91fe7128f74dbd4f031ea3d90fc5ea4dcfd81818', - cctpContracts: { - cctpTokenMessenger: '0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5', - cctpMessageTransmitter: '0xe09A679F56207EF33F5b9d8fb4499Ec00792eA73', - wormholeCCTP: '0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c', - wormholeCircleRelayer: '0x4cb69FaE7e7Af841e44E1A1c30Af640739378bb2', - }, - }, - */ - finalityThreshold: 64, - nativeTokenDecimals: 18, - cctpDomain: 7, - }, bsc: { key: 'bsc', id: 4, @@ -213,70 +171,6 @@ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = { finalityThreshold: 0, nativeTokenDecimals: 8, }, - arbitrumgoerli: { - key: 'arbitrumgoerli', - id: 23, - context: Context.ETH, - /* - * TODO SDKV2 - contracts: { - ...CONTRACTS.TESTNET.arbitrum, - cctpContracts: { - cctpTokenMessenger: '0x12dcfd3fe2e9eac2859fd1ed86d2ab8c5a2f9352', - cctpMessageTransmitter: '0x109bc137cb64eab7c0b1dddd1edf341467dc2d35', - wormholeCircleRelayer: '0xbf683d541e11320418ca78ec13309938e6c5922f', - wormholeCCTP: '0x2e8f5e00a9c5d450a72700546b89e2b70dfb00f2', - }, - tbtcGateway: '0x31A15e213B59E230b45e8c5c99dAFAc3d1236Ee2', - }, - */ - finalityThreshold: 0, - nativeTokenDecimals: 18, - cctpDomain: 3, - }, - optimismgoerli: { - key: 'optimismgoerli', - id: 24, - context: Context.ETH, - /* - * TODO SDKV2 - contracts: { - ...CONTRACTS.TESTNET.optimism, - cctpContracts: { - cctpTokenMessenger: '0x23a04d5935ed8bc8e3eb78db3541f0abfb001c6e', - cctpMessageTransmitter: '0x9ff9a4da6f2157a9c82ce756f8fd7e0d75be8895', - wormholeCircleRelayer: '0x4cb69FaE7e7Af841e44E1A1c30Af640739378bb2', - wormholeCCTP: '0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c', - }, - tbtcGateway: '0x6449F4381f3d63bDfb36B3bDc375724aD3cD4621', - }, - */ - finalityThreshold: 0, - nativeTokenDecimals: 18, - cctpDomain: 2, - }, - basegoerli: { - key: 'basegoerli', - id: 30, - context: Context.ETH, - /* - * TODO SDKV2 - contracts: { - ...CONTRACTS.TESTNET.base, - relayer: '0xae8dc4a7438801ec4edc0b035eccccf3807f4cc1', - cctpContracts: { - cctpTokenMessenger: '0x877b8e8c9e2383077809787ed6f279ce01cb4cc8', - cctpMessageTransmitter: '0x9ff9a4da6f2157a9c82ce756f8fd7e0d75be8895', - wormholeCircleRelayer: '0x4cb69FaE7e7Af841e44E1A1c30Af640739378bb2', - wormholeCCTP: '0x2703483B1a5a7c577e8680de9Df8Be03c6f30e3c', - }, - tbtcGateway: '0xe3e0511EEbD87F08FbaE4486419cb5dFB06e1343', - }, - */ - finalityThreshold: 0, - nativeTokenDecimals: 18, - cctpDomain: 6, - }, klaytn: { key: 'klaytn', id: 13, @@ -485,8 +379,6 @@ const TESTNET: { [chain in TestnetChainName]: ChainConfig } = { const TESTNET_CONFIG: WormholeConfig = { env: 'testnet', rpcs: { - goerli: 'https://rpc.ankr.com/eth_goerli', - mumbai: 'https://rpc.ankr.com/polygon_mumbai', bsc: 'https://data-seed-prebsc-1-s3.binance.org:8545', fuji: 'https://api.avax-test.network/ext/bc/C/rpc', fantom: 'https://rpc.ankr.com/fantom_testnet', @@ -495,9 +387,6 @@ const TESTNET_CONFIG: WormholeConfig = { moonbasealpha: 'https://rpc.api.moonbase.moonbeam.network', sui: 'https://fullnode.testnet.sui.io', aptos: 'https://fullnode.testnet.aptoslabs.com/v1', - arbitrumgoerli: 'https://arbitrum-goerli.publicnode.com', - optimismgoerli: 'https://optimism-goerli.publicnode.com', - basegoerli: 'https://base-goerli.publicnode.com', sei: 'https://rpc.atlantic-2.seinetwork.io', wormchain: '', osmosis: 'https://rpc.osmotest5.osmosis.zone', diff --git a/wormhole-connect/src/store/redeem.ts b/wormhole-connect/src/store/redeem.ts index d5effc0c6..4fb4b6bef 100644 --- a/wormhole-connect/src/store/redeem.ts +++ b/wormhole-connect/src/store/redeem.ts @@ -1,6 +1,6 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { ParsedMessage, ParsedRelayerMessage } from 'utils/sdk'; -import { UnsignedNttMessage, SignedMessage, TransferDestInfo } from 'routes'; +import { ParsedMessage } from 'utils/sdk'; +import { TransferDestInfo } from 'routes'; import { Route } from 'config/types'; import { DeliveryStatus } from 'utils/sdk'; @@ -10,8 +10,7 @@ export enum MessageType { } export interface RedeemState { - txData: ParsedMessage | ParsedRelayerMessage | UnsignedNttMessage | undefined; - signedMessage: SignedMessage | undefined; + txData?: ParsedMessage; sendTx: string; redeemTx: string; transferComplete: boolean; @@ -25,7 +24,6 @@ export interface RedeemState { const initialState: RedeemState = { txData: undefined, - signedMessage: undefined, sendTx: '', redeemTx: '', transferComplete: false, @@ -43,11 +41,7 @@ export const redeemSlice = createSlice({ reducers: { setTxDetails: ( state: RedeemState, - { - payload, - }: PayloadAction< - ParsedMessage | ParsedRelayerMessage | UnsignedNttMessage - >, + { payload }: PayloadAction, ) => { state.txData = payload; }, @@ -84,12 +78,6 @@ export const redeemSlice = createSlice({ state[key] = initialState[key]; }); }, - setSignedMessage: ( - state: RedeemState, - { payload }: PayloadAction, - ) => { - state.signedMessage = payload; - }, setDeliveryStatus: ( state: RedeemState, { payload }: PayloadAction, @@ -121,7 +109,6 @@ export const { setTransferDestInfo, clearRedeem, setRoute, - setSignedMessage, setDeliveryStatus, setIsResumeTx, } = redeemSlice.actions; diff --git a/wormhole-connect/src/utils/gas.ts b/wormhole-connect/src/utils/gas.ts index 5e00b8840..be772780e 100644 --- a/wormhole-connect/src/utils/gas.ts +++ b/wormhole-connect/src/utils/gas.ts @@ -3,7 +3,6 @@ import { ChainName, ChainId, Context, TokenId, NATIVE } from 'sdklegacy'; import config from 'config'; import { GasEstimateOptions, Route } from 'config/types'; //import RouteOperator from '../routes/operator'; -import { SignedMessage } from '../routes'; export const getGasFallback = ( chain: ChainName | ChainId, @@ -64,7 +63,7 @@ export const estimateSendGas = async ( export const estimateClaimGas = async ( route: Route, destChain: ChainName | ChainId, - signedMessage?: SignedMessage, + signedMessage?: any, ): Promise => { return '-'; /* diff --git a/wormhole-connect/src/utils/index.ts b/wormhole-connect/src/utils/index.ts index 0bfcce70b..c24b740ce 100644 --- a/wormhole-connect/src/utils/index.ts +++ b/wormhole-connect/src/utils/index.ts @@ -120,6 +120,7 @@ export function getTokenDecimals( return chainConfig.nativeTokenDecimals; } + console.log(tokenId); const tokenConfig = getTokenById(tokenId); if (!tokenConfig) { throw new Error('token config not found'); diff --git a/wormhole-connect/src/utils/sdk.ts b/wormhole-connect/src/utils/sdk.ts index 19e60beee..7e719c703 100644 --- a/wormhole-connect/src/utils/sdk.ts +++ b/wormhole-connect/src/utils/sdk.ts @@ -2,6 +2,7 @@ import { BigNumber } from 'ethers5'; import { ChainId, ChainName, TokenId } from 'sdklegacy'; import { getWrappedTokenId } from '.'; import config from 'config'; +import { chainToPlatform } from '@wormhole-foundation/sdk'; export enum PayloadType { Manual = 1, @@ -12,7 +13,6 @@ export interface ParsedMessage { sendTx: string; sender: string; amount: string; - payloadID: number; recipient: string; toChain: ChainName; fromChain: ChainName; @@ -28,13 +28,9 @@ export interface ParsedMessage { gasFee?: string; payload?: string; inputData?: string; -} - -export interface ParsedRelayerMessage extends ParsedMessage { - relayerPayloadId: number; - to: string; - relayerFee: string; - toNativeTokenAmount: string; + receiveAmount?: string; + relayerFee?: string; + receiveNativeAmount?: number; } export const formatAddress = (chain: ChainName | ChainId, address: string) => { @@ -114,44 +110,9 @@ export const isAcceptedToken = async (tokenId: TokenId): Promise => { return accepted; }; -// copied from @certusone/wormhole-sdk -// TODO SDKV2 -export const EVMChainNames = [ - 'ethereum', - 'bsc', - 'polygon', - 'avalanche', - 'oasis', - 'aurora', - 'fantom', - 'karura', - 'acala', - 'klaytn', - 'celo', - 'moonbeam', - 'neon', - 'arbitrum', - 'optimism', - 'gnosis', - 'base', - 'rootstock', - 'scroll', - 'mantle', - 'blast', - 'xlayer', - 'linea', - 'berachain', - 'seievm', - 'sepolia', - 'arbitrum_sepolia', - 'base_sepolia', - 'optimism_sepolia', - 'holesky', - 'polygon_sepolia', -]; - export const isEvmChain = (chain: ChainName | ChainId) => { - return EVMChainNames.includes(config.wh.toChainName(chain)); + const chainV2 = config.sdkConverter.toChainV2(chain); + return chainToPlatform.get(chainV2) === 'Evm'; }; export const toChainId = (chain: ChainName | ChainId) => { diff --git a/wormhole-connect/src/utils/transferValidation.ts b/wormhole-connect/src/utils/transferValidation.ts index b62aec7e5..81a01e9ca 100644 --- a/wormhole-connect/src/utils/transferValidation.ts +++ b/wormhole-connect/src/utils/transferValidation.ts @@ -23,7 +23,6 @@ import { isPorticoRoute } from 'routes/porticoBridge/utils'; import { PorticoBridgeState } from 'store/porticoBridge'; import { DataWrapper } from 'store/helpers'; import { CCTP_MAX_TRANSFER_LIMIT } from 'consts'; -import { isNttRoute } from 'routes'; export const validateFromChain = ( chain: ChainName | undefined, @@ -173,22 +172,6 @@ export const validateForeignAsset = ( return ''; }; -export const validateSolanaTokenAccount = ( - destChain: string | undefined, - destTokenAddr: string, - solanaTokenAccount: string, - route: Route | undefined, -): ValidationErr => { - if (destChain !== 'solana') return ''; - if (route === Route.Relay || route === Route.TBTC || isNttRoute(route)) - return ''; - if (!destTokenAddr) return ''; - if (destTokenAddr && !solanaTokenAccount) { - return 'The associated token account for this asset does not exist on Solana, you must create it first'; - } - return ''; -}; - export const validateRelayerFee = ( route: Route | undefined, routeOptions: any, diff --git a/wormhole-connect/src/utils/vaa.ts b/wormhole-connect/src/utils/vaa.ts index e8474cc46..2cb20c963 100644 --- a/wormhole-connect/src/utils/vaa.ts +++ b/wormhole-connect/src/utils/vaa.ts @@ -4,7 +4,6 @@ import { ChainId, ChainName } from 'sdklegacy'; import config, { newWormholeContextV2 } from 'config'; import { ParsedMessage, - ParsedRelayerMessage, getCurrentBlock, //isEvmChain, } from './sdk'; @@ -65,7 +64,7 @@ export async function getWormholeLogEvm( } export function getEmitterAndSequence( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): MessageIdentifier { const emitterChain = config.chains[txData.fromChain]; if (!emitterChain || !emitterChain.id) { @@ -84,7 +83,7 @@ export function getEmitterAndSequence( } export async function fetchVaa( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): Promise { try { const vaa = await fetchVaaWormscan(txData); @@ -103,7 +102,7 @@ export async function fetchVaa( } export async function fetchVaaWormscan( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): Promise { // return if the number of block confirmations hasn't been met const chainName = config.wh.toChainName(txData.fromChain); @@ -153,7 +152,7 @@ export async function fetchVaaWormscan( } export async function fetchVaaGuardian( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): Promise { // return if the number of block confirmations hasn't been met const chainName = config.wh.toChainName(txData.fromChain); @@ -198,7 +197,7 @@ export async function fetchVaaGuardian( } export const fetchIsVAAEnqueued = async ( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): Promise => { const messageId = getEmitterAndSequence(txData); const { emitterChain, emitterAddress, sequence } = messageId; @@ -218,7 +217,7 @@ export const fetchIsVAAEnqueued = async ( }; export const fetchGlobalTx = async ( - txData: ParsedMessage | ParsedRelayerMessage, + txData: ParsedMessage, ): Promise => { const messageId = getEmitterAndSequence(txData); const { emitterChain, emitterAddress, sequence } = messageId; diff --git a/wormhole-connect/src/views/Bridge/Bridge.tsx b/wormhole-connect/src/views/Bridge/Bridge.tsx index 22cf8b722..be012708d 100644 --- a/wormhole-connect/src/views/Bridge/Bridge.tsx +++ b/wormhole-connect/src/views/Bridge/Bridge.tsx @@ -9,7 +9,7 @@ import { joinClass } from 'utils/style'; import { isTransferValid, useValidate } from 'utils/transferValidation'; import useConfirmBeforeLeaving from 'utils/confirmBeforeLeaving'; -import GasSlider from './NativeGasSlider'; +import NativeGasSlider from './NativeGasSlider'; import Preview from './Preview'; import Send from './Send'; import { Collapse, useTheme } from '@mui/material'; @@ -24,10 +24,8 @@ import PoweredByIcon from 'icons/PoweredBy'; import { Alignment } from 'components/Header'; import FooterNavBar from 'components/FooterNavBar'; import { useComputeDestinationTokens } from 'hooks/useComputeDestinationTokens'; -import { useComputeReceiveAmount } from 'hooks/useComputeReceiveAmount'; +import { useComputeQuote } from 'hooks/useComputeQuote'; import { useComputeSourceTokens } from 'hooks/useComputeSourceTokens'; -//import { usePorticoSwapInfo } from 'hooks/usePorticoSwapInfo'; -import { usePorticoRelayerFee } from 'hooks/usePorticoRelayerFee'; import { useFetchTokenPrices } from 'hooks/useFetchTokenPrices'; import { useGasSlider } from 'hooks/useGasSlider'; import { useConnectToLastUsedWallet } from 'utils/wallet'; @@ -110,8 +108,8 @@ function Bridge() { route, }); - // Compute and set receive amount - useComputeReceiveAmount({ + // Compute and set quote + useComputeQuote({ sourceChain: fromChain, destChain: toChain, sourceToken: token, @@ -125,7 +123,7 @@ function Bridge() { // Route specific hooks //usePorticoSwapInfo(); - usePorticoRelayerFee(); + //usePorticoRelayerFee(); useFetchTokenPrices(); useConnectToLastUsedWallet(); @@ -174,7 +172,7 @@ function Bridge() { : {} } > - {showGasSlider && } + {showGasSlider && } diff --git a/wormhole-connect/src/views/Bridge/Inputs/AmountInput.tsx b/wormhole-connect/src/views/Bridge/Inputs/AmountInput.tsx index 77343fa39..1c65b9333 100644 --- a/wormhole-connect/src/views/Bridge/Inputs/AmountInput.tsx +++ b/wormhole-connect/src/views/Bridge/Inputs/AmountInput.tsx @@ -13,7 +13,7 @@ import { getTokenPrice, getUSDFormat } from 'utils'; import { TransferSide } from 'config/types'; type Props = { - handleAmountChange: (value: number | string) => void; + handleAmountChange: (value: string) => void; value: string; disabled?: boolean; label?: string; diff --git a/wormhole-connect/src/views/Bridge/Inputs/From.tsx b/wormhole-connect/src/views/Bridge/Inputs/From.tsx index 979db8f1e..bfa9c5f12 100644 --- a/wormhole-connect/src/views/Bridge/Inputs/From.tsx +++ b/wormhole-connect/src/views/Bridge/Inputs/From.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import React, { useCallback, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import type { ChainName } from 'sdklegacy'; @@ -7,21 +7,16 @@ import { setToken, selectFromChain, setAmount, - setReceiveAmount, - setFetchingReceiveAmount, - setReceiveAmountError, isDisabledChain, } from 'store/transferInput'; import config from 'config'; import { TransferWallet } from 'utils/wallet'; -import RouteOperator from 'routes/operator'; import { getTokenPrice, hydrateHrefTemplate } from 'utils'; import Inputs from './Inputs'; import Select from './Select'; import AmountInput from './AmountInput'; import TokensModal from 'components/TokensModal'; import ChainsModal from 'components/ChainsModal'; -import { isPorticoRoute } from 'routes/porticoBridge/utils'; import useGetTokenBalances from 'hooks/useGetTokenBalances'; function FromInputs() { @@ -29,10 +24,6 @@ function FromInputs() { const [showTokensModal, setShowTokensModal] = useState(false); const [showChainsModal, setShowChainsModal] = useState(false); - const { toNativeToken, relayerFee } = useSelector( - (state: RootState) => state.relay, - ); - const portico = useSelector((state: RootState) => state.porticoBridge); const wallet = useSelector((state: RootState) => state.wallet.sending); const { usdPrices: { data }, @@ -41,13 +32,11 @@ function FromInputs() { const { showValidationState: showErrors, validations, - route, fromChain, toChain, token, amount, isTransactionInProgress, - destToken, } = useSelector((state: RootState) => state.transferInput); const tokenConfig = token && config.tokens[token]; const tokenConfigArr = useMemo( @@ -96,67 +85,9 @@ function FromInputs() { /> ); - const computeReceiveAmount = useCallback( - async (value: number | string) => { - if (typeof value === 'number') { - dispatch(setAmount(`${value}`)); - } else { - dispatch(setAmount(value)); - } - const number = - typeof value === 'number' ? value : Number.parseFloat(value); - if (!route) { - dispatch(setReceiveAmount(`${value}`)); - return; - } - try { - const routeOptions = isPorticoRoute(route) - ? portico - : { toNativeToken, relayerFee }; - dispatch(setFetchingReceiveAmount()); - const receiveAmount = await RouteOperator.computeReceiveAmount( - route, - number, - token, - destToken, - fromChain, - toChain, - routeOptions, - ); - dispatch(setReceiveAmount(`${receiveAmount}`)); - } catch { - dispatch(setReceiveAmountError('Error computing receive amount')); - } - }, - [ - dispatch, - toNativeToken, - relayerFee, - route, - token, - destToken, - toChain, - fromChain, - portico, - ], - ); - - // TODO: clean up the send/receive amount set logic - const handleAmountChange = useCallback(computeReceiveAmount, [ - route, - toNativeToken, - relayerFee, - dispatch, - computeReceiveAmount, - ]); - // if route changes, re-calculate the amount - useEffect(() => { - if (!route) return; - computeReceiveAmount(amount); - }, [route, amount, computeReceiveAmount]); const amountInput = ( dispatch(setAmount(amount))} value={amount} side="source" /> diff --git a/wormhole-connect/src/views/Bridge/NativeGasSlider.tsx b/wormhole-connect/src/views/Bridge/NativeGasSlider.tsx index f7933d2db..15962e275 100644 --- a/wormhole-connect/src/views/Bridge/NativeGasSlider.tsx +++ b/wormhole-connect/src/views/Bridge/NativeGasSlider.tsx @@ -1,35 +1,23 @@ import Slider, { SliderThumb } from '@mui/material/Slider'; import { styled } from '@mui/material/styles'; -import { utils } from 'ethers5'; import React, { useEffect, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { makeStyles } from 'tss-react/mui'; import { useDebounce } from 'use-debounce'; import config from 'config'; -import { TokenConfig, Route } from 'config/types'; import { RoutesConfig } from 'config/routes'; -import { - getTokenDecimals, - getDisplayName, - calculateUSDPrice, - getWrappedTokenId, -} from 'utils'; -import { getConversion, toDecimals, toFixedDecimals } from 'utils/balance'; -import RouteOperator from 'routes/operator'; +import { getDisplayName, calculateUSDPrice } from 'utils'; import { RootState } from 'store'; -import { setTransferRoute } from 'store/transferInput'; -import { - setMaxSwapAmt, - setReceiveNativeAmt, - setToNativeToken, -} from 'store/relay'; +import { setToNativeToken } from 'store/relay'; import InputContainer from 'components/InputContainer'; import TokenIcon from 'icons/TokenIcons'; import BridgeCollapse, { CollapseControlStyle } from './Collapse'; import { Banner } from './RouteOptions'; import Price from 'components/Price'; +import { toFixedDecimals } from 'utils/balance'; +import { TokenConfig } from 'config/types'; const useStyles = makeStyles()(() => ({ container: { @@ -50,16 +38,6 @@ const useStyles = makeStyles()(() => ({ }, })); -function label(amt1: number, token1: string, amt2: number, token2: string) { - return ( -
- {toFixedDecimals(`${amt1}`, 4)} {token1} -
- {toFixedDecimals(`${amt2}`, 4)} {token2} -
- ); -} - type SliderProps = { color1: string; color2: string; @@ -84,203 +62,32 @@ const PrettoSlider = styled(Slider)(({ color1, color2 }) => ({ type ThumbProps = React.HTMLAttributes; -function formatAmount(amount?: number): number { - if (!amount) return 0; - let formatted = toFixedDecimals(`${amount}`, 6); - if (amount < 0.000001) formatted = '0'; - return Number.parseFloat(formatted); -} - -const INITIAL_STATE = { - disabled: false, - min: 0, - max: 0, - nativeGas: 0, - nativeGasPrice: '', - token: formatAmount(), - tokenPrice: '', - swapAmt: 0, - conversionRate: undefined as number | undefined, -}; - -function GasSlider(props: { disabled: boolean }) { +function NativeGasSlider(props: { disabled: boolean }) { const { classes } = useStyles(); const dispatch = useDispatch(); - const { token, toChain, amount, route, destToken } = useSelector( + const { token, toChain, amount, route, receiveAmount } = useSelector( (state: RootState) => state.transferInput, ); - const [debouncedAmount] = useDebounce(amount, 500); - const { maxSwapAmt, relayerFee } = useSelector( - (state: RootState) => state.relay, - ); - const amountNum = useMemo(() => { - return Number.parseFloat(debouncedAmount) - (relayerFee || 0); - }, [debouncedAmount, relayerFee]); - const { receiving: receivingWallet } = useSelector( - (state: RootState) => state.wallet, + const receiveNativeAmt = useSelector( + (state: RootState) => state.relay.receiveNativeAmt, ); + const relayerFee = useSelector((state: RootState) => state.relay.relayerFee); const { usdPrices: { data }, } = useSelector((state: RootState) => state.tokenPrices); const prices = data || {}; const destConfig = config.chains[toChain!]; const sendingToken = config.tokens[token]; - const receivingToken = config.tokens[destToken]; const nativeGasToken = config.tokens[destConfig!.gasToken]; - - const [state, setState] = useState(INITIAL_STATE); - const [debouncedSwapAmt] = useDebounce(state.swapAmt, 500); + const [percentage, setPercentage] = useState(0); + const [debouncedPercentage] = useDebounce(percentage, 500); + const [debouncedAmount] = useDebounce(amount, 500); + const amountNum = useMemo(() => { + return Number.parseFloat(debouncedAmount) - (relayerFee || 0); + }, [debouncedAmount, relayerFee]); const [gasSliderCollapsed, setGasSliderCollapsed] = useState(props.disabled); - // set the actual max swap amount (checks if max swap amount is greater than the sending amount) - useEffect(() => { - if ( - !amountNum || - amountNum === 0 || - !maxSwapAmt || - !route || - !RouteOperator.getRoute(route).NATIVE_GAS_DROPOFF_SUPPORTED || - !toChain || - !sendingToken - ) - return; - - let actualMaxSwap = - amountNum && maxSwapAmt && Math.max(Math.min(maxSwapAmt, amountNum), 0); - - if (actualMaxSwap) { - // address the bug that the swapAmount='maxSwapAmount' results in a 'minimumSendAmount' - // that could be higher than 'amount' (due to the buffer packed into minimumSendAmount) - // not a perfect fix for all possible 'getMinSendAmount' functions - but valid for linear ones - // - // For example, if 'amount' is 1.1, and relayerFee is 1, then 'amountNum' (the receive amount) is - // 0.1, and 'actualMaxSwap' is 0.1. - // Now suppose the user sets swapAmt to be 0.1 - so now toNativeToken = 0.1, - // meaning the 'minSendAmount' is getMinSendAmount({toNativeToken: 0.1, relayerFee: 1}) which - // currently is (0.1 + 1)*1.05 = 1.155 - // This is greater than what the current send amount (1.1) is! - // The next two lines remedy this issue by subtracting the difference (1.155-1.1) from - // actualMaxSwap (i.e. bringing it from 0.1 to 0.045) - const theoreticalMinSendAmount = RouteOperator.getRoute( - route, - ).getMinSendAmount(getWrappedTokenId(sendingToken), toChain, { - toNativeToken: actualMaxSwap, - relayerFee, - }); - const buffer = Math.max( - theoreticalMinSendAmount - amountNum - (relayerFee || 0), - 0, - ); - actualMaxSwap = Math.max(Math.min(maxSwapAmt, amountNum - buffer), 0); - } - - const newTokenAmount = amountNum - state.swapAmt; - if (actualMaxSwap === 0) setGasSliderCollapsed(true); - setState((prevState) => ({ - ...prevState, - disabled: amountNum <= 0 || actualMaxSwap === 0, - token: formatAmount(newTokenAmount), - tokenPrice: calculateUSDPrice( - formatAmount(newTokenAmount), - prices, - config.tokens[token], - ), - max: formatAmount(actualMaxSwap), - })); - }, [ - relayerFee, - maxSwapAmt, - amountNum, - route, - state.swapAmt, - data, - token, - toChain, - ]); - - useEffect(() => { - if ( - !toChain || - !sendingToken || - !route || - !RouteOperator.getRoute(route).NATIVE_GAS_DROPOFF_SUPPORTED || - !receivingWallet.address || - !receivingToken - ) { - return; - } - - let cancelled = false; - (async () => { - const tokenId = receivingToken.tokenId!; - - try { - const maxSwapAmount = await RouteOperator.maxSwapAmount( - route, - toChain, - tokenId, - receivingWallet.address, - ); - if (cancelled) return; - if (!maxSwapAmount) { - dispatch(setMaxSwapAmt(undefined)); - return; - } - const toChainDecimals = getTokenDecimals( - config.wh.toChainId(toChain), - tokenId, - ); - const amt = toDecimals(maxSwapAmount, toChainDecimals, 6); - dispatch(setMaxSwapAmt(Number.parseFloat(amt))); - } catch (e: any) { - if (cancelled) return; - if (e.message?.includes('swap rate not set')) { - if (route === Route.CCTPRelay) { - dispatch(setTransferRoute(Route.CCTPManual)); - } else { - dispatch(setTransferRoute(Route.Bridge)); - } - } else { - throw e; - } - } - - // get conversion rate of token - const { gasToken } = config.chains[toChain]!; - const conversionRate = await getConversion(token, gasToken); - if (cancelled) return; - const minNative = await RouteOperator.minSwapAmountNative( - route, - toChain, - tokenId, - receivingWallet.address, - ); - const minNativeAdjusted = Number.parseFloat( - toDecimals( - minNative, - getTokenDecimals(config.wh.toChainId(toChain), 'native'), - ), - ); - if (cancelled) return; - const min = conversionRate ? minNativeAdjusted / conversionRate : 0; - setState((prevState) => ({ ...prevState, conversionRate, min })); - })(); - - return () => { - cancelled = true; - }; - }, [ - sendingToken, - receivingToken, - receivingWallet, - toChain, - route, - token, - destToken, - dispatch, - ]); - function Thumb(props: ThumbProps) { const { children, ...other } = props; return ( @@ -295,127 +102,42 @@ function GasSlider(props: { disabled: boolean }) { setGasSliderCollapsed(collapsed); // user switched off conversion to native gas, so reset values if (collapsed) { - setState((prevState) => ({ - ...prevState, - swapAmt: 0, - nativeGas: 0, - nativeGasPrice: '', - token: formatAmount(amountNum), - tokenPrice: calculateUSDPrice( - formatAmount(amountNum), - prices, - config.tokens[token], - ), - })); - dispatch(setReceiveNativeAmt(0)); + setPercentage(0); + dispatch(setToNativeToken(0)); } }; - // compute amounts on change - const handleChange = (e: any) => { - if (!amountNum || !state.conversionRate) return; - const value = e.target.value < state.min ? 0 : e.target.value; - const newGasAmount = value * state.conversionRate; - const newTokenAmount = amountNum - value; - const swapAmount = value; - const conversion = { - nativeGas: formatAmount(newGasAmount), - nativeGasPrice: calculateUSDPrice( - formatAmount(newGasAmount), - prices, - nativeGasToken, - ), - token: formatAmount(newTokenAmount), - tokenPrice: calculateUSDPrice( - formatAmount(newTokenAmount), - prices, - config.tokens[token], - ), - swapAmt: formatAmount(swapAmount), - }; - setState((prevState) => ({ ...prevState, ...conversion })); - }; - - useEffect(() => { - let cancelled = false; - (async () => { - if ( - !receivingToken || - !sendingToken || - !route || - !receivingWallet.address - ) - return; - dispatch(setToNativeToken(debouncedSwapAmt)); - const tokenId = receivingToken.tokenId!; - const tokenToChainDecimals = getTokenDecimals( - config.wh.toChainId(toChain!), - tokenId, - ); - const formattedAmt = utils.parseUnits( - `${debouncedSwapAmt}`, - tokenToChainDecimals, - ); - const nativeGasAmt = await RouteOperator.nativeTokenAmount( - route, - toChain!, - tokenId, - formattedAmt, - receivingWallet.address, - ); - if (cancelled) return; - const nativeGasTokenToChainDecimals = getTokenDecimals( - config.wh.toChainId(toChain!), - 'native', - ); - const formattedNativeAmt = Number.parseFloat( - toDecimals(nativeGasAmt.toString(), nativeGasTokenToChainDecimals, 6), - ); - dispatch(setReceiveNativeAmt(formattedNativeAmt)); - setState((prevState) => ({ - ...prevState, - nativeGas: formattedNativeAmt, - nativeGasPrice: calculateUSDPrice( - formattedNativeAmt, - prices, - nativeGasToken, - ), - token: formatAmount(amountNum - debouncedSwapAmt), - tokenPrice: calculateUSDPrice( - formatAmount(amountNum - debouncedSwapAmt), - prices, - config.tokens[token], - ), - })); - })(); - return () => { - cancelled = true; - }; - }, [ - debouncedSwapAmt, - dispatch, - nativeGasToken, - receivingWallet.address, - sendingToken, - receivingToken, - toChain, - route, - amountNum, - data, - token, - ]); - const defaultSliderColor = 'white'; // TODO connect to theme const banner = !props.disabled && !!route && ( ); + useEffect(() => { + dispatch(setToNativeToken(debouncedPercentage / 100)); + }, [debouncedPercentage]); + + const nativeGasPrice = useMemo(() => { + return calculateUSDPrice( + toFixedDecimals(receiveNativeAmt?.toString() || '0', 6), + prices, + nativeGasToken, + ); + }, [receiveNativeAmt, nativeGasToken, prices]); + + const tokenPrice = useMemo(() => { + return calculateUSDPrice( + toFixedDecimals(receiveAmount?.data || '0', 6), + prices, + config.tokens[token], + ); + }, [receiveAmount, token, prices]); + return ( - label( - state.nativeGas, - getDisplayName(nativeGasToken), - state.token, - getDisplayName(config.tokens[token]), - ) - } + max={100} + valueLabelFormat={() => `${percentage}%`} valueLabelDisplay="auto" - onChange={handleChange} - marks={ - state.min ? [{ value: state.min, label: 'Min' }] : undefined - } + onChange={(e: any) => setPercentage(e.target.value)} />
- {state.nativeGas} {getDisplayName(nativeGasToken)} + {toFixedDecimals(receiveNativeAmt?.toString() || '0', 6)}{' '} + {getDisplayName(nativeGasToken)}
- {state.nativeGasPrice} + {nativeGasPrice}
@@ -478,10 +191,10 @@ function GasSlider(props: { disabled: boolean }) { icon={(sendingToken as TokenConfig)!.icon} height={16} /> - {state.token}{' '} + {toFixedDecimals(receiveAmount?.data || '0', 6)}{' '} {getDisplayName((sendingToken as TokenConfig)!)}
- {state.tokenPrice} + {tokenPrice}
@@ -494,4 +207,4 @@ function GasSlider(props: { disabled: boolean }) { ); } -export default GasSlider; +export default NativeGasSlider; diff --git a/wormhole-connect/src/views/Bridge/Preview.tsx b/wormhole-connect/src/views/Bridge/Preview.tsx index 446b1fe37..65bde704c 100644 --- a/wormhole-connect/src/views/Bridge/Preview.tsx +++ b/wormhole-connect/src/views/Bridge/Preview.tsx @@ -4,23 +4,12 @@ import { useTheme } from '@mui/material/styles'; import config from 'config'; import { RootState } from 'store'; -import { setTransferRoute } from 'store/transferInput'; -import { setRelayerFee } from 'store/relay'; -import { Route } from 'config/types'; -import { getTokenDecimals } from 'utils'; -import { toDecimals } from 'utils/balance'; -import { toChainId } from 'utils/sdk'; import { TransferDisplayData } from 'routes'; import RouteOperator from 'routes/operator'; import { RenderRows } from 'components/RenderRows'; import BridgeCollapse, { CollapseControlStyle } from './Collapse'; import InputContainer from 'components/InputContainer'; -import { - TokenNotSupportedForRelayError, - TokenNotRegisteredError, -} from 'sdklegacy'; -import { isPorticoRoute } from 'routes/porticoBridge/utils'; const defaultPrices = {}; @@ -47,8 +36,9 @@ function Preview(props: { collapsed: boolean }) { } = useSelector((state: RootState) => state.tokenPrices); const prices = data || defaultPrices; useEffect(() => { + let isActive = true; const buildPreview = async () => { - if (!fromChain || !route) return; + if (!fromChain || !route || !isActive) return; const sourceConfig = toChain && config.chains[fromChain]; const destConfig = toChain && config.chains[toChain]; const tokenConfig = token && config.tokens[token]; @@ -56,13 +46,6 @@ function Preview(props: { collapsed: boolean }) { if (!tokenConfig || !destTokenConfig || !sourceConfig || !destConfig) return; - const routeOptions = isPorticoRoute(route) - ? portico - : { - toNativeToken, - receiveNativeAmt, - relayerFee, - }; const rows = await RouteOperator.getPreview( route, tokenConfig, @@ -74,13 +57,18 @@ function Preview(props: { collapsed: boolean }) { gasEst.claim, receiveAmount.data || '', prices, - routeOptions, + relayerFee, + receiveNativeAmt, ); - setState({ rows }); + if (isActive) { + setState({ rows }); + } }; - buildPreview(); + return () => { + isActive = false; + }; }, [ token, destToken, @@ -98,9 +86,11 @@ function Preview(props: { collapsed: boolean }) { prices, ]); + /* useEffect(() => { + let isActive = true; const computeRelayerFee = async () => { - if (!token || !fromChain || !toChain || !route) return; + if (!token || !fromChain || !toChain || !route || !isActive) return; // don't bother if it's not an automatic route const r = RouteOperator.getRoute(route); if (!r.AUTOMATIC_DEPOSIT) return; @@ -115,12 +105,16 @@ function Preview(props: { collapsed: boolean }) { toChain, token, destToken, + amount, ); if (result === null) return; const { fee, feeToken } = result; const decimals = getTokenDecimals(toChainId(fromChain), feeToken); const formattedFee = Number.parseFloat(toDecimals(fee, decimals, 6)); - dispatch(setRelayerFee(formattedFee)); + if (isActive) { + dispatch(setRelayerFee(formattedFee)); + console.log('setting relayer fee', formattedFee); + } } catch (e: any) { // change to manual if the token is not available either on the relayer // or the wormhole bridge @@ -128,18 +122,25 @@ function Preview(props: { collapsed: boolean }) { e.message === TokenNotSupportedForRelayError.MESSAGE || e.message === TokenNotRegisteredError.MESSAGE ) { - if (route === Route.CCTPRelay) { - dispatch(setTransferRoute(Route.CCTPManual)); - } else { - dispatch(setTransferRoute(Route.Bridge)); + if (isActive) { + if (route === Route.CCTPRelay) { + dispatch(setTransferRoute(Route.CCTPManual)); + } else { + dispatch(setTransferRoute(Route.Bridge)); + } } } else { + console.error('Failed to get relayer fee', e); throw e; } } }; computeRelayerFee(); - }, [route, token, destToken, toChain, fromChain, dispatch]); + return () => { + isActive = false; + }; + }, [route, token, destToken, toChain, fromChain, amount, dispatch]); + */ return ( state.transferInput); + const { toNativeToken } = useSelector((state: RootState) => state.relay); const onSelect = useCallback( (value: Route) => { if (routeStates && routeStates.some((rs) => rs.name === value)) { @@ -402,6 +401,7 @@ function RouteOptions() { debouncedAmount, fromChain, toChain, + { nativeGas: toNativeToken }, ); const supported = await RouteOperator.isRouteSupported( @@ -425,7 +425,15 @@ function RouteOptions() { return () => { isActive = false; }; - }, [dispatch, token, destToken, debouncedAmount, fromChain, toChain]); + }, [ + dispatch, + token, + destToken, + debouncedAmount, + fromChain, + toChain, + toNativeToken, + ]); const allRoutes = useMemo(() => { if (!routeStates) return []; diff --git a/wormhole-connect/src/views/Bridge/Send.tsx b/wormhole-connect/src/views/Bridge/Send.tsx index 620e69333..0bd4c818d 100644 --- a/wormhole-connect/src/views/Bridge/Send.tsx +++ b/wormhole-connect/src/views/Bridge/Send.tsx @@ -23,7 +23,6 @@ import { getTokenDecimals, getWrappedToken, getWrappedTokenId, - sleep, } from 'utils'; import { LINK } from 'utils/style'; import { @@ -31,7 +30,6 @@ import { switchChain, TransferWallet, } from 'utils/wallet'; -import { UnsignedMessage } from 'routes'; import RouteOperator from 'routes/operator'; import { validate, isTransferValid } from 'utils/transferValidation'; import { @@ -45,7 +43,6 @@ import CircularProgress from '@mui/material/CircularProgress'; import AlertBanner from 'components/AlertBanner'; import { isGatewayChain } from 'utils/cosmos'; import { estimateClaimGas, estimateSendGas } from 'utils/gas'; -import { validateSolanaTokenAccount } from '../../utils/transferValidation'; import { useDebounce } from 'use-debounce'; import { isPorticoRoute } from 'routes/porticoBridge/utils'; import { interpretTransferError } from 'utils/errors'; @@ -83,26 +80,19 @@ function Send(props: { valid: boolean }) { amount, route, isTransactionInProgress, - foreignAsset, - associatedTokenAddress, + receiveAmount, } = transferInput; const [debouncedAmount] = useDebounce(amount, 500); const wallet = useSelector((state: RootState) => state.wallet); const { sending, receiving } = wallet; const relay = useSelector((state: RootState) => state.relay); - const { toNativeToken, relayerFee } = relay; + const { toNativeToken, relayerFee, receiveNativeAmt } = relay; const portico = useSelector((state: RootState) => state.porticoBridge); const [isConnected, setIsConnected] = useState( sending.currentAddress.toLowerCase() === sending.address.toLowerCase(), ); const [sendError, setSendError] = useState(''); - const solanaTokenAccountError = validateSolanaTokenAccount( - toChain, - foreignAsset, - associatedTokenAddress, - route, - ); const routeContext = useContext(RouteContext); @@ -161,8 +151,6 @@ function Send(props: { valid: boolean }) { await switchChain(fromConfig.chainId, TransferWallet.SENDING); } - const routeOptions = isPorticoRoute(route) ? portico : { toNativeToken }; - config.triggerEvent({ type: 'transfer.initiate', details: transferDetails, @@ -178,7 +166,7 @@ function Send(props: { valid: boolean }) { toChain!, receiving.address, destToken, - routeOptions, + { nativeGas: toNativeToken }, ); console.log('send done', sendResult); @@ -187,81 +175,48 @@ function Send(props: { valid: boolean }) { details: transferDetails, }); + const [sdkRoute, receipt] = sendResult; let txId = ''; - - // TODO SDKv2 HACK - // Legacy routes return a mere string (tx id) - // SDKv2 routes return a Receipt, which has its own nice way of - // awaiting for the transaction to complete. - // - // This means we don't need to use getMessage() on the SDKv2Route class - if (typeof sendResult === 'string') { - // Legacy route - // Wait for the VAA to be available - // In this case, sendResult is a txId - txId = sendResult; - let message: UnsignedMessage | undefined; - while (message === undefined) { - try { - message = await RouteOperator.getMessage( - route, - sendResult, - fromChain!, - true, // don't need to get the signed attestation - ); - } catch (e) { - console.error(e); - } - if (message === undefined) { - await sleep(3000); - } - } - - // TODO THERE IS NO ANALOGUE OF THIS FOR SDKv2 AHHHH - dispatch(setTxDetails(message)); + if ('originTxs' in receipt) { + txId = receipt.originTxs[receipt.originTxs.length - 1].txid; } else { - // SDKv2 Receipt - // SDKv2Route handles waiting for completion internally so there's nothing else to do here - const [sdkRoute, receipt] = sendResult; - if ('originTxs' in receipt) { - txId = receipt.originTxs[receipt.originTxs.length - 1].txid; - } - // TODO: SDKV2 set the tx details using on-chain data - // because they might be different than what we have in memory (relayer fee) - // or we may not have all the data (e.g. block) - dispatch( - setTxDetails({ - sendTx: txId, - sender: sending.address, - amount, - payloadID: sdkRoute.IS_AUTOMATIC ? 1 : 3, // TODO: don't need this - recipient: receiving.address, - toChain: config.sdkConverter.toChainNameV1(receipt.to), - fromChain: config.sdkConverter.toChainNameV1(receipt.from), - tokenAddress: getWrappedToken(sendToken).tokenId!.address, - tokenChain: config.sdkConverter.toChainNameV1(receipt.from), - tokenId: getWrappedTokenId(sendToken), - tokenKey: sendToken.key, - tokenDecimals: getTokenDecimals( - config.wh.toChainId(fromChain!), - getWrappedTokenId(sendToken), - ), - receivedTokenKey: config.tokens[destToken].key!, // TODO: wrong - emitterAddress: undefined, - sequence: undefined, - block: 0, - gasFee: undefined, - payload: undefined, - inputData: undefined, - relayerPayloadId: undefined, - to: undefined, - relayerFee: undefined, - toNativeTokenAmount: undefined, - }), - ); - routeContext.setRoute(sdkRoute); - routeContext.setReceipt(receipt); + throw new Error("Can't find txid in receipt"); } + // TODO: SDKV2 set the tx details using on-chain data + // because they might be different than what we have in memory (relayer fee) + // or we may not have all the data (e.g. block) + // TODO: we don't need all of these details + // The SDK should provide a way to get the details from the chain (e.g. route.lookupSourceTxDetails) + dispatch( + setTxDetails({ + sendTx: txId, + sender: sending.address, + amount, + recipient: receiving.address, + toChain: config.sdkConverter.toChainNameV1(receipt.to), + fromChain: config.sdkConverter.toChainNameV1(receipt.from), + tokenAddress: getWrappedToken(sendToken).tokenId!.address, + tokenChain: config.sdkConverter.toChainNameV1(receipt.from), + tokenId: getWrappedTokenId(sendToken), + tokenKey: sendToken.key, + tokenDecimals: getTokenDecimals( + config.wh.toChainId(fromChain!), + getWrappedTokenId(sendToken), + ), + receivedTokenKey: config.tokens[destToken].key!, // TODO: possibly wrong (e..g if portico swap fails) + emitterAddress: undefined, + sequence: undefined, + block: 0, + gasFee: undefined, + payload: undefined, + inputData: undefined, + relayerFee: relayerFee?.toString() || '', + receiveAmount: receiveAmount.data || '', + receiveNativeAmount: receiveNativeAmt, + }), + ); + routeContext.setRoute(sdkRoute); + routeContext.setReceipt(receipt); dispatch(setIsTransactionInProgress(false)); dispatch(setSendTx(txId)); @@ -315,8 +270,7 @@ function Send(props: { valid: boolean }) { route, ]); - const disabled = - isTransactionInProgress || !!solanaTokenAccountError || config.previewMode; + const disabled = isTransactionInProgress || config.previewMode; const setDestGas = useCallback(async () => { if (!route || !toChain) return; diff --git a/wormhole-connect/src/views/Redeem/Confirmations.tsx b/wormhole-connect/src/views/Redeem/Confirmations.tsx index 74c5bc5fb..7d97e3a90 100644 --- a/wormhole-connect/src/views/Redeem/Confirmations.tsx +++ b/wormhole-connect/src/views/Redeem/Confirmations.tsx @@ -86,14 +86,16 @@ function Confirmations(props: Props) { return chainConfig.finalityThreshold - blockDiff; }, [chainConfig.finalityThreshold, currentBlock, requiredHeight]); - // Percentage of the confirmations completed - const percentage = useMemo( - () => - chainConfig.finalityThreshold === 0 - ? 100 - : Math.floor((confirmations / chainConfig.finalityThreshold) * 100), - [chainConfig.finalityThreshold, confirmations], - ); + //// Percentage of the confirmations completed + //const percentage = useMemo( + // () => + // chainConfig.finalityThreshold === 0 + // ? 100 + // : Math.floor((confirmations / chainConfig.finalityThreshold) * 100), + // [chainConfig.finalityThreshold, confirmations], + //); + + const percentage = 100; return (
diff --git a/wormhole-connect/src/views/Redeem/Redeem.tsx b/wormhole-connect/src/views/Redeem/Redeem.tsx index 4fe211544..87051b2d3 100644 --- a/wormhole-connect/src/views/Redeem/Redeem.tsx +++ b/wormhole-connect/src/views/Redeem/Redeem.tsx @@ -6,13 +6,12 @@ import { RootState } from 'store'; import { setInvalidVaa, setIsVaaEnqueued, - setSignedMessage, setTransferComplete, } from 'store/redeem'; import { sleep } from 'utils'; import { fetchIsVAAEnqueued } from 'utils/vaa'; -import { SignedMessage, isNttRoute } from 'routes'; -import { ParsedMessage, ParsedRelayerMessage } from 'utils/sdk'; +import { isNttRoute } from 'routes'; +import { ParsedMessage } from 'utils/sdk'; import PageHeader from 'components/PageHeader'; import Spacer from 'components/Spacer'; @@ -20,7 +19,7 @@ import ChainsTag from './Tag'; import Stepper from './Stepper'; import GovernorEnqueuedWarning from './GovernorEnqueuedWarning'; import config from 'config'; -import useDeliveryStatus from 'hooks/useDeliveryStatus'; +// import useDeliveryStatus from 'hooks/useDeliveryStatus'; import useCheckInboundQueuedTransfer from 'hooks/useCheckInboundQueuedTransfer'; import useConfirmBeforeLeaving from 'utils/confirmBeforeLeaving'; @@ -28,7 +27,6 @@ import useConfirmBeforeLeaving from 'utils/confirmBeforeLeaving'; import useTrackTransfer from 'hooks/useTrackTransfer'; function Redeem({ - setSignedMessage, setIsVaaEnqueued, setInvalidVaa, setTransferComplete, @@ -37,18 +35,15 @@ function Redeem({ isVaaEnqueued, isResumeTx, route, - signedMessage, }: { - setSignedMessage: (signed: SignedMessage) => any; setIsVaaEnqueued: (isVaaEnqueued: boolean) => any; setInvalidVaa: (invalidVaa: boolean) => void; setTransferComplete: any; - txData: ParsedMessage | ParsedRelayerMessage | undefined; + txData: ParsedMessage | undefined; transferComplete: boolean; isVaaEnqueued: boolean; isResumeTx: boolean; route: Route | undefined; - signedMessage: SignedMessage | undefined; }) { // Warn user before closing tab if transaction is unredeemed useConfirmBeforeLeaving(!transferComplete); @@ -58,7 +53,6 @@ function Redeem({ if ( !txData?.sendTx || !txData.emitterAddress || // no VAA exists, e.g. CCTP route - !!signedMessage || // if we have the VAA, then it's not enqueued isNttRoute(route) // NTT route doesn't use token bridge / governor ) { return; @@ -81,7 +75,7 @@ function Redeem({ return () => { cancelled = true; }; - }, [txData, signedMessage, route, setIsVaaEnqueued]); + }, [txData, route, setIsVaaEnqueued]); //// fetch the VAA //useEffect(() => { @@ -167,7 +161,7 @@ function Redeem({ //}, [route, txData, transferComplete, setTransferComplete, signedMessage]); useCheckInboundQueuedTransfer(); - useDeliveryStatus(); + // useDeliveryStatus(); useTrackTransfer(); return txData?.fromChain ? ( @@ -189,10 +183,7 @@ function Redeem({ - +
) : ( @@ -208,7 +199,6 @@ function mapStateToProps(state: RootState) { isResumeTx, isInvalidVaa, route, - signedMessage, } = state.redeem; return { @@ -218,14 +208,11 @@ function mapStateToProps(state: RootState) { isResumeTx, isInvalidVaa, route, - signedMessage, }; } const mapDispatchToProps = (dispatch: any) => { return { - setSignedMessage: (signed: SignedMessage) => - dispatch(setSignedMessage(signed)), setIsVaaEnqueued: (isVaaEnqueued: boolean) => dispatch(setIsVaaEnqueued(isVaaEnqueued)), setInvalidVaa: (isInvalidVaa: boolean) => diff --git a/wormhole-connect/src/views/Redeem/SendFrom.tsx b/wormhole-connect/src/views/Redeem/SendFrom.tsx index b93432886..bc3a383e8 100644 --- a/wormhole-connect/src/views/Redeem/SendFrom.tsx +++ b/wormhole-connect/src/views/Redeem/SendFrom.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useContext, useEffect, useState } from 'react'; import { useSelector } from 'react-redux'; import InputContainer from 'components/InputContainer'; @@ -7,21 +7,22 @@ import { RootState } from 'store'; import { TransferDisplayData } from 'routes'; import RouteOperator from 'routes/operator'; -import Confirmations from './Confirmations'; import Header from './Header'; +import Confirmations from './Confirmations'; +import { RouteContext } from 'contexts/RouteContext'; +import { TransferState } from '@wormhole-foundation/sdk'; function SendFrom() { - const { txData, route, signedMessage } = useSelector( - (state: RootState) => state.redeem, - ); - const transferComplete = useSelector( - (state: RootState) => state.redeem.transferComplete, - ); + const { txData, route } = useSelector((state: RootState) => state.redeem); const { usdPrices: { data }, } = useSelector((state: RootState) => state.tokenPrices); const prices = data || {}; const [rows, setRows] = useState([] as TransferDisplayData); + const routeContext = useContext(RouteContext); + const isAttested = + routeContext.receipt && + routeContext.receipt.state >= TransferState.Attested; useEffect(() => { if (!txData || !route) return; @@ -43,7 +44,7 @@ function SendFrom() { /> - {!transferComplete && !signedMessage && ( + {!isAttested && ( )} diff --git a/wormhole-connect/src/views/Redeem/SendTo.tsx b/wormhole-connect/src/views/Redeem/SendTo.tsx index 8ee0b6daa..92ccd2b62 100644 --- a/wormhole-connect/src/views/Redeem/SendTo.tsx +++ b/wormhole-connect/src/views/Redeem/SendTo.tsx @@ -15,9 +15,8 @@ import { setTransferDestInfo, setRedeemTx, setTransferComplete, - setTxDetails, } from 'store/redeem'; -import { displayAddress, getTokenById /*getWrappedTokenId*/ } from 'utils'; +import { displayAddress /*getWrappedTokenId*/ } from 'utils'; import RouteOperator from 'routes/operator'; import { TransferWallet, @@ -33,11 +32,7 @@ import { RenderRows } from 'components/RenderRows'; import Spacer from 'components/Spacer'; import WalletsModal from '../WalletModal'; import Header from './Header'; -import { estimateClaimGas } from 'utils/gas'; import { isGatewayChain } from '../../utils/cosmos'; -import { PayloadType /*solanaContext*/ } from '../../utils/sdk'; -import { AssociatedTokenWarning } from '../Bridge/Inputs/TokenWarnings'; -import { Route } from 'config/types'; import SwitchToManualClaim from './SwitchToManualClaim'; import { isPorticoRoute } from 'routes/porticoBridge/utils'; import { getTokenDetails } from 'telemetry'; @@ -46,49 +41,12 @@ import { RouteContext } from 'contexts/RouteContext'; import { isRedeemed, routes } from '@wormhole-foundation/sdk'; import { SDKv2Signer } from 'routes/sdkv2/signer'; -function AssociatedTokenAlert() { - const dispatch = useDispatch(); - const txData = useSelector((state: RootState) => state.redeem.txData)!; - const wallet = useSelector((state: RootState) => state.wallet.receiving); - - const createAssociatedTokenAccount = useCallback(async () => { - const receivedToken = config.tokens[txData.receivedTokenKey]; - const token = - receivedToken?.nativeChain === 'solana' - ? receivedToken - : getTokenById(txData.tokenId); - if (!token) return; - /* - * TODO SDKV2 - const tokenId = getWrappedTokenId(token); - const tx = await solanaContext().createAssociatedTokenAccount( - tokenId, - wallet.address, - 'finalized', - ); - // if `tx` is null it means the account already exists - if (!tx) return; - await signAndSendTransaction('solana', tx, TransferWallet.RECEIVING); - */ - dispatch(setTxDetails({ ...txData, recipient: wallet.address })); - }, [txData, wallet.address, dispatch]); - - const content = ( - - ); - - return ; -} - function SendTo() { const dispatch = useDispatch(); const { redeemTx, transferComplete, route: routeName, - signedMessage, } = useSelector((state: RootState) => state.redeem); const txData = useSelector((state: RootState) => state.redeem.txData)!; const wallet = useSelector((state: RootState) => state.wallet.receiving); @@ -127,9 +85,11 @@ function SendTo() { // get the redeem tx, for automatic transfers only const getRedeemTx = useCallback(async () => { + // TODO: fetch redeem tx from wormholescan or sdk + /* if (!routeName) return; if (redeemTx) return redeemTx; - if (signedMessage && routeName) { + if (routeName) { const redeemedTransactionHash = await RouteOperator.tryFetchRedeemTx( routeName, signedMessage, @@ -139,7 +99,9 @@ function SendTo() { return redeemedTransactionHash; } } - }, [redeemTx, routeName, signedMessage, dispatch]); + */ + return undefined; + }, [redeemTx, routeName, dispatch]); useEffect(() => { if (!txData || !routeName) return; @@ -150,14 +112,6 @@ function SendTo() { } catch (e) { console.error(`could not fetch redeem event:\n${e}`); } - let gasEstimate; - if (!receiveTx) { - gasEstimate = await estimateClaimGas( - routeName, - txData.toChain, - signedMessage, - ); - } dispatch(setTransferDestInfo(undefined)); try { const info = await RouteOperator.getTransferDestInfo(routeName, { @@ -165,7 +119,6 @@ function SendTo() { tokenPrices: prices, receiveTx, transferComplete, - gasEstimate, }); dispatch(setTransferDestInfo(info)); } catch (e) { @@ -173,15 +126,7 @@ function SendTo() { } }; populate(); - }, [ - transferComplete, - getRedeemTx, - txData, - routeName, - signedMessage, - dispatch, - data, - ]); + }, [transferComplete, getRedeemTx, txData, routeName, dispatch, data]); useEffect(() => { setIsConnected(checkConnection()); @@ -252,6 +197,7 @@ function SendTo() { txData.toChain, wallet.address, {}, + TransferWallet.RECEIVING, ); const result = await route.complete(signer, routeContext.receipt!); if (!isRedeemed(result)) { @@ -294,12 +240,6 @@ function SendTo() { } }; - // sometimes the ATA might be closed even after the transfer began - const missingATA = - txData.recipient === '' && - txData.toChain === 'solana' && - txData.payloadID === PayloadType.Manual; - const loading = !AUTOMATIC_DEPOSIT ? inProgress && !transferComplete : !transferComplete && !manualClaim; @@ -309,17 +249,20 @@ function SendTo() { : claimError ? 'Error please retry . . .' : 'Claim below'; - const showSwitchToManualClaim = - !transferComplete && - (routeName === Route.Relay || isPorticoRoute(routeName as Route)); - let manualClaimTitle = ''; - if (showSwitchToManualClaim) { - manualClaimTitle = - 'This option avoids the relayer fee but requires you to pay the gas fee on the destination chain.'; - if (routeName === Route.Relay) { - manualClaimTitle += ' You will not receive any native gas.'; - } - } + // TODO: add manual claim to automatic route in SDK + const showSwitchToManualClaim = false; + const manualClaimTitle = ''; + //const showSwitchToManualClaim = + // !transferComplete && + // (routeName === Route.Relay || isPorticoRoute(routeName as Route)); + //let manualClaimTitle = ''; + //if (showSwitchToManualClaim) { + // manualClaimTitle = + // 'This option avoids the relayer fee but requires you to pay the gas fee on the destination chain.'; + // if (routeName === Route.Relay) { + // manualClaimTitle += ' You will not receive any native gas.'; + // } + //} const { previewMode } = config; @@ -347,13 +290,6 @@ function SendTo() { - {missingATA && ( - <> - - - - )} - {/* Claim button for manual transfers */} {!transferComplete && (!AUTOMATIC_DEPOSIT || manualClaim) && ( <> diff --git a/wormhole-connect/src/views/Redeem/Tag.tsx b/wormhole-connect/src/views/Redeem/Tag.tsx index 86b473157..f182aedc1 100644 --- a/wormhole-connect/src/views/Redeem/Tag.tsx +++ b/wormhole-connect/src/views/Redeem/Tag.tsx @@ -38,21 +38,20 @@ const useStyles = makeStyles()((theme) => ({ function ChainsTag() { const { classes } = useStyles(); const txData = useSelector((state: RootState) => state.redeem.txData)!; - const signedMessage = useSelector( - (state: RootState) => state.redeem.signedMessage, - ); const fromChainConfig = config.chains[txData.fromChain]!; const toChainConfig = config.chains[txData.toChain]!; - const sendTx = txData.sendTx || signedMessage?.sendTx; - const sequence = txData.sequence || signedMessage?.sequence; - const baseEmitter = txData.emitterAddress || signedMessage?.emitterAddress; + const sendTx = txData.sendTx; + const sequence = txData.sequence; + const baseEmitter = txData.emitterAddress; const emitter = baseEmitter ? stripHexPrefix(baseEmitter) : undefined; const link = useMemo(() => { + console.log(txData, sendTx); if (!txData) return; // As of 2023-10-12, wormscan only supports tx lookup on EVM chains (before a VAA is generated) + console.log(fromChainConfig.id); if (isEvmChain(fromChainConfig.id) && sendTx) { return `${WORMSCAN}tx/${sendTx}${ config.isMainnet ? '' : '?network=TESTNET' diff --git a/wormhole-connect/src/views/TxSearch.tsx b/wormhole-connect/src/views/TxSearch.tsx index 6bd443679..777c81ee2 100644 --- a/wormhole-connect/src/views/TxSearch.tsx +++ b/wormhole-connect/src/views/TxSearch.tsx @@ -1,17 +1,13 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useContext, useEffect, useState } from 'react'; import { makeStyles } from 'tss-react/mui'; import { useDispatch } from 'react-redux'; import { Select, MenuItem, CircularProgress } from '@mui/material'; import type { ChainName } from 'sdklegacy'; -import config from 'config'; +import config, { getWormholeContextV2 } from 'config'; import { isValidTxId } from 'utils'; import RouteOperator from 'routes/operator'; -import { - setTxDetails, - setRoute as setRedeemRoute, - setIsResumeTx, -} from 'store/redeem'; +import { setRoute as setRedeemRoute, setIsResumeTx } from 'store/redeem'; import { setRoute as setAppRoute } from 'store/router'; import PageHeader from 'components/PageHeader'; import Search from 'components/Search'; @@ -21,6 +17,8 @@ import AlertBanner from 'components/AlertBanner'; import { setToChain } from 'store/transferInput'; import FooterNavBar from 'components/FooterNavBar'; import { useExternalSearch } from 'hooks/useExternalSearch'; +import { getRoute } from 'routes/mappings'; +import { RouteContext } from 'contexts/RouteContext'; const useStyles = makeStyles()((theme) => ({ container: { @@ -66,6 +64,8 @@ function TxSearch() { const [error, setError] = useState(''); const [loading, setLoading] = useState(false); + const routeContext = useContext(RouteContext); + function setChain(e: any) { setState((prevState) => ({ ...prevState, chain: e.target.value })); } @@ -83,21 +83,52 @@ function TxSearch() { } try { setLoading(true); - const route = await RouteOperator.getRouteFromTx( - state.tx, - state.chain as ChainName, - ); - const message = await RouteOperator.getMessage( - route, + const { route, receipt } = await RouteOperator.getRouteFromTx( state.tx, - state.chain as ChainName, + config.sdkConverter.toChainV2(state.chain as ChainName), ); + const wh = await getWormholeContextV2(); + const sdkRoute = new (getRoute(route).rc)(wh); setError(''); - dispatch(setTxDetails(message)); + // TODO: these details are a placeholder + // dispatch(setTxDetails(message)); + //dispatch( + // setTxDetails({ + // sendTx: txId, + // sender: sending.address, + // amount, + // payloadID: sdkRoute.IS_AUTOMATIC ? 1 : 3, // TODO: don't need this + // recipient: receiving.address, + // toChain: config.sdkConverter.toChainNameV1(receipt.to), + // fromChain: config.sdkConverter.toChainNameV1(receipt.from), + // tokenAddress: getWrappedToken(sendToken).tokenId!.address, + // tokenChain: config.sdkConverter.toChainNameV1(receipt.from), + // tokenId: getWrappedTokenId(sendToken), + // tokenKey: sendToken.key, + // tokenDecimals: getTokenDecimals( + // config.wh.toChainId(fromChain!), + // getWrappedTokenId(sendToken), + // ), + // receivedTokenKey: config.tokens[destToken].key!, // TODO: wrong + // emitterAddress: undefined, + // sequence: undefined, + // block: 0, + // gasFee: undefined, + // payload: undefined, + // inputData: undefined, + // relayerPayloadId: undefined, + // to: undefined, + // relayerFee: undefined, + // toNativeTokenAmount: undefined, + // }), + //), dispatch(setIsResumeTx(true)); // To avoid send transfer.success event in Resume Transaction case dispatch(setRedeemRoute(route)); dispatch(setAppRoute('redeem')); - dispatch(setToChain(message.toChain)); + dispatch(setToChain(config.sdkConverter.toChainNameV1(receipt.to))); + + routeContext.setRoute(sdkRoute); + routeContext.setReceipt(receipt); } catch (e) { console.error(e); setError(