@wormhole-foundation/wormhole-connect 3.0.2-beta.0-development → 3.0.2-beta.1-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/{basic-ChNCp6rI.js → basic-PUjrTVXb.js} +1 -1
- package/dist/assets/{evm-DSirgd5b.js → evm-CO5UWnAY.js} +2 -2
- package/dist/assets/{index-L-lC4rqb.js → index-1lzfHdT2.js} +1 -1
- package/dist/assets/{index-CHfaLf5J.js → index-DBVZDYF7.js} +1 -1
- package/dist/assets/index-DKlPX3ZI.js +1 -0
- package/dist/assets/{index-BtCrMDAu.js → index-Ddk7n7Ti.js} +1 -1
- package/dist/assets/{index-HhyysXFu.js → index-DyUmO4PR.js} +1 -1
- package/dist/assets/{index-BiwA3Bbq.js → index-MMzKxP1N.js} +1 -1
- package/dist/assets/{secp256k1-Cd7rIav0.js → secp256k1-0LtSM2L1.js} +1 -1
- package/dist/assets/{secp256k1-BQBOR8e3.js → secp256k1-DwTU3j1N.js} +1 -1
- package/dist/assets/{solana-DcwLWeKT.js → solana-DlGdMBSL.js} +4 -4
- package/dist/assets/{w3m-modal-DdptuLHe.js → w3m-modal-DD9Jgepz.js} +1 -1
- package/dist/main.js +72 -70
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/config/tokens.d.ts +1 -1
- package/dist/src/config/tokens.d.ts.map +1 -1
- package/dist/src/exports/index.d.ts +2 -2
- package/dist/src/exports/index.d.ts.map +1 -1
- package/dist/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/dist/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/dist/src/icons/PoweredBy.d.ts.map +1 -1
- package/dist/src/icons/Routing.d.ts +5 -0
- package/dist/src/icons/Routing.d.ts.map +1 -0
- package/dist/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/dist/src/store/transferInput.d.ts +1 -1
- package/dist/src/store/transferInput.d.ts.map +1 -1
- package/dist/src/utils/coingecko.d.ts.map +1 -1
- package/dist/src/utils/formatNumber.d.ts +23 -0
- package/dist/src/utils/formatNumber.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +3 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/routes.d.ts +12 -0
- package/dist/src/utils/routes.d.ts.map +1 -0
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/dist/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/account-Br8E7RB6.js +1 -0
- package/lib/{account-BTK2b2Fv.mjs → account-CVa_3S2g.mjs} +1 -1
- package/lib/{address-8wLqn60W.mjs → address-BApwdEpr.mjs} +96 -96
- package/lib/address-BwQqFkyh.js +1 -0
- package/lib/address-C2pxq9b2.js +1 -0
- package/lib/{address-n0gAFMrZ.mjs → address-f6joE_ig.mjs} +12 -12
- package/lib/aptos-CMRGggVs.js +2 -0
- package/lib/{aptos-CK-j196x.js → aptos-CTKQNmlP.js} +1 -1
- package/lib/{aptos-B-DJQlwt.mjs → aptos-CfFbx7uf.mjs} +9 -9
- package/lib/{aptos-Bwcz9wZX.mjs → aptos-fozuppXh.mjs} +3 -3
- package/lib/{basic-DHWVLmCq.mjs → basic-BA2aRJJn.mjs} +2 -2
- package/lib/{basic-B5ZFelC_.js → basic-DUWaF2I0.js} +1 -1
- package/lib/{basic-E2M-9h1u.js → basic-DeiUayOA.js} +1 -1
- package/lib/{basic-Pour9Ggp.mjs → basic-DoC8u7J8.mjs} +2 -2
- package/lib/{blake2b-C5HyObld.mjs → blake2b-BGxWUAjG.mjs} +23 -23
- package/lib/blake2b-Fj1aPKgL.js +1 -0
- package/lib/{browser-ponyfill-jK8MKVVg.mjs → browser-ponyfill-D5AN8ZPp.mjs} +1 -1
- package/lib/browser-ponyfill-Dn6gsMYK.js +2 -0
- package/lib/{chain-Bm6u6eUF.mjs → chain-DAw2I5H8.mjs} +1 -1
- package/lib/chain-DnPXlO8g.js +1 -0
- package/lib/chunk-KJH4KKG6-BjF7YUcU.js +470 -0
- package/lib/{chunk-KJH4KKG6-DJsu-Y-X.mjs → chunk-KJH4KKG6-DmVjhXO7.mjs} +144 -144
- package/lib/{constants-Cf2YMjNo.js → constants-BtNs_2F4.js} +1 -1
- package/lib/{constants-B7AbX6qr.mjs → constants-Dcc2nVaW.mjs} +3 -3
- package/lib/contract-BEHYQLvJ.js +1 -0
- package/lib/{contract-llnN6ki0.mjs → contract-BkMAZomO.mjs} +123 -123
- package/lib/{core-CF5c7Vev.mjs → core-BHV42Qa0.mjs} +25 -26
- package/lib/core-CV23yxnG.js +889 -0
- package/lib/create-CHcGblj6.js +1 -0
- package/lib/{create-Dm87_0zG.mjs → create-CKLtL7hr.mjs} +1 -1
- package/lib/{evm-BYIGg8e4.mjs → evm-Bf7qbM19.mjs} +42 -42
- package/lib/{evm-B2hUWkt7.js → evm-ClWkquRx.js} +2 -2
- package/lib/{evm-fvvpk-li.mjs → evm-DhMoy8cH.mjs} +6 -6
- package/lib/{evm-DFNbMHoa.js → evm-tXmzU9Xp.js} +2 -2
- package/lib/executor.js +1 -1
- package/lib/executor.mjs +145 -138
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{index-Cwo5AKUC.mjs → index-1rCCpdwd.mjs} +5 -5
- package/lib/{index-DBCa3k0j.mjs → index-3HvzWPL7.mjs} +9 -9
- package/lib/{index-MOwE6ses.mjs → index-B7ztYPhr.mjs} +21 -22
- package/lib/index-BM-0SeYB.js +1 -0
- package/lib/{index-DiQ8Ytrt.mjs → index-BTnpftLz.mjs} +1 -1
- package/lib/{index-BiCMaXJS.js → index-BWQMi6Rj.js} +1 -1
- package/lib/index-BbgKw2pu.js +1 -0
- package/lib/index-BblcpkoK.js +1 -0
- package/lib/index-Bfblsmud.js +1 -0
- package/lib/{index-C_0yAOSX.mjs → index-BfkFXEnG.mjs} +25082 -24072
- package/lib/{index-fi1sh8vr.mjs → index-BijBPDRn.mjs} +2 -2
- package/lib/index-BoquY9R2.js +337 -0
- package/lib/index-C2NtsO9Q.js +1 -0
- package/lib/{index-CNuk-XLX.mjs → index-C4JmrizV.mjs} +4 -4
- package/lib/index-C8TtXpOf.js +1 -0
- package/lib/index-CB8kOyIP.js +1 -0
- package/lib/index-CInVjUCW.js +1 -0
- package/lib/{index-BF11RebI.mjs → index-CLTklDbp.mjs} +1 -1
- package/lib/index-CQvgeH_r.js +1 -0
- package/lib/{index-DzYjoSJp.mjs → index-CUnOYRFQ.mjs} +23 -24
- package/lib/{index-DGh9LzN1.mjs → index-CWe_BTdo.mjs} +31 -31
- package/lib/{index-2Bz1Np4K.mjs → index-CZ91lJ9M.mjs} +5 -5
- package/lib/{index-Dgy1FO7C.js → index-CgyVnj6U.js} +1 -1
- package/lib/{index-BzJcFdt_.mjs → index-Clr2JjoJ.mjs} +44 -44
- package/lib/index-CnnCCv6Q.js +1 -0
- package/lib/{index-CJnRWlFf.mjs → index-CwxGLNEk.mjs} +48 -49
- package/lib/index-D7BLfz05.js +1 -0
- package/lib/index-DM7C-wvQ.js +3 -0
- package/lib/{index-DhIh3xiW.mjs → index-DNy_sNGr.mjs} +8 -8
- package/lib/{index-BZaRg0yd.mjs → index-DVcaDWmz.mjs} +1 -1
- package/lib/{index-CsAigASU.mjs → index-DWOP9OBp.mjs} +17 -17
- package/lib/{index-CTLz8Fz0.mjs → index-Dda5qc2t.mjs} +13 -14
- package/lib/{index-CLBXF_zH.mjs → index-DeaiBvpG.mjs} +16 -16
- package/lib/index-HOuGP-7b.js +1 -0
- package/lib/{index-Dt2uNp-N.mjs → index-KZve3tYJ.mjs} +4 -4
- package/lib/{index-CJDBidKv.mjs → index-SIyXqCAN.mjs} +41 -41
- package/lib/index-WhVYPMUr.js +1 -0
- package/lib/index-hmjT4xa7.js +1 -0
- package/lib/index-ledagFNU.js +1 -0
- package/lib/index-pbRVlgcN.js +1 -0
- package/lib/{index-BpQXUhR4.mjs → index-qK7AyMAk.mjs} +23 -27
- package/lib/index-ttZu99PZ.js +1 -0
- package/lib/{index.es-BqRBGIq6.mjs → index.es-BXRQf6Oi.mjs} +25 -26
- package/lib/index.es-BjGaOok5.js +11 -0
- package/lib/index.es-D6S74vhi.js +27 -0
- package/lib/{index.es-DgCZuUzB.mjs → index.es-cOw8juwf.mjs} +741 -737
- package/lib/index.js +1 -1
- package/lib/index.mjs +17 -16
- package/lib/mayan.js +3 -3
- package/lib/mayan.mjs +918 -891
- package/lib/mint-CL36R6ED.js +1 -0
- package/lib/{mint-Dc-VsiAn.mjs → mint-DunEG1jV.mjs} +32 -33
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +2332 -2373
- package/lib/platform-7vCWzCny.js +1 -0
- package/lib/platform-BKhoO9So.js +1 -0
- package/lib/{platform-B95L0Vxv.mjs → platform-BN6LFtXE.mjs} +16 -16
- package/lib/{platform-DnP_1wGA.mjs → platform-BYLu9SzP.mjs} +4 -4
- package/lib/platform-Bbe26nx7.js +1 -0
- package/lib/{platform-DiG7WY9Z.mjs → platform-DCgWqmh1.mjs} +4 -4
- package/lib/{provider-jsonrpc-CRABh2gN.mjs → provider-jsonrpc-Bmgnrmpy.mjs} +155 -155
- package/lib/provider-jsonrpc-CbtP2Ffg.js +1 -0
- package/lib/{secp256k1-zHHDNAlH.mjs → secp256k1-BDQEvyHq.mjs} +1 -1
- package/lib/{secp256k1-obBDPYM-.mjs → secp256k1-C77Oh9AA.mjs} +1 -1
- package/lib/{secp256k1-2hq3Jk4g.mjs → secp256k1-CCn2vlXj.mjs} +1 -1
- package/lib/{secp256k1-B94G4gyy.js → secp256k1-CHAR40au.js} +1 -1
- package/lib/{secp256k1-DCcAh19h.js → secp256k1-D-DmPYcJ.js} +1 -1
- package/lib/{secp256k1-CjndBUS7.js → secp256k1-DYWDlveU.js} +1 -1
- package/lib/{signer-N_ccpPOz.mjs → signer-BIcn81N5.mjs} +18 -18
- package/lib/signer-H7atraks.js +1 -0
- package/lib/{solana-_Ha4YgiP.mjs → solana-B0QSg7B3.mjs} +30 -30
- package/lib/solana-Cs5VyB20.js +900 -0
- package/lib/solana-uvHG8JV5.js +1 -0
- package/lib/solana-zyfOlbhb.mjs +18 -0
- package/lib/{solanaEmbed.esm-DK5RIquB.mjs → solanaEmbed.esm-BqdznDuW.mjs} +623 -622
- package/lib/solanaEmbed.esm-D8vtESE6.js +10 -0
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/config/tokens.d.ts +1 -1
- package/lib/src/config/tokens.d.ts.map +1 -1
- package/lib/src/exports/index.d.ts +2 -2
- package/lib/src/exports/index.d.ts.map +1 -1
- package/lib/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/lib/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/lib/src/icons/PoweredBy.d.ts.map +1 -1
- package/lib/src/icons/Routing.d.ts +5 -0
- package/lib/src/icons/Routing.d.ts.map +1 -0
- package/lib/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/lib/src/store/transferInput.d.ts +1 -1
- package/lib/src/store/transferInput.d.ts.map +1 -1
- package/lib/src/utils/coingecko.d.ts.map +1 -1
- package/lib/src/utils/formatNumber.d.ts +23 -0
- package/lib/src/utils/formatNumber.d.ts.map +1 -0
- package/lib/src/utils/index.d.ts +3 -1
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/routes.d.ts +12 -0
- package/lib/src/utils/routes.d.ts.map +1 -0
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/{sui-CQcQ6w_P.mjs → sui-B38DyOqM.mjs} +44 -44
- package/lib/{sui-BplKFZQu.mjs → sui-BpfnZR4f.mjs} +3 -3
- package/lib/sui-CT9MWY38.js +1 -0
- package/lib/{sui-_hvmCvD8.js → sui-DXQAMRQJ.js} +1 -1
- package/lib/{tokens-DNv0ZNvU.js → tokens-CmINcwKk.js} +31 -31
- package/lib/{tokens-Dl4YwW18.mjs → tokens-YxAPPVy3.mjs} +1726 -1724
- package/lib/transfer-BQ72fByU.js +1 -0
- package/lib/transfer-bTW0j9yh.mjs +58 -0
- package/lib/units-Ckije3Qv.js +1 -0
- package/lib/{units-DPWUSE6J.mjs → units-CtyvuzxQ.mjs} +13 -13
- package/lib/unsignedTransaction-C6Qp42VS.js +1 -0
- package/lib/{unsignedTransaction-DwcUilyN.mjs → unsignedTransaction-CXB-QCUC.mjs} +18 -18
- package/lib/{w3m-modal-BJILsxDp.mjs → w3m-modal-B7LUHLWC.mjs} +2 -2
- package/lib/{w3m-modal-D4CpFxO2.mjs → w3m-modal-BOTzBqbc.mjs} +2 -2
- package/lib/{w3m-modal-CrfHWSrF.js → w3m-modal-BTb03-7B.js} +1 -1
- package/lib/{w3m-modal-CBG2MSPp.js → w3m-modal-xmdf4r6V.js} +1 -1
- package/lib/web3-COTIsLs8.js +22 -0
- package/lib/{address-B-XN4tFw.mjs → web3-DYVeiqSa.mjs} +6599 -6576
- package/package.json +32 -32
- package/dist/assets/index-BWPgrXHs.js +0 -1
- package/lib/account-cRt2xMoW.js +0 -1
- package/lib/address-BGujeWtN.js +0 -22
- package/lib/address-C7DIAk4M.js +0 -1
- package/lib/address-KNhRm6oe.js +0 -1
- package/lib/aptos-f5TqmvqV.js +0 -2
- package/lib/blake2b-B-MRXUPb.js +0 -1
- package/lib/browser-ponyfill-CE6vRkjp.js +0 -2
- package/lib/chain-Hsn22HAP.js +0 -1
- package/lib/chunk-KJH4KKG6-CoyI75Ig.js +0 -470
- package/lib/contract-D2fTrJgn.js +0 -1
- package/lib/core-v0G9f7LX.js +0 -889
- package/lib/create-DoZZ7ciL.js +0 -1
- package/lib/index-B8-KKWD-.js +0 -1
- package/lib/index-BHbvgOMD.js +0 -1
- package/lib/index-BHfUgvSV.js +0 -1
- package/lib/index-BTKC7Hou.js +0 -1
- package/lib/index-BWXglAWd.js +0 -1
- package/lib/index-Bpp8C4u8.js +0 -1
- package/lib/index-CF2fHBHJ.js +0 -3
- package/lib/index-CTPz98nv.js +0 -1
- package/lib/index-ClMoiji-.js +0 -1
- package/lib/index-ClsVcH6F.js +0 -1
- package/lib/index-CqOI6LVu.js +0 -1
- package/lib/index-DCz_4mcz.js +0 -1
- package/lib/index-DKksdvND.js +0 -335
- package/lib/index-DRv3ZpVL.js +0 -1
- package/lib/index-DYqo8IhM.js +0 -1
- package/lib/index-DZubce9o.js +0 -1
- package/lib/index-DprM_IpB.js +0 -1
- package/lib/index-DshEQYMA.js +0 -1
- package/lib/index-JrM783SN.js +0 -1
- package/lib/index.es-C6YhioMN.js +0 -27
- package/lib/index.es-D3Xxxr8I.js +0 -11
- package/lib/mint-DlXC3sGi.js +0 -1
- package/lib/platform-B1XoDKoN.js +0 -1
- package/lib/platform-COuZC5Zc.js +0 -1
- package/lib/platform-NG3efAb2.js +0 -1
- package/lib/provider-jsonrpc-pXNHQF7n.js +0 -1
- package/lib/signer-CCa6npZ3.js +0 -1
- package/lib/solana-BJ3aReZw.mjs +0 -18
- package/lib/solana-BwyVgP30.js +0 -1
- package/lib/solana-CanFuMgA.js +0 -900
- package/lib/solanaEmbed.esm-C--1F7Lx.js +0 -10
- package/lib/sui-Bs83Gy5Z.js +0 -1
- package/lib/units-BvcKDiAx.js +0 -1
- package/lib/unsignedTransaction-dN_5EJf5.js +0 -1
- package/lib/web3-Bu_6UejS.mjs +0 -67
- package/lib/web3-Doz_0RHD.js +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var yt = Object.defineProperty;
|
|
2
2
|
var vt = (m, t, a) => t in m ? yt(m, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : m[t] = a;
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
3
|
+
var h = (m, t, a) => vt(m, typeof t != "symbol" ? t + "" : t, a);
|
|
4
|
+
import { G as Z, u as C, bd as nt, T as w, O as Pt, B as ct, Q as b, C as dt, am as bt, ae as O, be as it, m as M, bf as f, F as l, ah as q, N as st, aU as _, q as xt, W as g, bg as Dt, o as P, V as Bt, t as Et, aX as z, bh as W, bi as mt, bj as ot, bk as $, bl as zt, bm as ut, aV as ht, an as lt, ao as ft, bn as V, D as F, A as D, bo as A, bp as St, bq as Ft, I as v, aW as Gt, br as It, aI as Ot, ac as Nt, aT as Mt, R as Rt, bs as Ut, bt as _t, ag as Vt, bu as Qt, r as Wt, U as rt, k as H } from "./web3-DYVeiqSa.mjs";
|
|
5
5
|
class tt {
|
|
6
6
|
constructor(t, a, e, n, i) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
h(this, "source");
|
|
8
|
+
h(this, "destination");
|
|
9
|
+
h(this, "fromChain");
|
|
10
|
+
h(this, "toChain");
|
|
11
|
+
h(this, "recipient");
|
|
12
12
|
this.fromChain = t, this.toChain = a, this.source = e, this.destination = n, this.recipient = i;
|
|
13
13
|
}
|
|
14
14
|
parseAmount(t) {
|
|
@@ -69,7 +69,7 @@ async function wt(m, t, a, e = 120 * 1e3, n = console.log) {
|
|
|
69
69
|
const s = e - (Date.now() - i);
|
|
70
70
|
return s > 0 ? (n("Transfer not complete, trying again in a 2000ms..."), await new Promise((r) => setTimeout(r, 2e3)), wt(m, t, a, s)) : t;
|
|
71
71
|
}
|
|
72
|
-
class X extends
|
|
72
|
+
class X extends O {
|
|
73
73
|
static supportedNetworks() {
|
|
74
74
|
return ["Mainnet", "Testnet"];
|
|
75
75
|
}
|
|
@@ -80,7 +80,7 @@ class X extends I {
|
|
|
80
80
|
// get the list of destination tokens that may be received on the destination chain
|
|
81
81
|
static async supportedDestinationTokens(t, a, e) {
|
|
82
82
|
try {
|
|
83
|
-
if (!
|
|
83
|
+
if (!M(t) && !await (await a.getAutomaticTokenBridge()).isRegisteredToken(t.address))
|
|
84
84
|
return [];
|
|
85
85
|
const n = await f.lookupDestinationToken(a, e, t);
|
|
86
86
|
return await (await e.getAutomaticTokenBridge()).isRegisteredToken(n.address) ? [n] : [];
|
|
@@ -97,7 +97,7 @@ class X extends I {
|
|
|
97
97
|
if (e.nativeGas && (e.nativeGas > 1 || e.nativeGas < 0))
|
|
98
98
|
throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");
|
|
99
99
|
const { destination: n } = t;
|
|
100
|
-
|
|
100
|
+
M(n.id.address) && e.nativeGas === 0 && (e.nativeGas = 0);
|
|
101
101
|
const i = { ...a, options: e };
|
|
102
102
|
return { valid: !0, params: {
|
|
103
103
|
...i,
|
|
@@ -108,17 +108,17 @@ class X extends I {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
async normalizeTransferParams(t, a) {
|
|
111
|
-
const e = t.parseAmount(a.amount), n =
|
|
112
|
-
if (
|
|
111
|
+
const e = t.parseAmount(a.amount), n = M(t.source.id.address) ? await t.fromChain.getNativeWrappedTokenId() : t.source.id, s = await (await t.fromChain.getAutomaticTokenBridge()).getRelayerFee(t.toChain.chain, n.address), o = s * 105n / 100n;
|
|
112
|
+
if (l(e) < o)
|
|
113
113
|
throw new q(C(o, e.decimals));
|
|
114
|
-
const r =
|
|
114
|
+
const r = l(e) - s;
|
|
115
115
|
let c = C(0n, t.source.decimals);
|
|
116
116
|
if (a.options && a.options.nativeGas > 0) {
|
|
117
117
|
let u = await (await t.toChain.getAutomaticTokenBridge()).maxSwapAmount(t.destination.id.address);
|
|
118
|
-
const p = st(C(r, e.decimals), f.MAX_DECIMALS), T = await t.toChain.getDecimals(t.destination.id.address), k =
|
|
118
|
+
const p = st(C(r, e.decimals), f.MAX_DECIMALS), T = await t.toChain.getDecimals(t.destination.id.address), k = l(_(p, T));
|
|
119
119
|
k < u && (u = k);
|
|
120
|
-
const G = 1e4, N = BigInt(Math.floor(a.options.nativeGas * G)),
|
|
121
|
-
c = _(st(
|
|
120
|
+
const G = 1e4, N = BigInt(Math.floor(a.options.nativeGas * G)), L = u * N / BigInt(G), I = C(L, t.destination.decimals);
|
|
121
|
+
c = _(st(I, f.MAX_DECIMALS), t.source.decimals), l(c) > r && (c = C(r, t.source.decimals));
|
|
122
122
|
}
|
|
123
123
|
return {
|
|
124
124
|
fee: C(s, t.source.decimals),
|
|
@@ -136,9 +136,9 @@ class X extends I {
|
|
|
136
136
|
try {
|
|
137
137
|
let n = await f.quoteTransfer(this.wh, t.fromChain, t.toChain, {
|
|
138
138
|
protocol: "AutomaticTokenBridge",
|
|
139
|
-
amount:
|
|
139
|
+
amount: l(a.normalizedParams.amount),
|
|
140
140
|
token: t.source.id,
|
|
141
|
-
nativeGas:
|
|
141
|
+
nativeGas: l(a.normalizedParams.nativeGasAmount)
|
|
142
142
|
});
|
|
143
143
|
return t.displayQuote(n, a);
|
|
144
144
|
} catch (n) {
|
|
@@ -169,27 +169,27 @@ class X extends I {
|
|
|
169
169
|
from: e,
|
|
170
170
|
to: n,
|
|
171
171
|
protocol: "AutomaticTokenBridge",
|
|
172
|
-
amount:
|
|
172
|
+
amount: l(a.normalizedParams.amount),
|
|
173
173
|
token: t.source.id,
|
|
174
|
-
nativeGas:
|
|
174
|
+
nativeGas: l(a.normalizedParams.nativeGasAmount)
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
h(X, "NATIVE_GAS_DROPOFF_SUPPORTED", !0), h(X, "meta", {
|
|
179
179
|
name: "AutomaticTokenBridge"
|
|
180
180
|
});
|
|
181
|
-
function
|
|
182
|
-
class t extends
|
|
181
|
+
function Lt(m = {}) {
|
|
182
|
+
class t extends Q {
|
|
183
183
|
}
|
|
184
|
-
return
|
|
184
|
+
return h(t, "config", m), t;
|
|
185
185
|
}
|
|
186
|
-
const B = class B extends
|
|
186
|
+
const B = class B extends O {
|
|
187
187
|
constructor() {
|
|
188
188
|
super(...arguments);
|
|
189
189
|
// @ts-ignore
|
|
190
190
|
// Since we set the config on the static class, access it with this param
|
|
191
191
|
// the ExecutorTokenBridgeRoute.config will always be empty
|
|
192
|
-
|
|
192
|
+
h(this, "staticConfig", this.constructor.config);
|
|
193
193
|
}
|
|
194
194
|
static supportedNetworks() {
|
|
195
195
|
return ["Mainnet", "Testnet"];
|
|
@@ -228,7 +228,7 @@ const B = class B extends I {
|
|
|
228
228
|
try {
|
|
229
229
|
let k;
|
|
230
230
|
const G = await a.toChain.getExecutorTokenBridge();
|
|
231
|
-
let { gasLimit: N, msgValue:
|
|
231
|
+
let { gasLimit: N, msgValue: L } = await G.estimateMsgValueAndGasLimit(a.destination.id, a.recipient);
|
|
232
232
|
if (((i = this.staticConfig.referrerFee) == null ? void 0 : i.referrerFeeDbps) !== void 0 && (k = this.staticConfig.referrerFee.referrerFeeDbps), (s = this.staticConfig.referrerFee) != null && s.tokenFeeOverrides) {
|
|
233
233
|
const y = P(a.source.id), x = (r = (o = this.staticConfig.referrerFee.tokenFeeOverrides[this.wh.network]) == null ? void 0 : o[a.fromChain.chain]) == null ? void 0 : r[y];
|
|
234
234
|
x !== void 0 && (k = x);
|
|
@@ -237,14 +237,14 @@ const B = class B extends I {
|
|
|
237
237
|
const y = P(a.destination.id), x = (d = (c = this.staticConfig.tokenOverrides[this.wh.network]) == null ? void 0 : c[a.destination.id.chain]) == null ? void 0 : d[y];
|
|
238
238
|
(x == null ? void 0 : x.gasLimit) !== void 0 && (N = x.gasLimit);
|
|
239
239
|
}
|
|
240
|
-
let
|
|
240
|
+
let I;
|
|
241
241
|
if (k !== void 0 && k > 0n) {
|
|
242
242
|
const y = (T = (p = (u = this.staticConfig.referrerFee) == null ? void 0 : u.referrerAddresses) == null ? void 0 : p[this.wh.network]) == null ? void 0 : T[a.fromChain.chain];
|
|
243
243
|
if (!y)
|
|
244
244
|
throw new Error(`No referrer address configured for network ${this.wh.network} and chain ${a.fromChain.chain}`);
|
|
245
|
-
|
|
245
|
+
I = g.chainAddress(a.fromChain.chain, y);
|
|
246
246
|
}
|
|
247
|
-
const At = k !== void 0 &&
|
|
247
|
+
const At = k !== void 0 && I !== void 0 ? { feeDbps: k, referrer: I } : void 0;
|
|
248
248
|
let at;
|
|
249
249
|
if (e.options.nativeGas !== void 0) {
|
|
250
250
|
const y = await f.getExecutorGasDropOffLimit(this.wh, a.toChain);
|
|
@@ -252,10 +252,10 @@ const B = class B extends I {
|
|
|
252
252
|
}
|
|
253
253
|
const et = await f.quoteTransfer(this.wh, a.fromChain, a.toChain, {
|
|
254
254
|
token: a.source.id,
|
|
255
|
-
amount:
|
|
255
|
+
amount: l(e.normalizedParams.amount),
|
|
256
256
|
protocol: "ExecutorTokenBridge",
|
|
257
257
|
nativeGas: at,
|
|
258
|
-
msgValue:
|
|
258
|
+
msgValue: L,
|
|
259
259
|
gasLimit: N,
|
|
260
260
|
referrerFee: At
|
|
261
261
|
});
|
|
@@ -292,7 +292,7 @@ const B = class B extends I {
|
|
|
292
292
|
throw new Error("The source must be finalized in order to complete the transfer");
|
|
293
293
|
if (!e.attestation)
|
|
294
294
|
throw new Error("The receipt must have an attestation to complete the transfer");
|
|
295
|
-
const n = this.wh.getChain(e.to), i = await n.getExecutorTokenBridge(), s = Et(a.chain(), a.address()), o = i.redeem(s, e.attestation.attestation), r = await
|
|
295
|
+
const n = this.wh.getChain(e.to), i = await n.getExecutorTokenBridge(), s = Et(a.chain(), a.address()), o = i.redeem(s, e.attestation.attestation), r = await z(n, o, a);
|
|
296
296
|
return {
|
|
297
297
|
...e,
|
|
298
298
|
state: w.DestinationInitiated,
|
|
@@ -317,18 +317,18 @@ const B = class B extends I {
|
|
|
317
317
|
from: n,
|
|
318
318
|
to: i,
|
|
319
319
|
token: a.source.id,
|
|
320
|
-
amount:
|
|
320
|
+
amount: l(e.normalizedParams.amount),
|
|
321
321
|
protocol: "ExecutorTokenBridge",
|
|
322
322
|
executorQuote: s.details.executorQuote,
|
|
323
323
|
referrerFee: s.details.referrerFee
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
|
|
327
|
+
h(B, "IS_EXECUTOR_ROUTE", !0), h(B, "NATIVE_GAS_DROPOFF_SUPPORTED", !0), h(B, "config", {}), h(B, "meta", {
|
|
328
328
|
name: "TokenBridgeExecutorRoute"
|
|
329
329
|
});
|
|
330
|
-
let
|
|
331
|
-
class gt extends
|
|
330
|
+
let Q = B;
|
|
331
|
+
class gt extends W {
|
|
332
332
|
static supportedNetworks() {
|
|
333
333
|
return ["Mainnet", "Testnet"];
|
|
334
334
|
}
|
|
@@ -359,7 +359,7 @@ class gt extends L {
|
|
|
359
359
|
try {
|
|
360
360
|
return t.displayQuote(await f.quoteTransfer(this.wh, t.fromChain, t.toChain, {
|
|
361
361
|
token: t.source.id,
|
|
362
|
-
amount:
|
|
362
|
+
amount: l(a.normalizedParams.amount),
|
|
363
363
|
protocol: "TokenBridge",
|
|
364
364
|
...a.options
|
|
365
365
|
}), a);
|
|
@@ -404,15 +404,15 @@ class gt extends L {
|
|
|
404
404
|
to: n,
|
|
405
405
|
protocol: "TokenBridge",
|
|
406
406
|
token: t.source.id,
|
|
407
|
-
amount:
|
|
407
|
+
amount: l(a.normalizedParams.amount),
|
|
408
408
|
...a.options
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
|
|
412
|
+
h(gt, "meta", {
|
|
413
413
|
name: "ManualTokenBridge"
|
|
414
414
|
});
|
|
415
|
-
const j = 15n, Tt = 100n,
|
|
415
|
+
const j = 15n, Tt = 100n, R = 10000n, S = class S extends O {
|
|
416
416
|
static supportedNetworks() {
|
|
417
417
|
return ["Mainnet"];
|
|
418
418
|
}
|
|
@@ -431,14 +431,14 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
431
431
|
}
|
|
432
432
|
const r = (await e.getPorticoBridge()).supportedTokens(), { tokenMap: c } = e.config, d = s.getTokenGroup(i);
|
|
433
433
|
return r.filter((u) => (u.group === d || // ETH/WETH supports wrapping/unwrapping
|
|
434
|
-
u.group === "ETH" && d === "WETH" || u.group === "WETH" && d === "ETH") && (!c ||
|
|
434
|
+
u.group === "ETH" && d === "WETH" || u.group === "WETH" && d === "ETH") && (!c || zt.byAddress(c, P(u.token)))).map((u) => u.token);
|
|
435
435
|
}
|
|
436
436
|
getDefaultOptions() {
|
|
437
437
|
return {};
|
|
438
438
|
}
|
|
439
439
|
async validate(t, a) {
|
|
440
440
|
try {
|
|
441
|
-
if (!
|
|
441
|
+
if (!S.supportedChains(t.fromChain.network).includes(t.fromChain.chain) || !S.supportedChains(t.toChain.network).includes(t.toChain.chain))
|
|
442
442
|
throw new Error("Protocol not supported");
|
|
443
443
|
const { fromChain: e, toChain: n, source: i, destination: s } = t, { network: o } = e, [, r] = $(o, e.chain, i.id), [, c] = $(o, n.chain, s.id), d = await e.getPorticoBridge(), u = await n.getPorticoBridge(), p = await d.getTransferrableToken(P(r)), T = await u.getTransferrableToken(P(c));
|
|
444
444
|
return { valid: !0, params: {
|
|
@@ -458,8 +458,8 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
458
458
|
}
|
|
459
459
|
async quote(t, a) {
|
|
460
460
|
try {
|
|
461
|
-
const e = await this.fetchSwapQuote(t, a), n = Math.max(t.source.decimals, t.destination.decimals), i =
|
|
462
|
-
if (
|
|
461
|
+
const e = await this.fetchSwapQuote(t, a), n = Math.max(t.source.decimals, t.destination.decimals), i = l(_(a.normalizedParams.amount, n));
|
|
462
|
+
if (l(_(C(e.minAmountFinish, t.destination.decimals), n)) < i - i * Tt / R)
|
|
463
463
|
throw new Error("Slippage too high");
|
|
464
464
|
const r = await (await t.toChain.getPorticoBridge()).quoteRelay(a.normalizedParams.canonicalDestinationToken.address, a.normalizedParams.destinationToken.address), c = {
|
|
465
465
|
swapAmounts: e,
|
|
@@ -471,7 +471,7 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
471
471
|
} : await t.displayQuote({
|
|
472
472
|
sourceToken: {
|
|
473
473
|
token: a.normalizedParams.sourceToken,
|
|
474
|
-
amount:
|
|
474
|
+
amount: l(a.normalizedParams.amount)
|
|
475
475
|
},
|
|
476
476
|
destinationToken: {
|
|
477
477
|
token: a.normalizedParams.destinationToken,
|
|
@@ -481,7 +481,7 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
481
481
|
token: a.normalizedParams.destinationToken,
|
|
482
482
|
amount: r
|
|
483
483
|
},
|
|
484
|
-
eta:
|
|
484
|
+
eta: ht(t.fromChain.chain),
|
|
485
485
|
expires: ut(0, 5, 0)
|
|
486
486
|
}, a, c);
|
|
487
487
|
} catch (e) {
|
|
@@ -492,16 +492,16 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
async initiate(t, a, e, n) {
|
|
495
|
-
const { params: i, details: s } = e, o = t.source.id.address, r = t.destination.id, c = await t.fromChain.getPorticoBridge(), d = c.getTokenGroup(o.toString()), p = (await t.toChain.getPorticoBridge()).getPorticoAddress(d), T = c.transfer(g.parseAddress(a.chain(), a.address()), n, o,
|
|
495
|
+
const { params: i, details: s } = e, o = t.source.id.address, r = t.destination.id, c = await t.fromChain.getPorticoBridge(), d = c.getTokenGroup(o.toString()), p = (await t.toChain.getPorticoBridge()).getPorticoAddress(d), T = c.transfer(g.parseAddress(a.chain(), a.address()), n, o, l(i.normalizedParams.amount), r, p, s);
|
|
496
496
|
return {
|
|
497
|
-
originTxs: await
|
|
497
|
+
originTxs: await z(t.fromChain, T, a),
|
|
498
498
|
state: w.SourceInitiated,
|
|
499
499
|
from: t.fromChain.chain,
|
|
500
500
|
to: t.toChain.chain
|
|
501
501
|
};
|
|
502
502
|
}
|
|
503
503
|
async *track(t, a) {
|
|
504
|
-
if (
|
|
504
|
+
if (lt(t) || ft(t)) {
|
|
505
505
|
const { txid: e } = t.originTxs[t.originTxs.length - 1], n = await this.wh.getVaa(e, "PorticoBridge:Transfer", a);
|
|
506
506
|
if (!n)
|
|
507
507
|
throw new Error("No VAA found for transaction: " + e);
|
|
@@ -528,13 +528,13 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
528
528
|
if (!b(a))
|
|
529
529
|
throw new Error("Source must be attested");
|
|
530
530
|
const e = await this.wh.getChain(a.to), n = await e.getPorticoBridge(), i = g.chainAddress(t.chain(), t.address()), s = n.redeem(i.address, a.attestation.attestation);
|
|
531
|
-
return await
|
|
531
|
+
return await z(e, s, t);
|
|
532
532
|
}
|
|
533
533
|
async fetchSwapQuote(t, a) {
|
|
534
|
-
const e = await t.fromChain.getPorticoBridge(), n =
|
|
534
|
+
const e = await t.fromChain.getPorticoBridge(), n = l(a.normalizedParams.amount), i = e.getTokenGroup(P(a.normalizedParams.sourceToken)), s = await e.quoteSwap(a.normalizedParams.sourceToken.address, a.normalizedParams.canonicalSourceToken.address, i, n), o = s * j / R;
|
|
535
535
|
if (o >= s)
|
|
536
536
|
throw new Error("Start slippage too high");
|
|
537
|
-
const r = await t.toChain.getPorticoBridge(), c = s - o, d = await r.quoteSwap(a.normalizedParams.canonicalDestinationToken.address, a.normalizedParams.destinationToken.address, i, c), u = d * j /
|
|
537
|
+
const r = await t.toChain.getPorticoBridge(), c = s - o, d = await r.quoteSwap(a.normalizedParams.canonicalDestinationToken.address, a.normalizedParams.destinationToken.address, i, c), u = d * j / R;
|
|
538
538
|
if (u >= d)
|
|
539
539
|
throw new Error("Finish slippage too high");
|
|
540
540
|
const p = d - u;
|
|
@@ -544,17 +544,17 @@ const j = 15n, Tt = 100n, M = 10000n, z = class z extends I {
|
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
};
|
|
547
|
-
|
|
547
|
+
h(S, "NATIVE_GAS_DROPOFF_SUPPORTED", !1), h(S, "meta", {
|
|
548
548
|
name: "AutomaticPortico"
|
|
549
549
|
});
|
|
550
|
-
let J =
|
|
551
|
-
class pt extends
|
|
550
|
+
let J = S;
|
|
551
|
+
class pt extends W {
|
|
552
552
|
static supportedNetworks() {
|
|
553
553
|
return ["Mainnet", "Testnet"];
|
|
554
554
|
}
|
|
555
555
|
// get the list of chains this route supports
|
|
556
556
|
static supportedChains(t) {
|
|
557
|
-
return
|
|
557
|
+
return V.has(t) ? V.get(t) : [];
|
|
558
558
|
}
|
|
559
559
|
// get the list of destination tokens that may be received on the destination chain
|
|
560
560
|
static async supportedDestinationTokens(t, a, e) {
|
|
@@ -584,7 +584,7 @@ class pt extends L {
|
|
|
584
584
|
try {
|
|
585
585
|
return t.displayQuote(await A.quoteTransfer(t.fromChain, t.toChain, {
|
|
586
586
|
automatic: !1,
|
|
587
|
-
amount:
|
|
587
|
+
amount: l(a.normalizedParams.amount),
|
|
588
588
|
...a.options
|
|
589
589
|
}), a);
|
|
590
590
|
} catch (e) {
|
|
@@ -608,11 +608,11 @@ class pt extends L {
|
|
|
608
608
|
if (!b(a))
|
|
609
609
|
throw new Error("The source must be finalized in order to complete the transfer");
|
|
610
610
|
const { id: e, attestation: n } = a.attestation;
|
|
611
|
-
if (
|
|
611
|
+
if (St.isCircleAttestation(n)) {
|
|
612
612
|
const { message: i, attestation: s } = n;
|
|
613
613
|
if (!s)
|
|
614
614
|
throw new Error(`No Circle attestation for ${e}`);
|
|
615
|
-
const o = this.wh.getChain(a.to), r = await o.getCircleBridge(), c = g.parseAddress(t.chain(), t.address()), d = r.redeem(c, i, s), u = await
|
|
615
|
+
const o = this.wh.getChain(a.to), r = await o.getCircleBridge(), c = g.parseAddress(t.chain(), t.address()), d = r.redeem(c, i, s), u = await z(o, d, t);
|
|
616
616
|
return {
|
|
617
617
|
...a,
|
|
618
618
|
state: w.DestinationInitiated,
|
|
@@ -632,23 +632,23 @@ class pt extends L {
|
|
|
632
632
|
return {
|
|
633
633
|
from: a,
|
|
634
634
|
to: e,
|
|
635
|
-
amount:
|
|
635
|
+
amount: l(t.normalizedParams.amount),
|
|
636
636
|
automatic: !1,
|
|
637
637
|
...t.options
|
|
638
638
|
};
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
|
|
641
|
+
h(pt, "meta", {
|
|
642
642
|
name: "ManualCCTP",
|
|
643
643
|
provider: "Circle"
|
|
644
644
|
});
|
|
645
|
-
class K extends
|
|
645
|
+
class K extends O {
|
|
646
646
|
static supportedNetworks() {
|
|
647
647
|
return ["Mainnet", "Testnet"];
|
|
648
648
|
}
|
|
649
649
|
// get the list of chains this route supports
|
|
650
650
|
static supportedChains(t) {
|
|
651
|
-
return
|
|
651
|
+
return V.has(t) ? V.get(t).filter((e) => {
|
|
652
652
|
var n;
|
|
653
653
|
return (n = Ft.get(t, e)) == null ? void 0 : n.wormholeRelayer;
|
|
654
654
|
}) : [];
|
|
@@ -688,8 +688,8 @@ class K extends I {
|
|
|
688
688
|
try {
|
|
689
689
|
return t.displayQuote(await A.quoteTransfer(t.fromChain, t.toChain, {
|
|
690
690
|
automatic: !0,
|
|
691
|
-
amount:
|
|
692
|
-
nativeGas:
|
|
691
|
+
amount: l(a.normalizedParams.amount),
|
|
692
|
+
nativeGas: l(a.normalizedParams.nativeGasAmount)
|
|
693
693
|
}), a);
|
|
694
694
|
} catch (e) {
|
|
695
695
|
return {
|
|
@@ -700,9 +700,9 @@ class K extends I {
|
|
|
700
700
|
}
|
|
701
701
|
async normalizeTransferParams(t, a) {
|
|
702
702
|
const e = t.parseAmount(a.amount), i = await (await t.fromChain.getAutomaticCircleBridge()).getRelayerFee(t.toChain.chain), s = i * 105n / 100n;
|
|
703
|
-
if (
|
|
703
|
+
if (l(e) < s)
|
|
704
704
|
throw new q(C(s, e.decimals));
|
|
705
|
-
const o =
|
|
705
|
+
const o = l(e) - i, c = (a.options ?? this.getDefaultOptions()).nativeGas ?? 0;
|
|
706
706
|
if (c > 1 || c < 0)
|
|
707
707
|
throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");
|
|
708
708
|
let d = 0n;
|
|
@@ -722,9 +722,9 @@ class K extends I {
|
|
|
722
722
|
return {
|
|
723
723
|
from: a,
|
|
724
724
|
to: e,
|
|
725
|
-
amount:
|
|
725
|
+
amount: l(t.normalizedParams.amount),
|
|
726
726
|
automatic: !0,
|
|
727
|
-
nativeGas:
|
|
727
|
+
nativeGas: l(t.normalizedParams.nativeGasAmount)
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
730
|
async initiate(t, a, e, n) {
|
|
@@ -743,11 +743,11 @@ class K extends I {
|
|
|
743
743
|
yield* A.track(this.wh, t, a);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
|
|
746
|
+
h(K, "NATIVE_GAS_DROPOFF_SUPPORTED", !0), h(K, "meta", {
|
|
747
747
|
name: "AutomaticCCTP",
|
|
748
748
|
provider: "Circle"
|
|
749
749
|
});
|
|
750
|
-
class kt extends
|
|
750
|
+
class kt extends W {
|
|
751
751
|
static supportedNetworks() {
|
|
752
752
|
return ["Mainnet"];
|
|
753
753
|
}
|
|
@@ -783,7 +783,7 @@ class kt extends L {
|
|
|
783
783
|
} };
|
|
784
784
|
}
|
|
785
785
|
async quote(t, a) {
|
|
786
|
-
const e =
|
|
786
|
+
const e = ht(t.fromChain.chain) + Gt;
|
|
787
787
|
return {
|
|
788
788
|
success: !0,
|
|
789
789
|
params: a,
|
|
@@ -800,7 +800,7 @@ class kt extends L {
|
|
|
800
800
|
};
|
|
801
801
|
}
|
|
802
802
|
async initiate(t, a, e, n) {
|
|
803
|
-
const i =
|
|
803
|
+
const i = l(e.params.normalizedParams.amount), s = t.fromChain.chain === "Ethereum", o = v.getNativeTbtcToken(t.fromChain.chain), r = o && D(e.sourceToken.token, o);
|
|
804
804
|
if (r && !s)
|
|
805
805
|
return await this.transferNative(t, a, n, i);
|
|
806
806
|
if (!r && s)
|
|
@@ -815,14 +815,14 @@ class kt extends L {
|
|
|
815
815
|
async transferNative(t, a, e, n) {
|
|
816
816
|
const i = g.parseAddress(a.chain(), a.address()), o = (await t.fromChain.getTBTCBridge()).transfer(i, e, n);
|
|
817
817
|
return {
|
|
818
|
-
originTxs: await
|
|
818
|
+
originTxs: await z(t.fromChain, o, a),
|
|
819
819
|
state: w.SourceInitiated,
|
|
820
820
|
from: t.fromChain.chain,
|
|
821
821
|
to: t.toChain.chain
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
824
|
async transferWrapped(t, a, e, n) {
|
|
825
|
-
const i = g.parseAddress(a.chain(), a.address()), s =
|
|
825
|
+
const i = g.parseAddress(a.chain(), a.address()), s = It.get(t.fromChain.network, e.chain), o = await t.fromChain.getTokenBridge();
|
|
826
826
|
let r;
|
|
827
827
|
return s ? r = o.transfer(
|
|
828
828
|
i,
|
|
@@ -832,7 +832,7 @@ class kt extends L {
|
|
|
832
832
|
// payload is the recipient address
|
|
833
833
|
e.address.toUniversalAddress().toUint8Array()
|
|
834
834
|
) : r = o.transfer(i, e, t.source.id.address, n), {
|
|
835
|
-
originTxs: await
|
|
835
|
+
originTxs: await z(t.fromChain, r, a),
|
|
836
836
|
state: w.SourceInitiated,
|
|
837
837
|
from: t.fromChain.chain,
|
|
838
838
|
to: t.toChain.chain
|
|
@@ -846,10 +846,10 @@ class kt extends L {
|
|
|
846
846
|
if (n.payloadLiteral === "TBTCBridge:GatewayTransfer")
|
|
847
847
|
s = (await i.getTBTCBridge()).redeem(e, n);
|
|
848
848
|
else {
|
|
849
|
-
const r = await i.getTokenBridge(), c =
|
|
849
|
+
const r = await i.getTokenBridge(), c = Ot(n), d = Nt("TokenBridge:Transfer", c);
|
|
850
850
|
s = r.redeem(e, d);
|
|
851
851
|
}
|
|
852
|
-
const o = await
|
|
852
|
+
const o = await z(i, s, t);
|
|
853
853
|
return {
|
|
854
854
|
...a,
|
|
855
855
|
state: w.DestinationInitiated,
|
|
@@ -879,7 +879,7 @@ class kt extends L {
|
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
881
|
async *track(t, a) {
|
|
882
|
-
if (
|
|
882
|
+
if (lt(t) || ft(t)) {
|
|
883
883
|
const { txid: e } = t.originTxs[t.originTxs.length - 1], n = await this.wh.getVaa(e, v.getTransferDiscriminator(), a);
|
|
884
884
|
if (!n)
|
|
885
885
|
throw new Error("No VAA found for transaction: " + e);
|
|
@@ -903,7 +903,7 @@ class kt extends L {
|
|
|
903
903
|
}, yield t), yield t;
|
|
904
904
|
}
|
|
905
905
|
static async isSourceTokenSupported(t, a) {
|
|
906
|
-
if (
|
|
906
|
+
if (M(t.address))
|
|
907
907
|
return !1;
|
|
908
908
|
const e = v.getNativeTbtcToken(a.chain);
|
|
909
909
|
if (e && D(t, e))
|
|
@@ -919,33 +919,33 @@ class kt extends L {
|
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
|
-
|
|
922
|
+
h(kt, "meta", {
|
|
923
923
|
name: "ManualTBTC"
|
|
924
924
|
});
|
|
925
925
|
const Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
926
926
|
__proto__: null,
|
|
927
927
|
AutomaticCCTPRoute: K,
|
|
928
928
|
AutomaticPorticoRoute: J,
|
|
929
|
-
AutomaticRoute:
|
|
929
|
+
AutomaticRoute: O,
|
|
930
930
|
AutomaticTokenBridgeRoute: X,
|
|
931
|
-
BPS_PER_HUNDRED_PERCENT:
|
|
931
|
+
BPS_PER_HUNDRED_PERCENT: R,
|
|
932
932
|
CCTPRoute: pt,
|
|
933
|
-
ExecutorTokenBridgeRoute:
|
|
934
|
-
FinalizableRoute:
|
|
933
|
+
ExecutorTokenBridgeRoute: Q,
|
|
934
|
+
FinalizableRoute: Mt,
|
|
935
935
|
MAX_SLIPPAGE_BPS: Tt,
|
|
936
|
-
ManualRoute:
|
|
936
|
+
ManualRoute: W,
|
|
937
937
|
MinAmountError: q,
|
|
938
|
-
RelayFailedError:
|
|
938
|
+
RelayFailedError: Rt,
|
|
939
939
|
Route: Ut,
|
|
940
940
|
RouteResolver: _t,
|
|
941
941
|
RouteTransferRequest: tt,
|
|
942
942
|
SLIPPAGE_BPS: j,
|
|
943
943
|
TBTCRoute: kt,
|
|
944
944
|
TokenBridgeRoute: gt,
|
|
945
|
-
UnavailableError:
|
|
945
|
+
UnavailableError: Vt,
|
|
946
946
|
checkAndCompleteTransfer: wt,
|
|
947
|
-
executorTokenBridgeRoute:
|
|
948
|
-
isAutomatic:
|
|
947
|
+
executorTokenBridgeRoute: Lt,
|
|
948
|
+
isAutomatic: Qt,
|
|
949
949
|
isFinalizable: dt,
|
|
950
950
|
isManual: ct
|
|
951
951
|
}, Symbol.toStringTag, { value: "Module" })), Kt = "0x1::aptos_coin::AptosCoin", U = "::", Ct = "Aptos", $t = (m) => /^(0x)?[0-9a-fA-F]+::\w+::\w+$/.test(m), Yt = (m) => m.split(U)[0];
|
|
@@ -954,11 +954,11 @@ function Ht(m) {
|
|
|
954
954
|
}
|
|
955
955
|
const E = class E {
|
|
956
956
|
constructor(t) {
|
|
957
|
-
|
|
957
|
+
h(this, "type", "Native");
|
|
958
958
|
// Full 32 bytes of Address
|
|
959
|
-
|
|
959
|
+
h(this, "address");
|
|
960
960
|
// Optional module and contract name
|
|
961
|
-
|
|
961
|
+
h(this, "module");
|
|
962
962
|
if (E.instanceof(t))
|
|
963
963
|
this.address = t.address, this.module = t.module;
|
|
964
964
|
else if (rt.instanceof(t))
|
|
@@ -997,9 +997,9 @@ const E = class E {
|
|
|
997
997
|
return E.instanceof(t) ? t.unwrap() === this.unwrap() : this.toUniversalAddress().equals(t);
|
|
998
998
|
}
|
|
999
999
|
};
|
|
1000
|
-
|
|
1000
|
+
h(E, "byteSize", 32), h(E, "platform", Ct);
|
|
1001
1001
|
let Y = E;
|
|
1002
|
-
|
|
1002
|
+
Wt(Ct, Y);
|
|
1003
1003
|
export {
|
|
1004
1004
|
K as A,
|
|
1005
1005
|
pt as C,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var H=Object.defineProperty;var _=(t,e,n)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var U=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);const w=require("./web3-COTIsLs8.js");function M(t){if(t.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let r=0;r<e.length;r++)e[r]=255;for(let r=0;r<t.length;r++){const o=t.charAt(r),f=o.charCodeAt(0);if(e[f]!==255)throw new TypeError(o+" is ambiguous");e[f]=r}const n=t.length,i=t.charAt(0),l=Math.log(n)/Math.log(256),u=Math.log(256)/Math.log(n);function y(r){if(r instanceof Uint8Array||(ArrayBuffer.isView(r)?r=new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Array.isArray(r)&&(r=Uint8Array.from(r))),!(r instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(r.length===0)return"";let o=0,f=0,s=0;const h=r.length;for(;s!==h&&r[s]===0;)s++,o++;const d=(h-s)*u+1>>>0,a=new Uint8Array(d);for(;s!==h;){let p=r[s],c=0;for(let m=d-1;(p!==0||c<f)&&m!==-1;m--,c++)p+=256*a[m]>>>0,a[m]=p%n>>>0,p=p/n>>>0;if(p!==0)throw new Error("Non-zero carry");f=c,s++}let g=d-f;for(;g!==d&&a[g]===0;)g++;let b=i.repeat(o);for(;g<d;++g)b+=t.charAt(a[g]);return b}function A(r){if(typeof r!="string")throw new TypeError("Expected String");if(r.length===0)return new Uint8Array;let o=0,f=0,s=0;for(;r[o]===i;)f++,o++;const h=(r.length-o)*l+1>>>0,d=new Uint8Array(h);for(;o<r.length;){const p=r.charCodeAt(o);if(p>255)return;let c=e[p];if(c===255)return;let m=0;for(let E=h-1;(c!==0||m<s)&&E!==-1;E--,m++)c+=n*d[E]>>>0,d[E]=c%256>>>0,c=c/256>>>0;if(c!==0)throw new Error("Non-zero carry");s=m,o++}let a=h-s;for(;a!==h&&d[a]===0;)a++;const g=new Uint8Array(f+(h-a));let b=f;for(;a!==h;)g[b++]=d[a++];return g}function I(r){const o=A(r);if(o)return o;throw new Error("Non-base"+n+" character")}return{encode:y,decodeUnsafe:A,decode:I}}var q="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const N=M(q),$=t=>N.encode(t),B=t=>N.decode(t);function K(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const C=8192;function F(t){if(t.length<C)return btoa(String.fromCharCode(...t));let e="";for(var n=0;n<t.length;n+=C){const i=t.slice(n,n+C);e+=String.fromCharCode(...i)}return btoa(e)}function L(t){var l;const e=t.startsWith("0x")?t.slice(2):t,n=e.length%2===0?e:`0${e}`,i=((l=n.match(/[0-9a-fA-F]{2}/g))==null?void 0:l.map(u=>parseInt(u,16)))??[];if(i.length!==n.length/2)throw new Error(`Invalid hex string ${t}`);return Uint8Array.from(i)}function P(t){return t.reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}function W(t,e){switch(e){case"base58":return $(t);case"base64":return F(t);case"hex":return P(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function R(t,e=["<",">"]){const[n,i]=e,l=[];let u="",y=0;for(let A=0;A<t.length;A++){const I=t[A];if(I===n&&y++,I===i&&y--,y===0&&I===","){l.push(u.trim()),u="";continue}u+=I}return l.push(u.trim()),l}const X=32;function Z(t){try{return B(t).length===X}catch{return!1}}const k=32;function V(t){return tt(t)&&et(t)===k}function J(t){return V(t)}function Q(t){return t.includes("::")?j(t):t}function j(t){const[e,n]=t.split("::"),i=t.slice(e.length+n.length+4),l=i.includes("<")?i.slice(0,i.indexOf("<")):i,u=i.includes("<")?R(i.slice(i.indexOf("<")+1,i.lastIndexOf(">"))).map(y=>Q(y.trim())):[];return{address:z(e),module:n,name:l,typeParams:u}}function z(t,e=!1){let n=t.toLowerCase();return!e&&n.startsWith("0x")&&(n=n.slice(2)),`0x${n.padStart(k*2,"0")}`}function Y(t,e=!1){return z(t,e)}function tt(t){return/^(0x|0X)?[a-fA-F0-9]+$/.test(t)&&t.length%2===0}function et(t){return/^(0x|0X)/.test(t)?(t.length-2)/2:t.length/2}const T="::",D="0x2::sui::SUI",v=t=>/^(0x)?[0-9a-fA-F]+::\w+::\w+$/.test(t),G=t=>t.replace(/(0x)(0*)/g,"0x");function O(t){return t=t.startsWith("0x")?t.slice(2):t,t=t.length%2===0?t:"0"+t,`0x${t.length===64?t:w.hex.encode(w.bytes.zpad(w.hex.decode(t),32))}`}const nt=t=>{const e=t.split(T);if(e.length!==3)throw new Error(`Invalid Sui type: ${t}`);return[z(e[0]),e[1],e[2]].join(T)},rt=t=>new x(t).getCoinType(),it=t=>new x(t).getPackageId(),ot=t=>{const e=G(t).match(/0x2::table::Table<(.*)>/);if(!e)throw new Error(`Invalid table type: ${t}`);if(e.length<2)throw new Error(`Invalid table type: ${t}`);const[n]=e[1].split(",");if(!n||!v(n))throw new Error(`Invalid key type: ${n}`);return n},S=class S{constructor(e){U(this,"address");U(this,"module");if(S.instanceof(e))this.address=e.address,this.module=e.module;else if(w.UniversalAddress.instanceof(e))this.address=e.toUint8Array();else if(typeof e=="string"){if(v(e)){const n=e.split(T);this.module=n.slice(1).join(T),e=n[0]}if(e=O(e),!w.hex.valid(e))throw new Error("Invalid Sui address: "+e);this.address=w.hex.decode(e)}else this.address=e}unwrap(){const e=this.getPackageId(),n=this.module?T+this.module:"";return`${e}${n}`}toString(){return this.unwrap()}toNative(){return this}toUint8Array(){return this.address}toUniversalAddress(){return new w.UniversalAddress(this.toUint8Array())}getPackageId(){return O(w.hex.encode(this.address))}getCoinType(){if(this.module==="sui::SUI")return D;if(!this.module)throw new Error("No module present in Sui token address");return this.unwrap()}static instanceof(e){return e.constructor.platform===S.platform}equals(e){return S.instanceof(e)?e.unwrap()===this.unwrap():this.toUniversalAddress().equals(e)}};U(S,"byteSize",32),U(S,"platform","Sui");let x=S;w.registerNative("Sui",x);exports.SUI_ADDRESS_LENGTH=k;exports.SUI_COIN=D;exports.SUI_SEPARATOR=T;exports.SuiAddress=x;exports.encodeStr=W;exports.fromBase58=B;exports.fromBase64=K;exports.fromHex=L;exports.getCoinTypeFromPackageId=rt;exports.getPackageIdFromType=it;exports.getTableKeyType=ot;exports.isValidSuiAddress=V;exports.isValidSuiObjectId=J;exports.isValidSuiType=v;exports.isValidTransactionDigest=Z;exports.normalizeSuiAddress=z;exports.normalizeSuiObjectId=Y;exports.normalizeSuiType=nt;exports.parseStructTag=j;exports.splitGenericParameters=R;exports.toBase58=$;exports.toBase64=F;exports.toHex=P;exports.trimSuiType=G;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var $=Object.defineProperty;var H=(l,t,e)=>t in l?$(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var f=(l,t,e)=>H(l,typeof t!="symbol"?t+"":t,e);const n=require("./web3-COTIsLs8.js");class z{constructor(t,e,a,i,s){f(this,"source");f(this,"destination");f(this,"fromChain");f(this,"toChain");f(this,"recipient");this.fromChain=t,this.toChain=e,this.source=a,this.destination=i,this.recipient=s}parseAmount(t){return n.parse(t,this.source.decimals)}amountFromBaseUnits(t){return n.fromBaseUnits(t,this.source.decimals)}async displayQuote(t,e,a){let i={success:!0,sourceToken:{token:t.sourceToken.token,amount:n.fromBaseUnits(t.sourceToken.amount,this.source.decimals)},destinationToken:{token:t.destinationToken.token,amount:n.fromBaseUnits(t.destinationToken.amount,this.destination.decimals)},params:e};if(t.relayFee){const o=await(t.relayFee.token.chain===this.fromChain.chain?this.fromChain:this.toChain).getDecimals(t.relayFee.token.address);i.relayFee={token:t.relayFee.token,amount:n.fromBaseUnits(t.relayFee.amount,o)}}if(t.destinationNativeGas){const s=await this.toChain.getDecimals("native");i.destinationNativeGas=n.fromBaseUnits(t.destinationNativeGas,s)}return t.warnings&&t.warnings.length>0&&(i.warnings=[...t.warnings]),i.eta=t.eta,i.expires=t.expires,a&&(i.details=a),i}static async create(t,e,a,i){a=a??t.getChain(e.source.chain),i=i??t.getChain(e.destination.chain);const s=await n.getTokenDetails(a,e.source,e.sourceDecimals),o=await n.getTokenDetails(i,e.destination,e.destinationDecimals);return new z(a,i,s,o,e.recipient)}}async function _(l,t,e,a=120*1e3,i=console.log){const s=Date.now();i("Checking transfer state...");for await(t of l.track(t,120*1e3))i("Current Transfer State: ",n.TransferState[t.state]);if(n.isCompleted(t))return t;if(n.isManual(l)&&n.isAttested(t)&&e){i("Completing transfer...");const r=await l.complete(e,t);i("Completed transfer with txids: ",r)}if(n.isFinalizable(l)&&n.isRedeemed(t)&&e){i("Finalizing transfer...");const r=await l.finalize(e,t);i("Finalized transfer with txids: ",r)}const o=a-(Date.now()-s);return o>0?(i("Transfer not complete, trying again in a 2000ms..."),await new Promise(c=>setTimeout(c,2e3)),_(l,t,e,o)):t}class b extends n.AutomaticRoute{static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return n.tokenBridgeRelayerChains.has(t)?n.tokenBridgeRelayerChains.get(t):[]}static async supportedDestinationTokens(t,e,a){try{if(!n.isNative(t)&&!await(await e.getAutomaticTokenBridge()).isRegisteredToken(t.address))return[];const i=await n.TokenTransfer.lookupDestinationToken(e,a,t);return await(await a.getAutomaticTokenBridge()).isRegisteredToken(i.address)?[i]:[]}catch{return[]}}getDefaultOptions(){return{nativeGas:0}}async validate(t,e){try{const a=e.options??this.getDefaultOptions();if(a.nativeGas&&(a.nativeGas>1||a.nativeGas<0))throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");const{destination:i}=t;n.isNative(i.id.address)&&a.nativeGas===0&&(a.nativeGas=0);const s={...e,options:a};return{valid:!0,params:{...s,normalizedParams:await this.normalizeTransferParams(t,s)}}}catch(a){return{valid:!1,params:e,error:a}}}async normalizeTransferParams(t,e){const a=t.parseAmount(e.amount),i=n.isNative(t.source.id.address)?await t.fromChain.getNativeWrappedTokenId():t.source.id,o=await(await t.fromChain.getAutomaticTokenBridge()).getRelayerFee(t.toChain.chain,i.address),r=o*105n/100n;if(n.units(a)<r)throw new n.MinAmountError(n.fromBaseUnits(r,a.decimals));const c=n.units(a)-o;let d=n.fromBaseUnits(0n,t.source.decimals);if(e.options&&e.options.nativeGas>0){let m=await(await t.toChain.getAutomaticTokenBridge()).maxSwapAmount(t.destination.id.address);const T=n.truncate(n.fromBaseUnits(c,a.decimals),n.TokenTransfer.MAX_DECIMALS),h=await t.toChain.getDecimals(t.destination.id.address),w=n.units(n.scale(T,h));w<m&&(m=w);const y=1e4,B=BigInt(Math.floor(e.options.nativeGas*y)),F=m*B/BigInt(y),v=n.fromBaseUnits(F,t.destination.decimals);d=n.scale(n.truncate(v,n.TokenTransfer.MAX_DECIMALS),t.source.decimals),n.units(d)>c&&(d=n.fromBaseUnits(c,t.source.decimals))}return{fee:n.fromBaseUnits(o,t.source.decimals),amount:a,nativeGasAmount:d}}async quote(t,e){const a=await t.fromChain.getAutomaticTokenBridge();if(n.isTokenId(t.source.id)&&!await a.isRegisteredToken(t.source.id.address))return{success:!1,error:new Error("Source token is not registered")};try{let i=await n.TokenTransfer.quoteTransfer(this.wh,t.fromChain,t.toChain,{protocol:"AutomaticTokenBridge",amount:n.units(e.normalizedParams.amount),token:t.source.id,nativeGas:n.units(e.normalizedParams.nativeGasAmount)});return t.displayQuote(i,e)}catch(i){return{success:!1,error:i}}}async initiate(t,e,a,i){const{params:s}=a,o=this.toTransferDetails(t,s,n.Wormhole.chainAddress(e.chain(),e.address()),i),r=await n.TokenTransfer.transfer(t.fromChain,o,e);return{from:o.from.chain,to:o.to.chain,state:n.TransferState.SourceInitiated,originTxs:r}}async*track(t,e){try{yield*n.TokenTransfer.track(this.wh,t,e)}catch(a){throw a}}toTransferDetails(t,e,a,i){return{from:a,to:i,protocol:"AutomaticTokenBridge",amount:n.units(e.normalizedParams.amount),token:t.source.id,nativeGas:n.units(e.normalizedParams.nativeGasAmount)}}}f(b,"NATIVE_GAS_DROPOFF_SUPPORTED",!0),f(b,"meta",{name:"AutomaticTokenBridge"});function X(l={}){class t extends x{}return f(t,"config",l),t}const p=class p extends n.AutomaticRoute{constructor(){super(...arguments);f(this,"staticConfig",this.constructor.config)}static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(e){return e==="Devnet"?[]:n.executorTokenBridgeChains(e)}static async supportedDestinationTokens(e,a,i){try{return[await n.TokenTransfer.lookupDestinationToken(a,i,e)]}catch{return[]}}getDefaultOptions(){return{nativeGas:0}}async validate(e,a){const i=n.parse(a.amount,e.source.decimals),s=a.options??this.getDefaultOptions();if(s.nativeGas&&(s.nativeGas>1||s.nativeGas<0))throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");return{valid:!0,params:{amount:a.amount,normalizedParams:{amount:i},options:s}}}async quote(e,a){var s,o,r,c,d,u,m,T,h;const i=p.supportedChains(e.fromChain.network);if(!i.includes(e.fromChain.chain)||!i.includes(e.toChain.chain))return{success:!1,error:new Error(`Executor Token Bridge does not support transfers from ${e.fromChain.chain} to ${e.toChain.chain}`)};try{let w;const y=await e.toChain.getExecutorTokenBridge();let{gasLimit:B,msgValue:F}=await y.estimateMsgValueAndGasLimit(e.destination.id,e.recipient);if(((s=this.staticConfig.referrerFee)==null?void 0:s.referrerFeeDbps)!==void 0&&(w=this.staticConfig.referrerFee.referrerFeeDbps),(o=this.staticConfig.referrerFee)!=null&&o.tokenFeeOverrides){const g=n.canonicalAddress(e.source.id),k=(c=(r=this.staticConfig.referrerFee.tokenFeeOverrides[this.wh.network])==null?void 0:r[e.fromChain.chain])==null?void 0:c[g];k!==void 0&&(w=k)}if(this.staticConfig.tokenOverrides){const g=n.canonicalAddress(e.destination.id),k=(u=(d=this.staticConfig.tokenOverrides[this.wh.network])==null?void 0:d[e.destination.id.chain])==null?void 0:u[g];(k==null?void 0:k.gasLimit)!==void 0&&(B=k.gasLimit)}let v;if(w!==void 0&&w>0n){const g=(h=(T=(m=this.staticConfig.referrerFee)==null?void 0:m.referrerAddresses)==null?void 0:T[this.wh.network])==null?void 0:h[e.fromChain.chain];if(!g)throw new Error(`No referrer address configured for network ${this.wh.network} and chain ${e.fromChain.chain}`);v=n.Wormhole.chainAddress(e.fromChain.chain,g)}const L=w!==void 0&&v!==void 0?{feeDbps:w,referrer:v}:void 0;let U;if(a.options.nativeGas!==void 0){const g=await n.TokenTransfer.getExecutorGasDropOffLimit(this.wh,e.toChain);U=g>0n?BigInt(Math.round(a.options.nativeGas*100))*g/100n:0n}const W=await n.TokenTransfer.quoteTransfer(this.wh,e.fromChain,e.toChain,{token:e.source.id,amount:n.units(a.normalizedParams.amount),protocol:"ExecutorTokenBridge",nativeGas:U,msgValue:F,gasLimit:B,referrerFee:L});return e.displayQuote(W,a,W.details)}catch(w){return{success:!1,error:w}}}async initiate(e,a,i,s){const{fromChain:o,toChain:r}=e,{params:c}=i,d=await n.TokenTransfer.destinationOverrides(o,r,this.toTransferDetails(e,c,n.Wormhole.chainAddress(a.chain(),a.address()),s,i)),u=await n.TokenTransfer.transfer(o,d,a);let m=0;return(async()=>{for(;m<20;){try{const[h]=await this.wh.getExecutorTxStatus(u.at(-1).txid,o.chain);if(h)break}catch{}m++,await new Promise(h=>setTimeout(h,2e3))}})(),{from:d.from.chain,to:d.to.chain,state:n.TransferState.SourceInitiated,originTxs:u}}async complete(e,a){if(!n.isAttested(a)&&!n.isFailed(a))throw new Error("The source must be finalized in order to complete the transfer");if(!a.attestation)throw new Error("The receipt must have an attestation to complete the transfer");const i=this.wh.getChain(a.to),s=await i.getExecutorTokenBridge(),o=n.toNative(e.chain(),e.address()),r=s.redeem(o,a.attestation.attestation),c=await n.signSendWait(i,r,e);return{...a,state:n.TransferState.DestinationInitiated,attestation:a.attestation,destinationTxs:c}}async resume(e){const a=await n.TokenTransfer.from(this.wh,e,1e4);if(a.transfer.protocol!=="ExecutorTokenBridge")throw new Error("Can only resume ExecutorTokenBridge transfers");return n.TokenTransfer.getReceipt(a)}async*track(e,a){for await(const i of n.TokenTransfer.track(this.wh,e,a))yield i}toTransferDetails(e,a,i,s,o){if(!o.details)throw new Error("Missing quote details");return{from:i,to:s,token:e.source.id,amount:n.units(a.normalizedParams.amount),protocol:"ExecutorTokenBridge",executorQuote:o.details.executorQuote,referrerFee:o.details.referrerFee}}};f(p,"IS_EXECUTOR_ROUTE",!0),f(p,"NATIVE_GAS_DROPOFF_SUPPORTED",!0),f(p,"config",{}),f(p,"meta",{name:"TokenBridgeExecutorRoute"});let x=p;class O extends n.ManualRoute{static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return n.tokenBridgeChains(t)}static async supportedDestinationTokens(t,e,a){try{return[await n.TokenTransfer.lookupDestinationToken(e,a,t)]}catch{return[]}}getDefaultOptions(){return{payload:void 0}}async validate(t,e){const a=n.parse(e.amount,t.source.decimals);return{valid:!0,params:{amount:e.amount,normalizedParams:{amount:a},options:{}}}}async quote(t,e){try{return t.displayQuote(await n.TokenTransfer.quoteTransfer(this.wh,t.fromChain,t.toChain,{token:t.source.id,amount:n.units(e.normalizedParams.amount),protocol:"TokenBridge",...e.options}),e)}catch(a){return{success:!1,error:a}}}async initiate(t,e,a,i){const{params:s}=a,o=await n.TokenTransfer.destinationOverrides(t.fromChain,t.toChain,this.toTransferDetails(t,s,n.Wormhole.chainAddress(e.chain(),e.address()),i)),r=await n.TokenTransfer.transfer(t.fromChain,o,e);return{from:o.from.chain,to:o.to.chain,state:n.TransferState.SourceInitiated,originTxs:r}}async complete(t,e){if(!n.isAttested(e))throw new Error("The source must be finalized in order to complete the transfer");const a=this.wh.getChain(e.to),i=await n.TokenTransfer.redeem(a,e.attestation.attestation,t);return{...e,state:n.TransferState.DestinationInitiated,destinationTxs:i}}async resume(t){const e=await n.TokenTransfer.from(this.wh,t,1e4);if(e.transfer.protocol!=="TokenBridge")throw new Error("Transfer is not a TokenBridge transfer");return n.TokenTransfer.getReceipt(e)}async*track(t,e){yield*n.TokenTransfer.track(this.wh,t,e)}toTransferDetails(t,e,a,i){return{from:a,to:i,protocol:"TokenBridge",token:t.source.id,amount:n.units(e.normalizedParams.amount),...e.options}}}f(O,"meta",{name:"ManualTokenBridge"});const R=15n,V=100n,S=10000n,A=class A extends n.AutomaticRoute{static supportedNetworks(){return["Mainnet"]}static supportedChains(t){return n.porticoContractChains.has(t)?n.porticoContractChains.get(t):[]}static async supportedDestinationTokens(t,e,a){const[,i]=n.resolveWrappedToken(e.network,e.chain,t),s=n.canonicalAddress(i),o=await e.getPorticoBridge();if(!o.supportedTokens().some(m=>n.canonicalAddress(m.token)===s))return[];try{const m=await o.getTransferrableToken(s);await n.TokenTransfer.lookupDestinationToken(e,a,m)}catch{return[]}const c=(await a.getPorticoBridge()).supportedTokens(),{tokenMap:d}=a.config,u=o.getTokenGroup(s);return c.filter(m=>(m.group===u||m.group==="ETH"&&u==="WETH"||m.group==="WETH"&&u==="ETH")&&(!d||n.filters.byAddress(d,n.canonicalAddress(m.token)))).map(m=>m.token)}getDefaultOptions(){return{}}async validate(t,e){try{if(!A.supportedChains(t.fromChain.network).includes(t.fromChain.chain)||!A.supportedChains(t.toChain.network).includes(t.toChain.chain))throw new Error("Protocol not supported");const{fromChain:a,toChain:i,source:s,destination:o}=t,{network:r}=a,[,c]=n.resolveWrappedToken(r,a.chain,s.id),[,d]=n.resolveWrappedToken(r,i.chain,o.id),u=await a.getPorticoBridge(),m=await i.getPorticoBridge(),T=await u.getTransferrableToken(n.canonicalAddress(c)),h=await m.getTransferrableToken(n.canonicalAddress(d));return{valid:!0,params:{amount:e.amount,options:e.options??this.getDefaultOptions(),normalizedParams:{amount:t.parseAmount(e.amount),canonicalSourceToken:T,canonicalDestinationToken:h,sourceToken:c,destinationToken:d}}}}catch(a){return{valid:!1,error:a,params:e}}}async quote(t,e){try{const a=await this.fetchSwapQuote(t,e),i=Math.max(t.source.decimals,t.destination.decimals),s=n.units(n.scale(e.normalizedParams.amount,i));if(n.units(n.scale(n.fromBaseUnits(a.minAmountFinish,t.destination.decimals),i))<s-s*V/S)throw new Error("Slippage too high");const c=await(await t.toChain.getPorticoBridge()).quoteRelay(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address),d={swapAmounts:a,relayerFee:c},u=d.swapAmounts.minAmountFinish-c;return u<0n?{success:!1,error:new Error(`Amount too low for slippage and fee, would result in negative destination amount (${u})`)}:await t.displayQuote({sourceToken:{token:e.normalizedParams.sourceToken,amount:n.units(e.normalizedParams.amount)},destinationToken:{token:e.normalizedParams.destinationToken,amount:d.swapAmounts.minAmountFinish-c},relayFee:{token:e.normalizedParams.destinationToken,amount:c},eta:n.estimateFinalityTime(t.fromChain.chain),expires:n.expiration(0,5,0)},e,d)}catch(a){return{success:!1,error:a}}}async initiate(t,e,a,i){const{params:s,details:o}=a,r=t.source.id.address,c=t.destination.id,d=await t.fromChain.getPorticoBridge(),u=d.getTokenGroup(r.toString()),T=(await t.toChain.getPorticoBridge()).getPorticoAddress(u),h=d.transfer(n.Wormhole.parseAddress(e.chain(),e.address()),i,r,n.units(s.normalizedParams.amount),c,T,o);return{originTxs:await n.signSendWait(t.fromChain,h,e),state:n.TransferState.SourceInitiated,from:t.fromChain.chain,to:t.toChain.chain}}async*track(t,e){if(n.isSourceInitiated(t)||n.isSourceFinalized(t)){const{txid:a}=t.originTxs[t.originTxs.length-1],i=await this.wh.getVaa(a,"PorticoBridge:Transfer",e);if(!i)throw new Error("No VAA found for transaction: "+a);const s={chain:i.emitterChain,emitter:i.emitterAddress,sequence:i.sequence};t={...t,state:n.TransferState.Attested,attestation:{id:s,attestation:i}},yield t}n.isAttested(t)&&await(await this.wh.getChain(t.to).getPorticoBridge()).isTransferCompleted(t.attestation.attestation)&&(t={...t,state:n.TransferState.DestinationFinalized},yield t),yield t}async complete(t,e){if(!n.isAttested(e))throw new Error("Source must be attested");const a=await this.wh.getChain(e.to),i=await a.getPorticoBridge(),s=n.Wormhole.chainAddress(t.chain(),t.address()),o=i.redeem(s.address,e.attestation.attestation);return await n.signSendWait(a,o,t)}async fetchSwapQuote(t,e){const a=await t.fromChain.getPorticoBridge(),i=n.units(e.normalizedParams.amount),s=a.getTokenGroup(n.canonicalAddress(e.normalizedParams.sourceToken)),o=await a.quoteSwap(e.normalizedParams.sourceToken.address,e.normalizedParams.canonicalSourceToken.address,s,i),r=o*R/S;if(r>=o)throw new Error("Start slippage too high");const c=await t.toChain.getPorticoBridge(),d=o-r,u=await c.quoteSwap(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address,s,d),m=u*R/S;if(m>=u)throw new Error("Finish slippage too high");const T=u-m;return{minAmountStart:d,minAmountFinish:T}}};f(A,"NATIVE_GAS_DROPOFF_SUPPORTED",!1),f(A,"meta",{name:"AutomaticPortico"});let G=A;class N extends n.ManualRoute{static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return n.circleContractChains.has(t)?n.circleContractChains.get(t):[]}static async supportedDestinationTokens(t,e,a){const i=n.usdcContract.get(e.network,e.chain);if(!i)return[];if(!n.isSameToken(t,n.Wormhole.tokenId(e.chain,i)))return[];const{network:s,chain:o}=a;return n.usdcContract.has(s,o)?[n.Wormhole.chainAddress(o,n.usdcContract.get(s,o))]:[]}getDefaultOptions(){return{payload:void 0}}async validate(t,e){return{valid:!0,params:{normalizedParams:{amount:t.parseAmount(e.amount)},options:e.options??this.getDefaultOptions(),...e}}}async quote(t,e){try{return t.displayQuote(await n.CircleTransfer.quoteTransfer(t.fromChain,t.toChain,{automatic:!1,amount:n.units(e.normalizedParams.amount),...e.options}),e)}catch(a){return{success:!1,error:a}}}async initiate(t,e,a,i){const{params:s}=a,o=await n.CircleTransfer.destinationOverrides(t.fromChain,t.toChain,this.toTransferDetails(s,n.Wormhole.chainAddress(e.chain(),e.address()),i)),r=await n.CircleTransfer.transfer(t.fromChain,o,e),c=await n.CircleTransfer.getTransferMessage(t.fromChain,r[r.length-1].txid);return{from:o.from.chain,to:o.to.chain,state:n.TransferState.SourceFinalized,originTxs:r,attestation:{id:c.id,attestation:{message:c.message}}}}async complete(t,e){if(!n.isAttested(e))throw new Error("The source must be finalized in order to complete the transfer");const{id:a,attestation:i}=e.attestation;if(n.CircleBridge.isCircleAttestation(i)){const{message:s,attestation:o}=i;if(!o)throw new Error(`No Circle attestation for ${a}`);const r=this.wh.getChain(e.to),c=await r.getCircleBridge(),d=n.Wormhole.parseAddress(t.chain(),t.address()),u=c.redeem(d,s,o),m=await n.signSendWait(r,u,t);return{...e,state:n.TransferState.DestinationInitiated,destinationTxs:m}}else return e}async resume(t){const e=await n.CircleTransfer.from(this.wh,t,1e4);return n.CircleTransfer.getReceipt(e)}async*track(t,e){yield*n.CircleTransfer.track(this.wh,t,e)}toTransferDetails(t,e,a){return{from:e,to:a,amount:n.units(t.normalizedParams.amount),automatic:!1,...t.options}}}f(N,"meta",{name:"ManualCCTP",provider:"Circle"});class D extends n.AutomaticRoute{static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return n.circleContractChains.has(t)?n.circleContractChains.get(t).filter(a=>{var i;return(i=n.circleContracts.get(t,a))==null?void 0:i.wormholeRelayer}):[]}static async supportedDestinationTokens(t,e,a){const i=n.usdcContract.get(e.network,e.chain);if(!i)return[];if(!n.isSameToken(t,n.Wormhole.tokenId(e.chain,i)))return[];const{network:s,chain:o}=a;return n.usdcContract.has(s,o)?[n.Wormhole.chainAddress(o,n.usdcContract.get(s,o))]:[]}getDefaultOptions(){return{nativeGas:0}}async validate(t,e){try{const a=e.options??this.getDefaultOptions();return{valid:!0,params:{normalizedParams:await this.normalizeTransferParams(t,e),options:a,...e}}}catch(a){return{valid:!1,params:e,error:a}}}async quote(t,e){try{return t.displayQuote(await n.CircleTransfer.quoteTransfer(t.fromChain,t.toChain,{automatic:!0,amount:n.units(e.normalizedParams.amount),nativeGas:n.units(e.normalizedParams.nativeGasAmount)}),e)}catch(a){return{success:!1,error:a}}}async normalizeTransferParams(t,e){const a=t.parseAmount(e.amount),s=await(await t.fromChain.getAutomaticCircleBridge()).getRelayerFee(t.toChain.chain),o=s*105n/100n;if(n.units(a)<o)throw new n.MinAmountError(n.fromBaseUnits(o,a.decimals));const r=n.units(a)-s,d=(e.options??this.getDefaultOptions()).nativeGas??0;if(d>1||d<0)throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");let u=0n;if(d>0){let T=await(await t.toChain.getAutomaticCircleBridge()).maxSwapAmount();r<T&&(T=r);const h=1e4,w=BigInt(Math.floor(d*h));u=T*w/BigInt(h),u===r&&u>0n&&(u-=1n)}return{fee:t.amountFromBaseUnits(s),amount:a,nativeGasAmount:t.amountFromBaseUnits(u)}}toTransferDetails(t,e,a){return{from:e,to:a,amount:n.units(t.normalizedParams.amount),automatic:!0,nativeGas:n.units(t.normalizedParams.nativeGasAmount)}}async initiate(t,e,a,i){const{params:s}=a;let o=this.toTransferDetails(s,n.Wormhole.chainAddress(e.chain(),e.address()),i),r=await n.CircleTransfer.transfer(t.fromChain,o,e);const c=await n.CircleTransfer.getTransferMessage(t.fromChain,r[r.length-1].txid);return{from:o.from.chain,to:o.to.chain,state:n.TransferState.SourceFinalized,originTxs:r,attestation:{id:c.id,attestation:{message:c.message}}}}async*track(t,e){yield*n.CircleTransfer.track(this.wh,t,e)}}f(D,"NATIVE_GAS_DROPOFF_SUPPORTED",!0),f(D,"meta",{name:"AutomaticCCTP",provider:"Circle"});class I extends n.ManualRoute{static supportedNetworks(){return["Mainnet"]}static supportedChains(t){return n.tokenBridgeChains(t)}static async supportedDestinationTokens(t,e,a){if(!await this.isSourceTokenSupported(t,e))return[];const i=n.TBTCBridge.getNativeTbtcToken(a.chain);if(i)return[i];const s=await a.getTokenBridge(),o=n.TBTCBridge.getNativeTbtcToken("Ethereum");try{const r=await s.getWrappedAsset(o);return[n.Wormhole.tokenId(a.chain,r.toString())]}catch(r){if(r.message.includes("not a wrapped asset"))return[];throw r}}getDefaultOptions(){return{}}async validate(t,e){return{valid:!0,params:{normalizedParams:{amount:t.parseAmount(e.amount)},options:e.options??this.getDefaultOptions(),...e}}}async quote(t,e){const a=n.estimateFinalityTime(t.fromChain.chain)+n.guardianAttestationEta;return{success:!0,params:e,sourceToken:{token:t.source.id,amount:e.normalizedParams.amount},destinationToken:{token:t.destination.id,amount:e.normalizedParams.amount},eta:a,expires:n.expiration(24,0,0)}}async initiate(t,e,a,i){const s=n.units(a.params.normalizedParams.amount),o=t.fromChain.chain==="Ethereum",r=n.TBTCBridge.getNativeTbtcToken(t.fromChain.chain),c=r&&n.isSameToken(a.sourceToken.token,r);if(c&&!o)return await this.transferNative(t,e,i,s);if(!c&&o)throw new Error("Only tbtc can be transferred on Ethereum");if(!c){const u=await(await t.fromChain.getTokenBridge()).getOriginalAsset(a.sourceToken.token.address),m=n.TBTCBridge.getNativeTbtcToken("Ethereum");if(!n.isSameToken(u,m))throw new Error("Can only transfer wrapped tbtc")}return await this.transferWrapped(t,e,i,s)}async transferNative(t,e,a,i){const s=n.Wormhole.parseAddress(e.chain(),e.address()),r=(await t.fromChain.getTBTCBridge()).transfer(s,a,i);return{originTxs:await n.signSendWait(t.fromChain,r,e),state:n.TransferState.SourceInitiated,from:t.fromChain.chain,to:t.toChain.chain}}async transferWrapped(t,e,a,i){const s=n.Wormhole.parseAddress(e.chain(),e.address()),o=n.tbtc.get(t.fromChain.network,a.chain),r=await t.fromChain.getTokenBridge();let c;return o?c=r.transfer(s,n.Wormhole.chainAddress(t.toChain.chain,o),t.source.id.address,i,a.address.toUniversalAddress().toUint8Array()):c=r.transfer(s,a,t.source.id.address,i),{originTxs:await n.signSendWait(t.fromChain,c,e),state:n.TransferState.SourceInitiated,from:t.fromChain.chain,to:t.toChain.chain}}async complete(t,e){if(!n.isAttested(e))throw new Error("The source must be finalized in order to complete the transfer");const a=n.Wormhole.parseAddress(t.chain(),t.address()),i=e.attestation.attestation,s=this.wh.getChain(e.to);let o;if(i.payloadLiteral==="TBTCBridge:GatewayTransfer")o=(await s.getTBTCBridge()).redeem(a,i);else{const c=await s.getTokenBridge(),d=n.serialize$1(i),u=n.deserialize("TokenBridge:Transfer",d);o=c.redeem(a,u)}const r=await n.signSendWait(s,o,t);return{...e,state:n.TransferState.DestinationInitiated,destinationTxs:r}}async resume(t){const e=await this.wh.getVaa(t.txid,n.TBTCBridge.getTransferDiscriminator());if(!e)throw new Error("No VAA found for transaction: "+t);const a=n.TBTCBridge.getNativeTbtcToken("Ethereum"),{chain:i,address:s}=e.payload.token;if(!n.isSameToken(a,{chain:i,address:s}))throw new Error("Can only resume tbtc transfers");return{originTxs:[t],state:n.TransferState.Attested,from:e.emitterChain,to:e.payload.to.chain,attestation:{id:{chain:e.emitterChain,emitter:e.emitterAddress,sequence:e.sequence},attestation:e}}}async*track(t,e){if(n.isSourceInitiated(t)||n.isSourceFinalized(t)){const{txid:a}=t.originTxs[t.originTxs.length-1],i=await this.wh.getVaa(a,n.TBTCBridge.getTransferDiscriminator(),e);if(!i)throw new Error("No VAA found for transaction: "+a);const s={chain:i.emitterChain,emitter:i.emitterAddress,sequence:i.sequence};t={...t,state:n.TransferState.Attested,attestation:{id:s,attestation:i}},yield t}n.isAttested(t)&&await(await this.wh.getChain(t.to).getTokenBridge()).isTransferCompleted(t.attestation.attestation)&&(t={...t,state:n.TransferState.DestinationFinalized},yield t),yield t}static async isSourceTokenSupported(t,e){if(n.isNative(t.address))return!1;const a=n.TBTCBridge.getNativeTbtcToken(e.chain);if(a&&n.isSameToken(t,a))return!0;const i=await e.getTokenBridge();try{const s=await i.getOriginalAsset(t.address);return n.isSameToken(s,n.TBTCBridge.getNativeTbtcToken("Ethereum"))}catch(s){if(s.message.includes("not a wrapped asset"))return!1;throw s}}}f(I,"meta",{name:"ManualTBTC"});const j=Object.freeze(Object.defineProperty({__proto__:null,AutomaticCCTPRoute:D,AutomaticPorticoRoute:G,AutomaticRoute:n.AutomaticRoute,AutomaticTokenBridgeRoute:b,BPS_PER_HUNDRED_PERCENT:S,CCTPRoute:N,ExecutorTokenBridgeRoute:x,FinalizableRoute:n.FinalizableRoute,MAX_SLIPPAGE_BPS:V,ManualRoute:n.ManualRoute,MinAmountError:n.MinAmountError,RelayFailedError:n.RelayFailedError,Route:n.Route,RouteResolver:n.RouteResolver,RouteTransferRequest:z,SLIPPAGE_BPS:R,TBTCRoute:I,TokenBridgeRoute:O,UnavailableError:n.UnavailableError,checkAndCompleteTransfer:_,executorTokenBridgeRoute:X,isAutomatic:n.isAutomatic,isFinalizable:n.isFinalizable,isManual:n.isManual},Symbol.toStringTag,{value:"Module"})),J="0x1::aptos_coin::AptosCoin",P="::",M="Aptos",Q=l=>/^(0x)?[0-9a-fA-F]+::\w+::\w+$/.test(l),K=l=>l.split(P)[0];function Y(l){return l.length%2!==0||l.length<66?(l=l.startsWith("0x")?l.slice(2):l,"0x"+l.padStart(64,"0")):l}const C=class C{constructor(t){f(this,"type","Native");f(this,"address");f(this,"module");if(C.instanceof(t))this.address=t.address,this.module=t.module;else if(n.UniversalAddress.instanceof(t))this.address=t.toUint8Array();else if(typeof t=="string"){if(Q(t)){const e=t.split(P);this.module=e.slice(1).join(P),t=e[0]}if(t=Y(t),!n.hex.valid(t))throw new Error("Invalid Aptos address: "+t);this.address=n.hex.decode(t)}else this.address=t}unwrap(){const t=n.hex.encode(this.address).replace(/^0+/,""),e=this.module?P+this.module:"";return`0x${t}${e}`}toString(){return this.unwrap()}toNative(){return this}toUint8Array(){return this.address}toUniversalAddress(){return new n.UniversalAddress(this.toUint8Array())}static instanceof(t){return t.constructor.platform===C.platform}equals(t){return C.instanceof(t)?t.unwrap()===this.unwrap():this.toUniversalAddress().equals(t)}};f(C,"byteSize",32),f(C,"platform",M);let E=C;n.registerNative(M,E);exports.APTOS_COIN=J;exports.APTOS_SEPARATOR=P;exports.AptosAddress=E;exports.AutomaticCCTPRoute=D;exports.AutomaticTokenBridgeRoute=b;exports.CCTPRoute=N;exports.RouteTransferRequest=z;exports.TBTCRoute=I;exports.TokenBridgeRoute=O;exports._platform=M;exports.coalesceModuleAddress=K;exports.isValidAptosType=Q;exports.routes=j;
|