@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
package/lib/executor.mjs
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { aZ as
|
|
2
|
-
import { l as
|
|
3
|
-
import { A as
|
|
4
|
-
import { c as
|
|
5
|
-
import { A as
|
|
6
|
-
import { E as
|
|
7
|
-
import { C as
|
|
8
|
-
import { E as
|
|
9
|
-
import { b as
|
|
10
|
-
import { suiCircleObjects as
|
|
11
|
-
import { S as
|
|
12
|
-
import { createDepositForBurnInstruction as
|
|
13
|
-
import { P as
|
|
14
|
-
import { S as
|
|
15
|
-
import { d as
|
|
16
|
-
import { r as
|
|
17
|
-
const
|
|
1
|
+
import { aZ as At, av as xt, a_ as Dt, a$ as St, b0 as vt, b1 as Ft, b2 as Tt, b3 as Bt, b4 as Pt, b5 as It, b6 as Mt, b7 as kt, at as ze, d as y, b8 as X, az as A, aH as k, m as Ne, aB as ne, aE as _, aF as Oe, ax as Le, aL as O, q as z, aI as We, aR as Vt, _ as Ut, P as h, L as P, ar as Pe, aq as Qe, as as Rt, ac as l, S as se, N as ue, aO as I, aP as re, K as Ge, b9 as je, aQ as qe, j as _t, W as F, V as v, ba as Ze, u as me, b as He, bb as Ke, af as $t, aW as Ye, e as x, Z as Je, aU as Xe, f as S, n as fe, v as H, z as $, a7 as ae, a8 as ie, x as q, R as et } from "./web3-BifDBsFp.mjs";
|
|
2
|
+
import { l as Ie } from "./chunk-KJH4KKG6-BgebMATq.mjs";
|
|
3
|
+
import { A as zt } from "./platform-DBNvSsue.mjs";
|
|
4
|
+
import { c as Me, _ as Nt } from "./address-BX2fIOro.mjs";
|
|
5
|
+
import { A as Ot } from "./unsignedTransaction-BJi-f5xi.mjs";
|
|
6
|
+
import { E as K } from "./platform-DtB8gGMl.mjs";
|
|
7
|
+
import { C as Z } from "./contract-KYuIk_vR.mjs";
|
|
8
|
+
import { E as tt } from "./unsignedTransaction-Efb4L-cb.mjs";
|
|
9
|
+
import { b as ke, T as Lt, a as Wt, _ as Qt } from "./platform-C5gJAqtZ.mjs";
|
|
10
|
+
import { suiCircleObjects as Gt } from "./index-Bicx897u.mjs";
|
|
11
|
+
import { S as jt } from "./unsignedTransaction-YrtWU1ft.mjs";
|
|
12
|
+
import { createDepositForBurnInstruction as qt, createReceiveMessageInstruction as Zt } from "./index-CkvxfaqA.mjs";
|
|
13
|
+
import { P as nt } from "./index-BlWksu-f.mjs";
|
|
14
|
+
import { S as st, a as rt } from "./unsignedTransaction-CVE7GUdC.mjs";
|
|
15
|
+
import { d as Ht } from "./account-BcnWVXmg.mjs";
|
|
16
|
+
import { r as Kt } from "./index-CTpINVAG.mjs";
|
|
17
|
+
const Yt = {
|
|
18
18
|
binary: "uint",
|
|
19
19
|
size: 1,
|
|
20
20
|
custom: {
|
|
21
|
-
to: (
|
|
22
|
-
from: (
|
|
21
|
+
to: (s) => s > 0,
|
|
22
|
+
from: (s) => s ? 1 : 0
|
|
23
23
|
}
|
|
24
|
-
},
|
|
24
|
+
}, Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
25
25
|
__proto__: null,
|
|
26
|
-
amountItem:
|
|
27
|
-
boolItem:
|
|
28
|
-
chainItem:
|
|
29
|
-
circleDomainItem:
|
|
30
|
-
circleNonceItem:
|
|
31
|
-
dateConversion:
|
|
32
|
-
fixedChainItem:
|
|
33
|
-
fixedLengthStringItem:
|
|
34
|
-
guardianSetItem:
|
|
35
|
-
payloadIdItem:
|
|
36
|
-
sequenceItem:
|
|
37
|
-
signatureItem:
|
|
38
|
-
stringConversion:
|
|
39
|
-
universalAddressItem:
|
|
40
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
26
|
+
amountItem: At,
|
|
27
|
+
boolItem: Yt,
|
|
28
|
+
chainItem: xt,
|
|
29
|
+
circleDomainItem: Dt,
|
|
30
|
+
circleNonceItem: St,
|
|
31
|
+
dateConversion: vt,
|
|
32
|
+
fixedChainItem: Ft,
|
|
33
|
+
fixedLengthStringItem: Tt,
|
|
34
|
+
guardianSetItem: Bt,
|
|
35
|
+
payloadIdItem: Pt,
|
|
36
|
+
sequenceItem: It,
|
|
37
|
+
signatureItem: Mt,
|
|
38
|
+
stringConversion: kt,
|
|
39
|
+
universalAddressItem: ze
|
|
40
|
+
}, Symbol.toStringTag, { value: "Module" })), le = {
|
|
41
41
|
Testnet: "https://executor-testnet.labsapis.com",
|
|
42
42
|
Mainnet: "https://executor.labsapis.com"
|
|
43
|
-
},
|
|
43
|
+
}, he = {
|
|
44
44
|
Testnet: {
|
|
45
45
|
Aptos: "0x14a12d1fd6ef371b70c2113155534ec152ec7f779e281b54866c796c9a4a58d3",
|
|
46
46
|
Avalanche: "0x2cfEC91B50f657Cc86Ec693542527ac3e03bF742",
|
|
@@ -59,7 +59,7 @@ const Qt = {
|
|
|
59
59
|
Unichain: "0xA7aBDb8f2108901c586543BD5e10E4fA263F4A47",
|
|
60
60
|
Solana: "CXGRA5SCc8jxDbaQPZrmmZNu2JV34DP7gFW4m31uC1zs"
|
|
61
61
|
}
|
|
62
|
-
},
|
|
62
|
+
}, Xt = {
|
|
63
63
|
Testnet: {
|
|
64
64
|
Avalanche: "0x4058F0C3924eDaB19c15597C438968ed49C1a213",
|
|
65
65
|
BaseSepolia: "0xC400FcC0e92d3406747FBb6f513D3aa8B038fcE9",
|
|
@@ -70,6 +70,7 @@ const Qt = {
|
|
|
70
70
|
Avalanche: "0x3952914628650Ca510404872D84DfF10A844C5B5",
|
|
71
71
|
Base: "0xbd8d42f40a11b37bD1b3770D754f9629F7cd5679",
|
|
72
72
|
Ethereum: "0x2cCf230467FE7387674BAa657747F0B5485c7fEC",
|
|
73
|
+
HyperEVM: "0xACD054f83c0b852d02503191e2c26527A7E72B1f",
|
|
73
74
|
Linea: "0xc48c126468BE919068dE1983F00F65af759a4E87",
|
|
74
75
|
Optimism: "0xd0a8940b2e743e33b682daec4d52b46713606c9d",
|
|
75
76
|
Polygon: "0xc8a8e6d760dcbd5d6746e2f66cd2ffa722dd1e59",
|
|
@@ -78,7 +79,7 @@ const Qt = {
|
|
|
78
79
|
Sonic: "0xc39BF082ec91D9bC385F956D24a8D66C0c26223d",
|
|
79
80
|
Worldchain: "0x789f2b91f7B35D5B890983328340c4600339B354"
|
|
80
81
|
}
|
|
81
|
-
},
|
|
82
|
+
}, Ve = {
|
|
82
83
|
Testnet: {
|
|
83
84
|
executorId: "0x4000cfe2955d8355b3d3cf186f854fea9f787a457257056926fde1ec977670eb",
|
|
84
85
|
executorRequestsId: "0x2d9ccf3cce3f7dce408e5455e90b80a8161ad9673d1366c2a5def60ad93657a8"
|
|
@@ -87,10 +88,10 @@ const Qt = {
|
|
|
87
88
|
executorId: "0xdb0fe8bb1e2b5be628adbea0636063325073e1070ee11e4281457dfd7f158235",
|
|
88
89
|
executorRequestsId: "0xc030df7a3eed1494fa4b64aa8ab63a79041cf1114f4ff2b7ab5aca1c684a21a7"
|
|
89
90
|
}
|
|
90
|
-
},
|
|
91
|
+
}, at = {
|
|
91
92
|
Testnet: "execXUrAsMnqMmTHj5m7N1YQgsDz3cwGLYCYyuDRciV",
|
|
92
93
|
Mainnet: "execXUrAsMnqMmTHj5m7N1YQgsDz3cwGLYCYyuDRciV"
|
|
93
|
-
},
|
|
94
|
+
}, en = 5001n, tn = {
|
|
94
95
|
Testnet: {
|
|
95
96
|
Aptos: 5000n,
|
|
96
97
|
ArbitrumSepolia: 800000n,
|
|
@@ -108,6 +109,7 @@ const Qt = {
|
|
|
108
109
|
Avalanche: 250000n,
|
|
109
110
|
Base: 250000n,
|
|
110
111
|
Ethereum: 250000n,
|
|
112
|
+
HyperEVM: 250000n,
|
|
111
113
|
Linea: 250000n,
|
|
112
114
|
Optimism: 250000n,
|
|
113
115
|
Polygon: 250000n,
|
|
@@ -118,7 +120,7 @@ const Qt = {
|
|
|
118
120
|
Sui: 8000000n,
|
|
119
121
|
Worldchain: 250000n
|
|
120
122
|
}
|
|
121
|
-
},
|
|
123
|
+
}, it = {
|
|
122
124
|
Testnet: {
|
|
123
125
|
ArbitrumSepolia: {
|
|
124
126
|
tokenMessengerV2: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA",
|
|
@@ -140,6 +142,10 @@ const Qt = {
|
|
|
140
142
|
tokenMessengerV2: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA",
|
|
141
143
|
messageTransmitterV2: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"
|
|
142
144
|
},
|
|
145
|
+
Solana: {
|
|
146
|
+
tokenMessengerV2: "CCTPV2vPZJS2u2BBsUoscuikbYjnpFmbFsvVuJdgUMQe",
|
|
147
|
+
messageTransmitterV2: "CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC"
|
|
148
|
+
},
|
|
143
149
|
Sonic: {
|
|
144
150
|
tokenMessengerV2: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA",
|
|
145
151
|
messageTransmitterV2: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"
|
|
@@ -162,6 +168,10 @@ const Qt = {
|
|
|
162
168
|
tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
|
|
163
169
|
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
164
170
|
},
|
|
171
|
+
HyperEVM: {
|
|
172
|
+
tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
|
|
173
|
+
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
174
|
+
},
|
|
165
175
|
Linea: {
|
|
166
176
|
tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
|
|
167
177
|
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
@@ -174,6 +184,10 @@ const Qt = {
|
|
|
174
184
|
tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
|
|
175
185
|
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
176
186
|
},
|
|
187
|
+
Solana: {
|
|
188
|
+
tokenMessengerV2: "CCTPV2vPZJS2u2BBsUoscuikbYjnpFmbFsvVuJdgUMQe",
|
|
189
|
+
messageTransmitterV2: "CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC"
|
|
190
|
+
},
|
|
177
191
|
Unichain: {
|
|
178
192
|
tokenMessengerV2: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d",
|
|
179
193
|
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
@@ -191,7 +205,7 @@ const Qt = {
|
|
|
191
205
|
messageTransmitterV2: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"
|
|
192
206
|
}
|
|
193
207
|
}
|
|
194
|
-
},
|
|
208
|
+
}, ot = {
|
|
195
209
|
Testnet: {
|
|
196
210
|
Sepolia: 0,
|
|
197
211
|
Avalanche: 1,
|
|
@@ -216,11 +230,12 @@ const Qt = {
|
|
|
216
230
|
Aptos: 9,
|
|
217
231
|
Unichain: 10
|
|
218
232
|
}
|
|
219
|
-
},
|
|
233
|
+
}, Q = (s, e) => ot[s]?.[e] !== void 0, ee = {
|
|
220
234
|
Testnet: {
|
|
221
235
|
Sepolia: 0,
|
|
222
236
|
Avalanche: 1,
|
|
223
237
|
ArbitrumSepolia: 3,
|
|
238
|
+
Solana: 5,
|
|
224
239
|
BaseSepolia: 6,
|
|
225
240
|
Linea: 11,
|
|
226
241
|
Sonic: 13
|
|
@@ -230,33 +245,35 @@ const Qt = {
|
|
|
230
245
|
Avalanche: 1,
|
|
231
246
|
Optimism: 2,
|
|
232
247
|
Arbitrum: 3,
|
|
248
|
+
Solana: 5,
|
|
233
249
|
Base: 6,
|
|
234
250
|
Polygon: 7,
|
|
235
251
|
Unichain: 10,
|
|
236
252
|
Linea: 11,
|
|
237
253
|
Sonic: 13,
|
|
238
254
|
Worldchain: 14,
|
|
239
|
-
Seievm: 16
|
|
255
|
+
Seievm: 16,
|
|
256
|
+
HyperEVM: 19
|
|
240
257
|
}
|
|
241
|
-
},
|
|
242
|
-
const t =
|
|
258
|
+
}, oe = (s, e) => ee[s]?.[e] !== void 0, N = (s, e) => {
|
|
259
|
+
const t = ee[s]?.[e];
|
|
243
260
|
if (t === void 0)
|
|
244
|
-
throw new Error(`CircleV2 domain not found for network ${
|
|
261
|
+
throw new Error(`CircleV2 domain not found for network ${s} and chain ${e}`);
|
|
245
262
|
return t;
|
|
246
|
-
},
|
|
247
|
-
const t = Object.entries(
|
|
263
|
+
}, ct = (s, e) => {
|
|
264
|
+
const t = Object.entries(ee[s] ?? {}).find(([, n]) => n === e)?.[0];
|
|
248
265
|
if (t === void 0)
|
|
249
|
-
throw new Error(`CircleV2 chain not found for network ${
|
|
266
|
+
throw new Error(`CircleV2 chain not found for network ${s} and domain ${e}`);
|
|
250
267
|
return t;
|
|
251
|
-
},
|
|
268
|
+
}, te = {
|
|
252
269
|
Testnet: "https://iris-api-sandbox.circle.com/v2",
|
|
253
270
|
Mainnet: "https://iris-api.circle.com/v2"
|
|
254
271
|
};
|
|
255
|
-
var
|
|
256
|
-
(function(
|
|
257
|
-
|
|
258
|
-
})(
|
|
259
|
-
const
|
|
272
|
+
var Y;
|
|
273
|
+
(function(s) {
|
|
274
|
+
s[s.CONFIRMED = 1e3] = "CONFIRMED", s[s.FINALIZED = 2e3] = "FINALIZED";
|
|
275
|
+
})(Y || (Y = {}));
|
|
276
|
+
const dt = {
|
|
260
277
|
// milliseconds
|
|
261
278
|
Testnet: {
|
|
262
279
|
ArbitrumSepolia: 8e3,
|
|
@@ -275,46 +292,46 @@ const Xe = {
|
|
|
275
292
|
Seievm: 8e3,
|
|
276
293
|
Worldchain: 8e3
|
|
277
294
|
}
|
|
278
|
-
},
|
|
279
|
-
class
|
|
295
|
+
}, nn = (s, e) => dt[s]?.[e] !== void 0;
|
|
296
|
+
class ge {
|
|
280
297
|
network;
|
|
281
298
|
chain;
|
|
282
299
|
provider;
|
|
283
300
|
contracts;
|
|
284
301
|
usdcId;
|
|
285
302
|
shimContract;
|
|
286
|
-
constructor(e, t,
|
|
287
|
-
if (this.network = e, this.chain = t, this.provider =
|
|
303
|
+
constructor(e, t, n, a) {
|
|
304
|
+
if (this.network = e, this.chain = t, this.provider = n, this.contracts = a, e === "Devnet")
|
|
288
305
|
throw new Error("CCTPExecutor not supported on Devnet");
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
306
|
+
const r = y.get(this.network, this.chain);
|
|
307
|
+
if (!r)
|
|
291
308
|
throw new Error(`No USDC contract configured for network=${this.network} chain=${this.chain}`);
|
|
292
|
-
this.usdcId =
|
|
293
|
-
const i =
|
|
309
|
+
this.usdcId = r;
|
|
310
|
+
const i = he[e]?.[t];
|
|
294
311
|
if (!i)
|
|
295
312
|
throw new Error(`Shim contract for ${t} not found`);
|
|
296
313
|
this.shimContract = i;
|
|
297
314
|
}
|
|
298
315
|
static async fromRpc(e, t) {
|
|
299
|
-
const [
|
|
300
|
-
if (!
|
|
301
|
-
throw new Error(`No config found for ${
|
|
302
|
-
if (
|
|
303
|
-
throw new Error(`Network mismatch: ${
|
|
304
|
-
return new
|
|
305
|
-
}
|
|
306
|
-
async *transfer(e, t,
|
|
307
|
-
const
|
|
316
|
+
const [n, a] = await zt.chainFromRpc(e), r = t[a];
|
|
317
|
+
if (!r)
|
|
318
|
+
throw new Error(`No config found for ${a}`);
|
|
319
|
+
if (r.network !== n)
|
|
320
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
321
|
+
return new ge(n, a, e, r.contracts);
|
|
322
|
+
}
|
|
323
|
+
async *transfer(e, t, n) {
|
|
324
|
+
const a = new Me(e).unwrap(), r = Ie.from(t.address.toUniversalAddress().toUint8Array()), i = Ie.from(this.usdcId), o = n.remainingAmount + n.referrerFee, c = X.get(this.network, t.chain), u = a, f = new Me(n.referrer?.address?.toString() ?? a).unwrap(), d = [
|
|
308
325
|
o,
|
|
309
326
|
c,
|
|
310
|
-
|
|
327
|
+
r.toString(),
|
|
311
328
|
i.toString(),
|
|
312
|
-
|
|
313
|
-
|
|
329
|
+
n.estimatedCost,
|
|
330
|
+
A(t.chain),
|
|
314
331
|
u,
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
332
|
+
n.signedQuote,
|
|
333
|
+
n.relayInstructions,
|
|
334
|
+
n.referrerFeeDbps,
|
|
318
335
|
f
|
|
319
336
|
], m = {
|
|
320
337
|
function: `${this.shimContract}::cctp_v1_with_executor::deposit_for_burn_entry`,
|
|
@@ -322,114 +339,114 @@ class de {
|
|
|
322
339
|
};
|
|
323
340
|
yield this.createUnsignedTx(m, "AtposCCTPExecutor.Transfer");
|
|
324
341
|
}
|
|
325
|
-
createUnsignedTx(e, t,
|
|
326
|
-
return new
|
|
342
|
+
createUnsignedTx(e, t, n = !1) {
|
|
343
|
+
return new Ot(e, this.network, this.chain, t, n);
|
|
327
344
|
}
|
|
328
345
|
}
|
|
329
|
-
|
|
330
|
-
class
|
|
346
|
+
k(Nt, "CCTPExecutor", ge);
|
|
347
|
+
class pe {
|
|
331
348
|
network;
|
|
332
349
|
chain;
|
|
333
350
|
provider;
|
|
334
351
|
contracts;
|
|
335
352
|
chainId;
|
|
336
353
|
shimContract;
|
|
337
|
-
constructor(e, t,
|
|
338
|
-
if (this.network = e, this.chain = t, this.provider =
|
|
354
|
+
constructor(e, t, n, a) {
|
|
355
|
+
if (this.network = e, this.chain = t, this.provider = n, this.contracts = a, e === "Devnet")
|
|
339
356
|
throw new Error("CCTPExecutor not supported on Devnet");
|
|
340
|
-
this.chainId =
|
|
341
|
-
const
|
|
342
|
-
if (!
|
|
357
|
+
this.chainId = Ne.get(e, t);
|
|
358
|
+
const r = he[e]?.[t];
|
|
359
|
+
if (!r)
|
|
343
360
|
throw new Error(`Shim contract for ${t} not found`);
|
|
344
|
-
this.shimContract =
|
|
361
|
+
this.shimContract = r;
|
|
345
362
|
}
|
|
346
363
|
static async fromRpc(e, t) {
|
|
347
|
-
const [
|
|
348
|
-
if (
|
|
349
|
-
throw new Error(`Network mismatch: ${
|
|
350
|
-
return new
|
|
351
|
-
}
|
|
352
|
-
async *transfer(e, t,
|
|
353
|
-
const
|
|
354
|
-
if (await c.allowance(
|
|
355
|
-
const
|
|
356
|
-
yield this.createUnsignedTx(
|
|
364
|
+
const [n, a] = await K.chainFromRpc(e), r = t[a];
|
|
365
|
+
if (r.network !== n)
|
|
366
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
367
|
+
return new pe(n, a, e, r.contracts);
|
|
368
|
+
}
|
|
369
|
+
async *transfer(e, t, n) {
|
|
370
|
+
const a = new ne(e).toString(), r = t.address.toUniversalAddress().toUint8Array(), i = n.remainingAmount + n.referrerFee, o = y.get(this.network, this.chain), c = K.getTokenImplementation(this.provider, o);
|
|
371
|
+
if (await c.allowance(a, this.shimContract) < i) {
|
|
372
|
+
const g = await c.approve.populateTransaction(this.shimContract, i);
|
|
373
|
+
yield this.createUnsignedTx(_(g, a), "ERC20.approve of EvmCCTPExecutor", !1);
|
|
357
374
|
}
|
|
358
375
|
const f = [
|
|
359
376
|
"function depositForBurn(uint256 amount, uint16 destinationChain, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, (address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint16 dbps, address payee) feeArgs) external payable returns (uint64 nonce)"
|
|
360
|
-
], m = await new
|
|
361
|
-
refundAddress:
|
|
362
|
-
signedQuote:
|
|
363
|
-
instructions:
|
|
377
|
+
], m = await new Z(this.shimContract, f, this.provider).getFunction("depositForBurn").populateTransaction(i, A(t.chain), X.get(this.network, t.chain), r, o, {
|
|
378
|
+
refundAddress: a,
|
|
379
|
+
signedQuote: n.signedQuote,
|
|
380
|
+
instructions: n.relayInstructions
|
|
364
381
|
}, {
|
|
365
|
-
dbps:
|
|
366
|
-
payee:
|
|
382
|
+
dbps: n.referrerFeeDbps,
|
|
383
|
+
payee: n.referrer?.address?.toString() ?? a
|
|
367
384
|
});
|
|
368
|
-
m.value =
|
|
385
|
+
m.value = n.estimatedCost, yield this.createUnsignedTx(_(m, a), "EvmCCTPExecutor.depositForBurn");
|
|
369
386
|
}
|
|
370
|
-
createUnsignedTx(e, t,
|
|
371
|
-
return new
|
|
387
|
+
createUnsignedTx(e, t, n = !1) {
|
|
388
|
+
return new tt(Oe(e, this.chainId), this.network, this.chain, t, n);
|
|
372
389
|
}
|
|
373
390
|
}
|
|
374
|
-
const { amountItem:
|
|
391
|
+
const { amountItem: G, circleDomainItem: Ue, universalAddressItem: M } = Jt, ut = {
|
|
375
392
|
binary: "uint",
|
|
376
393
|
size: 4,
|
|
377
394
|
custom: 1,
|
|
378
395
|
omit: !1
|
|
379
|
-
},
|
|
396
|
+
}, sn = {
|
|
380
397
|
binary: "bytes",
|
|
381
398
|
size: 32
|
|
382
|
-
},
|
|
399
|
+
}, Re = {
|
|
383
400
|
binary: "uint",
|
|
384
401
|
size: 4
|
|
385
|
-
},
|
|
386
|
-
{ name: "version", ...
|
|
387
|
-
{ name: "burnToken", ...
|
|
388
|
-
{ name: "mintRecipient", ...
|
|
389
|
-
{ name: "amount", ...
|
|
390
|
-
{ name: "messageSender", ...
|
|
391
|
-
{ name: "maxFee", ...
|
|
392
|
-
{ name: "feeExecuted", ...
|
|
393
|
-
{ name: "expirationBlock", ...
|
|
402
|
+
}, rn = [
|
|
403
|
+
{ name: "version", ...ut },
|
|
404
|
+
{ name: "burnToken", ...M },
|
|
405
|
+
{ name: "mintRecipient", ...M },
|
|
406
|
+
{ name: "amount", ...G },
|
|
407
|
+
{ name: "messageSender", ...M },
|
|
408
|
+
{ name: "maxFee", ...G },
|
|
409
|
+
{ name: "feeExecuted", ...G },
|
|
410
|
+
{ name: "expirationBlock", ...G },
|
|
394
411
|
{ name: "hookData", binary: "bytes" }
|
|
395
|
-
],
|
|
396
|
-
{ name: "version", ...
|
|
397
|
-
{ name: "sourceDomain", ...
|
|
398
|
-
{ name: "destinationDomain", ...
|
|
399
|
-
{ name: "nonce", ...
|
|
400
|
-
{ name: "sender", ...
|
|
401
|
-
{ name: "recipient", ...
|
|
402
|
-
{ name: "destinationCaller", ...
|
|
403
|
-
{ name: "minFinalityThreshold", ...
|
|
404
|
-
{ name: "finalityThresholdExecuted", ...
|
|
405
|
-
{ name: "messageBody", binary: "bytes", layout:
|
|
406
|
-
],
|
|
412
|
+
], mt = [
|
|
413
|
+
{ name: "version", ...ut },
|
|
414
|
+
{ name: "sourceDomain", ...Ue },
|
|
415
|
+
{ name: "destinationDomain", ...Ue },
|
|
416
|
+
{ name: "nonce", ...sn },
|
|
417
|
+
{ name: "sender", ...M },
|
|
418
|
+
{ name: "recipient", ...M },
|
|
419
|
+
{ name: "destinationCaller", ...M },
|
|
420
|
+
{ name: "minFinalityThreshold", ...Re },
|
|
421
|
+
{ name: "finalityThresholdExecuted", ...Re },
|
|
422
|
+
{ name: "messageBody", binary: "bytes", layout: rn }
|
|
423
|
+
], an = (s) => O(mt, s), ft = (s) => Le(mt, s), on = [
|
|
407
424
|
{ name: "gasLimit", binary: "uint", size: 16 },
|
|
408
425
|
{ name: "msgValue", binary: "uint", size: 16 }
|
|
409
|
-
],
|
|
426
|
+
], cn = [
|
|
410
427
|
{ name: "dropOff", binary: "uint", size: 16 },
|
|
411
|
-
{ name: "recipient", ...
|
|
412
|
-
],
|
|
428
|
+
{ name: "recipient", ...ze }
|
|
429
|
+
], dn = [
|
|
413
430
|
{
|
|
414
431
|
name: "request",
|
|
415
432
|
binary: "switch",
|
|
416
433
|
idSize: 1,
|
|
417
434
|
idTag: "type",
|
|
418
435
|
layouts: [
|
|
419
|
-
[[1, "GasInstruction"],
|
|
420
|
-
[[2, "GasDropOffInstruction"],
|
|
436
|
+
[[1, "GasInstruction"], on],
|
|
437
|
+
[[2, "GasDropOffInstruction"], cn]
|
|
421
438
|
]
|
|
422
439
|
}
|
|
423
|
-
],
|
|
440
|
+
], lt = [
|
|
424
441
|
{
|
|
425
442
|
name: "requests",
|
|
426
443
|
binary: "array",
|
|
427
|
-
layout:
|
|
444
|
+
layout: dn
|
|
428
445
|
}
|
|
429
|
-
],
|
|
430
|
-
to: (
|
|
431
|
-
from: (
|
|
432
|
-
},
|
|
446
|
+
], un = {
|
|
447
|
+
to: (s) => new Date(Number(s * 1000n)),
|
|
448
|
+
from: (s) => BigInt(s.getTime()) / 1000n
|
|
449
|
+
}, mn = [
|
|
433
450
|
{
|
|
434
451
|
name: "quote",
|
|
435
452
|
binary: "switch",
|
|
@@ -455,7 +472,7 @@ const { amountItem: R, circleDomainItem: Se, universalAddressItem: T } = Wt, Je
|
|
|
455
472
|
name: "expiryTime",
|
|
456
473
|
binary: "uint",
|
|
457
474
|
size: 8,
|
|
458
|
-
custom:
|
|
475
|
+
custom: un
|
|
459
476
|
},
|
|
460
477
|
{ name: "baseFee", binary: "uint", size: 8 },
|
|
461
478
|
{ name: "dstGasPrice", binary: "uint", size: 8 },
|
|
@@ -465,11 +482,11 @@ const { amountItem: R, circleDomainItem: Se, universalAddressItem: T } = Wt, Je
|
|
|
465
482
|
]
|
|
466
483
|
]
|
|
467
484
|
}
|
|
468
|
-
],
|
|
469
|
-
...
|
|
485
|
+
], Ce = [
|
|
486
|
+
...mn,
|
|
470
487
|
{ name: "signature", binary: "bytes", size: 65 }
|
|
471
488
|
];
|
|
472
|
-
class
|
|
489
|
+
class we {
|
|
473
490
|
network;
|
|
474
491
|
chain;
|
|
475
492
|
provider;
|
|
@@ -478,64 +495,64 @@ class me {
|
|
|
478
495
|
shimContract;
|
|
479
496
|
messageTransmitter;
|
|
480
497
|
usdcContract;
|
|
481
|
-
constructor(e, t,
|
|
482
|
-
if (this.network = e, this.chain = t, this.provider =
|
|
498
|
+
constructor(e, t, n, a) {
|
|
499
|
+
if (this.network = e, this.chain = t, this.provider = n, this.contracts = a, e === "Devnet")
|
|
483
500
|
throw new Error("CCTPv2Executor not supported on Devnet");
|
|
484
|
-
this.chainId =
|
|
485
|
-
const
|
|
486
|
-
if (!
|
|
501
|
+
this.chainId = Ne.get(e, t);
|
|
502
|
+
const r = Xt[e]?.[t];
|
|
503
|
+
if (!r)
|
|
487
504
|
throw new Error(`Shim contract for ${t} not found`);
|
|
488
|
-
this.shimContract =
|
|
489
|
-
const i =
|
|
505
|
+
this.shimContract = r;
|
|
506
|
+
const i = it[e]?.[t]?.messageTransmitterV2;
|
|
490
507
|
if (!i)
|
|
491
508
|
throw new Error(`MessageTransmitter contract for ${t} not found`);
|
|
492
509
|
this.messageTransmitter = i;
|
|
493
|
-
const o =
|
|
510
|
+
const o = y.get(e, t);
|
|
494
511
|
if (!o)
|
|
495
512
|
throw new Error(`USDC contract for ${t} not found`);
|
|
496
513
|
this.usdcContract = o;
|
|
497
514
|
}
|
|
498
515
|
static async fromRpc(e, t) {
|
|
499
|
-
const [
|
|
500
|
-
if (
|
|
501
|
-
throw new Error(`Network mismatch: ${
|
|
502
|
-
return new
|
|
503
|
-
}
|
|
504
|
-
async *transfer(e, t,
|
|
505
|
-
const
|
|
506
|
-
if (await o.allowance(
|
|
507
|
-
const
|
|
508
|
-
yield this.createUnsignedTx(
|
|
516
|
+
const [n, a] = await K.chainFromRpc(e), r = t[a];
|
|
517
|
+
if (r.network !== n)
|
|
518
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
519
|
+
return new we(n, a, e, r.contracts);
|
|
520
|
+
}
|
|
521
|
+
async *transfer(e, t, n) {
|
|
522
|
+
const a = new ne(e).toString(), r = t.address.toUniversalAddress().toUint8Array(), i = n.remainingAmount + n.referrerFee, o = K.getTokenImplementation(this.provider, this.usdcContract);
|
|
523
|
+
if (await o.allowance(a, this.shimContract) < i) {
|
|
524
|
+
const p = await o.approve.populateTransaction(this.shimContract, i);
|
|
525
|
+
yield this.createUnsignedTx(_(p, a), "ERC20.approve of EvmCCTPv2Executor", !1);
|
|
509
526
|
}
|
|
510
527
|
const u = [
|
|
511
528
|
"function depositForBurn(uint256 amount, uint16 destinationChain, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, bytes32 destinationCaller, uint256 maxFee, uint32 minFinalityThreshold, (address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint16 dbps, address payee) feeArgs) external payable returns (uint64 nonce)"
|
|
512
|
-
], f = new Uint8Array(32), d = new
|
|
513
|
-
refundAddress:
|
|
514
|
-
signedQuote:
|
|
515
|
-
instructions:
|
|
529
|
+
], f = new Uint8Array(32), d = new Z(this.shimContract, u, this.provider), m = N(this.network, t.chain), g = await d.getFunction("depositForBurn").populateTransaction(i, A(t.chain), m, r, this.usdcContract, f, n.fastTransferMaxFee, n.minFinalityThreshold, {
|
|
530
|
+
refundAddress: a,
|
|
531
|
+
signedQuote: n.signedQuote,
|
|
532
|
+
instructions: n.relayInstructions
|
|
516
533
|
}, {
|
|
517
|
-
dbps:
|
|
518
|
-
payee:
|
|
534
|
+
dbps: n.referrerFeeDbps,
|
|
535
|
+
payee: n.referrer?.address?.toString() ?? a
|
|
519
536
|
});
|
|
520
|
-
|
|
537
|
+
g.value = n.estimatedCost, yield this.createUnsignedTx(_(g, a), "EvmCCTPv2Executor.depositForBurn");
|
|
521
538
|
}
|
|
522
539
|
async isTransferCompleted(e) {
|
|
523
|
-
return await new
|
|
540
|
+
return await new Z(this.messageTransmitter, ["function usedNonces(bytes32) public view returns (uint256)"], this.provider).getFunction("usedNonces").staticCall(e.nonce) === 1n;
|
|
524
541
|
}
|
|
525
|
-
async *redeem(e, t,
|
|
526
|
-
const
|
|
527
|
-
yield this.createUnsignedTx(
|
|
542
|
+
async *redeem(e, t, n) {
|
|
543
|
+
const a = new ne(e).toString(), i = await new Z(this.messageTransmitter, ["function receiveMessage(bytes message, bytes attestation)"], this.provider).getFunction("receiveMessage").populateTransaction(ft(t), z.decode(n));
|
|
544
|
+
yield this.createUnsignedTx(_(i, a), "MessageTransmitterV2.receiveMessage");
|
|
528
545
|
}
|
|
529
546
|
async getCurrentBlock() {
|
|
530
547
|
return BigInt(await this.provider.getBlockNumber());
|
|
531
548
|
}
|
|
532
|
-
createUnsignedTx(e, t,
|
|
533
|
-
return new
|
|
549
|
+
createUnsignedTx(e, t, n = !1) {
|
|
550
|
+
return new tt(Oe(e, this.chainId), this.network, this.chain, t, n);
|
|
534
551
|
}
|
|
535
552
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
class
|
|
553
|
+
k(We, "CCTPExecutor", pe);
|
|
554
|
+
k(We, "CCTPv2Executor", we);
|
|
555
|
+
class be {
|
|
539
556
|
network;
|
|
540
557
|
chain;
|
|
541
558
|
provider;
|
|
@@ -548,170 +565,170 @@ class fe {
|
|
|
548
565
|
messageTransmitterStateId;
|
|
549
566
|
executorId;
|
|
550
567
|
executorRequestsId;
|
|
551
|
-
constructor(e, t,
|
|
552
|
-
if (this.network = e, this.chain = t, this.provider =
|
|
568
|
+
constructor(e, t, n, a) {
|
|
569
|
+
if (this.network = e, this.chain = t, this.provider = n, this.contracts = a, e === "Devnet")
|
|
553
570
|
throw new Error("CCTPExecutor not supported on Devnet");
|
|
554
|
-
const
|
|
571
|
+
const r = (u, f) => {
|
|
555
572
|
if (!u)
|
|
556
573
|
throw new Error(f);
|
|
557
574
|
return u;
|
|
558
575
|
};
|
|
559
|
-
this.usdcId =
|
|
560
|
-
const { tokenMessengerState: i, messageTransmitterState: o, usdcTreasury: c } =
|
|
561
|
-
this.usdcTreasuryId = c, this.tokenMessengerId =
|
|
576
|
+
this.usdcId = r(y.get(this.network, this.chain), `No USDC contract configured for network=${this.network} chain=${this.chain}`);
|
|
577
|
+
const { tokenMessengerState: i, messageTransmitterState: o, usdcTreasury: c } = Gt(e);
|
|
578
|
+
this.usdcTreasuryId = c, this.tokenMessengerId = r(a.cctp?.tokenMessenger, `Circle Token Messenger contract for domain ${t} not found`), this.messageTransmitterId = r(a.cctp?.messageTransmitter, `Circle Message Transmitter contract for domain ${t} not found`), this.tokenMessengerStateId = i, this.messageTransmitterStateId = o, this.executorId = r(Ve[e]?.executorId, `Executor contract for ${e} not found`), this.executorRequestsId = r(Ve[e]?.executorRequestsId, `Executor requests contract for ${e} not found`);
|
|
562
579
|
}
|
|
563
580
|
static async fromRpc(e, t) {
|
|
564
|
-
const [
|
|
565
|
-
if (
|
|
566
|
-
throw new Error(`Network mismatch: ${
|
|
567
|
-
return new
|
|
581
|
+
const [n, a] = await ke.chainFromRpc(e), r = t[a];
|
|
582
|
+
if (r.network !== n)
|
|
583
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
584
|
+
return new be(n, a, e, r.contracts);
|
|
568
585
|
}
|
|
569
|
-
async *transfer(e, t,
|
|
570
|
-
const
|
|
586
|
+
async *transfer(e, t, n) {
|
|
587
|
+
const a = new Lt(), r = new Vt(e).unwrap(), i = X.get(this.network, t.chain), [o, ...c] = await ke.getCoins(this.provider, e, this.usdcId);
|
|
571
588
|
if (o === void 0)
|
|
572
589
|
throw new Error("No USDC in wallet");
|
|
573
|
-
const u =
|
|
574
|
-
c.length > 0 &&
|
|
590
|
+
const u = a.object(o.coinObjectId);
|
|
591
|
+
c.length > 0 && a.mergeCoins(u, c.map((w) => a.object(w.coinObjectId)));
|
|
575
592
|
let f;
|
|
576
|
-
if (
|
|
577
|
-
const [
|
|
578
|
-
|
|
579
|
-
|
|
593
|
+
if (n.referrerFee > 0n) {
|
|
594
|
+
const [w, D] = a.splitCoins(u, [
|
|
595
|
+
n.remainingAmount,
|
|
596
|
+
n.referrerFee
|
|
580
597
|
]);
|
|
581
|
-
f =
|
|
598
|
+
f = w, a.transferObjects([D], n.referrer ? Ut(n.referrer) : r);
|
|
582
599
|
} else {
|
|
583
|
-
const [
|
|
584
|
-
|
|
600
|
+
const [w] = a.splitCoins(u, [
|
|
601
|
+
n.remainingAmount
|
|
585
602
|
]);
|
|
586
|
-
f =
|
|
603
|
+
f = w;
|
|
587
604
|
}
|
|
588
|
-
const [d, m] =
|
|
605
|
+
const [d, m] = a.moveCall({
|
|
589
606
|
target: `${this.tokenMessengerId}::deposit_for_burn::deposit_for_burn`,
|
|
590
607
|
arguments: [
|
|
591
608
|
f,
|
|
592
|
-
|
|
609
|
+
a.pure.u32(i),
|
|
593
610
|
// destination_domain
|
|
594
|
-
|
|
611
|
+
a.pure.address(t.address.toUniversalAddress().toString()),
|
|
595
612
|
// mint_recipient
|
|
596
|
-
|
|
613
|
+
a.object(this.tokenMessengerStateId),
|
|
597
614
|
// token_messenger_minter state
|
|
598
|
-
|
|
615
|
+
a.object(this.messageTransmitterStateId),
|
|
599
616
|
// message_transmitter state
|
|
600
|
-
|
|
617
|
+
a.object("0x403"),
|
|
601
618
|
// deny_list id, fixed address
|
|
602
|
-
|
|
619
|
+
a.object(this.usdcTreasuryId)
|
|
603
620
|
// treasury object Treasury<USDC>
|
|
604
621
|
],
|
|
605
622
|
typeArguments: [this.usdcId]
|
|
606
|
-
}), [
|
|
623
|
+
}), [g] = a.moveCall({
|
|
607
624
|
target: `${this.messageTransmitterId}::message::source_domain`,
|
|
608
625
|
arguments: [m]
|
|
609
|
-
}), [
|
|
626
|
+
}), [p] = a.moveCall({
|
|
610
627
|
target: `${this.messageTransmitterId}::message::nonce`,
|
|
611
628
|
arguments: [m]
|
|
612
|
-
}), [
|
|
629
|
+
}), [C] = a.moveCall({
|
|
613
630
|
target: `${this.executorRequestsId}::executor_requests::make_cctp_v1_request`,
|
|
614
|
-
arguments: [
|
|
615
|
-
}), [
|
|
616
|
-
|
|
631
|
+
arguments: [g, p]
|
|
632
|
+
}), [E] = a.splitCoins(a.gas, [
|
|
633
|
+
a.pure.u64(n.estimatedCost)
|
|
617
634
|
]);
|
|
618
|
-
|
|
635
|
+
a.moveCall({
|
|
619
636
|
target: `${this.executorId}::executor::request_execution`,
|
|
620
637
|
arguments: [
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
638
|
+
E,
|
|
639
|
+
a.object(Wt),
|
|
640
|
+
a.pure.u16(A(t.chain)),
|
|
641
|
+
a.pure.address("0x0"),
|
|
642
|
+
a.pure.address(r),
|
|
643
|
+
a.pure.vector("u8", n.signedQuote),
|
|
644
|
+
C,
|
|
645
|
+
a.pure.vector("u8", n.relayInstructions)
|
|
629
646
|
]
|
|
630
|
-
}), yield this.createUnsignedTx(
|
|
647
|
+
}), yield this.createUnsignedTx(a, "SuiCCTPExecutor.Transfer");
|
|
631
648
|
}
|
|
632
|
-
createUnsignedTx(e, t,
|
|
633
|
-
return new
|
|
649
|
+
createUnsignedTx(e, t, n = !1) {
|
|
650
|
+
return new jt(e, this.network, this.chain, t, n);
|
|
634
651
|
}
|
|
635
652
|
}
|
|
636
|
-
|
|
637
|
-
const
|
|
638
|
-
new
|
|
639
|
-
const
|
|
640
|
-
new
|
|
641
|
-
new
|
|
642
|
-
class
|
|
653
|
+
k(Qt, "CCTPExecutor", be);
|
|
654
|
+
const L = new h("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
655
|
+
new h("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
656
|
+
const ye = new h("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
657
|
+
new h("So11111111111111111111111111111111111111112");
|
|
658
|
+
new h("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
|
|
659
|
+
class fn extends Error {
|
|
643
660
|
constructor(e) {
|
|
644
661
|
super(e);
|
|
645
662
|
}
|
|
646
663
|
}
|
|
647
|
-
class
|
|
664
|
+
class ln extends fn {
|
|
648
665
|
constructor() {
|
|
649
666
|
super(...arguments), this.name = "TokenOwnerOffCurveError";
|
|
650
667
|
}
|
|
651
668
|
}
|
|
652
|
-
var
|
|
653
|
-
(function(
|
|
654
|
-
|
|
655
|
-
})(
|
|
656
|
-
function
|
|
669
|
+
var ce;
|
|
670
|
+
(function(s) {
|
|
671
|
+
s[s.InitializeMint = 0] = "InitializeMint", s[s.InitializeAccount = 1] = "InitializeAccount", s[s.InitializeMultisig = 2] = "InitializeMultisig", s[s.Transfer = 3] = "Transfer", s[s.Approve = 4] = "Approve", s[s.Revoke = 5] = "Revoke", s[s.SetAuthority = 6] = "SetAuthority", s[s.MintTo = 7] = "MintTo", s[s.Burn = 8] = "Burn", s[s.CloseAccount = 9] = "CloseAccount", s[s.FreezeAccount = 10] = "FreezeAccount", s[s.ThawAccount = 11] = "ThawAccount", s[s.TransferChecked = 12] = "TransferChecked", s[s.ApproveChecked = 13] = "ApproveChecked", s[s.MintToChecked = 14] = "MintToChecked", s[s.BurnChecked = 15] = "BurnChecked", s[s.InitializeAccount2 = 16] = "InitializeAccount2", s[s.SyncNative = 17] = "SyncNative", s[s.InitializeAccount3 = 18] = "InitializeAccount3", s[s.InitializeMultisig2 = 19] = "InitializeMultisig2", s[s.InitializeMint2 = 20] = "InitializeMint2", s[s.GetAccountDataSize = 21] = "GetAccountDataSize", s[s.InitializeImmutableOwner = 22] = "InitializeImmutableOwner", s[s.AmountToUiAmount = 23] = "AmountToUiAmount", s[s.UiAmountToAmount = 24] = "UiAmountToAmount", s[s.InitializeMintCloseAuthority = 25] = "InitializeMintCloseAuthority", s[s.TransferFeeExtension = 26] = "TransferFeeExtension", s[s.ConfidentialTransferExtension = 27] = "ConfidentialTransferExtension", s[s.DefaultAccountStateExtension = 28] = "DefaultAccountStateExtension", s[s.Reallocate = 29] = "Reallocate", s[s.MemoTransferExtension = 30] = "MemoTransferExtension", s[s.CreateNativeMint = 31] = "CreateNativeMint", s[s.InitializeNonTransferableMint = 32] = "InitializeNonTransferableMint", s[s.InterestBearingMintExtension = 33] = "InterestBearingMintExtension", s[s.CpiGuardExtension = 34] = "CpiGuardExtension", s[s.InitializePermanentDelegate = 35] = "InitializePermanentDelegate", s[s.TransferHookExtension = 36] = "TransferHookExtension", s[s.MetadataPointerExtension = 39] = "MetadataPointerExtension";
|
|
672
|
+
})(ce || (ce = {}));
|
|
673
|
+
function hn(s, e, t) {
|
|
657
674
|
if (t.length) {
|
|
658
|
-
|
|
659
|
-
for (const
|
|
660
|
-
|
|
661
|
-
pubkey:
|
|
675
|
+
s.push({ pubkey: e, isSigner: !1, isWritable: !1 });
|
|
676
|
+
for (const n of t)
|
|
677
|
+
s.push({
|
|
678
|
+
pubkey: n instanceof h ? n : n.publicKey,
|
|
662
679
|
isSigner: !0,
|
|
663
680
|
isWritable: !1
|
|
664
681
|
});
|
|
665
682
|
} else
|
|
666
|
-
|
|
667
|
-
return
|
|
683
|
+
s.push({ pubkey: e, isSigner: !0, isWritable: !1 });
|
|
684
|
+
return s;
|
|
668
685
|
}
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
686
|
+
const gn = P.struct([
|
|
687
|
+
P.u32("mintAuthorityOption"),
|
|
688
|
+
Pe("mintAuthority"),
|
|
689
|
+
Qe("supply"),
|
|
690
|
+
P.u8("decimals"),
|
|
691
|
+
Rt("isInitialized"),
|
|
692
|
+
P.u32("freezeAuthorityOption"),
|
|
693
|
+
Pe("freezeAuthority")
|
|
677
694
|
]);
|
|
678
|
-
|
|
679
|
-
function
|
|
680
|
-
if (!t && !
|
|
681
|
-
throw new
|
|
682
|
-
const [
|
|
683
|
-
return
|
|
695
|
+
gn.span;
|
|
696
|
+
function J(s, e, t = !1, n = L, a = ye) {
|
|
697
|
+
if (!t && !h.isOnCurve(e.toBuffer()))
|
|
698
|
+
throw new ln();
|
|
699
|
+
const [r] = h.findProgramAddressSync([e.toBuffer(), n.toBuffer(), s.toBuffer()], a);
|
|
700
|
+
return r;
|
|
684
701
|
}
|
|
685
|
-
function
|
|
686
|
-
return
|
|
702
|
+
function ht(s, e, t, n, a = L, r = ye) {
|
|
703
|
+
return pn(s, e, t, n, l.from([1]), a, r);
|
|
687
704
|
}
|
|
688
|
-
function
|
|
705
|
+
function pn(s, e, t, n, a, r = L, i = ye) {
|
|
689
706
|
const o = [
|
|
690
|
-
{ pubkey:
|
|
707
|
+
{ pubkey: s, isSigner: !0, isWritable: !0 },
|
|
691
708
|
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
692
709
|
{ pubkey: t, isSigner: !1, isWritable: !1 },
|
|
693
|
-
{ pubkey:
|
|
694
|
-
{ pubkey:
|
|
695
|
-
{ pubkey:
|
|
710
|
+
{ pubkey: n, isSigner: !1, isWritable: !1 },
|
|
711
|
+
{ pubkey: se.programId, isSigner: !1, isWritable: !1 },
|
|
712
|
+
{ pubkey: r, isSigner: !1, isWritable: !1 }
|
|
696
713
|
];
|
|
697
|
-
return new
|
|
714
|
+
return new ue({
|
|
698
715
|
keys: o,
|
|
699
716
|
programId: i,
|
|
700
|
-
data:
|
|
717
|
+
data: a
|
|
701
718
|
});
|
|
702
719
|
}
|
|
703
|
-
const
|
|
704
|
-
function
|
|
705
|
-
const i =
|
|
706
|
-
{ pubkey:
|
|
720
|
+
const _e = P.struct([P.u8("instruction"), Qe("amount")]);
|
|
721
|
+
function gt(s, e, t, n, a = [], r = L) {
|
|
722
|
+
const i = hn([
|
|
723
|
+
{ pubkey: s, isSigner: !1, isWritable: !0 },
|
|
707
724
|
{ pubkey: e, isSigner: !1, isWritable: !0 }
|
|
708
|
-
], t,
|
|
709
|
-
return
|
|
710
|
-
instruction:
|
|
711
|
-
amount: BigInt(
|
|
712
|
-
}, o), new
|
|
725
|
+
], t, a), o = l.alloc(_e.span);
|
|
726
|
+
return _e.encode({
|
|
727
|
+
instruction: ce.Transfer,
|
|
728
|
+
amount: BigInt(n)
|
|
729
|
+
}, o), new ue({ keys: i, programId: r, data: o });
|
|
713
730
|
}
|
|
714
|
-
const
|
|
731
|
+
const Cn = {
|
|
715
732
|
version: "0.1.0",
|
|
716
733
|
name: "example_cctp_with_executor",
|
|
717
734
|
instructions: [
|
|
@@ -781,7 +798,7 @@ const gn = {
|
|
|
781
798
|
}
|
|
782
799
|
]
|
|
783
800
|
};
|
|
784
|
-
class
|
|
801
|
+
class Ee {
|
|
785
802
|
network;
|
|
786
803
|
chain;
|
|
787
804
|
connection;
|
|
@@ -790,267 +807,493 @@ class he {
|
|
|
790
807
|
messageTransmitterProgramId;
|
|
791
808
|
shimProgramId;
|
|
792
809
|
executorProgramId;
|
|
793
|
-
constructor(e, t,
|
|
794
|
-
if (this.network = e, this.chain = t, this.connection =
|
|
810
|
+
constructor(e, t, n, a) {
|
|
811
|
+
if (this.network = e, this.chain = t, this.connection = n, this.contracts = a, e === "Devnet")
|
|
795
812
|
throw new Error("CCTPExecutor not supported on Devnet");
|
|
796
|
-
const
|
|
813
|
+
const r = (i, o) => {
|
|
797
814
|
if (!i)
|
|
798
815
|
throw new Error(o);
|
|
799
|
-
return new
|
|
816
|
+
return new h(i);
|
|
800
817
|
};
|
|
801
|
-
this.tokenMessengerProgramId =
|
|
818
|
+
this.tokenMessengerProgramId = r(a.cctp?.tokenMessenger, `Circle Token Messenger contract for domain ${t} not found`), this.messageTransmitterProgramId = r(a.cctp?.messageTransmitter, `Circle Message Transmitter contract for domain ${t} not found`), this.shimProgramId = r(he[e]?.[t], `Shim contract for ${t} not found`), this.executorProgramId = r(at[e], `Executor contract for ${e} not found`);
|
|
802
819
|
}
|
|
803
820
|
static async fromRpc(e, t) {
|
|
804
|
-
const [
|
|
805
|
-
if (
|
|
806
|
-
throw new Error(`Network mismatch: ${
|
|
807
|
-
return new
|
|
808
|
-
}
|
|
809
|
-
async *transfer(e, t,
|
|
810
|
-
const
|
|
811
|
-
if (c.feePayer =
|
|
812
|
-
const
|
|
813
|
-
await this.connection.getAccountInfo(
|
|
821
|
+
const [n, a] = await st.chainFromRpc(e), r = t[a];
|
|
822
|
+
if (r.network !== n)
|
|
823
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
824
|
+
return new Ee(n, a, e, r.contracts);
|
|
825
|
+
}
|
|
826
|
+
async *transfer(e, t, n) {
|
|
827
|
+
const a = new h(y.get(this.network, this.chain)), r = new I(e).unwrap(), i = J(a, r), o = new I(n.referrer?.address?.toString() ?? r).unwrap(), c = new re();
|
|
828
|
+
if (c.feePayer = r, n.referrerFee > 0n) {
|
|
829
|
+
const C = J(a, o, !0);
|
|
830
|
+
await this.connection.getAccountInfo(C) || c.add(ht(r, C, o, a)), c.add(gt(i, C, r, n.referrerFee));
|
|
814
831
|
}
|
|
815
|
-
const u =
|
|
816
|
-
c.add(await
|
|
817
|
-
const m = new
|
|
832
|
+
const u = X.get(this.network, t.chain), f = t.address.toUniversalAddress(), d = Ge.generate();
|
|
833
|
+
c.add(await qt(this.messageTransmitterProgramId, this.tokenMessengerProgramId, a, u, r, i, f, n.remainingAmount, d.publicKey));
|
|
834
|
+
const m = new nt(Cn, this.shimProgramId, { connection: null }), g = O(Ce, n.signedQuote), p = Ht("message_transmitter", this.messageTransmitterProgramId);
|
|
818
835
|
c.add(await m.methods.relayLastMessage({
|
|
819
|
-
execAmount: new
|
|
820
|
-
recipientChain:
|
|
821
|
-
signedQuoteBytes:
|
|
822
|
-
relayInstructions:
|
|
836
|
+
execAmount: new je(n.estimatedCost.toString()),
|
|
837
|
+
recipientChain: A(t.chain),
|
|
838
|
+
signedQuoteBytes: l.from(n.signedQuote),
|
|
839
|
+
relayInstructions: l.from(n.relayInstructions)
|
|
823
840
|
}).accounts({
|
|
824
|
-
payer:
|
|
825
|
-
messageTransmitter:
|
|
826
|
-
payee: new g
|
|
841
|
+
payer: r,
|
|
842
|
+
messageTransmitter: p,
|
|
843
|
+
payee: new h(g.quote.payeeAddress),
|
|
827
844
|
executorProgram: this.executorProgramId
|
|
828
845
|
}).instruction()), yield this.createUnsignedTx({ transaction: c, signers: [d] }, "SvmCCTPExecutor.Transfer");
|
|
829
846
|
}
|
|
830
|
-
createUnsignedTx(e, t,
|
|
831
|
-
return new
|
|
847
|
+
createUnsignedTx(e, t, n = !1) {
|
|
848
|
+
return new rt(e, this.network, this.chain, t, n);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
const wn = {
|
|
852
|
+
version: "0.1.0",
|
|
853
|
+
name: "executor",
|
|
854
|
+
instructions: [
|
|
855
|
+
{
|
|
856
|
+
name: "requestForExecution",
|
|
857
|
+
accounts: [
|
|
858
|
+
{
|
|
859
|
+
name: "payer",
|
|
860
|
+
isMut: !0,
|
|
861
|
+
isSigner: !0
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
name: "payee",
|
|
865
|
+
isMut: !0,
|
|
866
|
+
isSigner: !1
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
name: "systemProgram",
|
|
870
|
+
isMut: !1,
|
|
871
|
+
isSigner: !1
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
args: [
|
|
875
|
+
{
|
|
876
|
+
name: "args",
|
|
877
|
+
type: {
|
|
878
|
+
defined: "RequestForExecutionArgs"
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
],
|
|
884
|
+
types: [
|
|
885
|
+
{
|
|
886
|
+
name: "RequestForExecutionArgs",
|
|
887
|
+
type: {
|
|
888
|
+
kind: "struct",
|
|
889
|
+
fields: [
|
|
890
|
+
{
|
|
891
|
+
name: "amount",
|
|
892
|
+
type: "u64"
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
name: "dstChain",
|
|
896
|
+
type: "u16"
|
|
897
|
+
},
|
|
898
|
+
{
|
|
899
|
+
name: "dstAddr",
|
|
900
|
+
type: {
|
|
901
|
+
array: ["u8", 32]
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
name: "refundAddr",
|
|
906
|
+
type: "publicKey"
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
name: "signedQuoteBytes",
|
|
910
|
+
type: "bytes"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: "requestBytes",
|
|
914
|
+
type: "bytes"
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: "relayInstructions",
|
|
918
|
+
type: "bytes"
|
|
919
|
+
}
|
|
920
|
+
]
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
],
|
|
924
|
+
errors: [
|
|
925
|
+
{
|
|
926
|
+
code: 6e3,
|
|
927
|
+
name: "InvalidArguments",
|
|
928
|
+
msg: "InvalidArguments"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
code: 6001,
|
|
932
|
+
name: "QuoteSrcChainMismatch",
|
|
933
|
+
msg: "QuoteSrcChainMismatch"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
code: 6002,
|
|
937
|
+
name: "QuoteDstChainMismatch",
|
|
938
|
+
msg: "QuoteDstChainMismatch"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
code: 6003,
|
|
942
|
+
name: "QuoteExpired",
|
|
943
|
+
msg: "QuoteExpired"
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
code: 6004,
|
|
947
|
+
name: "QuotePayeeMismatch",
|
|
948
|
+
msg: "QuotePayeeMismatch"
|
|
949
|
+
}
|
|
950
|
+
]
|
|
951
|
+
}, bn = l.from("4552433201", "hex");
|
|
952
|
+
class Ae {
|
|
953
|
+
network;
|
|
954
|
+
chain;
|
|
955
|
+
connection;
|
|
956
|
+
contracts;
|
|
957
|
+
tokenMessengerV2ProgramId;
|
|
958
|
+
messageTransmitterV2ProgramId;
|
|
959
|
+
executorProgramId;
|
|
960
|
+
constructor(e, t, n, a) {
|
|
961
|
+
this.network = e, this.chain = t, this.connection = n, this.contracts = a;
|
|
962
|
+
const r = (o, c) => {
|
|
963
|
+
if (!o)
|
|
964
|
+
throw new Error(c);
|
|
965
|
+
return new h(o);
|
|
966
|
+
}, i = it[e]?.[t];
|
|
967
|
+
if (!i)
|
|
968
|
+
throw new Error(`Circle V2 contracts not found for ${e} ${t}`);
|
|
969
|
+
this.tokenMessengerV2ProgramId = r(i.tokenMessengerV2, `Circle Token Messenger V2 contract for domain ${t} not found`), this.messageTransmitterV2ProgramId = r(i.messageTransmitterV2, `Circle Message Transmitter V2 contract for domain ${t} not found`), this.executorProgramId = r(at[e], `Executor contract for ${e} not found`);
|
|
970
|
+
}
|
|
971
|
+
static async fromRpc(e, t) {
|
|
972
|
+
const [n, a] = await st.chainFromRpc(e), r = t[a];
|
|
973
|
+
if (r.network !== n)
|
|
974
|
+
throw new Error(`Network mismatch: ${r.network} != ${n}`);
|
|
975
|
+
return new Ae(n, a, e, r.contracts);
|
|
976
|
+
}
|
|
977
|
+
async *transfer(e, t, n) {
|
|
978
|
+
const a = new h(y.get(this.network, this.chain)), r = new I(e).unwrap(), i = J(a, r), o = new I(n.referrer?.address?.toString() ?? r).unwrap(), c = new re();
|
|
979
|
+
if (c.feePayer = r, n.referrerFee > 0n) {
|
|
980
|
+
const C = J(a, o, !0);
|
|
981
|
+
await this.connection.getAccountInfo(C) || c.add(ht(r, C, o, a)), c.add(gt(i, C, r, n.referrerFee));
|
|
982
|
+
}
|
|
983
|
+
const u = N(this.network, t.chain), f = t.address.toUniversalAddress(), d = Ge.generate(), m = await this.createCCTPv2DepositInstruction(a, u, r, i, f, n.remainingAmount, d.publicKey);
|
|
984
|
+
c.add(m);
|
|
985
|
+
const g = new nt(wn, this.executorProgramId, { connection: null }), p = O(Ce, n.signedQuote);
|
|
986
|
+
c.add(await g.methods.requestForExecution({
|
|
987
|
+
amount: new je(n.estimatedCost.toString()),
|
|
988
|
+
dstChain: A(t.chain),
|
|
989
|
+
dstAddr: [...t.address.toUniversalAddress().toUint8Array()],
|
|
990
|
+
refundAddr: r,
|
|
991
|
+
signedQuoteBytes: l.from(n.signedQuote),
|
|
992
|
+
requestBytes: bn,
|
|
993
|
+
relayInstructions: l.from(n.relayInstructions)
|
|
994
|
+
}).accounts({
|
|
995
|
+
payer: r,
|
|
996
|
+
payee: new h(p.quote.payeeAddress),
|
|
997
|
+
systemProgram: se.programId
|
|
998
|
+
}).instruction()), yield this.createUnsignedTx({ transaction: c, signers: [d] }, "SvmCCTPv2Executor.Transfer");
|
|
999
|
+
}
|
|
1000
|
+
async isTransferCompleted(e) {
|
|
1001
|
+
const t = l.alloc(4);
|
|
1002
|
+
t.writeUInt32LE(e.sourceDomain, 0);
|
|
1003
|
+
const n = l.from(e.nonce).subarray(0, 8), [a] = h.findProgramAddressSync([l.from("used_nonces"), t, n], this.messageTransmitterV2ProgramId);
|
|
1004
|
+
try {
|
|
1005
|
+
return await this.connection.getAccountInfo(a) !== null;
|
|
1006
|
+
} catch {
|
|
1007
|
+
return !1;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
async *redeem(e, t, n) {
|
|
1011
|
+
const a = new I(e).unwrap(), r = new re();
|
|
1012
|
+
r.feePayer = a, r.add(await Zt(this.messageTransmitterV2ProgramId, this.tokenMessengerV2ProgramId, new h(y.get(this.network, this.chain)), ft(t), n, a)), yield this.createUnsignedTx({ transaction: r, signers: [] }, "SvmCCTPv2Executor.Redeem");
|
|
1013
|
+
}
|
|
1014
|
+
async getCurrentBlock() {
|
|
1015
|
+
const e = await this.connection.getSlot();
|
|
1016
|
+
return BigInt(e);
|
|
1017
|
+
}
|
|
1018
|
+
async createCCTPv2DepositInstruction(e, t, n, a, r, i, o) {
|
|
1019
|
+
const [c] = h.findProgramAddressSync([l.from("token_messenger")], this.tokenMessengerV2ProgramId), [u] = h.findProgramAddressSync([l.from("local_token"), e.toBuffer()], this.tokenMessengerV2ProgramId), [f] = h.findProgramAddressSync([
|
|
1020
|
+
l.from("remote_token_messenger"),
|
|
1021
|
+
l.from(t.toString())
|
|
1022
|
+
], this.tokenMessengerV2ProgramId), [d] = h.findProgramAddressSync([l.from("token_minter")], this.tokenMessengerV2ProgramId), [m] = h.findProgramAddressSync([l.from("sender_authority")], this.tokenMessengerV2ProgramId), [g] = h.findProgramAddressSync([l.from("__event_authority")], this.tokenMessengerV2ProgramId), [p] = h.findProgramAddressSync([l.from("denylist_account"), n.toBuffer()], this.tokenMessengerV2ProgramId), [C] = h.findProgramAddressSync([l.from("message_transmitter")], this.messageTransmitterV2ProgramId), E = l.from([215, 60, 61, 46, 114, 55, 128, 176]), w = l.alloc(8);
|
|
1023
|
+
w.writeBigUInt64LE(i);
|
|
1024
|
+
const D = l.alloc(4);
|
|
1025
|
+
D.writeUInt32LE(t);
|
|
1026
|
+
const T = l.from(r.toUint8Array()), V = l.alloc(32), U = l.alloc(8);
|
|
1027
|
+
U.writeBigUInt64LE(0n);
|
|
1028
|
+
const B = l.alloc(4);
|
|
1029
|
+
B.writeUInt32LE(0);
|
|
1030
|
+
const W = l.concat([
|
|
1031
|
+
E,
|
|
1032
|
+
w,
|
|
1033
|
+
D,
|
|
1034
|
+
T,
|
|
1035
|
+
V,
|
|
1036
|
+
U,
|
|
1037
|
+
B
|
|
1038
|
+
]), R = [
|
|
1039
|
+
{ pubkey: n, isSigner: !0, isWritable: !1 },
|
|
1040
|
+
{ pubkey: n, isSigner: !0, isWritable: !0 },
|
|
1041
|
+
{ pubkey: m, isSigner: !1, isWritable: !1 },
|
|
1042
|
+
{ pubkey: a, isSigner: !1, isWritable: !0 },
|
|
1043
|
+
{ pubkey: p, isSigner: !1, isWritable: !1 },
|
|
1044
|
+
{ pubkey: C, isSigner: !1, isWritable: !0 },
|
|
1045
|
+
{ pubkey: c, isSigner: !1, isWritable: !1 },
|
|
1046
|
+
{ pubkey: f, isSigner: !1, isWritable: !1 },
|
|
1047
|
+
{ pubkey: d, isSigner: !1, isWritable: !1 },
|
|
1048
|
+
{ pubkey: u, isSigner: !1, isWritable: !0 },
|
|
1049
|
+
{ pubkey: e, isSigner: !1, isWritable: !0 },
|
|
1050
|
+
{ pubkey: o, isSigner: !0, isWritable: !0 },
|
|
1051
|
+
{
|
|
1052
|
+
pubkey: this.messageTransmitterV2ProgramId,
|
|
1053
|
+
isSigner: !1,
|
|
1054
|
+
isWritable: !1
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
pubkey: this.tokenMessengerV2ProgramId,
|
|
1058
|
+
isSigner: !1,
|
|
1059
|
+
isWritable: !1
|
|
1060
|
+
},
|
|
1061
|
+
{ pubkey: L, isSigner: !1, isWritable: !1 },
|
|
1062
|
+
{ pubkey: se.programId, isSigner: !1, isWritable: !1 },
|
|
1063
|
+
{ pubkey: g, isSigner: !1, isWritable: !1 },
|
|
1064
|
+
{ pubkey: this.tokenMessengerV2ProgramId, isSigner: !1, isWritable: !1 }
|
|
1065
|
+
];
|
|
1066
|
+
return new ue({
|
|
1067
|
+
keys: R,
|
|
1068
|
+
programId: this.tokenMessengerV2ProgramId,
|
|
1069
|
+
data: W
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
createUnsignedTx(e, t, n = !1) {
|
|
1073
|
+
return new rt(e, this.network, this.chain, t, n);
|
|
832
1074
|
}
|
|
833
1075
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
1076
|
+
k(qe, "CCTPExecutor", Ee);
|
|
1077
|
+
k(qe, "CCTPv2Executor", Ae);
|
|
1078
|
+
var b;
|
|
1079
|
+
(function(s) {
|
|
1080
|
+
s.Pending = "pending", s.Failed = "failed", s.Unsupported = "unsupported", s.Submitted = "submitted", s.Underpaid = "underpaid", s.Aborted = "aborted";
|
|
1081
|
+
})(b || (b = {}));
|
|
1082
|
+
var $e;
|
|
1083
|
+
(function(s) {
|
|
1084
|
+
s.ERM1 = "ERM1", s.ERV1 = "ERV1", s.ERN1 = "ERN1", s.ERC1 = "ERC1", s.ERC2 = "ERC2";
|
|
1085
|
+
})($e || ($e = {}));
|
|
1086
|
+
async function yn(s) {
|
|
1087
|
+
const e = `${le[s]}/v0/capabilities`;
|
|
845
1088
|
try {
|
|
846
|
-
return (await
|
|
1089
|
+
return (await v.get(e)).data;
|
|
847
1090
|
} catch {
|
|
848
|
-
throw new Error(`Failed to fetch capabilities for network: ${
|
|
1091
|
+
throw new Error(`Failed to fetch capabilities for network: ${s}.`);
|
|
849
1092
|
}
|
|
850
1093
|
}
|
|
851
|
-
async function
|
|
852
|
-
const
|
|
1094
|
+
async function En(s, e, t, n) {
|
|
1095
|
+
const a = `${le[s]}/v0/quote`;
|
|
853
1096
|
try {
|
|
854
|
-
return (await
|
|
855
|
-
srcChain:
|
|
856
|
-
dstChain:
|
|
857
|
-
relayInstructions:
|
|
1097
|
+
return (await v.post(a, {
|
|
1098
|
+
srcChain: A(e),
|
|
1099
|
+
dstChain: A(t),
|
|
1100
|
+
relayInstructions: n
|
|
858
1101
|
})).data;
|
|
859
1102
|
} catch {
|
|
860
1103
|
throw new Error("Failed to fetch signed quote.");
|
|
861
1104
|
}
|
|
862
1105
|
}
|
|
863
|
-
async function
|
|
864
|
-
const
|
|
1106
|
+
async function xe(s, e, t) {
|
|
1107
|
+
const n = `${le[s]}/v0/status/tx`;
|
|
865
1108
|
try {
|
|
866
|
-
return (await
|
|
1109
|
+
return (await v.post(n, {
|
|
867
1110
|
txHash: e,
|
|
868
|
-
chainId:
|
|
1111
|
+
chainId: A(t)
|
|
869
1112
|
})).data;
|
|
870
1113
|
} catch {
|
|
871
1114
|
throw new Error(`Failed to fetch status for txHash: ${e}.`);
|
|
872
1115
|
}
|
|
873
1116
|
}
|
|
874
|
-
const
|
|
875
|
-
function
|
|
876
|
-
if (e >
|
|
1117
|
+
const An = 65535n;
|
|
1118
|
+
function xn(s, e, t) {
|
|
1119
|
+
if (e > An)
|
|
877
1120
|
throw new Error("dBps exceeds max u16");
|
|
878
|
-
let
|
|
1121
|
+
let n = e, a = s, r = 0n;
|
|
879
1122
|
if (e > 0) {
|
|
880
|
-
if (t !== void 0 &&
|
|
881
|
-
const i =
|
|
882
|
-
|
|
1123
|
+
if (t !== void 0 && s > 0) {
|
|
1124
|
+
const i = He(t.toString(), 6), o = me(i) / s, c = e < o ? e : o;
|
|
1125
|
+
r = s * c / 100000n, n = c;
|
|
883
1126
|
} else
|
|
884
|
-
|
|
885
|
-
|
|
1127
|
+
r = s * e / 100000n;
|
|
1128
|
+
a = s - r;
|
|
886
1129
|
}
|
|
887
|
-
return { referrerFee:
|
|
1130
|
+
return { referrerFee: r, remainingAmount: a, referrerFeeDbps: n };
|
|
888
1131
|
}
|
|
889
|
-
function
|
|
890
|
-
return new Promise((e) => setTimeout(e,
|
|
1132
|
+
function Dn(s) {
|
|
1133
|
+
return new Promise((e) => setTimeout(e, s));
|
|
891
1134
|
}
|
|
892
|
-
async function
|
|
893
|
-
const
|
|
894
|
-
return
|
|
895
|
-
const
|
|
1135
|
+
async function de(s, e, t = Ze) {
|
|
1136
|
+
const n = N(e, s.chain);
|
|
1137
|
+
return Ke(async () => {
|
|
1138
|
+
const a = `${te[e]}/messages/${n}?transactionHash=${s.txid}`;
|
|
896
1139
|
try {
|
|
897
|
-
const i = (await
|
|
1140
|
+
const i = (await v.get(a)).data.messages[0];
|
|
898
1141
|
if (!i)
|
|
899
1142
|
return null;
|
|
900
1143
|
if (i.cctpVersion !== 2)
|
|
901
1144
|
throw new Error("CCTPv1 attestation found");
|
|
902
1145
|
return i.status === "pending_confirmations" ? null : {
|
|
903
|
-
message:
|
|
1146
|
+
message: an(z.decode(i.message)),
|
|
904
1147
|
attestation: i.attestation
|
|
905
1148
|
};
|
|
906
|
-
} catch (
|
|
907
|
-
if (!
|
|
1149
|
+
} catch (r) {
|
|
1150
|
+
if (!r || typeof r == "object" && (v.isAxiosError(r) && r.response?.status === 404 || "status" in r && r.status === 404))
|
|
908
1151
|
return null;
|
|
909
|
-
throw
|
|
1152
|
+
throw r;
|
|
910
1153
|
}
|
|
911
1154
|
}, 2e3, t, "CCTPv2:GetMessage");
|
|
912
1155
|
}
|
|
913
|
-
async function
|
|
914
|
-
const
|
|
1156
|
+
async function Sn(s, e, t) {
|
|
1157
|
+
const n = N(s, e), a = N(s, t), r = `${te[s]}/fastBurn/USDC/fees/${n}/${a}`, i = await v.get(r);
|
|
915
1158
|
return BigInt(i.data.minimumFee);
|
|
916
1159
|
}
|
|
917
|
-
async function
|
|
918
|
-
const t =
|
|
919
|
-
if (
|
|
920
|
-
if (
|
|
1160
|
+
async function vn(s, e) {
|
|
1161
|
+
const t = z.encode(e.attestation.message.nonce, !0), n = `${te[s]}/reattest/${t}`, a = await v.post(n);
|
|
1162
|
+
if (a.data.error) {
|
|
1163
|
+
if (a.data.error.includes("Message is already finalized"))
|
|
921
1164
|
return e.attestation;
|
|
922
|
-
throw new Error(`Error re-attesting message: ${
|
|
1165
|
+
throw new Error(`Error re-attesting message: ${a.data.error}`);
|
|
923
1166
|
}
|
|
924
|
-
const
|
|
925
|
-
return
|
|
926
|
-
const i = await
|
|
1167
|
+
const r = ct(s, e.attestation.message.sourceDomain);
|
|
1168
|
+
return Ke(async () => {
|
|
1169
|
+
const i = await de({ txid: e.id, chain: r }, s);
|
|
927
1170
|
return !i || i.message.messageBody.expirationBlock !== 0n ? null : i;
|
|
928
|
-
}, 2e3,
|
|
1171
|
+
}, 2e3, Ze, "CCTPv2:Reattest");
|
|
929
1172
|
}
|
|
930
|
-
async function
|
|
931
|
-
const e = `${
|
|
932
|
-
return
|
|
1173
|
+
async function Fn(s) {
|
|
1174
|
+
const e = `${te[s]}/fastBurn/USDC/allowance`, t = await v.get(e);
|
|
1175
|
+
return me(He(t.data.allowance, 6));
|
|
933
1176
|
}
|
|
934
|
-
function
|
|
935
|
-
const
|
|
936
|
-
if (!(
|
|
1177
|
+
function De(s, e, t) {
|
|
1178
|
+
const n = y.get(e.network, e.chain);
|
|
1179
|
+
if (!(n && _t(s, F.tokenId(e.chain, n))))
|
|
937
1180
|
return [];
|
|
938
|
-
const { network:
|
|
939
|
-
return i ? [
|
|
1181
|
+
const { network: a, chain: r } = t, i = y.get(a, r);
|
|
1182
|
+
return i ? [F.chainAddress(r, i)] : [];
|
|
940
1183
|
}
|
|
941
|
-
let
|
|
942
|
-
async function
|
|
943
|
-
const { fromChain:
|
|
944
|
-
if (!
|
|
1184
|
+
let j;
|
|
1185
|
+
async function Se(s, e, t, n) {
|
|
1186
|
+
const { fromChain: a, toChain: r } = s;
|
|
1187
|
+
if (!y.get(a.network, a.chain))
|
|
945
1188
|
throw new Error("Invalid transfer, no USDC contract on source");
|
|
946
|
-
const o =
|
|
1189
|
+
const o = y.get(r.network, r.chain);
|
|
947
1190
|
if (!o)
|
|
948
1191
|
throw new Error("Invalid transfer, no USDC contract on destination");
|
|
949
1192
|
let c;
|
|
950
|
-
if (t.referrerFeeDbps > 0n && (c = t.referrerAddresses?.[
|
|
951
|
-
throw new Error(`Referrer address not configured for ${
|
|
952
|
-
const u = c ?
|
|
1193
|
+
if (t.referrerFeeDbps > 0n && (c = t.referrerAddresses?.[a.network]?.[a.chain], !c))
|
|
1194
|
+
throw new Error(`Referrer address not configured for ${a.chain}`);
|
|
1195
|
+
const u = c ? F.chainAddress(a.chain, c) : void 0, { referrerFee: f, remainingAmount: d, referrerFeeDbps: m } = xn(me(e.normalizedParams.amount), t.referrerFeeDbps, t.referrerFeeThreshold);
|
|
953
1196
|
if (d <= 0n)
|
|
954
1197
|
throw new Error("Amount after fee <= 0");
|
|
955
|
-
const
|
|
956
|
-
if (!
|
|
1198
|
+
const g = tn[r.network]?.[r.chain];
|
|
1199
|
+
if (!g)
|
|
957
1200
|
throw new Error("Gas limit not found");
|
|
958
|
-
const
|
|
959
|
-
if (!
|
|
1201
|
+
const p = await yn(a.network);
|
|
1202
|
+
if (!p[A(a.chain)])
|
|
960
1203
|
throw new Error("Unsupported source chain");
|
|
961
|
-
const
|
|
962
|
-
if (!
|
|
1204
|
+
const E = p[A(r.chain)];
|
|
1205
|
+
if (!E || !E.requestPrefixes.includes(n))
|
|
963
1206
|
throw new Error("Unsupported destination chain");
|
|
964
|
-
const { recipient:
|
|
965
|
-
let
|
|
966
|
-
if (
|
|
967
|
-
const
|
|
968
|
-
|
|
969
|
-
}
|
|
970
|
-
let
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
|
|
1207
|
+
const { recipient: w } = s;
|
|
1208
|
+
let D = !0;
|
|
1209
|
+
if (w && r.chain === "Solana") {
|
|
1210
|
+
const yt = F.parseAddress("Solana", o), Et = await r.getTokenAccount(w.address, yt), Be = await r.getRpc();
|
|
1211
|
+
D = await Be.getAccountInfo(new I(Et.address).unwrap()) !== null, !D && !j && (j = BigInt(await Be.getMinimumBalanceForRentExemption(165)));
|
|
1212
|
+
}
|
|
1213
|
+
let T = 0n;
|
|
1214
|
+
r.chain === "Solana" && (T += en, !D && j && (T += j), n === "ERC2" && (T += 1200000n));
|
|
1215
|
+
const V = [];
|
|
1216
|
+
V.push({
|
|
974
1217
|
request: {
|
|
975
1218
|
type: "GasInstruction",
|
|
976
|
-
gasLimit:
|
|
977
|
-
msgValue:
|
|
1219
|
+
gasLimit: g,
|
|
1220
|
+
msgValue: T
|
|
978
1221
|
}
|
|
979
1222
|
});
|
|
980
|
-
const
|
|
981
|
-
(
|
|
1223
|
+
const U = BigInt(E.gasDropOffLimit), B = e.options.nativeGas && U > 0n ? BigInt(Math.round(e.options.nativeGas * 100)) * U / 100n : 0n;
|
|
1224
|
+
(B > 0n || !D) && V.push({
|
|
982
1225
|
request: {
|
|
983
1226
|
type: "GasDropOffInstruction",
|
|
984
|
-
dropOff:
|
|
1227
|
+
dropOff: B,
|
|
985
1228
|
// If the recipient is undefined (e.g. the user hasn’t connected their wallet yet),
|
|
986
1229
|
// we temporarily use a dummy address to fetch a quote.
|
|
987
1230
|
// The recipient address is validated later in the `initiate` method, which will throw if it's still missing.
|
|
988
|
-
recipient:
|
|
1231
|
+
recipient: w ? w.address.toUniversalAddress() : new $t(new Uint8Array(32))
|
|
989
1232
|
}
|
|
990
1233
|
});
|
|
991
|
-
const
|
|
992
|
-
requests:
|
|
993
|
-
}),
|
|
994
|
-
if (!
|
|
1234
|
+
const W = Le(lt, {
|
|
1235
|
+
requests: V
|
|
1236
|
+
}), R = await En(a.network, a.chain, r.chain, z.encode(W, !0));
|
|
1237
|
+
if (!R.estimatedCost)
|
|
995
1238
|
throw new Error("No estimated cost");
|
|
996
|
-
const
|
|
1239
|
+
const Te = z.decode(R.signedQuote), wt = O(Ce, Te), bt = BigInt(R.estimatedCost);
|
|
997
1240
|
return {
|
|
998
|
-
signedQuote:
|
|
999
|
-
relayInstructions:
|
|
1000
|
-
estimatedCost:
|
|
1241
|
+
signedQuote: Te,
|
|
1242
|
+
relayInstructions: W,
|
|
1243
|
+
estimatedCost: bt,
|
|
1001
1244
|
referrer: u,
|
|
1002
1245
|
referrerFee: f,
|
|
1003
1246
|
remainingAmount: d,
|
|
1004
1247
|
referrerFeeDbps: m,
|
|
1005
|
-
expiryTime:
|
|
1006
|
-
gasDropOff:
|
|
1248
|
+
expiryTime: wt.quote.expiryTime,
|
|
1249
|
+
gasDropOff: B
|
|
1007
1250
|
};
|
|
1008
1251
|
}
|
|
1009
|
-
async function
|
|
1010
|
-
|
|
1252
|
+
async function pt(s, e, t, n) {
|
|
1253
|
+
O(lt, n.details.relayInstructions).requests.forEach(({ request: d }) => {
|
|
1011
1254
|
if (d.type === "GasDropOffInstruction" && !d.recipient.equals(t.address.toUniversalAddress()))
|
|
1012
1255
|
throw new Error("Gas drop-off recipient does not match");
|
|
1013
1256
|
});
|
|
1014
|
-
const
|
|
1257
|
+
const r = F.parseAddress(e.chain(), e.address()), i = await Tn(t, s);
|
|
1015
1258
|
let o;
|
|
1016
|
-
|
|
1017
|
-
const c = await
|
|
1259
|
+
n.protocol === "CCTPExecutor" ? o = await (await s.fromChain.getProtocol(n.protocol)).transfer(r, i, n.details) : o = await (await s.fromChain.getProtocol(n.protocol)).transfer(r, i, n.details);
|
|
1260
|
+
const c = await Ye(s.fromChain, o, e);
|
|
1018
1261
|
let u = 0;
|
|
1019
1262
|
return (async () => {
|
|
1020
1263
|
for (; u < 20; ) {
|
|
1021
1264
|
try {
|
|
1022
|
-
const [d] = await
|
|
1265
|
+
const [d] = await xe(s.fromChain.network, c.at(-1).txid, s.fromChain.chain);
|
|
1023
1266
|
if (d)
|
|
1024
1267
|
break;
|
|
1025
1268
|
} catch {
|
|
1026
1269
|
}
|
|
1027
|
-
u++, await
|
|
1270
|
+
u++, await Dn(2e3);
|
|
1028
1271
|
}
|
|
1029
1272
|
})(), {
|
|
1030
|
-
from:
|
|
1031
|
-
to:
|
|
1032
|
-
state:
|
|
1273
|
+
from: s.fromChain.chain,
|
|
1274
|
+
to: s.toChain.chain,
|
|
1275
|
+
state: x.SourceInitiated,
|
|
1033
1276
|
originTxs: c
|
|
1034
1277
|
};
|
|
1035
1278
|
}
|
|
1036
|
-
async function
|
|
1037
|
-
if (
|
|
1038
|
-
return
|
|
1039
|
-
const t =
|
|
1279
|
+
async function Tn(s, e) {
|
|
1280
|
+
if (s.chain !== "Solana")
|
|
1281
|
+
return s;
|
|
1282
|
+
const t = y.get(e.toChain.network, e.toChain.chain);
|
|
1040
1283
|
if (!t)
|
|
1041
1284
|
throw new Error("No USDC contract found for Solana");
|
|
1042
|
-
const
|
|
1043
|
-
return e.toChain.getTokenAccount(
|
|
1285
|
+
const n = F.parseAddress("Solana", t);
|
|
1286
|
+
return e.toChain.getTokenAccount(s.address, n);
|
|
1044
1287
|
}
|
|
1045
|
-
function
|
|
1046
|
-
if (
|
|
1288
|
+
function Zn(s = { referrerFeeDbps: 0n }) {
|
|
1289
|
+
if (s.referrerFeeDbps < 0 || s.referrerFeeDbps > 65535n)
|
|
1047
1290
|
throw new Error("Referrer fee must be between 0 and 65535");
|
|
1048
|
-
class e extends
|
|
1049
|
-
static config =
|
|
1291
|
+
class e extends Bn {
|
|
1292
|
+
static config = s;
|
|
1050
1293
|
}
|
|
1051
1294
|
return e;
|
|
1052
1295
|
}
|
|
1053
|
-
class
|
|
1296
|
+
class Bn extends Je {
|
|
1054
1297
|
static NATIVE_GAS_DROPOFF_SUPPORTED = !0;
|
|
1055
1298
|
// @ts-ignore
|
|
1056
1299
|
// Since we set the config on the static class, access it with this param
|
|
@@ -1065,10 +1308,10 @@ class vn extends We {
|
|
|
1065
1308
|
return ["Mainnet", "Testnet"];
|
|
1066
1309
|
}
|
|
1067
1310
|
static supportedChains(e) {
|
|
1068
|
-
return [...Object.keys(
|
|
1311
|
+
return [...Object.keys(ot[e] ?? {})];
|
|
1069
1312
|
}
|
|
1070
|
-
static async supportedDestinationTokens(e, t,
|
|
1071
|
-
return !
|
|
1313
|
+
static async supportedDestinationTokens(e, t, n) {
|
|
1314
|
+
return !Q(t.network, t.chain) || !Q(n.network, n.chain) ? [] : De(e, t, n);
|
|
1072
1315
|
}
|
|
1073
1316
|
getDefaultOptions() {
|
|
1074
1317
|
return {
|
|
@@ -1076,8 +1319,8 @@ class vn extends We {
|
|
|
1076
1319
|
};
|
|
1077
1320
|
}
|
|
1078
1321
|
async validate(e, t) {
|
|
1079
|
-
const { fromChain:
|
|
1080
|
-
return !
|
|
1322
|
+
const { fromChain: n, toChain: a } = e;
|
|
1323
|
+
return !Q(n.network, n.chain) || !Q(a.network, a.chain) ? {
|
|
1081
1324
|
valid: !1,
|
|
1082
1325
|
error: new Error("Unsupported source or destination chain"),
|
|
1083
1326
|
params: t
|
|
@@ -1094,11 +1337,11 @@ class vn extends We {
|
|
|
1094
1337
|
} };
|
|
1095
1338
|
}
|
|
1096
1339
|
async quote(e, t) {
|
|
1097
|
-
const { fromChain:
|
|
1340
|
+
const { fromChain: n, toChain: a } = e;
|
|
1098
1341
|
try {
|
|
1099
|
-
const
|
|
1100
|
-
|
|
1101
|
-
|
|
1342
|
+
const r = await Se(e, t, this.staticConfig, "ERC1"), { remainingAmount: i, estimatedCost: o, gasDropOff: c, expiryTime: u } = r, f = n.chain === "Polygon" ? 2e3 * 200 : Xe(n.chain) + 1e3, [d, m] = await Promise.all([
|
|
1343
|
+
n.getDecimals("native"),
|
|
1344
|
+
a.getDecimals("native")
|
|
1102
1345
|
]);
|
|
1103
1346
|
return {
|
|
1104
1347
|
success: !0,
|
|
@@ -1109,193 +1352,193 @@ class vn extends We {
|
|
|
1109
1352
|
},
|
|
1110
1353
|
destinationToken: {
|
|
1111
1354
|
token: e.destination.id,
|
|
1112
|
-
amount:
|
|
1355
|
+
amount: S(i, e.destination.decimals)
|
|
1113
1356
|
},
|
|
1114
1357
|
relayFee: {
|
|
1115
|
-
token:
|
|
1116
|
-
amount:
|
|
1358
|
+
token: fe(n.chain),
|
|
1359
|
+
amount: S(o, d)
|
|
1117
1360
|
},
|
|
1118
|
-
destinationNativeGas:
|
|
1361
|
+
destinationNativeGas: S(c, m),
|
|
1119
1362
|
eta: f,
|
|
1120
1363
|
expires: u,
|
|
1121
|
-
details:
|
|
1364
|
+
details: r
|
|
1122
1365
|
};
|
|
1123
|
-
} catch (
|
|
1366
|
+
} catch (r) {
|
|
1124
1367
|
return {
|
|
1125
1368
|
success: !1,
|
|
1126
|
-
error: new Error(
|
|
1369
|
+
error: new Error(r instanceof Error ? r.message : `${r}`)
|
|
1127
1370
|
};
|
|
1128
1371
|
}
|
|
1129
1372
|
}
|
|
1130
|
-
async initiate(e, t,
|
|
1131
|
-
if (!
|
|
1373
|
+
async initiate(e, t, n, a) {
|
|
1374
|
+
if (!n.details)
|
|
1132
1375
|
throw new Error("Missing quote details");
|
|
1133
|
-
return await
|
|
1376
|
+
return await pt(e, t, a, {
|
|
1134
1377
|
protocol: "CCTPExecutor",
|
|
1135
|
-
details:
|
|
1378
|
+
details: n.details
|
|
1136
1379
|
});
|
|
1137
1380
|
}
|
|
1138
1381
|
async *track(e, t) {
|
|
1139
|
-
if (
|
|
1382
|
+
if (H(e) || $(e))
|
|
1140
1383
|
return e;
|
|
1141
|
-
let
|
|
1142
|
-
for (;
|
|
1143
|
-
const
|
|
1144
|
-
if (
|
|
1384
|
+
let n = t || 3600 * 1e3;
|
|
1385
|
+
for (; n > 0; ) {
|
|
1386
|
+
const a = Date.now();
|
|
1387
|
+
if (ae(e) || ie(e) || q(e))
|
|
1145
1388
|
try {
|
|
1146
|
-
const [
|
|
1147
|
-
if (!
|
|
1389
|
+
const [r] = await xe(this.wh.network, e.originTxs.at(-1).txid, e.from);
|
|
1390
|
+
if (!r)
|
|
1148
1391
|
throw new Error("No transaction status found");
|
|
1149
|
-
const i =
|
|
1150
|
-
if ((i ===
|
|
1151
|
-
i ===
|
|
1152
|
-
i ===
|
|
1153
|
-
i ===
|
|
1392
|
+
const i = r?.status;
|
|
1393
|
+
if ((i === b.Failed || // this could happen if simulation fails
|
|
1394
|
+
i === b.Underpaid || // only happens if you don't pay at least the costEstimate
|
|
1395
|
+
i === b.Unsupported || // capabilities check didn't pass
|
|
1396
|
+
i === b.Aborted) && (e = {
|
|
1154
1397
|
...e,
|
|
1155
|
-
state:
|
|
1156
|
-
error: new
|
|
1157
|
-
}), i ===
|
|
1398
|
+
state: x.Failed,
|
|
1399
|
+
error: new et(`Relay failed with status: ${i}`)
|
|
1400
|
+
}), i === b.Submitted && (e = {
|
|
1158
1401
|
...e,
|
|
1159
|
-
state:
|
|
1160
|
-
attestation: { id:
|
|
1161
|
-
}), yield e,
|
|
1402
|
+
state: x.DestinationFinalized,
|
|
1403
|
+
attestation: { id: r.id, attestation: {} }
|
|
1404
|
+
}), yield e, H(e) || $(e))
|
|
1162
1405
|
return e;
|
|
1163
|
-
} catch (
|
|
1164
|
-
console.error(`Error fetching transaction status: ${
|
|
1406
|
+
} catch (r) {
|
|
1407
|
+
console.error(`Error fetching transaction status: ${r.message || r}`);
|
|
1165
1408
|
}
|
|
1166
|
-
await new Promise((
|
|
1409
|
+
await new Promise((r) => setTimeout(r, 3e3)), n -= Date.now() - a;
|
|
1167
1410
|
}
|
|
1168
1411
|
return e;
|
|
1169
1412
|
}
|
|
1170
1413
|
}
|
|
1171
|
-
class
|
|
1414
|
+
class Ct extends Je {
|
|
1172
1415
|
static NATIVE_GAS_DROPOFF_SUPPORTED = !0;
|
|
1173
1416
|
static supportedNetworks() {
|
|
1174
1417
|
return ["Mainnet", "Testnet"];
|
|
1175
1418
|
}
|
|
1176
1419
|
static supportedChains(e) {
|
|
1177
|
-
return Object.keys(
|
|
1420
|
+
return Object.keys(ee[e] ?? {});
|
|
1178
1421
|
}
|
|
1179
1422
|
getDefaultOptions() {
|
|
1180
1423
|
return {
|
|
1181
1424
|
nativeGas: 0
|
|
1182
1425
|
};
|
|
1183
1426
|
}
|
|
1184
|
-
async initiate(e, t,
|
|
1185
|
-
if (!
|
|
1427
|
+
async initiate(e, t, n, a) {
|
|
1428
|
+
if (!n.details)
|
|
1186
1429
|
throw new Error("Missing quote details");
|
|
1187
|
-
return await
|
|
1430
|
+
return await pt(e, t, a, {
|
|
1188
1431
|
protocol: "CCTPv2Executor",
|
|
1189
|
-
details:
|
|
1432
|
+
details: n.details
|
|
1190
1433
|
});
|
|
1191
1434
|
}
|
|
1192
1435
|
async *track(e, t) {
|
|
1193
|
-
if (
|
|
1436
|
+
if (H(e))
|
|
1194
1437
|
return e;
|
|
1195
|
-
let
|
|
1196
|
-
for (;
|
|
1197
|
-
const
|
|
1198
|
-
if (
|
|
1438
|
+
let n = t || 3600 * 1e3;
|
|
1439
|
+
for (; n > 0; ) {
|
|
1440
|
+
const a = Date.now();
|
|
1441
|
+
if (ae(e) || ie(e) || q(e) || $(e))
|
|
1199
1442
|
try {
|
|
1200
|
-
const
|
|
1201
|
-
if (
|
|
1202
|
-
const i = await
|
|
1443
|
+
const r = e.originTxs.at(-1).txid;
|
|
1444
|
+
if (ae(e) || ie(e)) {
|
|
1445
|
+
const i = await de({ chain: e.from, txid: r }, this.wh.network);
|
|
1203
1446
|
i && (e = {
|
|
1204
1447
|
...e,
|
|
1205
|
-
state:
|
|
1448
|
+
state: x.Attested,
|
|
1206
1449
|
attestation: {
|
|
1207
|
-
id:
|
|
1450
|
+
id: r,
|
|
1208
1451
|
attestation: i
|
|
1209
1452
|
}
|
|
1210
1453
|
}), yield e;
|
|
1211
1454
|
}
|
|
1212
|
-
if (
|
|
1213
|
-
const [i] = await
|
|
1455
|
+
if (q(e)) {
|
|
1456
|
+
const [i] = await xe(this.wh.network, r, e.from);
|
|
1214
1457
|
if (!i)
|
|
1215
1458
|
throw new Error("No transaction status found");
|
|
1216
1459
|
const o = i?.status;
|
|
1217
|
-
o ===
|
|
1460
|
+
o === b.Submitted ? e = {
|
|
1218
1461
|
...e,
|
|
1219
|
-
state:
|
|
1220
|
-
} : (o ===
|
|
1221
|
-
o ===
|
|
1222
|
-
o ===
|
|
1223
|
-
o ===
|
|
1462
|
+
state: x.DestinationFinalized
|
|
1463
|
+
} : (o === b.Failed || // this could happen if simulation fails
|
|
1464
|
+
o === b.Underpaid || // only happens if you don't pay at least the costEstimate
|
|
1465
|
+
o === b.Unsupported || // capabilities check didn't pass
|
|
1466
|
+
o === b.Aborted) && (e = {
|
|
1224
1467
|
...e,
|
|
1225
|
-
state:
|
|
1226
|
-
error: new
|
|
1468
|
+
state: x.Failed,
|
|
1469
|
+
error: new et(`Relay failed with status: ${o}`)
|
|
1227
1470
|
});
|
|
1228
1471
|
}
|
|
1229
|
-
if (
|
|
1472
|
+
if ($(e)) {
|
|
1230
1473
|
if (!e.attestation)
|
|
1231
1474
|
throw new Error("Receipt is missing attestation");
|
|
1232
1475
|
const i = e.attestation;
|
|
1233
1476
|
await (await this.wh.getChain(e.to).getProtocol("CCTPv2Executor")).isTransferCompleted(i.attestation.message) && (e = {
|
|
1234
1477
|
...e,
|
|
1235
|
-
state:
|
|
1478
|
+
state: x.DestinationFinalized,
|
|
1236
1479
|
attestation: i
|
|
1237
1480
|
});
|
|
1238
1481
|
}
|
|
1239
|
-
if (yield e,
|
|
1482
|
+
if (yield e, H(e))
|
|
1240
1483
|
return e;
|
|
1241
|
-
} catch (
|
|
1242
|
-
console.error(`Error fetching transaction status: ${
|
|
1484
|
+
} catch (r) {
|
|
1485
|
+
console.error(`Error fetching transaction status: ${r.message || r}`);
|
|
1243
1486
|
}
|
|
1244
|
-
await new Promise((
|
|
1487
|
+
await new Promise((r) => setTimeout(r, 3e3)), n -= Date.now() - a;
|
|
1245
1488
|
}
|
|
1246
1489
|
return e;
|
|
1247
1490
|
}
|
|
1248
1491
|
async complete(e, t) {
|
|
1249
|
-
if (!
|
|
1492
|
+
if (!q(t) && !$(t))
|
|
1250
1493
|
throw new Error("Transfer is not attested");
|
|
1251
1494
|
if (!t.attestation)
|
|
1252
1495
|
throw new Error("No attestation found");
|
|
1253
|
-
const
|
|
1254
|
-
let { attestation:
|
|
1255
|
-
const { expirationBlock: o } = i.messageBody, c = await
|
|
1496
|
+
const n = this.wh.getChain(t.to), a = await n.getProtocol("CCTPv2Executor");
|
|
1497
|
+
let { attestation: r, message: i } = t.attestation.attestation;
|
|
1498
|
+
const { expirationBlock: o } = i.messageBody, c = await a.getCurrentBlock();
|
|
1256
1499
|
if (o !== 0n && o < c) {
|
|
1257
|
-
const m = await
|
|
1500
|
+
const m = await vn(n.network, t.attestation);
|
|
1258
1501
|
if (!m)
|
|
1259
1502
|
throw new Error("Failed to reattest message");
|
|
1260
|
-
|
|
1503
|
+
r = m.attestation, i = m.message;
|
|
1261
1504
|
}
|
|
1262
|
-
const u =
|
|
1505
|
+
const u = F.parseAddress(e.chain(), e.address()), f = a.redeem(u, i, r), d = await Ye(this.wh.getChain(t.to), f, e);
|
|
1263
1506
|
return {
|
|
1264
1507
|
...t,
|
|
1265
|
-
state:
|
|
1508
|
+
state: x.DestinationInitiated,
|
|
1266
1509
|
attestation: t.attestation,
|
|
1267
1510
|
destinationTxs: d
|
|
1268
1511
|
};
|
|
1269
1512
|
}
|
|
1270
1513
|
async resume(e) {
|
|
1271
|
-
const t = await
|
|
1514
|
+
const t = await de(e, this.wh.network);
|
|
1272
1515
|
if (!t)
|
|
1273
1516
|
throw new Error("No attestation found");
|
|
1274
|
-
const { message:
|
|
1275
|
-
return await (await this.wh.getChain(
|
|
1517
|
+
const { message: n } = t, a = ct(this.wh.network, n.destinationDomain);
|
|
1518
|
+
return await (await this.wh.getChain(a).getProtocol("CCTPv2Executor")).isTransferCompleted(n) ? {
|
|
1276
1519
|
from: e.chain,
|
|
1277
|
-
to:
|
|
1278
|
-
state:
|
|
1520
|
+
to: a,
|
|
1521
|
+
state: x.DestinationFinalized,
|
|
1279
1522
|
originTxs: [e],
|
|
1280
1523
|
attestation: { id: e.txid, attestation: t }
|
|
1281
1524
|
} : {
|
|
1282
1525
|
from: e.chain,
|
|
1283
|
-
to:
|
|
1284
|
-
state:
|
|
1526
|
+
to: a,
|
|
1527
|
+
state: x.Attested,
|
|
1285
1528
|
originTxs: [e],
|
|
1286
1529
|
attestation: { id: e.txid, attestation: t }
|
|
1287
1530
|
};
|
|
1288
1531
|
}
|
|
1289
1532
|
}
|
|
1290
|
-
function
|
|
1291
|
-
if (
|
|
1533
|
+
function Hn(s = { referrerFeeDbps: 0n }) {
|
|
1534
|
+
if (s.referrerFeeDbps < 0 || s.referrerFeeDbps > 65535n)
|
|
1292
1535
|
throw new Error("Referrer fee must be between 0 and 65535");
|
|
1293
|
-
class e extends
|
|
1294
|
-
static config =
|
|
1536
|
+
class e extends ve {
|
|
1537
|
+
static config = s;
|
|
1295
1538
|
}
|
|
1296
1539
|
return e;
|
|
1297
1540
|
}
|
|
1298
|
-
class
|
|
1541
|
+
class ve extends Ct {
|
|
1299
1542
|
// @ts-ignore
|
|
1300
1543
|
// Since we set the config on the static class, access it with this param
|
|
1301
1544
|
// the CCTPv2FastExecutorRoute.config will always be empty
|
|
@@ -1306,13 +1549,13 @@ class we extends at {
|
|
|
1306
1549
|
provider: "Circle CCTP"
|
|
1307
1550
|
};
|
|
1308
1551
|
static isPathSupported(e, t) {
|
|
1309
|
-
return
|
|
1552
|
+
return nn(e.network, e.chain) && oe(t.network, t.chain);
|
|
1310
1553
|
}
|
|
1311
|
-
static async supportedDestinationTokens(e, t,
|
|
1312
|
-
return this.isPathSupported(t,
|
|
1554
|
+
static async supportedDestinationTokens(e, t, n) {
|
|
1555
|
+
return this.isPathSupported(t, n) ? De(e, t, n) : [];
|
|
1313
1556
|
}
|
|
1314
1557
|
async validate(e, t) {
|
|
1315
|
-
return
|
|
1558
|
+
return ve.isPathSupported(e.fromChain, e.toChain) ? t.options?.nativeGas && (t.options.nativeGas < 0 || t.options.nativeGas > 1) ? {
|
|
1316
1559
|
valid: !1,
|
|
1317
1560
|
error: new Error("Invalid native gas percentage"),
|
|
1318
1561
|
params: t
|
|
@@ -1329,23 +1572,23 @@ class we extends at {
|
|
|
1329
1572
|
};
|
|
1330
1573
|
}
|
|
1331
1574
|
async quote(e, t) {
|
|
1332
|
-
const { fromChain:
|
|
1575
|
+
const { fromChain: n, toChain: a } = e;
|
|
1333
1576
|
try {
|
|
1334
|
-
const
|
|
1335
|
-
if (await
|
|
1577
|
+
const r = await Se(e, t, this.staticConfig, "ERC2"), { remainingAmount: i, estimatedCost: o, gasDropOff: c, expiryTime: u } = r;
|
|
1578
|
+
if (await Fn(n.network) <= i)
|
|
1336
1579
|
return {
|
|
1337
1580
|
success: !1,
|
|
1338
1581
|
error: new Error("Insufficient allowance for fast transfer")
|
|
1339
1582
|
};
|
|
1340
|
-
const d = await
|
|
1341
|
-
if (
|
|
1583
|
+
const d = await Sn(n.network, n.chain, a.chain), m = (i * d + 10000n - 1n) / 10000n, g = i - m;
|
|
1584
|
+
if (g <= 0n)
|
|
1342
1585
|
return {
|
|
1343
1586
|
success: !1,
|
|
1344
1587
|
error: new Error("Amount after fast transfer fee <= 0")
|
|
1345
1588
|
};
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
|
|
1589
|
+
const p = dt[n.network]?.[n.chain], [C, E] = await Promise.all([
|
|
1590
|
+
n.getDecimals("native"),
|
|
1591
|
+
a.getDecimals("native")
|
|
1349
1592
|
]);
|
|
1350
1593
|
return {
|
|
1351
1594
|
success: !0,
|
|
@@ -1356,38 +1599,38 @@ class we extends at {
|
|
|
1356
1599
|
},
|
|
1357
1600
|
destinationToken: {
|
|
1358
1601
|
token: e.destination.id,
|
|
1359
|
-
amount:
|
|
1602
|
+
amount: S(g, e.destination.decimals)
|
|
1360
1603
|
},
|
|
1361
1604
|
relayFee: {
|
|
1362
|
-
token:
|
|
1363
|
-
amount:
|
|
1605
|
+
token: fe(n.chain),
|
|
1606
|
+
amount: S(o, C)
|
|
1364
1607
|
},
|
|
1365
|
-
destinationNativeGas:
|
|
1366
|
-
eta:
|
|
1608
|
+
destinationNativeGas: S(c, E),
|
|
1609
|
+
eta: p,
|
|
1367
1610
|
expires: u,
|
|
1368
1611
|
details: {
|
|
1369
|
-
...
|
|
1370
|
-
minFinalityThreshold:
|
|
1612
|
+
...r,
|
|
1613
|
+
minFinalityThreshold: Y.CONFIRMED,
|
|
1371
1614
|
fastTransferMaxFee: m
|
|
1372
1615
|
}
|
|
1373
1616
|
};
|
|
1374
|
-
} catch (
|
|
1617
|
+
} catch (r) {
|
|
1375
1618
|
return {
|
|
1376
1619
|
success: !1,
|
|
1377
|
-
error: new Error(
|
|
1620
|
+
error: new Error(r instanceof Error ? r.message : `${r}`)
|
|
1378
1621
|
};
|
|
1379
1622
|
}
|
|
1380
1623
|
}
|
|
1381
1624
|
}
|
|
1382
|
-
function
|
|
1383
|
-
if (
|
|
1625
|
+
function Kn(s = { referrerFeeDbps: 0n }) {
|
|
1626
|
+
if (s.referrerFeeDbps < 0 || s.referrerFeeDbps > 65535n)
|
|
1384
1627
|
throw new Error("Referrer fee must be between 0 and 65535");
|
|
1385
|
-
class e extends
|
|
1386
|
-
static config =
|
|
1628
|
+
class e extends Fe {
|
|
1629
|
+
static config = s;
|
|
1387
1630
|
}
|
|
1388
1631
|
return e;
|
|
1389
1632
|
}
|
|
1390
|
-
class
|
|
1633
|
+
class Fe extends Ct {
|
|
1391
1634
|
// @ts-ignore
|
|
1392
1635
|
// Since we set the config on the static class, access it with this param
|
|
1393
1636
|
// the CCTPv2StandardExecutorRoute.config will always be empty
|
|
@@ -1398,15 +1641,15 @@ class be extends at {
|
|
|
1398
1641
|
provider: "Circle CCTP"
|
|
1399
1642
|
};
|
|
1400
1643
|
static isPathSupported(e, t) {
|
|
1401
|
-
return
|
|
1644
|
+
return oe(e.network, e.chain) && oe(t.network, t.chain) && // We don't support slow transfers from Linea because the attestation time
|
|
1402
1645
|
// can be anywhere between 6 and 32 hours! Fast transfer should be used instead.
|
|
1403
1646
|
e.chain !== "Linea";
|
|
1404
1647
|
}
|
|
1405
|
-
static async supportedDestinationTokens(e, t,
|
|
1406
|
-
return this.isPathSupported(t,
|
|
1648
|
+
static async supportedDestinationTokens(e, t, n) {
|
|
1649
|
+
return this.isPathSupported(t, n) ? De(e, t, n) : [];
|
|
1407
1650
|
}
|
|
1408
1651
|
async validate(e, t) {
|
|
1409
|
-
return
|
|
1652
|
+
return Fe.isPathSupported(e.fromChain, e.toChain) ? t.options?.nativeGas && (t.options.nativeGas < 0 || t.options.nativeGas > 1) ? {
|
|
1410
1653
|
valid: !1,
|
|
1411
1654
|
error: new Error("Invalid native gas percentage"),
|
|
1412
1655
|
params: t
|
|
@@ -1423,11 +1666,11 @@ class be extends at {
|
|
|
1423
1666
|
};
|
|
1424
1667
|
}
|
|
1425
1668
|
async quote(e, t) {
|
|
1426
|
-
const { fromChain:
|
|
1669
|
+
const { fromChain: n, toChain: a } = e;
|
|
1427
1670
|
try {
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
|
|
1671
|
+
const r = await Se(e, t, this.staticConfig, "ERC2"), { remainingAmount: i, estimatedCost: o, gasDropOff: c, expiryTime: u } = r, f = n.chain === "Polygon" ? 2e3 * 200 : Xe(n.chain) + 1e3, [d, m] = await Promise.all([
|
|
1672
|
+
n.getDecimals("native"),
|
|
1673
|
+
a.getDecimals("native")
|
|
1431
1674
|
]);
|
|
1432
1675
|
return {
|
|
1433
1676
|
success: !0,
|
|
@@ -1438,34 +1681,34 @@ class be extends at {
|
|
|
1438
1681
|
},
|
|
1439
1682
|
destinationToken: {
|
|
1440
1683
|
token: e.destination.id,
|
|
1441
|
-
amount:
|
|
1684
|
+
amount: S(i, e.destination.decimals)
|
|
1442
1685
|
},
|
|
1443
1686
|
relayFee: {
|
|
1444
|
-
token:
|
|
1445
|
-
amount:
|
|
1687
|
+
token: fe(n.chain),
|
|
1688
|
+
amount: S(o, d)
|
|
1446
1689
|
},
|
|
1447
|
-
destinationNativeGas:
|
|
1690
|
+
destinationNativeGas: S(c, m),
|
|
1448
1691
|
eta: f,
|
|
1449
1692
|
expires: u,
|
|
1450
1693
|
details: {
|
|
1451
|
-
...
|
|
1452
|
-
minFinalityThreshold:
|
|
1694
|
+
...r,
|
|
1695
|
+
minFinalityThreshold: Y.FINALIZED,
|
|
1453
1696
|
fastTransferMaxFee: 0n
|
|
1454
1697
|
// no fee for standard / slow transfer
|
|
1455
1698
|
}
|
|
1456
1699
|
};
|
|
1457
|
-
} catch (
|
|
1700
|
+
} catch (r) {
|
|
1458
1701
|
return {
|
|
1459
1702
|
success: !1,
|
|
1460
|
-
error: new Error(
|
|
1703
|
+
error: new Error(r instanceof Error ? r.message : `${r}`)
|
|
1461
1704
|
};
|
|
1462
1705
|
}
|
|
1463
1706
|
}
|
|
1464
1707
|
}
|
|
1465
|
-
const { executorTokenBridgeRoute:
|
|
1708
|
+
const { executorTokenBridgeRoute: Yn } = Kt;
|
|
1466
1709
|
export {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1710
|
+
Zn as cctpExecutorRoute,
|
|
1711
|
+
Hn as cctpV2FastExecutorRoute,
|
|
1712
|
+
Kn as cctpV2StandardExecutorRoute,
|
|
1713
|
+
Yn as executorTokenBridgeRoute
|
|
1471
1714
|
};
|