@wormhole-foundation/wormhole-connect 4.0.0-beta.0-development → 4.0.0-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/dist/assets/{aptos-CIKjhZ5R.js → aptos-CaGPw7HM.js} +2 -2
- package/dist/assets/create-54a95t1x.js +1 -0
- package/dist/assets/{evm-Ky_mCHhS.js → evm-Bv0RsFka.js} +2 -2
- package/dist/assets/{index-DW7sWcdW.js → index-B5JfIVKE.js} +1 -1
- package/dist/assets/{index-DHLr3HmO.js → index-BCD-VOiF.js} +1 -1
- package/dist/assets/index-BwhO0jGm.js +1 -0
- package/dist/assets/{index-DpM61P6H.js → index-CMULoTsT.js} +1 -1
- package/dist/assets/{index-DZpeOp3V.js → index-CO4HXUmy.js} +1 -1
- package/dist/assets/{index-Bg3NWSHL.js → index-COw2RtBx.js} +1 -1
- package/dist/assets/{index-DRk-Cj0P.js → index-ClrVAZUa.js} +1 -1
- package/dist/assets/{index-D7RgFG0F.js → index-CzQeh-hT.js} +1 -1
- package/dist/assets/{index-Csghphw2.js → index-DC4mZtDw.js} +1 -1
- package/dist/assets/{index-Cqs_fFht.js → index-DI-xN_q3.js} +1 -1
- package/dist/assets/{index-DVbfoP0w.js → index-DRsHBjoG.js} +1 -1
- package/dist/assets/{index-CdAFGcxx.js → index-DXcQbQ8r.js} +1 -1
- package/dist/assets/{index-DJ52h-dV.js → index-DxHhcWFS.js} +1 -1
- package/dist/assets/{index-g9iLhWvp.js → index-GKTf0CV7.js} +1 -1
- package/dist/assets/{index-DuR9wYhp.js → index-aoYIFErC.js} +1 -1
- package/dist/assets/{index-DfNgilHG.js → index-jixjwN_L.js} +1 -1
- package/dist/assets/{solana-jYIeIu4B.js → solana-DpD0VkQS.js} +2 -2
- package/dist/assets/{sui-B96bqBVv.js → sui-7K04yY2U.js} +2 -2
- package/dist/main.js +75 -75
- package/dist/src/components/TokenBalance.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/contexts/wallet/WalletProvider.d.ts.map +1 -1
- package/dist/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/dist/src/hooks/useTokenListWithSearch.d.ts +1 -4
- package/dist/src/hooks/useTokenListWithSearch.d.ts.map +1 -1
- package/dist/src/routes/operator.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts +2 -2
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/telemetry/types.d.ts +1 -0
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/utils/sdkv2.d.ts.map +1 -1
- package/dist/src/utils/wrappedNativeTokens.d.ts +12 -0
- package/dist/src/utils/wrappedNativeTokens.d.ts.map +1 -0
- package/dist/src/views/Terms.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts +2 -4
- package/dist/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts.map +1 -1
- package/lib/{account-D0Q4K1CI.js → account-24z6tDMM.js} +1 -1
- package/lib/{account-BdDruAAr.mjs → account-BcnWVXmg.mjs} +1 -1
- package/lib/{address-fSXS9iww.mjs → address-BX2fIOro.mjs} +1 -1
- package/lib/{address-BO6rj6uK.js → address-Bc-5yO4D.js} +1 -1
- package/lib/{aptos-B1VSCmD9.mjs → aptos-5b4F4UXd.mjs} +4 -4
- package/lib/{aptos-DG7QN21P.js → aptos-B_Yz-0gh.js} +1 -1
- package/lib/{aptos-BnKScTtI.mjs → aptos-DO_Sexq-.mjs} +7 -7
- package/lib/{aptos-B3C7cnvM.js → aptos-DffuIzI0.js} +2 -2
- package/lib/{basic-BRYkcAmD.mjs → basic-BclwqsOq.mjs} +4 -4
- package/lib/{basic-CN2jAqvS.js → basic-BdiYk8Hf.js} +1 -1
- package/lib/{basic-DufHOLGA.js → basic-CuO6iz8a.js} +1 -1
- package/lib/{basic-Cw13RoYq.mjs → basic-HasHL_DG.mjs} +4 -4
- package/lib/{blake2b-CT6EW399.mjs → blake2b-CVpPk5O9.mjs} +1 -1
- package/lib/{blake2b-B_Q_lTGN.js → blake2b-DXExLbRg.js} +1 -1
- package/lib/{browser-ponyfill-CnfcLhK-.mjs → browser-ponyfill-DeOApqpH.mjs} +1 -1
- package/lib/{browser-ponyfill-DbGoEOBo.js → browser-ponyfill-VhIu9z_I.js} +1 -1
- package/lib/{chain-BCKkYvDb.js → chain-BxNUWKZE.js} +1 -1
- package/lib/{chain-_dXKRkCE.mjs → chain-CvZsIsLh.mjs} +1 -1
- package/lib/{chunk-KJH4KKG6-RA0hChr8.mjs → chunk-KJH4KKG6-BgebMATq.mjs} +2 -2
- package/lib/{chunk-KJH4KKG6-BXBLZwfY.js → chunk-KJH4KKG6-DNlN4p21.js} +1 -1
- package/lib/{constants-QsbOfMbk.mjs → constants-DnbaS3cF.mjs} +3 -3
- package/lib/constants-abC7FLXq.js +1 -0
- package/lib/{contract-MkLF5rqi.js → contract-CTycrpaK.js} +1 -1
- package/lib/{contract-C_4H8x77.mjs → contract-KYuIk_vR.mjs} +1 -1
- package/lib/{core-Cpb3gtg_.js → core-COM78LTW.js} +3 -3
- package/lib/{core-ntLR7o2S.mjs → core-DT_3gIqi.mjs} +6 -6
- package/lib/{create-naslyPfU.mjs → create-BvzkkBPW.mjs} +1 -1
- package/lib/{create-CfgTxAS-.js → create-CGZYy2vu.js} +1 -1
- package/lib/{evm-C6xp3v8Z.mjs → evm-CUR4-a7F.mjs} +9 -9
- package/lib/{evm-B3G2Vkzg.js → evm-CoLwXequ.js} +2 -2
- package/lib/{evm-B20n3mf_.mjs → evm-DoVrPE_X.mjs} +7 -7
- package/lib/{evm-aSG_vFbw.js → evm-Dv-WYu07.js} +2 -2
- package/lib/executor.js +1 -1
- package/lib/executor.mjs +815 -572
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{index-DSmKiYkD.mjs → index-B1KwS33G.mjs} +5 -5
- package/lib/{index-vhQ5Q8ov.mjs → index-B2sVzSwb.mjs} +52 -97
- package/lib/{index-Bz7ogqhR.mjs → index-B3idKQJG.mjs} +1 -1
- package/lib/index-B7Afz_5P.js +1 -0
- package/lib/{index-Dq7WWqFe.js → index-B7HBnPLP.js} +1 -1
- package/lib/{index-DQX74QAE.js → index-BFBwRlid.js} +1 -1
- package/lib/{index-C6XNAQ4w.js → index-BZZZ8OeS.js} +1 -1
- package/lib/{index-C3LC73WN.js → index-BaYN-RHF.js} +1 -1
- package/lib/{index-BTUx12aa.js → index-Bhwzpq1T.js} +1 -1
- package/lib/{index-MsaML_Ju.mjs → index-Bicx897u.mjs} +2 -2
- package/lib/{index-Dajw3Alx.mjs → index-BlWksu-f.mjs} +1 -1
- package/lib/{index-DS8bl8fA.mjs → index-Bn0hkKKz.mjs} +4 -4
- package/lib/{index-BojkMsXD.js → index-BoKTcLq-.js} +1 -1
- package/lib/{index-BRYq_Nt2.mjs → index-Bp4ojxz6.mjs} +4 -4
- package/lib/{index-Cnznwcdb.js → index-BqabgGIh.js} +1 -1
- package/lib/{index-DxYgNWMY.mjs → index-BtEjOWoP.mjs} +3 -3
- package/lib/{index-BJcbyvof.js → index-C8HxYDNY.js} +1 -1
- package/lib/{index-Bhd_YhUf.js → index-C9Bk-rKp.js} +1 -1
- package/lib/{index-YAL4zolc.js → index-C9uGqcwH.js} +1 -1
- package/lib/{index-BQvEIlB2.mjs → index-CBGUPQXa.mjs} +3 -3
- package/lib/{index-IHxtA-NL.js → index-CGpn3INM.js} +1 -1
- package/lib/{index-BRyW-hBN.mjs → index-CTpINVAG.mjs} +2 -2
- package/lib/{index-bNUantLb.js → index-CjjP3Qp5.js} +1 -1
- package/lib/{index-CU73EUQW.js → index-CkGYgQTz.js} +1 -1
- package/lib/{index-DqzqJgVc.mjs → index-CkvxfaqA.mjs} +3 -3
- package/lib/{index-DfDB5FLw.js → index-ClMpLrxa.js} +1 -1
- package/lib/{index-B7VNYedX.mjs → index-CtU_hkYp.mjs} +4 -4
- package/lib/{index-DMOY218i.js → index-CzRVzbTC.js} +1 -1
- package/lib/{index-B4S4sz6p.mjs → index-Czxl_5Tr.mjs} +5 -5
- package/lib/{index-D0XQIiQn.js → index-D6qJDbzm.js} +1 -1
- package/lib/{index-D-H8WyKb.mjs → index-DGzoIr_I.mjs} +1 -1
- package/lib/{index-BD0gcmCp.mjs → index-DPpi4Don.mjs} +5 -5
- package/lib/{index-7_BfcP8x.mjs → index-DZaOh3F9.mjs} +2105 -2021
- package/lib/{index-QlIJYJce.js → index-DaY7_eQ6.js} +66 -66
- package/lib/{index-C3L-xKvN.mjs → index-DlmQ0_RF.mjs} +4839 -4850
- package/lib/{index-D5ENAOm3.js → index-DmsirrTI.js} +1 -1
- package/lib/{index-DnO0ZdKy.mjs → index-DpN0dULN.mjs} +1 -1
- package/lib/{index-BNuKzxGJ.js → index-DydXCN0v.js} +1 -1
- package/lib/{index-CSMunRpZ.mjs → index-NKV6j8zE.mjs} +3 -3
- package/lib/{index-BIYx5IBr.mjs → index-OlMuNft9.mjs} +3 -3
- package/lib/{index-tztRp3yJ.js → index-P9DbJOzh.js} +1 -1
- package/lib/{index-D1y-l93C.js → index-UbeUI3Ir.js} +1 -1
- package/lib/{index-BZYEbYGY.mjs → index-ZGgSxaDf.mjs} +3 -3
- package/lib/{index-DFpSbD7R.mjs → index-_e8uUnEK.mjs} +5 -5
- package/lib/{index-Cb9lswnP.js → index-cCBQV2Yv.js} +8 -8
- package/lib/{index-B9ybSY9R.mjs → index-cggXdVJu.mjs} +5 -5
- package/lib/{index.es-C476iHvN.mjs → index.es-5ecqX8B9.mjs} +4 -4
- package/lib/{index.es-CU6nhwJO.js → index.es-LBG64XJ6.js} +1 -1
- package/lib/{index.es-CkGpObng.js → index.es-owVcNlof.js} +3 -3
- package/lib/{index.es-CtiAoQ78.mjs → index.es-zNH_KzcH.mjs} +3 -3
- package/lib/index.js +1 -1
- package/lib/index.mjs +5 -5
- package/lib/mayan.js +1 -1
- package/lib/mayan.mjs +11 -11
- package/lib/{mint-zy6P38iu.js → mint-B4t2SvV6.js} +1 -1
- package/lib/{mint-DyoU9X22.mjs → mint-BGuU5y5m.mjs} +1 -1
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +14 -12
- package/lib/{platform-x3ZBJ0YM.js → platform-Bkbg7A9d.js} +1 -1
- package/lib/{platform-BqpAMtgx.mjs → platform-C5gJAqtZ.mjs} +3 -3
- package/lib/{platform-BhspUaMJ.js → platform-C6QB7aIN.js} +1 -1
- package/lib/{platform-DQfpyXSV.mjs → platform-DBNvSsue.mjs} +4 -4
- package/lib/{platform-BHAZvZ_O.mjs → platform-DtB8gGMl.mjs} +4 -4
- package/lib/{platform-4nANkJAM.js → platform-qdbxkhTI.js} +1 -1
- package/lib/{provider-jsonrpc-DIXcAw4Q.mjs → provider-jsonrpc-BIIDy-Aw.mjs} +2 -2
- package/lib/{provider-jsonrpc-BCKoIijx.js → provider-jsonrpc-DHzam3ud.js} +1 -1
- package/lib/{secp256k1-CaaRyr2C.mjs → secp256k1-BF6Vm50D.mjs} +1 -1
- package/lib/{secp256k1-C60XBS-e.js → secp256k1-Bb6lbAjK.js} +1 -1
- package/lib/{secp256k1-UnRv5Suy.mjs → secp256k1-BfK5OWRP.mjs} +1 -1
- package/lib/{secp256k1-BWFGSbjt.mjs → secp256k1-CqT-a-I8.mjs} +1 -1
- package/lib/{secp256k1-CFt7TfEF.js → secp256k1-DRTQ6WrU.js} +1 -1
- package/lib/{secp256k1-BIiWvuxu.js → secp256k1-D_GNj8sK.js} +1 -1
- package/lib/{signer-DhO2iGae.mjs → signer-BH3gAHuj.mjs} +2 -2
- package/lib/{signer-BFY1Ytf6.js → signer-MBixef_P.js} +1 -1
- package/lib/{solana-CQk4ocg8.mjs → solana-C1puc64V.mjs} +11 -11
- package/lib/solana-C8xK8qJY.mjs +18 -0
- package/lib/solana-CRSliekb.js +1 -0
- package/lib/{solana-Cp49k9--.js → solana-CtBdJ6Wt.js} +4 -4
- package/lib/{solanaEmbed.esm-Cwa6cl_R.js → solanaEmbed.esm-BpIKVhXq.js} +1 -1
- package/lib/{solanaEmbed.esm-DBOqO9Ii.mjs → solanaEmbed.esm-NdE_DQuw.mjs} +3 -3
- package/lib/src/components/TokenBalance.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/contexts/wallet/WalletProvider.d.ts.map +1 -1
- package/lib/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/lib/src/hooks/useTokenListWithSearch.d.ts +1 -4
- package/lib/src/hooks/useTokenListWithSearch.d.ts.map +1 -1
- package/lib/src/routes/operator.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts +2 -2
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/telemetry/types.d.ts +1 -0
- package/lib/src/telemetry/types.d.ts.map +1 -1
- package/lib/src/utils/sdkv2.d.ts.map +1 -1
- package/lib/src/utils/wrappedNativeTokens.d.ts +12 -0
- package/lib/src/utils/wrappedNativeTokens.d.ts.map +1 -0
- package/lib/src/views/Terms.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts +2 -4
- package/lib/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts.map +1 -1
- package/lib/{sui-C2a1eehP.mjs → sui-BW7tMLZs.mjs} +4 -4
- package/lib/{sui-9gsoM56W.js → sui-DdujB9Bc.js} +1 -1
- package/lib/{sui-Cr98JBgS.js → sui-QcDjGW68.js} +1 -1
- package/lib/{sui-B4RvzEXx.mjs → sui-euceXgYf.mjs} +7 -7
- package/lib/{tokens-BbFKf6Hv.mjs → tokens-DI-tPIbd.mjs} +3 -3
- package/lib/{tokens-LVHsSbYG.js → tokens-DJos2DwM.js} +1 -1
- package/lib/{transfer-DZ-wNocj.js → transfer-BinEH6ml.js} +1 -1
- package/lib/{transfer-BV1ou1GP.mjs → transfer-DTvv5m_5.mjs} +2 -2
- package/lib/{units-BqUlbZ46.mjs → units-CVEv4txp.mjs} +2 -2
- package/lib/{units-D-oRQjOa.js → units-DtldPRXy.js} +1 -1
- package/lib/{unsignedTransaction-BmxD6VsY.mjs → unsignedTransaction-CVE7GUdC.mjs} +3 -3
- package/lib/{unsignedTransaction-CiPKh85X.js → unsignedTransaction-DL3WyIkF.js} +1 -1
- package/lib/{w3m-modal-3qLkbPfi.mjs → w3m-modal-B2VF8j7W.mjs} +2 -2
- package/lib/{w3m-modal-D4-nrnEK.mjs → w3m-modal-C32eQxEe.mjs} +2 -2
- package/lib/{w3m-modal-CoTG8Zu4.js → w3m-modal-DSY2qJYP.js} +1 -1
- package/lib/{w3m-modal-xqVExHU-.js → w3m-modal-DgqSQLqZ.js} +1 -1
- package/lib/{web3-C1wK6wIV.js → web3-BKaP497Y.js} +1 -1
- package/lib/{web3-BkEb7AgB.mjs → web3-BifDBsFp.mjs} +8 -4
- package/package.json +49 -44
- package/dist/assets/create-q7V6muDT.js +0 -1
- package/dist/assets/index-B59bCuJJ.js +0 -1
- package/lib/constants-BR_zyzqY.js +0 -1
- package/lib/index-CXsUtRJQ.js +0 -1
- package/lib/solana-Dv_mUYcl.mjs +0 -18
- package/lib/solana-g3YsP966.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ax as S, at as g, av as v, ag as x, az as f, dM as w, Y as I, af as m, q as i, bG as T, i as d, t as k, ac as U, ay as $, aG as c, aH as E } from "./web3-
|
|
2
|
-
import { e as u, c as h, f as F, d as _, i as C } from "./address-
|
|
3
|
-
import { T as b } from "./chunk-KJH4KKG6-
|
|
4
|
-
import { A as W } from "./platform-
|
|
1
|
+
import { ax as S, at as g, av as v, ag as x, az as f, dM as w, Y as I, af as m, q as i, bG as T, i as d, t as k, ac as U, ay as $, aG as c, aH as E } from "./web3-BifDBsFp.mjs";
|
|
2
|
+
import { e as u, c as h, f as F, d as _, i as C } from "./address-BX2fIOro.mjs";
|
|
3
|
+
import { T as b } from "./chunk-KJH4KKG6-BgebMATq.mjs";
|
|
4
|
+
import { A as W } from "./platform-DBNvSsue.mjs";
|
|
5
5
|
import { A as N } from "./unsignedTransaction-BJi-f5xi.mjs";
|
|
6
6
|
const O = [
|
|
7
7
|
{ name: "tokenBridgeAddress", ...g },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./web3-C1wK6wIV.js"),T=require("./address-BO6rj6uK.js");async function p(m,t,e,a=120*1e3,o=console.log){const i=Date.now();o("Checking transfer state...");for await(t of m.track(t,120*1e3))o("Current Transfer State: ",n.TransferState[t.state]);if(n.isCompleted(t))return t;if(n.isManual(m)&&n.isAttested(t)&&e){o("Completing transfer...");const c=await m.complete(e,t);o("Completed transfer with txids: ",c)}if(n.isFinalizable(m)&&n.isRedeemed(t)&&e){o("Finalizing transfer...");const c=await m.finalize(e,t);o("Finalized transfer with txids: ",c)}const r=a-(Date.now()-i);return r>0?(o("Transfer not complete, trying again in a 2000ms..."),await new Promise(s=>setTimeout(s,2e3)),p(m,t,e,r)):t}function E(m={}){class t extends k{static config=m}return t}class k extends n.AutomaticRoute{static IS_EXECUTOR_ROUTE=!0;static NATIVE_GAS_DROPOFF_SUPPORTED=!0;staticConfig=this.constructor.config;static config={};static meta={name:"TokenBridgeExecutorRoute"};static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return t==="Devnet"?[]:n.executorTokenBridgeChains(t)}static async supportedDestinationTokens(t,e,a){try{return[await n.TokenTransfer.lookupDestinationToken(e,a,t)]}catch{return[]}}getDefaultOptions(){return{nativeGas:0}}async validate(t,e){if(t.fromChain.chain===t.toChain.chain)return{valid:!1,params:e,error:new Error("Source and destination chains cannot be the same")};const a=n.parse(e.amount,t.source.decimals),o=e.options??this.getDefaultOptions();if(o.nativeGas&&(o.nativeGas>1||o.nativeGas<0))throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");return{valid:!0,params:{amount:e.amount,normalizedParams:{amount:a},options:o}}}async quote(t,e){const a=k.supportedChains(t.fromChain.network);if(!a.includes(t.fromChain.chain)||!a.includes(t.toChain.chain))return{success:!1,error:new Error(`Executor Token Bridge does not support transfers from ${t.fromChain.chain} to ${t.toChain.chain}`)};try{let o;const i=await t.toChain.getExecutorTokenBridge();let{gasLimit:r,msgValue:c}=await i.estimateMsgValueAndGasLimit(t.destination.id,t.recipient);if(this.staticConfig.referrerFee?.referrerFeeDbps!==void 0&&(o=this.staticConfig.referrerFee.referrerFeeDbps),this.staticConfig.referrerFee?.tokenFeeOverrides){const l=n.canonicalAddress(t.source.id),h=this.staticConfig.referrerFee.tokenFeeOverrides[this.wh.network]?.[t.fromChain.chain]?.[l];h!==void 0&&(o=h)}if(this.staticConfig.tokenOverrides){const l=n.canonicalAddress(t.destination.id),h=this.staticConfig.tokenOverrides[this.wh.network]?.[t.destination.id.chain]?.[l];h?.gasLimit!==void 0&&(r=h.gasLimit)}let s;if(o!==void 0&&o>0n){const l=this.staticConfig.referrerFee?.referrerAddresses?.[this.wh.network]?.[t.fromChain.chain];if(!l)throw new Error(`No referrer address configured for network ${this.wh.network} and chain ${t.fromChain.chain}`);s=n.Wormhole.chainAddress(t.fromChain.chain,l)}const d=o!==void 0&&s!==void 0?{feeDbps:o,referrer:s}:void 0;let u;if(e.options.nativeGas!==void 0){const l=await n.TokenTransfer.getExecutorGasDropOffLimit(this.wh,t.toChain);u=l>0n?BigInt(Math.round(e.options.nativeGas*100))*l/100n:0n}const f=await n.TokenTransfer.quoteTransfer(this.wh,t.fromChain,t.toChain,{token:t.source.id,amount:n.units(e.normalizedParams.amount),protocol:"ExecutorTokenBridge",nativeGas:u,msgValue:c,gasLimit:r,referrerFee:d});return t.displayQuote(f,e,f.details)}catch(o){return{success:!1,error:o}}}async initiate(t,e,a,o){const{fromChain:i,toChain:r}=t,{params:c}=a,s=await n.TokenTransfer.destinationOverrides(i,r,this.toTransferDetails(t,c,n.Wormhole.chainAddress(e.chain(),e.address()),o,a)),d=await n.TokenTransfer.transfer(i,s,e);let u=0;return(async()=>{for(;u<20;){try{const[l]=await this.wh.getExecutorTxStatus(d.at(-1).txid,i.chain);if(l)break}catch{}u++,await new Promise(l=>setTimeout(l,2e3))}})(),{from:s.from.chain,to:s.to.chain,state:n.TransferState.SourceInitiated,originTxs:d}}async complete(t,e){if(!n.isAttested(e)&&!n.isFailed(e))throw new Error("The source must be finalized in order to complete the transfer");if(!e.attestation)throw new Error("The receipt must have an attestation to complete the transfer");const a=this.wh.getChain(e.to),o=await a.getExecutorTokenBridge(),i=n.toNative(t.chain(),t.address()),r=o.redeem(i,e.attestation.attestation),c=await n.signSendWait(a,r,t);return{...e,state:n.TransferState.DestinationInitiated,attestation:e.attestation,destinationTxs:c}}async resume(t){const e=await n.TokenTransfer.from(this.wh,t,1e4);if(e.transfer.protocol!=="ExecutorTokenBridge")throw new Error("Can only resume ExecutorTokenBridge transfers");return n.TokenTransfer.getReceipt(e)}async*track(t,e){for await(const a of n.TokenTransfer.track(this.wh,t,e))yield a}toTransferDetails(t,e,a,o,i){if(!i.details)throw new Error("Missing quote details");return{from:a,to:o,token:t.source.id,amount:n.units(e.normalizedParams.amount),protocol:"ExecutorTokenBridge",executorQuote:i.details.executorQuote,referrerFee:i.details.referrerFee}}}const C=15n,P=100n,w=10000n;class g extends n.AutomaticRoute{static NATIVE_GAS_DROPOFF_SUPPORTED=!1;static meta={name:"AutomaticPortico"};static supportedNetworks(){return["Mainnet"]}static supportedChains(t){return n.porticoContractChains.has(t)?n.porticoContractChains.get(t):[]}static async supportedDestinationTokens(t,e,a){const[,o]=n.resolveWrappedToken(e.network,e.chain,t),i=n.canonicalAddress(o),r=await e.getPorticoBridge();if(!r.supportedTokens().some(f=>n.canonicalAddress(f.token)===i))return[];try{const f=await r.getTransferrableToken(i);await n.TokenTransfer.lookupDestinationToken(e,a,f)}catch{return[]}const s=(await a.getPorticoBridge()).supportedTokens(),{tokenMap:d}=a.config,u=r.getTokenGroup(i);return s.filter(f=>(f.group===u||f.group==="ETH"&&u==="WETH"||f.group==="WETH"&&u==="ETH")&&(!d||n.filters.byAddress(d,n.canonicalAddress(f.token)))).map(f=>f.token)}getDefaultOptions(){return{}}async validate(t,e){try{if(t.fromChain.chain===t.toChain.chain)return{valid:!1,params:e,error:new Error("Source and destination chains cannot be the same")};if(!g.supportedChains(t.fromChain.network).includes(t.fromChain.chain)||!g.supportedChains(t.toChain.network).includes(t.toChain.chain))throw new Error("Protocol not supported");const{fromChain:a,toChain:o,source:i,destination:r}=t,{network:c}=a,[,s]=n.resolveWrappedToken(c,a.chain,i.id),[,d]=n.resolveWrappedToken(c,o.chain,r.id),u=await a.getPorticoBridge(),f=await o.getPorticoBridge(),l=await u.getTransferrableToken(n.canonicalAddress(s)),h=await f.getTransferrableToken(n.canonicalAddress(d));return{valid:!0,params:{amount:e.amount,options:e.options??this.getDefaultOptions(),normalizedParams:{amount:t.parseAmount(e.amount),canonicalSourceToken:l,canonicalDestinationToken:h,sourceToken:s,destinationToken:d}}}}catch(a){return{valid:!1,error:a,params:e}}}async quote(t,e){try{const a=await this.fetchSwapQuote(t,e),o=Math.max(t.source.decimals,t.destination.decimals),i=n.units(n.scale(e.normalizedParams.amount,o));if(n.units(n.scale(n.fromBaseUnits(a.minAmountFinish,t.destination.decimals),o))<i-i*P/w)throw new Error("Slippage too high");const s=await(await t.toChain.getPorticoBridge()).quoteRelay(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address),d={swapAmounts:a,relayerFee:s},u=d.swapAmounts.minAmountFinish-s;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-s},relayFee:{token:e.normalizedParams.destinationToken,amount:s},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,o){const{params:i,details:r}=a,c=t.source.id.address,s=t.destination.id,d=await t.fromChain.getPorticoBridge(),u=d.getTokenGroup(c.toString()),l=(await t.toChain.getPorticoBridge()).getPorticoAddress(u),h=d.transfer(n.Wormhole.parseAddress(e.chain(),e.address()),o,c,n.units(i.normalizedParams.amount),s,l,r);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],o=await this.wh.getVaa(a,"PorticoBridge:Transfer",e);if(!o)throw new Error("No VAA found for transaction: "+a);const i={chain:o.emitterChain,emitter:o.emitterAddress,sequence:o.sequence};t={...t,state:n.TransferState.Attested,attestation:{id:i,attestation:o}},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),o=await a.getPorticoBridge(),i=n.Wormhole.chainAddress(t.chain(),t.address()),r=o.redeem(i.address,e.attestation.attestation);return await n.signSendWait(a,r,t)}async fetchSwapQuote(t,e){const a=await t.fromChain.getPorticoBridge(),o=n.units(e.normalizedParams.amount),i=a.getTokenGroup(n.canonicalAddress(e.normalizedParams.sourceToken)),r=await a.quoteSwap(e.normalizedParams.sourceToken.address,e.normalizedParams.canonicalSourceToken.address,i,o),c=r*C/w;if(c>=r)throw new Error("Start slippage too high");const s=await t.toChain.getPorticoBridge(),d=r-c,u=await s.quoteSwap(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address,i,d),f=u*C/w;if(f>=u)throw new Error("Finish slippage too high");const l=u-f;return{minAmountStart:d,minAmountFinish:l}}}const x=Object.freeze(Object.defineProperty({__proto__:null,AutomaticCCTPRoute:T.AutomaticCCTPRoute,AutomaticPorticoRoute:g,AutomaticRoute:n.AutomaticRoute,AutomaticTokenBridgeRoute:T.AutomaticTokenBridgeRoute,BPS_PER_HUNDRED_PERCENT:w,CCTPRoute:T.CCTPRoute,ExecutorTokenBridgeRoute:k,FinalizableRoute:n.FinalizableRoute,MAX_SLIPPAGE_BPS:P,ManualRoute:n.ManualRoute,MinAmountError:n.MinAmountError,RelayFailedError:n.RelayFailedError,Route:n.Route,RouteResolver:n.RouteResolver,RouteTransferRequest:T.RouteTransferRequest,SLIPPAGE_BPS:C,TBTCRoute:T.TBTCRoute,TokenBridgeRoute:T.TokenBridgeRoute,UnavailableError:n.UnavailableError,checkAndCompleteTransfer:p,executorTokenBridgeRoute:E,isAutomatic:n.isAutomatic,isFinalizable:n.isFinalizable,isManual:n.isManual},Symbol.toStringTag,{value:"Module"}));exports.routes=x;
|
|
1
|
+
"use strict";const n=require("./web3-BKaP497Y.js"),T=require("./address-Bc-5yO4D.js");async function p(m,t,e,a=120*1e3,o=console.log){const i=Date.now();o("Checking transfer state...");for await(t of m.track(t,120*1e3))o("Current Transfer State: ",n.TransferState[t.state]);if(n.isCompleted(t))return t;if(n.isManual(m)&&n.isAttested(t)&&e){o("Completing transfer...");const c=await m.complete(e,t);o("Completed transfer with txids: ",c)}if(n.isFinalizable(m)&&n.isRedeemed(t)&&e){o("Finalizing transfer...");const c=await m.finalize(e,t);o("Finalized transfer with txids: ",c)}const r=a-(Date.now()-i);return r>0?(o("Transfer not complete, trying again in a 2000ms..."),await new Promise(s=>setTimeout(s,2e3)),p(m,t,e,r)):t}function E(m={}){class t extends k{static config=m}return t}class k extends n.AutomaticRoute{static IS_EXECUTOR_ROUTE=!0;static NATIVE_GAS_DROPOFF_SUPPORTED=!0;staticConfig=this.constructor.config;static config={};static meta={name:"TokenBridgeExecutorRoute"};static supportedNetworks(){return["Mainnet","Testnet"]}static supportedChains(t){return t==="Devnet"?[]:n.executorTokenBridgeChains(t)}static async supportedDestinationTokens(t,e,a){try{return[await n.TokenTransfer.lookupDestinationToken(e,a,t)]}catch{return[]}}getDefaultOptions(){return{nativeGas:0}}async validate(t,e){if(t.fromChain.chain===t.toChain.chain)return{valid:!1,params:e,error:new Error("Source and destination chains cannot be the same")};const a=n.parse(e.amount,t.source.decimals),o=e.options??this.getDefaultOptions();if(o.nativeGas&&(o.nativeGas>1||o.nativeGas<0))throw new Error("Native gas must be between 0.0 and 1.0 (0% and 100%)");return{valid:!0,params:{amount:e.amount,normalizedParams:{amount:a},options:o}}}async quote(t,e){const a=k.supportedChains(t.fromChain.network);if(!a.includes(t.fromChain.chain)||!a.includes(t.toChain.chain))return{success:!1,error:new Error(`Executor Token Bridge does not support transfers from ${t.fromChain.chain} to ${t.toChain.chain}`)};try{let o;const i=await t.toChain.getExecutorTokenBridge();let{gasLimit:r,msgValue:c}=await i.estimateMsgValueAndGasLimit(t.destination.id,t.recipient);if(this.staticConfig.referrerFee?.referrerFeeDbps!==void 0&&(o=this.staticConfig.referrerFee.referrerFeeDbps),this.staticConfig.referrerFee?.tokenFeeOverrides){const l=n.canonicalAddress(t.source.id),h=this.staticConfig.referrerFee.tokenFeeOverrides[this.wh.network]?.[t.fromChain.chain]?.[l];h!==void 0&&(o=h)}if(this.staticConfig.tokenOverrides){const l=n.canonicalAddress(t.destination.id),h=this.staticConfig.tokenOverrides[this.wh.network]?.[t.destination.id.chain]?.[l];h?.gasLimit!==void 0&&(r=h.gasLimit)}let s;if(o!==void 0&&o>0n){const l=this.staticConfig.referrerFee?.referrerAddresses?.[this.wh.network]?.[t.fromChain.chain];if(!l)throw new Error(`No referrer address configured for network ${this.wh.network} and chain ${t.fromChain.chain}`);s=n.Wormhole.chainAddress(t.fromChain.chain,l)}const d=o!==void 0&&s!==void 0?{feeDbps:o,referrer:s}:void 0;let u;if(e.options.nativeGas!==void 0){const l=await n.TokenTransfer.getExecutorGasDropOffLimit(this.wh,t.toChain);u=l>0n?BigInt(Math.round(e.options.nativeGas*100))*l/100n:0n}const f=await n.TokenTransfer.quoteTransfer(this.wh,t.fromChain,t.toChain,{token:t.source.id,amount:n.units(e.normalizedParams.amount),protocol:"ExecutorTokenBridge",nativeGas:u,msgValue:c,gasLimit:r,referrerFee:d});return t.displayQuote(f,e,f.details)}catch(o){return{success:!1,error:o}}}async initiate(t,e,a,o){const{fromChain:i,toChain:r}=t,{params:c}=a,s=await n.TokenTransfer.destinationOverrides(i,r,this.toTransferDetails(t,c,n.Wormhole.chainAddress(e.chain(),e.address()),o,a)),d=await n.TokenTransfer.transfer(i,s,e);let u=0;return(async()=>{for(;u<20;){try{const[l]=await this.wh.getExecutorTxStatus(d.at(-1).txid,i.chain);if(l)break}catch{}u++,await new Promise(l=>setTimeout(l,2e3))}})(),{from:s.from.chain,to:s.to.chain,state:n.TransferState.SourceInitiated,originTxs:d}}async complete(t,e){if(!n.isAttested(e)&&!n.isFailed(e))throw new Error("The source must be finalized in order to complete the transfer");if(!e.attestation)throw new Error("The receipt must have an attestation to complete the transfer");const a=this.wh.getChain(e.to),o=await a.getExecutorTokenBridge(),i=n.toNative(t.chain(),t.address()),r=o.redeem(i,e.attestation.attestation),c=await n.signSendWait(a,r,t);return{...e,state:n.TransferState.DestinationInitiated,attestation:e.attestation,destinationTxs:c}}async resume(t){const e=await n.TokenTransfer.from(this.wh,t,1e4);if(e.transfer.protocol!=="ExecutorTokenBridge")throw new Error("Can only resume ExecutorTokenBridge transfers");return n.TokenTransfer.getReceipt(e)}async*track(t,e){for await(const a of n.TokenTransfer.track(this.wh,t,e))yield a}toTransferDetails(t,e,a,o,i){if(!i.details)throw new Error("Missing quote details");return{from:a,to:o,token:t.source.id,amount:n.units(e.normalizedParams.amount),protocol:"ExecutorTokenBridge",executorQuote:i.details.executorQuote,referrerFee:i.details.referrerFee}}}const C=15n,P=100n,w=10000n;class g extends n.AutomaticRoute{static NATIVE_GAS_DROPOFF_SUPPORTED=!1;static meta={name:"AutomaticPortico"};static supportedNetworks(){return["Mainnet"]}static supportedChains(t){return n.porticoContractChains.has(t)?n.porticoContractChains.get(t):[]}static async supportedDestinationTokens(t,e,a){const[,o]=n.resolveWrappedToken(e.network,e.chain,t),i=n.canonicalAddress(o),r=await e.getPorticoBridge();if(!r.supportedTokens().some(f=>n.canonicalAddress(f.token)===i))return[];try{const f=await r.getTransferrableToken(i);await n.TokenTransfer.lookupDestinationToken(e,a,f)}catch{return[]}const s=(await a.getPorticoBridge()).supportedTokens(),{tokenMap:d}=a.config,u=r.getTokenGroup(i);return s.filter(f=>(f.group===u||f.group==="ETH"&&u==="WETH"||f.group==="WETH"&&u==="ETH")&&(!d||n.filters.byAddress(d,n.canonicalAddress(f.token)))).map(f=>f.token)}getDefaultOptions(){return{}}async validate(t,e){try{if(t.fromChain.chain===t.toChain.chain)return{valid:!1,params:e,error:new Error("Source and destination chains cannot be the same")};if(!g.supportedChains(t.fromChain.network).includes(t.fromChain.chain)||!g.supportedChains(t.toChain.network).includes(t.toChain.chain))throw new Error("Protocol not supported");const{fromChain:a,toChain:o,source:i,destination:r}=t,{network:c}=a,[,s]=n.resolveWrappedToken(c,a.chain,i.id),[,d]=n.resolveWrappedToken(c,o.chain,r.id),u=await a.getPorticoBridge(),f=await o.getPorticoBridge(),l=await u.getTransferrableToken(n.canonicalAddress(s)),h=await f.getTransferrableToken(n.canonicalAddress(d));return{valid:!0,params:{amount:e.amount,options:e.options??this.getDefaultOptions(),normalizedParams:{amount:t.parseAmount(e.amount),canonicalSourceToken:l,canonicalDestinationToken:h,sourceToken:s,destinationToken:d}}}}catch(a){return{valid:!1,error:a,params:e}}}async quote(t,e){try{const a=await this.fetchSwapQuote(t,e),o=Math.max(t.source.decimals,t.destination.decimals),i=n.units(n.scale(e.normalizedParams.amount,o));if(n.units(n.scale(n.fromBaseUnits(a.minAmountFinish,t.destination.decimals),o))<i-i*P/w)throw new Error("Slippage too high");const s=await(await t.toChain.getPorticoBridge()).quoteRelay(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address),d={swapAmounts:a,relayerFee:s},u=d.swapAmounts.minAmountFinish-s;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-s},relayFee:{token:e.normalizedParams.destinationToken,amount:s},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,o){const{params:i,details:r}=a,c=t.source.id.address,s=t.destination.id,d=await t.fromChain.getPorticoBridge(),u=d.getTokenGroup(c.toString()),l=(await t.toChain.getPorticoBridge()).getPorticoAddress(u),h=d.transfer(n.Wormhole.parseAddress(e.chain(),e.address()),o,c,n.units(i.normalizedParams.amount),s,l,r);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],o=await this.wh.getVaa(a,"PorticoBridge:Transfer",e);if(!o)throw new Error("No VAA found for transaction: "+a);const i={chain:o.emitterChain,emitter:o.emitterAddress,sequence:o.sequence};t={...t,state:n.TransferState.Attested,attestation:{id:i,attestation:o}},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),o=await a.getPorticoBridge(),i=n.Wormhole.chainAddress(t.chain(),t.address()),r=o.redeem(i.address,e.attestation.attestation);return await n.signSendWait(a,r,t)}async fetchSwapQuote(t,e){const a=await t.fromChain.getPorticoBridge(),o=n.units(e.normalizedParams.amount),i=a.getTokenGroup(n.canonicalAddress(e.normalizedParams.sourceToken)),r=await a.quoteSwap(e.normalizedParams.sourceToken.address,e.normalizedParams.canonicalSourceToken.address,i,o),c=r*C/w;if(c>=r)throw new Error("Start slippage too high");const s=await t.toChain.getPorticoBridge(),d=r-c,u=await s.quoteSwap(e.normalizedParams.canonicalDestinationToken.address,e.normalizedParams.destinationToken.address,i,d),f=u*C/w;if(f>=u)throw new Error("Finish slippage too high");const l=u-f;return{minAmountStart:d,minAmountFinish:l}}}const x=Object.freeze(Object.defineProperty({__proto__:null,AutomaticCCTPRoute:T.AutomaticCCTPRoute,AutomaticPorticoRoute:g,AutomaticRoute:n.AutomaticRoute,AutomaticTokenBridgeRoute:T.AutomaticTokenBridgeRoute,BPS_PER_HUNDRED_PERCENT:w,CCTPRoute:T.CCTPRoute,ExecutorTokenBridgeRoute:k,FinalizableRoute:n.FinalizableRoute,MAX_SLIPPAGE_BPS:P,ManualRoute:n.ManualRoute,MinAmountError:n.MinAmountError,RelayFailedError:n.RelayFailedError,Route:n.Route,RouteResolver:n.RouteResolver,RouteTransferRequest:T.RouteTransferRequest,SLIPPAGE_BPS:C,TBTCRoute:T.TBTCRoute,TokenBridgeRoute:T.TokenBridgeRoute,UnavailableError:n.UnavailableError,checkAndCompleteTransfer:p,executorTokenBridgeRoute:E,isAutomatic:n.isAutomatic,isFinalizable:n.isFinalizable,isManual:n.isManual},Symbol.toStringTag,{value:"Module"}));exports.routes=x;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as f, aL as Le, at as te, ac as u, N as Ue, dS as Te, S as h, cm as Ce, az as x, M as E, J as F, aO as K, b9 as ae, dT as ke, dU as _e, K as ne, aP as Y, Y as Pe, aH as ve, aQ as Be } from "./web3-
|
|
2
|
-
import { d, P as ze, c as Ke } from "./index-
|
|
3
|
-
import { d as S, g as B } from "./account-
|
|
4
|
-
import { S as qe, a as Fe } from "./unsignedTransaction-
|
|
5
|
-
import { c as Ve } from "./create-
|
|
1
|
+
import { P as f, aL as Le, at as te, ac as u, N as Ue, dS as Te, S as h, cm as Ce, az as x, M as E, J as F, aO as K, b9 as ae, dT as ke, dU as _e, K as ne, aP as Y, Y as Pe, aH as ve, aQ as Be } from "./web3-BifDBsFp.mjs";
|
|
2
|
+
import { d, P as ze, c as Ke } from "./index-BlWksu-f.mjs";
|
|
3
|
+
import { d as S, g as B } from "./account-BcnWVXmg.mjs";
|
|
4
|
+
import { S as qe, a as Fe } from "./unsignedTransaction-CVE7GUdC.mjs";
|
|
5
|
+
import { c as Ve } from "./create-BvzkkBPW.mjs";
|
|
6
6
|
const ie = new f("BPFLoaderUpgradeab1e11111111111111111111111");
|
|
7
7
|
function De(s) {
|
|
8
8
|
return S([new f(s).toBuffer()], ie);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./platform-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./platform-Bkbg7A9d.js"),c=require("./web3-BKaP497Y.js"),b=require("./unsignedTransaction-5HCmv6m2.js"),h=[["Testnet",{tokenMessengerState:"0x5252abd1137094ed1db3e0d75bc36abcd287aee4bc310f8e047727ef5682e7c2",messageTransmitterState:"0x98234bd0fa9ac12cc0a20a144a22e36d6a32f7e0a97baaeaf9c76cdc6d122d2e",usdcTreasury:"0x7170137d4a6431bf83351ac025baf462909bffe2877d87716374fb42b9629ebe"}],["Mainnet",{tokenMessengerState:"0x45993eecc0382f37419864992c12faee2238f5cfe22b98ad3bf455baf65c8a2f",messageTransmitterState:"0xf68268c3d9b1df3215f2439400c1c4ea08ac4ef4bb7d6f3ca6a2a239e17510af",usdcTreasury:"0x57d6725e7a8b49a7b2a612f6bd66ab5f39fc95332ca48be421c3229d514a6de7"}]],f=c.constMap(h,[0,1]);class u{network;chain;provider;contracts;usdcId;usdcTreasuryId;tokenMessengerId;tokenMessengerStateId;messageTransmitterId;messageTransmitterStateId;constructor(s,t,r,e){if(this.network=s,this.chain=t,this.provider=r,this.contracts=e,s==="Devnet")throw new Error("CircleBridge not supported on Devnet");const n=c.usdcContract.get(this.network,this.chain);if(!n)throw new Error(`No USDC contract configured for network=${this.network} chain=${this.chain}`);const{tokenMessengerState:i,messageTransmitterState:a,usdcTreasury:o}=f(s);if(!e.cctp?.tokenMessenger)throw new Error(`Circle Token Messenger contract for domain ${t} not found`);if(!e.cctp?.messageTransmitter)throw new Error(`Circle Message Transmitter contract for domain ${t} not found`);this.usdcId=n,this.usdcTreasuryId=o,this.tokenMessengerId=e.cctp?.tokenMessenger,this.messageTransmitterId=e.cctp?.messageTransmitter,this.tokenMessengerStateId=i,this.messageTransmitterStateId=a}async*transfer(s,t,r){const e=new d.Transaction,n=c.circleChainId.get(this.network,t.chain),[i,...a]=await d.SuiPlatform.getCoins(this.provider,s,this.usdcId);if(i===void 0)throw new Error("No USDC in wallet");const o=e.object(i.coinObjectId);a.length>0&&e.mergeCoins(o,a.map(m=>e.object(m.coinObjectId)));const[g]=e.splitCoins(o,[r]);e.moveCall({target:`${this.tokenMessengerId}::deposit_for_burn::deposit_for_burn`,arguments:[g,e.pure.u32(n),e.pure.address(t.address.toUniversalAddress().toString()),e.object(this.tokenMessengerStateId),e.object(this.messageTransmitterStateId),e.object("0x403"),e.object(this.usdcTreasuryId)],typeArguments:[this.usdcId]}),yield this.createUnsignedTx(e,"Sui.CircleBridge.Transfer")}async isTransferCompleted(s){const t=new d.Transaction;t.moveCall({target:`${this.messageTransmitterId}::state::is_nonce_used`,arguments:[t.object(this.messageTransmitterStateId),t.pure.u32(s.sourceDomain),t.pure.u64(s.nonce)]});const r=await this.provider.devInspectTransactionBlock({sender:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionBlock:t});try{return!!r.results[0].returnValues[0][0][0]}catch(e){return console.error(`Error reading if nonce was used: ${e}`),!1}}async*redeem(s,t,r){const e=new d.Transaction,[n]=e.moveCall({target:`${this.messageTransmitterId}::receive_message::receive_message`,arguments:[e.pure.vector("u8",c.CircleBridge.serialize(t)),e.pure.vector("u8",c.hex.decode(r)),e.object(this.messageTransmitterStateId)]});if(!n)throw new Error("Failed to produce receipt");const[i]=e.moveCall({target:`${this.tokenMessengerId}::handle_receive_message::handle_receive_message`,arguments:[n,e.object(this.tokenMessengerStateId),e.object("0x403"),e.object(this.usdcTreasuryId)],typeArguments:[this.usdcId]});if(!i)throw new Error("Failed to produce stamp receipt ticket with burn message");const[a]=e.moveCall({target:`${this.tokenMessengerId}::handle_receive_message::deconstruct_stamp_receipt_ticket_with_burn_message`,arguments:[i]});if(!a)throw new Error("Failed to produce stamp receipt ticket");const[o]=e.moveCall({target:`${this.messageTransmitterId}::receive_message::stamp_receipt`,arguments:[a,e.object(this.messageTransmitterStateId)],typeArguments:[`${this.tokenMessengerId}::message_transmitter_authenticator::MessageTransmitterAuthenticator`]});if(!o)throw new Error("Failed to produce stamped receipt");e.moveCall({target:`${this.messageTransmitterId}::receive_message::complete_receive_message`,arguments:[o,e.object(this.messageTransmitterStateId)]}),yield this.createUnsignedTx(e,"Sui.CircleBridge.Redeem")}async parseTransactionDetails(s){const t=await this.provider.waitForTransaction({digest:s,options:{showEvents:!0,showEffects:!0,showInput:!0}});if(!t)throw new Error("Transaction not found");if(!t.events)throw new Error("Transaction events not found");const r=t.events?.find(w=>w.type.includes("send_message::MessageSent"));if(!r)throw new Error("No MessageSent event found");const e=new Uint8Array((r?.parsedJson).message),[n,i]=c.CircleBridge.deserialize(e),{payload:a}=n,o=a.messageSender,g=a.mintRecipient,m=c.toCircleChain(this.network,n.sourceDomain),l=c.toCircleChain(this.network,n.destinationDomain),p={chain:m,address:a.burnToken};return{from:{chain:m,address:o},to:{chain:l,address:g},token:p,amount:a.amount,message:n,id:{hash:i}}}static async fromRpc(s,t){const[r,e]=await d.SuiPlatform.chainFromRpc(s),n=t[e];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} != ${r}`);return new u(r,e,s,n.contracts)}createUnsignedTx(s,t,r=!1){return new b.SuiUnsignedTransaction(s,this.network,this.chain,t,r)}}c.registerProtocol("Sui","CircleBridge",u);exports.SuiCircleBridge=u;exports._suiCircleObjects=h;exports.suiCircleObjects=f;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as y, e as b, x as w } from "./lit-element-DrneaN_7.mjs";
|
|
2
2
|
import { n as l, m as I, e as L } from "./class-map-BbR7GrmK.mjs";
|
|
3
|
-
import { r as S, k as W, e as D } from "./solana-
|
|
3
|
+
import { r as S, k as W, e as D } from "./solana-C1puc64V.mjs";
|
|
4
4
|
const h = {
|
|
5
5
|
getSpacingStyles(i, t) {
|
|
6
6
|
if (Array.isArray(i))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as i, ac as c, az as h, L as l, ar as E, aq as H, as as Q, S as Z, N as J, aO as W, dR as x, bu as X, M as K, J as Y, a2 as N, a3 as v, aH as j, aQ as $ } from "./web3-
|
|
2
|
-
import { a as ee, b as te, c as ne, e as ie, f as se, S as ae, h as re, d as oe } from "./index-
|
|
3
|
-
import { deriveWrappedMetaKey as O, deriveTokenBridgeConfigKey as G, deriveAuthoritySignerKey as ce, deriveSenderAccountKey as de, deriveMintAuthorityKey as ue, deriveEndpointKey as me } from "./index-
|
|
4
|
-
import { P as ge } from "./index-
|
|
5
|
-
import { S as fe, a as le } from "./unsignedTransaction-
|
|
1
|
+
import { P as i, ac as c, az as h, L as l, ar as E, aq as H, as as Q, S as Z, N as J, aO as W, dR as x, bu as X, M as K, J as Y, a2 as N, a3 as v, aH as j, aQ as $ } from "./web3-BifDBsFp.mjs";
|
|
2
|
+
import { a as ee, b as te, c as ne, e as ie, f as se, S as ae, h as re, d as oe } from "./index-Czxl_5Tr.mjs";
|
|
3
|
+
import { deriveWrappedMetaKey as O, deriveTokenBridgeConfigKey as G, deriveAuthoritySignerKey as ce, deriveSenderAccountKey as de, deriveMintAuthorityKey as ue, deriveEndpointKey as me } from "./index-_e8uUnEK.mjs";
|
|
4
|
+
import { P as ge } from "./index-BlWksu-f.mjs";
|
|
5
|
+
import { S as fe, a as le } from "./unsignedTransaction-CVE7GUdC.mjs";
|
|
6
6
|
const he = {
|
|
7
7
|
version: "0.1.0",
|
|
8
8
|
name: "wormhole_gateway",
|