@wormhole-foundation/wormhole-connect 3.0.0-beta.0-development → 3.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.
Files changed (135) hide show
  1. package/dist/main.js +49 -49
  2. package/dist/src/components/SampleApp/index.d.ts.map +1 -1
  3. package/dist/src/config/index.d.ts.map +1 -1
  4. package/dist/src/config/types.d.ts +2 -0
  5. package/dist/src/config/types.d.ts.map +1 -1
  6. package/dist/src/exports/executor.d.ts +2 -0
  7. package/dist/src/exports/executor.d.ts.map +1 -0
  8. package/dist/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
  9. package/dist/src/utils/index.d.ts +1 -0
  10. package/dist/src/utils/index.d.ts.map +1 -1
  11. package/dist/src/utils/sdkv2.d.ts +0 -1
  12. package/dist/src/utils/sdkv2.d.ts.map +1 -1
  13. package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  14. package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  15. package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
  16. package/lib/account-CKUCmcgT.mjs +30 -0
  17. package/lib/account-QG_Hi4er.js +1 -0
  18. package/lib/address-B-_yHNB2.js +1 -0
  19. package/lib/{address-D74XlMdi.mjs → address-B9anhmbU.mjs} +5 -5
  20. package/lib/address-Cj96wodd.mjs +64 -0
  21. package/lib/{address-DXFbgyJW.mjs → address-Drr_9OcK.mjs} +93 -93
  22. package/lib/aptos-BZ2mcuTd.js +2 -0
  23. package/lib/aptos-DPIwkCrX.mjs +68 -0
  24. package/lib/{aptos-WhWqMfkU.js → aptos-Da6iqpC-.js} +1 -1
  25. package/lib/{aptos-BckWT_Pe.mjs → aptos-Dz4Js3_d.mjs} +3 -3
  26. package/lib/{base64-DPCMLrON.mjs → base64-BcnUThiU.mjs} +1 -1
  27. package/lib/{blake2b-BmQx89Cf.mjs → blake2b-CnkNeJT4.mjs} +1 -1
  28. package/lib/{browser-ponyfill-Zjbs5ehD.mjs → browser-ponyfill-oWZrCgRw.mjs} +1 -1
  29. package/lib/{ccip-DiNEz9KN.js → ccip-Bb-IPrNA.js} +1 -1
  30. package/lib/{ccip-B45dpIhp.mjs → ccip-Ceg_B70t.mjs} +1 -1
  31. package/lib/{chain-DaAd2Ztf.mjs → chain-CNVMEdrk.mjs} +1 -1
  32. package/lib/{chunk-IMTC3J2M-Bn3rs7tb.mjs → chunk-IMTC3J2M-B7fKwIuX.mjs} +3 -3
  33. package/lib/{constants-CbKC2uxb.mjs → constants-Ba9GwEM1.mjs} +1 -1
  34. package/lib/constants-BqqwmYZc.js +1 -0
  35. package/lib/{contract-BI_HDILr.mjs → contract-DANWVftx.mjs} +1 -1
  36. package/lib/{create-CzWSWmF_.mjs → create-B9LwWha4.mjs} +1 -1
  37. package/lib/{evm-DFyxDQ-x.js → evm-1T5rGzcO.js} +3 -3
  38. package/lib/{evm-DgG5biHb.mjs → evm-B552wdhN.mjs} +9 -9
  39. package/lib/{evm-Es3E89UO.mjs → evm-DarNu22s.mjs} +9 -9
  40. package/lib/executor.d.ts +2 -0
  41. package/lib/executor.js +1 -0
  42. package/lib/executor.mjs +828 -0
  43. package/lib/hosted.js +1 -1
  44. package/lib/hosted.mjs +1 -1
  45. package/lib/index-2f5GRlqp.mjs +46 -0
  46. package/lib/{index-Blt9MjZK.mjs → index-B1XGfrNH.mjs} +1 -1
  47. package/lib/{index-DUiyW0v6.js → index-B40ktVOy.js} +1 -1
  48. package/lib/{index-jfL73ugq.mjs → index-B4NYDFvU.mjs} +5 -5
  49. package/lib/{index--QOOnO1S.mjs → index-BAuH_G93.mjs} +5 -5
  50. package/lib/{index-C9ZemP81.mjs → index-BHMN5Px3.mjs} +2 -2
  51. package/lib/{index-CGbZMLbJ.mjs → index-BO0DC-jc.mjs} +3 -3
  52. package/lib/{index-BziywkBj.mjs → index-BQ0RlDhv.mjs} +246 -272
  53. package/lib/{index-Cuu-xM0U.mjs → index-BR4w3fuE.mjs} +5 -5
  54. package/lib/{index-DnOkd5VL.js → index-BTNmmLkb.js} +1 -1
  55. package/lib/{index-BQwsEzas.mjs → index-BlJpOhTM.mjs} +5 -5
  56. package/lib/{index-CjL3WbDp.js → index-Blzzdktm.js} +1 -1
  57. package/lib/{index-Bc7EWiox.js → index-Bn1o04G7.js} +80 -80
  58. package/lib/index-C2Pe6i5V.js +1 -0
  59. package/lib/{index-5xE5bjpW.mjs → index-C9XIIFQK.mjs} +1 -1
  60. package/lib/{index-XFRw6zfV.mjs → index-CCRPy0B_.mjs} +2 -2
  61. package/lib/index-CE0rxdUf.js +1 -0
  62. package/lib/{index-Bu6LLuxH.mjs → index-CEXcD8Mw.mjs} +4 -4
  63. package/lib/{index-BLYjmYmu.mjs → index-CKg04pdA.mjs} +5 -5
  64. package/lib/{index-CxW1HjrT.mjs → index-CM_IP492.mjs} +14 -14
  65. package/lib/{index-pjyIirVB.mjs → index-CT2-qOL1.mjs} +2 -2
  66. package/lib/{index-DFHQnDR7.mjs → index-CYdhveYx.mjs} +6 -6
  67. package/lib/{index-COkWxUoe.mjs → index-Cda4HnP1.mjs} +5 -5
  68. package/lib/{index-BYzONVwG.mjs → index-CfC3_uPF.mjs} +7 -7
  69. package/lib/index-DC1ot7tO.js +1 -0
  70. package/lib/{index-v0MO46Zl.mjs → index-DHAgduQ-.mjs} +4 -4
  71. package/lib/{index-DQjqwKVk.mjs → index-DSSOE7Me.mjs} +2 -2
  72. package/lib/{index-BbCcdl9J.mjs → index-DoFo485M.mjs} +73 -72
  73. package/lib/{index-BNjB0Q50.mjs → index-DvxmZnxH.mjs} +5 -5
  74. package/lib/{index-ju2wtFjy.mjs → index-Dw7INWis.mjs} +7 -7
  75. package/lib/{index-t94-e3qG.js → index-VhcNuaP6.js} +1 -1
  76. package/lib/index-dpkTW-H8.js +1 -0
  77. package/lib/index-f_27F6WX.js +1 -0
  78. package/lib/{index-BkHLwIMc.mjs → index-l0sxQXRT.mjs} +1 -1
  79. package/lib/{index-CdOqWihR.mjs → index-mXHkgOxH.mjs} +4 -4
  80. package/lib/{index-C2jOUiub.mjs → index-pN0Dgjjf.mjs} +5 -5
  81. package/lib/{index-B7U-me-L.mjs → index-pNqQSm4p.mjs} +6628 -6659
  82. package/lib/{index.es-BYLVcsBS.js → index.es-_N4sKEIC.js} +1 -1
  83. package/lib/{index.es-BrgiiIYV.mjs → index.es-rEir51oG.mjs} +7 -7
  84. package/lib/index.js +1 -1
  85. package/lib/index.mjs +5 -5
  86. package/lib/mayan.mjs +10 -10
  87. package/lib/{mint-BjwZUbPm.mjs → mint-DVxIczlI.mjs} +2 -2
  88. package/lib/ntt.js +1 -1
  89. package/lib/ntt.mjs +10 -10
  90. package/lib/{platform-pi9E7cPR.mjs → platform-CbDx4hex.mjs} +4 -4
  91. package/lib/platform-CyTWPtDR.js +1 -0
  92. package/lib/{platform-C-edrCmf.mjs → platform-D-nUFU0e.mjs} +6 -6
  93. package/lib/platform-PaIJsXKV.mjs +118 -0
  94. package/lib/{provider-jsonrpc-BjcoR80W.mjs → provider-jsonrpc-C_IZFSfB.mjs} +2 -2
  95. package/lib/{sha3-B1KxiAa7.mjs → sha3-DQQvDwj1.mjs} +1 -1
  96. package/lib/{signer-CgLO7fBA.mjs → signer-CsMX8mEc.mjs} +6 -6
  97. package/lib/{solana-DA48rYUK.js → solana-BRQmi9BN.js} +1 -1
  98. package/lib/solana-C_0khyJw.mjs +18 -0
  99. package/lib/{solana-Pjpx_PkM.js → solana-CrjSp_Zk.js} +1 -1
  100. package/lib/{solana-CvaeYBIB.mjs → solana-SQhnN3yB.mjs} +6 -6
  101. package/lib/{solanaEmbed.esm-jxAhxZ9V.js → solanaEmbed.esm-B7IRXgnI.js} +1 -1
  102. package/lib/{solanaEmbed.esm-Gti-Nr19.mjs → solanaEmbed.esm-Din0Z51P.mjs} +3 -3
  103. package/lib/src/components/SampleApp/index.d.ts.map +1 -1
  104. package/lib/src/config/index.d.ts.map +1 -1
  105. package/lib/src/config/types.d.ts +2 -0
  106. package/lib/src/config/types.d.ts.map +1 -1
  107. package/lib/src/exports/executor.d.ts +2 -0
  108. package/lib/src/exports/executor.d.ts.map +1 -0
  109. package/lib/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
  110. package/lib/src/utils/index.d.ts +1 -0
  111. package/lib/src/utils/index.d.ts.map +1 -1
  112. package/lib/src/utils/sdkv2.d.ts +0 -1
  113. package/lib/src/utils/sdkv2.d.ts.map +1 -1
  114. package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  115. package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  116. package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
  117. package/lib/{sui-CuwmPzXZ.mjs → sui-BSLo7-bI.mjs} +14 -14
  118. package/lib/{sui-Bi1J0W_P.mjs → sui-BePFnRSc.mjs} +3 -3
  119. package/lib/{sui-uSCH-o_h.js → sui-C7KPm3kD.js} +1 -1
  120. package/lib/{tokens-DcqY0jHv.js → tokens-CChVRIuE.js} +1 -1
  121. package/lib/{tokens-DOx4hiaR.mjs → tokens-CyKAZUN-.mjs} +4 -4
  122. package/lib/{units-YO78Cq5F.mjs → units-DP5zqyxn.mjs} +9 -9
  123. package/lib/{unsignedTransaction-Cj476rGh.mjs → unsignedTransaction-fSrwDjHx.mjs} +9 -9
  124. package/lib/{web3--AtxvLIy.mjs → web3-DCo8oN-v.mjs} +4 -4
  125. package/package.json +16 -1
  126. package/lib/aptos-VwYOwtQy.mjs +0 -179
  127. package/lib/aptos-hc5GrCHO.js +0 -2
  128. package/lib/constants-Cib4VRZO.js +0 -1
  129. package/lib/index-BlzRxQ82.js +0 -1
  130. package/lib/index-CJXmILJz.js +0 -1
  131. package/lib/index-C_dsyQjC.mjs +0 -46
  132. package/lib/index-CpuzvBlL.js +0 -1
  133. package/lib/index-Cxg2C7RE.js +0 -1
  134. package/lib/index-DDAGOrv0.js +0 -1
  135. package/lib/solana-qHqB-cdc.mjs +0 -18
@@ -0,0 +1,828 @@
1
+ var Pe = Object.defineProperty;
2
+ var Me = (e, n, t) => n in e ? Pe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var c = (e, n, t) => Me(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { az as W, aP as C, aJ as Be, E as b, b4 as P, aF as Ie, aR as ze, aU as te, aV as Te, aW as Ue, v as Re, ae as g, ar as pe, aG as re, au as be, d as D, an as _e, as as Ce, b1 as N, b2 as Ne, ao as $e, a_ as $, aX as Oe, b3 as We, A as ke, D as se, F as Ge, W as S, u as Le, _ as Qe, aN as qe, a3 as ne, y as je, f as R, af as Ve, z as Ke, T as _, i as ae, aj as ie, B as Xe, C as Je, e as He } from "./address-Drr_9OcK.mjs";
5
+ import { r as M } from "./chain-CNVMEdrk.mjs";
6
+ import { l as oe } from "./chunk-IMTC3J2M-B7fKwIuX.mjs";
7
+ import { A as Ze } from "./platform-PaIJsXKV.mjs";
8
+ import { A as Ye, _ as et } from "./address-Cj96wodd.mjs";
9
+ import { A as tt } from "./unsignedTransaction-BDOQhqcZ.mjs";
10
+ import { E as ce } from "./platform-D-nUFU0e.mjs";
11
+ import { C as rt } from "./contract-DANWVftx.mjs";
12
+ import { E as st } from "./unsignedTransaction-C0V0UbsS.mjs";
13
+ import { b as de, T as nt, a as at, _ as it } from "./platform-CbDx4hex.mjs";
14
+ import { suiCircleObjects as ot } from "./index-BO0DC-jc.mjs";
15
+ import { S as ct, R as dt } from "./address-B9anhmbU.mjs";
16
+ import { S as ut } from "./unsignedTransaction-BD81leu1.mjs";
17
+ import { createDepositForBurnInstruction as ft } from "./index-BR4w3fuE.mjs";
18
+ import { P as mt } from "./index-l0sxQXRT.mjs";
19
+ import { p as ue, u as Ae, b as ht } from "./web3-DCo8oN-v.mjs";
20
+ import { a as lt, S as gt } from "./unsignedTransaction-fSrwDjHx.mjs";
21
+ import { d as pt } from "./account-CKUCmcgT.mjs";
22
+ const k = {
23
+ Testnet: "https://executor-testnet.labsapis.com",
24
+ Mainnet: "https://executor.labsapis.com"
25
+ }, G = {
26
+ Testnet: {
27
+ Aptos: "0x14a12d1fd6ef371b70c2113155534ec152ec7f779e281b54866c796c9a4a58d3",
28
+ Avalanche: "0x2cfEC91B50f657Cc86Ec693542527ac3e03bF742",
29
+ BaseSepolia: "0x4983C6bD3bB7DA9EECe71cfa7AE4C67CAbf362F0",
30
+ Sepolia: "0x0F78904c750801391EbBf308181e9d6fc892B0f3",
31
+ Solana: "CXGRA5SCc8jxDbaQPZrmmZNu2JV34DP7gFW4m31uC1zs"
32
+ },
33
+ Mainnet: {
34
+ Aptos: "0x9f5ad7d5c2d067ca4abb6d8d6aba44c15596b71a1def8eb4596089b527bb2eb1",
35
+ Arbitrum: "0x55Dd4466BFec29527C54A72fd306efb54e5F7027",
36
+ Avalanche: "0xd331819478b74d8a7B8EA631118B4a4e50F6EbD1",
37
+ Base: "0x08FEB1838C3d7F8509DA1EBb9a11a94c1f006cb2",
38
+ Ethereum: "0xeEFb36c4458dA7798742cf038C5c27E07aB9c51E",
39
+ Optimism: "0xBC6f9d1CBa49DB365728478cefa02F6743617637",
40
+ Polygon: "0x007995f2AEcfBC745f20a7AE8D3a02c0EbF46264",
41
+ Unichain: "0xA7aBDb8f2108901c586543BD5e10E4fA263F4A47",
42
+ Solana: "CXGRA5SCc8jxDbaQPZrmmZNu2JV34DP7gFW4m31uC1zs"
43
+ }
44
+ }, fe = {
45
+ Testnet: {
46
+ executorId: "0x4000cfe2955d8355b3d3cf186f854fea9f787a457257056926fde1ec977670eb",
47
+ executorRequestsId: "0x2d9ccf3cce3f7dce408e5455e90b80a8161ad9673d1366c2a5def60ad93657a8"
48
+ },
49
+ Mainnet: {
50
+ executorId: "0xdb0fe8bb1e2b5be628adbea0636063325073e1070ee11e4281457dfd7f158235",
51
+ executorRequestsId: "0xc030df7a3eed1494fa4b64aa8ab63a79041cf1114f4ff2b7ab5aca1c684a21a7"
52
+ }
53
+ }, bt = {
54
+ Testnet: "execXUrAsMnqMmTHj5m7N1YQgsDz3cwGLYCYyuDRciV",
55
+ Mainnet: "execXUrAsMnqMmTHj5m7N1YQgsDz3cwGLYCYyuDRciV"
56
+ }, Ct = 5001n, At = {
57
+ Testnet: {
58
+ Aptos: 5000n,
59
+ Avalanche: 200000n,
60
+ BaseSepolia: 200000n,
61
+ Sepolia: 200000n,
62
+ Solana: 250000n,
63
+ Sui: 8000000n
64
+ },
65
+ Mainnet: {
66
+ Aptos: 5000n,
67
+ Arbitrum: 400000n,
68
+ Avalanche: 250000n,
69
+ Base: 250000n,
70
+ Ethereum: 250000n,
71
+ Optimism: 250000n,
72
+ Polygon: 250000n,
73
+ Unichain: 250000n,
74
+ Solana: 250000n,
75
+ Sui: 8000000n
76
+ }
77
+ }, wt = {
78
+ Testnet: {
79
+ Aptos: "0x23b54f6e29bba7f4123d088f4cfcd83f5e23a049de15895b119ce5a6cb5faa91",
80
+ Avalanche: "0x8F26A0025dcCc6Cfc07A7d38756280a10E295ad7",
81
+ BaseSepolia: "0x8F26A0025dcCc6Cfc07A7d38756280a10E295ad7",
82
+ Sepolia: "0x8F26A0025dcCc6Cfc07A7d38756280a10E295ad7",
83
+ Solana: "9r6q2iEg4MBevjC8reaLmQUDxueF3vabUoqDkZ2LoAYe",
84
+ Sui: "0x30bd9b3d5ad00f38fd0c314139ba47ccb3c78353d99880d81125ca0c370b415e"
85
+ },
86
+ Mainnet: {
87
+ Aptos: "0x1f177e724a874ab6267172a3049291c480fc665883e6a3ac95d0909492c09dc8",
88
+ Solana: "JB3rmygUVuVZzgkxvMdV8mSKLJeQAkSXEK284Dqsziah",
89
+ Sui: "0xbfa1240e48c622d97881473953be730091161b7931d89bd6afe667841cf69ef4",
90
+ Arbitrum: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
91
+ Avalanche: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
92
+ Base: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
93
+ Ethereum: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
94
+ Optimism: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
95
+ Polygon: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E",
96
+ Unichain: "0xF11e0efF8b11Ce382645dd75352fC16b3aB3551E"
97
+ }
98
+ };
99
+ var w;
100
+ (function(e) {
101
+ e.Pending = "pending", e.Failed = "failed", e.Unsupported = "unsupported", e.Submitted = "submitted", e.Underpaid = "underpaid", e.Aborted = "aborted";
102
+ })(w || (w = {}));
103
+ async function yt(e) {
104
+ const n = `${k[e]}/v0/capabilities`;
105
+ try {
106
+ return (await W.get(n)).data;
107
+ } catch {
108
+ throw new Error(`Failed to fetch capabilities for network: ${e}.`);
109
+ }
110
+ }
111
+ async function Et(e, n, t, r) {
112
+ const s = `${k[e]}/v0/quote`;
113
+ try {
114
+ return (await W.post(s, {
115
+ srcChain: C(n),
116
+ dstChain: C(t),
117
+ relayInstructions: r
118
+ })).data;
119
+ } catch {
120
+ throw new Error("Failed to fetch signed quote.");
121
+ }
122
+ }
123
+ async function xt(e, n, t) {
124
+ const r = `${k[e]}/v0/status/tx`;
125
+ try {
126
+ return (await W.post(r, {
127
+ txHash: n,
128
+ chainId: C(t)
129
+ })).data;
130
+ } catch {
131
+ throw new Error(`Failed to fetch status for txHash: ${n}.`);
132
+ }
133
+ }
134
+ const St = 65535n;
135
+ function vt(e, n) {
136
+ if (n > St)
137
+ throw new Error("dBps exceeds max u16");
138
+ if (n > 0) {
139
+ const t = e * n / 100000n, r = e - t;
140
+ return { referrerFee: t, remainingAmount: r };
141
+ }
142
+ return { referrerFee: 0n, remainingAmount: e };
143
+ }
144
+ const Ft = [
145
+ { name: "gasLimit", binary: "uint", size: 16 },
146
+ { name: "msgValue", binary: "uint", size: 16 }
147
+ ], Dt = [
148
+ { name: "dropOff", binary: "uint", size: 16 },
149
+ { name: "recipient", ...Be }
150
+ ], Pt = [
151
+ {
152
+ name: "request",
153
+ binary: "switch",
154
+ idSize: 1,
155
+ idTag: "type",
156
+ layouts: [
157
+ [[1, "GasInstruction"], Ft],
158
+ [[2, "GasDropOffInstruction"], Dt]
159
+ ]
160
+ }
161
+ ], me = [
162
+ {
163
+ name: "requests",
164
+ binary: "array",
165
+ layout: Pt
166
+ }
167
+ ];
168
+ var he;
169
+ (function(e) {
170
+ e.ERM1 = "ERM1", e.ERV1 = "ERV1", e.ERN1 = "ERN1", e.ERC1 = "ERC1";
171
+ })(he || (he = {}));
172
+ const Mt = {
173
+ to: (e) => new Date(Number(e * 1000n)),
174
+ from: (e) => BigInt(e.getTime()) / 1000n
175
+ }, Bt = [
176
+ {
177
+ name: "quote",
178
+ binary: "switch",
179
+ idSize: 4,
180
+ idTag: "prefix",
181
+ layouts: [
182
+ [
183
+ [1162948657, "EQ01"],
184
+ [
185
+ {
186
+ name: "quoterAddress",
187
+ binary: "bytes",
188
+ size: 20
189
+ },
190
+ {
191
+ name: "payeeAddress",
192
+ binary: "bytes",
193
+ size: 32
194
+ },
195
+ { name: "srcChain", binary: "uint", size: 2 },
196
+ { name: "dstChain", binary: "uint", size: 2 },
197
+ {
198
+ name: "expiryTime",
199
+ binary: "uint",
200
+ size: 8,
201
+ custom: Mt
202
+ },
203
+ { name: "baseFee", binary: "uint", size: 8 },
204
+ { name: "dstGasPrice", binary: "uint", size: 8 },
205
+ { name: "srcPrice", binary: "uint", size: 8 },
206
+ { name: "dstPrice", binary: "uint", size: 8 }
207
+ ]
208
+ ]
209
+ ]
210
+ }
211
+ ], we = [
212
+ ...Bt,
213
+ { name: "signature", binary: "bytes", size: 65 }
214
+ ];
215
+ class L {
216
+ constructor(n, t, r, s) {
217
+ c(this, "network");
218
+ c(this, "chain");
219
+ c(this, "provider");
220
+ c(this, "contracts");
221
+ c(this, "usdcId");
222
+ c(this, "shimContract");
223
+ var o;
224
+ if (this.network = n, this.chain = t, this.provider = r, this.contracts = s, n === "Devnet")
225
+ throw new Error("CCTPW7Executor not supported on Devnet");
226
+ const a = b.get(this.network, this.chain);
227
+ if (!a)
228
+ throw new Error(`No USDC contract configured for network=${this.network} chain=${this.chain}`);
229
+ this.usdcId = a;
230
+ const i = (o = G[n]) == null ? void 0 : o[t];
231
+ if (!i)
232
+ throw new Error(`Shim contract for ${t} not found`);
233
+ this.shimContract = i;
234
+ }
235
+ static async fromRpc(n, t) {
236
+ const [r, s] = await Ze.chainFromRpc(n), a = t[s];
237
+ if (!a)
238
+ throw new Error(`No config found for ${s}`);
239
+ if (a.network !== r)
240
+ throw new Error(`Network mismatch: ${a.network} != ${r}`);
241
+ return new L(r, s, n, a.contracts);
242
+ }
243
+ async *transfer(n, t, r) {
244
+ const s = new Ye(n).unwrap(), a = oe.from(t.address.toUniversalAddress().toUint8Array()), i = oe.from(this.usdcId), o = r.remainingAmount + r.referrerFee, d = P.get(this.network, t.chain), f = s, m = s, h = [
245
+ o,
246
+ d,
247
+ a.toString(),
248
+ i.toString(),
249
+ r.estimatedCost,
250
+ C(t.chain),
251
+ f,
252
+ r.signedQuote,
253
+ r.relayInstructions,
254
+ r.referrerFeeDbps,
255
+ m
256
+ ], u = {
257
+ function: `${this.shimContract}::cctp_v1_with_executor::deposit_for_burn_entry`,
258
+ functionArguments: h
259
+ };
260
+ yield this.createUnsignedTx(u, "AtposCCTPW7Executor.Transfer");
261
+ }
262
+ createUnsignedTx(n, t, r = !1) {
263
+ return new tt(n, this.network, this.chain, t, r);
264
+ }
265
+ }
266
+ M(et, "CCTPW7Executor", L);
267
+ class Q {
268
+ constructor(n, t, r, s) {
269
+ c(this, "network");
270
+ c(this, "chain");
271
+ c(this, "provider");
272
+ c(this, "contracts");
273
+ c(this, "chainId");
274
+ c(this, "shimContract");
275
+ var i;
276
+ if (this.network = n, this.chain = t, this.provider = r, this.contracts = s, n === "Devnet")
277
+ throw new Error("CCTPW7Executor not supported on Devnet");
278
+ this.chainId = Ie.get(n, t);
279
+ const a = (i = G[n]) == null ? void 0 : i[t];
280
+ if (!a)
281
+ throw new Error(`Shim contract for ${t} not found`);
282
+ this.shimContract = a;
283
+ }
284
+ static async fromRpc(n, t) {
285
+ const [r, s] = await ce.chainFromRpc(n), a = t[s];
286
+ if (a.network !== r)
287
+ throw new Error(`Network mismatch: ${a.network} != ${r}`);
288
+ return new Q(r, s, n, a.contracts);
289
+ }
290
+ async *transfer(n, t, r) {
291
+ const s = new ze(n).toString(), a = t.address.toUniversalAddress().toUint8Array(), i = r.remainingAmount + r.referrerFee, o = b.get(this.network, this.chain), d = ce.getTokenImplementation(this.provider, o);
292
+ if (await d.allowance(s, this.shimContract) < i) {
293
+ const l = await d.approve.populateTransaction(this.shimContract, i);
294
+ yield this.createUnsignedTx(te(l, s), "ERC20.approve of EvmCCTPW7Executor", !1);
295
+ }
296
+ const m = [
297
+ "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)"
298
+ ], u = await new rt(this.shimContract, m, this.provider).getFunction("depositForBurn").populateTransaction(i, C(t.chain), P.get(this.network, t.chain), a, o, {
299
+ refundAddress: s,
300
+ signedQuote: r.signedQuote,
301
+ instructions: r.relayInstructions
302
+ }, {
303
+ dbps: r.referrerFeeDbps,
304
+ payee: r.referrer.address.toString()
305
+ });
306
+ u.value = r.estimatedCost, yield this.createUnsignedTx(te(u, s), "EvmCCTPW7Executor.depositForBurn");
307
+ }
308
+ createUnsignedTx(n, t, r = !1) {
309
+ return new st(Te(n, this.chainId), this.network, this.chain, t, r);
310
+ }
311
+ }
312
+ M(Ue, "CCTPW7Executor", Q);
313
+ class q {
314
+ constructor(n, t, r, s) {
315
+ c(this, "network");
316
+ c(this, "chain");
317
+ c(this, "provider");
318
+ c(this, "contracts");
319
+ c(this, "usdcId");
320
+ c(this, "usdcTreasuryId");
321
+ c(this, "tokenMessengerId");
322
+ c(this, "tokenMessengerStateId");
323
+ c(this, "messageTransmitterId");
324
+ c(this, "messageTransmitterStateId");
325
+ c(this, "executorId");
326
+ c(this, "executorRequestsId");
327
+ var f, m, h, u;
328
+ if (this.network = n, this.chain = t, this.provider = r, this.contracts = s, n === "Devnet")
329
+ throw new Error("CCTPW7Executor not supported on Devnet");
330
+ const a = (l, A) => {
331
+ if (!l)
332
+ throw new Error(A);
333
+ return l;
334
+ };
335
+ this.usdcId = a(b.get(this.network, this.chain), `No USDC contract configured for network=${this.network} chain=${this.chain}`);
336
+ const { tokenMessengerState: i, messageTransmitterState: o, usdcTreasury: d } = ot(n);
337
+ this.usdcTreasuryId = d, this.tokenMessengerId = a((f = s.cctp) == null ? void 0 : f.tokenMessenger, `Circle Token Messenger contract for domain ${t} not found`), this.messageTransmitterId = a((m = s.cctp) == null ? void 0 : m.messageTransmitter, `Circle Message Transmitter contract for domain ${t} not found`), this.tokenMessengerStateId = i, this.messageTransmitterStateId = o, this.executorId = a((h = fe[n]) == null ? void 0 : h.executorId, `Executor contract for ${n} not found`), this.executorRequestsId = a((u = fe[n]) == null ? void 0 : u.executorRequestsId, `Executor requests contract for ${n} not found`);
338
+ }
339
+ static async fromRpc(n, t) {
340
+ const [r, s] = await de.chainFromRpc(n), a = t[s];
341
+ if (a.network !== r)
342
+ throw new Error(`Network mismatch: ${a.network} != ${r}`);
343
+ return new q(r, s, n, a.contracts);
344
+ }
345
+ async *transfer(n, t, r) {
346
+ const s = new nt(), a = new ct(n).unwrap(), i = P.get(this.network, t.chain), [o, ...d] = await de.getCoins(this.provider, n, this.usdcId);
347
+ if (o === void 0)
348
+ throw new Error("No USDC in wallet");
349
+ const f = s.object(o.coinObjectId);
350
+ d.length > 0 && s.mergeCoins(f, d.map((p) => s.object(p.coinObjectId)));
351
+ let m;
352
+ if (r.referrerFee > 0n) {
353
+ const [p, x] = s.splitCoins(f, [
354
+ r.remainingAmount,
355
+ r.referrerFee
356
+ ]);
357
+ m = p, s.transferObjects([x], Re(r.referrer));
358
+ } else {
359
+ const [p] = s.splitCoins(f, [
360
+ r.remainingAmount
361
+ ]);
362
+ m = p;
363
+ }
364
+ const [h, u] = s.moveCall({
365
+ target: `${this.tokenMessengerId}::deposit_for_burn::deposit_for_burn`,
366
+ arguments: [
367
+ m,
368
+ s.pure.u32(i),
369
+ // destination_domain
370
+ s.pure.address(t.address.toUniversalAddress().toString()),
371
+ // mint_recipient
372
+ s.object(this.tokenMessengerStateId),
373
+ // token_messenger_minter state
374
+ s.object(this.messageTransmitterStateId),
375
+ // message_transmitter state
376
+ s.object("0x403"),
377
+ // deny_list id, fixed address
378
+ s.object(this.usdcTreasuryId)
379
+ // treasury object Treasury<USDC>
380
+ ],
381
+ typeArguments: [this.usdcId]
382
+ }), [l] = s.moveCall({
383
+ target: `${this.messageTransmitterId}::message::source_domain`,
384
+ arguments: [u]
385
+ }), [A] = s.moveCall({
386
+ target: `${this.messageTransmitterId}::message::nonce`,
387
+ arguments: [u]
388
+ }), [y] = s.moveCall({
389
+ target: `${this.executorRequestsId}::executor_requests::make_cctp_v1_request`,
390
+ arguments: [l, A]
391
+ }), [E] = s.splitCoins(s.gas, [
392
+ s.pure.u64(r.estimatedCost)
393
+ ]);
394
+ s.moveCall({
395
+ target: `${this.executorId}::executor::request_execution`,
396
+ arguments: [
397
+ E,
398
+ s.object(at),
399
+ s.pure.u16(C(t.chain)),
400
+ s.pure.address("0x0"),
401
+ s.pure.address(a),
402
+ s.pure.vector("u8", r.signedQuote),
403
+ y,
404
+ s.pure.vector("u8", r.relayInstructions)
405
+ ]
406
+ }), yield this.createUnsignedTx(s, "SuiCCTPW7Executor.Transfer");
407
+ }
408
+ createUnsignedTx(n, t, r = !1) {
409
+ return new ut(n, this.network, this.chain, t, r);
410
+ }
411
+ }
412
+ M(it, "CCTPW7Executor", q);
413
+ const B = new g("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
414
+ new g("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
415
+ const j = new g("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
416
+ new g("So11111111111111111111111111111111111111112");
417
+ new g("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");
418
+ class It extends Error {
419
+ constructor(n) {
420
+ super(n);
421
+ }
422
+ }
423
+ class zt extends It {
424
+ constructor() {
425
+ super(...arguments), this.name = "TokenOwnerOffCurveError";
426
+ }
427
+ }
428
+ var O;
429
+ (function(e) {
430
+ e[e.InitializeMint = 0] = "InitializeMint", e[e.InitializeAccount = 1] = "InitializeAccount", e[e.InitializeMultisig = 2] = "InitializeMultisig", e[e.Transfer = 3] = "Transfer", e[e.Approve = 4] = "Approve", e[e.Revoke = 5] = "Revoke", e[e.SetAuthority = 6] = "SetAuthority", e[e.MintTo = 7] = "MintTo", e[e.Burn = 8] = "Burn", e[e.CloseAccount = 9] = "CloseAccount", e[e.FreezeAccount = 10] = "FreezeAccount", e[e.ThawAccount = 11] = "ThawAccount", e[e.TransferChecked = 12] = "TransferChecked", e[e.ApproveChecked = 13] = "ApproveChecked", e[e.MintToChecked = 14] = "MintToChecked", e[e.BurnChecked = 15] = "BurnChecked", e[e.InitializeAccount2 = 16] = "InitializeAccount2", e[e.SyncNative = 17] = "SyncNative", e[e.InitializeAccount3 = 18] = "InitializeAccount3", e[e.InitializeMultisig2 = 19] = "InitializeMultisig2", e[e.InitializeMint2 = 20] = "InitializeMint2", e[e.GetAccountDataSize = 21] = "GetAccountDataSize", e[e.InitializeImmutableOwner = 22] = "InitializeImmutableOwner", e[e.AmountToUiAmount = 23] = "AmountToUiAmount", e[e.UiAmountToAmount = 24] = "UiAmountToAmount", e[e.InitializeMintCloseAuthority = 25] = "InitializeMintCloseAuthority", e[e.TransferFeeExtension = 26] = "TransferFeeExtension", e[e.ConfidentialTransferExtension = 27] = "ConfidentialTransferExtension", e[e.DefaultAccountStateExtension = 28] = "DefaultAccountStateExtension", e[e.Reallocate = 29] = "Reallocate", e[e.MemoTransferExtension = 30] = "MemoTransferExtension", e[e.CreateNativeMint = 31] = "CreateNativeMint", e[e.InitializeNonTransferableMint = 32] = "InitializeNonTransferableMint", e[e.InterestBearingMintExtension = 33] = "InterestBearingMintExtension", e[e.CpiGuardExtension = 34] = "CpiGuardExtension", e[e.InitializePermanentDelegate = 35] = "InitializePermanentDelegate", e[e.TransferHookExtension = 36] = "TransferHookExtension", e[e.MetadataPointerExtension = 39] = "MetadataPointerExtension";
431
+ })(O || (O = {}));
432
+ function Tt(e, n, t) {
433
+ if (t.length) {
434
+ e.push({ pubkey: n, isSigner: !1, isWritable: !1 });
435
+ for (const r of t)
436
+ e.push({
437
+ pubkey: r instanceof g ? r : r.publicKey,
438
+ isSigner: !0,
439
+ isWritable: !1
440
+ });
441
+ } else
442
+ e.push({ pubkey: n, isSigner: !0, isWritable: !1 });
443
+ return e;
444
+ }
445
+ const Ut = pe([
446
+ re("mintAuthorityOption"),
447
+ ue("mintAuthority"),
448
+ Ae("supply"),
449
+ be("decimals"),
450
+ ht("isInitialized"),
451
+ re("freezeAuthorityOption"),
452
+ ue("freezeAuthority")
453
+ ]);
454
+ Ut.span;
455
+ function le(e, n, t = !1, r = B, s = j) {
456
+ if (!t && !g.isOnCurve(n.toBuffer()))
457
+ throw new zt();
458
+ const [a] = g.findProgramAddressSync([n.toBuffer(), r.toBuffer(), e.toBuffer()], s);
459
+ return a;
460
+ }
461
+ function Rt(e, n, t, r, s = B, a = j) {
462
+ return _t(e, n, t, r, D.Buffer.from([1]), s, a);
463
+ }
464
+ function _t(e, n, t, r, s, a = B, i = j) {
465
+ const o = [
466
+ { pubkey: e, isSigner: !0, isWritable: !0 },
467
+ { pubkey: n, isSigner: !1, isWritable: !0 },
468
+ { pubkey: t, isSigner: !1, isWritable: !1 },
469
+ { pubkey: r, isSigner: !1, isWritable: !1 },
470
+ { pubkey: _e.programId, isSigner: !1, isWritable: !1 },
471
+ { pubkey: a, isSigner: !1, isWritable: !1 }
472
+ ];
473
+ return new Ce({
474
+ keys: o,
475
+ programId: i,
476
+ data: s
477
+ });
478
+ }
479
+ const ge = pe([be("instruction"), Ae("amount")]);
480
+ function Nt(e, n, t, r, s = [], a = B) {
481
+ const i = Tt([
482
+ { pubkey: e, isSigner: !1, isWritable: !0 },
483
+ { pubkey: n, isSigner: !1, isWritable: !0 }
484
+ ], t, s), o = D.Buffer.alloc(ge.span);
485
+ return ge.encode({
486
+ instruction: O.Transfer,
487
+ amount: BigInt(r)
488
+ }, o), new Ce({ keys: i, programId: a, data: o });
489
+ }
490
+ const $t = {
491
+ version: "0.1.0",
492
+ name: "example_cctp_with_executor",
493
+ instructions: [
494
+ {
495
+ name: "relayLastMessage",
496
+ accounts: [
497
+ {
498
+ name: "payer",
499
+ isMut: !0,
500
+ isSigner: !0
501
+ },
502
+ {
503
+ name: "payee",
504
+ isMut: !0,
505
+ isSigner: !1
506
+ },
507
+ {
508
+ name: "messageTransmitter",
509
+ isMut: !1,
510
+ isSigner: !1
511
+ },
512
+ {
513
+ name: "executorProgram",
514
+ isMut: !1,
515
+ isSigner: !1
516
+ },
517
+ {
518
+ name: "systemProgram",
519
+ isMut: !1,
520
+ isSigner: !1
521
+ }
522
+ ],
523
+ args: [
524
+ {
525
+ name: "args",
526
+ type: {
527
+ defined: "relayLastMessageArgs"
528
+ }
529
+ }
530
+ ]
531
+ }
532
+ ],
533
+ types: [
534
+ {
535
+ name: "relayLastMessageArgs",
536
+ type: {
537
+ kind: "struct",
538
+ fields: [
539
+ {
540
+ name: "recipientChain",
541
+ type: "u16"
542
+ },
543
+ {
544
+ name: "execAmount",
545
+ type: "u64"
546
+ },
547
+ {
548
+ name: "signedQuoteBytes",
549
+ type: "bytes"
550
+ },
551
+ {
552
+ name: "relayInstructions",
553
+ type: "bytes"
554
+ }
555
+ ]
556
+ }
557
+ }
558
+ ]
559
+ };
560
+ class V {
561
+ constructor(n, t, r, s) {
562
+ c(this, "network");
563
+ c(this, "chain");
564
+ c(this, "connection");
565
+ c(this, "contracts");
566
+ c(this, "tokenMessengerProgramId");
567
+ c(this, "messageTransmitterProgramId");
568
+ c(this, "shimProgramId");
569
+ c(this, "executorProgramId");
570
+ var i, o, d;
571
+ if (this.network = n, this.chain = t, this.connection = r, this.contracts = s, n === "Devnet")
572
+ throw new Error("CCTPW7Executor not supported on Devnet");
573
+ const a = (f, m) => {
574
+ if (!f)
575
+ throw new Error(m);
576
+ return new g(f);
577
+ };
578
+ this.tokenMessengerProgramId = a((i = s.cctp) == null ? void 0 : i.tokenMessenger, `Circle Token Messenger contract for domain ${t} not found`), this.messageTransmitterProgramId = a((o = s.cctp) == null ? void 0 : o.messageTransmitter, `Circle Message Transmitter contract for domain ${t} not found`), this.shimProgramId = a((d = G[n]) == null ? void 0 : d[t], `Shim contract for ${t} not found`), this.executorProgramId = a(bt[n], `Executor contract for ${n} not found`);
579
+ }
580
+ static async fromRpc(n, t) {
581
+ const [r, s] = await lt.chainFromRpc(n), a = t[s];
582
+ if (a.network !== r)
583
+ throw new Error(`Network mismatch: ${a.network} != ${r}`);
584
+ return new V(r, s, n, a.contracts);
585
+ }
586
+ async *transfer(n, t, r) {
587
+ const s = new g(b.get(this.network, this.chain)), a = new N(n).unwrap(), i = le(s, a), o = new N(r.referrer.address).unwrap(), d = new Ne();
588
+ if (d.feePayer = a, r.referrerFee > 0n) {
589
+ const y = le(s, o);
590
+ await this.connection.getAccountInfo(y) || d.add(Rt(a, y, o, s)), d.add(Nt(i, y, a, r.referrerFee));
591
+ }
592
+ const f = P.get(this.network, t.chain), m = t.address.toUniversalAddress(), h = $e.generate();
593
+ d.add(await ft(this.messageTransmitterProgramId, this.tokenMessengerProgramId, s, f, a, i, m, r.remainingAmount, h.publicKey));
594
+ const u = new mt($t, this.shimProgramId, { connection: null }), l = $(we, r.signedQuote), A = pt("message_transmitter", this.messageTransmitterProgramId);
595
+ d.add(await u.methods.relayLastMessage({
596
+ execAmount: new Oe(r.estimatedCost.toString()),
597
+ recipientChain: C(t.chain),
598
+ signedQuoteBytes: D.Buffer.from(r.signedQuote),
599
+ relayInstructions: D.Buffer.from(r.relayInstructions)
600
+ }).accounts({
601
+ payer: a,
602
+ messageTransmitter: A,
603
+ payee: new g(l.quote.payeeAddress),
604
+ executorProgram: this.executorProgramId
605
+ }).instruction()), yield this.createUnsignedTx({ transaction: d, signers: [h] }, "SvmCCTPW7Executor.Transfer");
606
+ }
607
+ createUnsignedTx(n, t, r = !1) {
608
+ return new gt(n, this.network, this.chain, t, r);
609
+ }
610
+ }
611
+ M(We, "CCTPW7Executor", V);
612
+ let v;
613
+ function ar(e) {
614
+ if (e.referrerFeeDbps < 0 || e.referrerFeeDbps > 65535n)
615
+ throw new Error("Referrer fee must be between 0 and 65535");
616
+ class n extends F {
617
+ }
618
+ return c(n, "config", e), n;
619
+ }
620
+ class F extends ke {
621
+ constructor() {
622
+ super(...arguments);
623
+ // @ts-ignore
624
+ // Since we set the config on the static class, access it with this param
625
+ // the CCTPW7ExecutorRoute.config will always be empty
626
+ c(this, "staticConfig", this.constructor.config);
627
+ }
628
+ static supportedNetworks() {
629
+ return ["Mainnet", "Testnet"];
630
+ }
631
+ static supportedChains(t) {
632
+ return se.has(t) ? se.get(t) : [];
633
+ }
634
+ static async supportedDestinationTokens(t, r, s) {
635
+ const a = b.get(r.network, r.chain);
636
+ if (!(a && Ge(t, S.tokenId(r.chain, a))))
637
+ return [];
638
+ const { network: i, chain: o } = s;
639
+ return b.has(i, o) ? [
640
+ S.chainAddress(o, b.get(i, o))
641
+ ] : [];
642
+ }
643
+ getDefaultOptions() {
644
+ return {
645
+ nativeGas: 0
646
+ };
647
+ }
648
+ async validate(t, r) {
649
+ var a;
650
+ return (a = r.options) != null && a.nativeGas && (r.options.nativeGas < 0 || r.options.nativeGas > 1) ? {
651
+ valid: !1,
652
+ error: new Error("Invalid native gas percentage"),
653
+ params: r
654
+ } : { valid: !0, params: {
655
+ normalizedParams: {
656
+ amount: t.parseAmount(r.amount)
657
+ },
658
+ options: r.options ?? this.getDefaultOptions(),
659
+ ...r
660
+ } };
661
+ }
662
+ async quote(t, r) {
663
+ var Z, Y;
664
+ const { fromChain: s, toChain: a } = t;
665
+ if (!b.get(s.network, s.chain))
666
+ throw new Error("Invalid transfer, no USDC contract on source");
667
+ const o = b.get(a.network, a.chain);
668
+ if (!o)
669
+ throw new Error("Invalid transfer, no USDC contract on destination");
670
+ const d = (Z = wt[s.network]) == null ? void 0 : Z[s.chain];
671
+ if (!d)
672
+ return {
673
+ success: !1,
674
+ error: new Error("No referrer address found")
675
+ };
676
+ const f = S.chainAddress(s.chain, d), m = this.staticConfig.referrerFeeDbps, { referrerFee: h, remainingAmount: u } = vt(Le(r.normalizedParams.amount), this.staticConfig.referrerFeeDbps);
677
+ if (u <= 0n)
678
+ return {
679
+ success: !1,
680
+ error: new Error("Amount after fee <= 0")
681
+ };
682
+ const l = (Y = At[s.network]) == null ? void 0 : Y[a.chain];
683
+ if (!l)
684
+ return {
685
+ success: !1,
686
+ error: new Error("Gas limit not found")
687
+ };
688
+ const A = await yt(s.network);
689
+ if (!A[C(s.chain)])
690
+ return {
691
+ success: !1,
692
+ error: new Error("Unsupported source chain")
693
+ };
694
+ const E = A[C(a.chain)];
695
+ if (!E || !E.requestPrefixes.includes("ERC1"))
696
+ return {
697
+ success: !1,
698
+ error: new Error("Unsupported destination chain")
699
+ };
700
+ const { recipient: p } = t;
701
+ let x = !0;
702
+ if (p && a.chain === "Solana") {
703
+ const Fe = S.parseAddress("Solana", o), De = await a.getTokenAccount(p.address, Fe), ee = await a.getRpc();
704
+ x = await ee.getAccountInfo(new N(De.address).unwrap()) !== null, !x && !v && (v = BigInt(await ee.getMinimumBalanceForRentExemption(165)));
705
+ }
706
+ let I = 0n;
707
+ a.chain === "Solana" && (I += Ct, !x && v && (I += v));
708
+ const z = [];
709
+ z.push({
710
+ request: {
711
+ type: "GasInstruction",
712
+ gasLimit: l,
713
+ msgValue: I
714
+ }
715
+ });
716
+ const K = BigInt(E.gasDropOffLimit), T = r.options.nativeGas && K > 0n ? BigInt(Math.round(r.options.nativeGas * 100)) * K / 100n : 0n;
717
+ (T > 0n || !x) && z.push({
718
+ request: {
719
+ type: "GasDropOffInstruction",
720
+ dropOff: T,
721
+ // If the recipient is undefined (e.g. the user hasn’t connected their wallet yet),
722
+ // we temporarily use a dummy address to fetch a quote.
723
+ // The recipient address is validated later in the `initiate` method, which will throw if it's still missing.
724
+ recipient: p ? p.address.toUniversalAddress() : new Qe(new Uint8Array(32))
725
+ }
726
+ });
727
+ const X = qe(me, {
728
+ requests: z
729
+ }), U = await Et(s.network, s.chain, a.chain, ne.encode(X, !0));
730
+ if (!U.estimatedCost)
731
+ return {
732
+ success: !1,
733
+ error: new Error("No estimated cost")
734
+ };
735
+ const J = ne.decode(U.signedQuote), ye = $(we, J), Ee = s.chain === "Polygon" ? 2e3 * 200 : je(s.chain) + 1e3, H = BigInt(U.estimatedCost), xe = {
736
+ signedQuote: J,
737
+ relayInstructions: X,
738
+ estimatedCost: H,
739
+ referrer: f,
740
+ referrerFee: h,
741
+ remainingAmount: u,
742
+ referrerFeeDbps: m
743
+ }, [Se, ve] = await Promise.all([
744
+ s.getDecimals("native"),
745
+ a.getDecimals("native")
746
+ ]);
747
+ return {
748
+ success: !0,
749
+ params: r,
750
+ sourceToken: {
751
+ token: t.source.id,
752
+ amount: r.normalizedParams.amount
753
+ },
754
+ destinationToken: {
755
+ token: t.destination.id,
756
+ amount: R(u, t.destination.decimals)
757
+ },
758
+ relayFee: {
759
+ token: Ve(s.chain),
760
+ amount: R(H, Se)
761
+ },
762
+ destinationNativeGas: R(T, ve),
763
+ eta: Ee,
764
+ expires: ye.quote.expiryTime,
765
+ details: xe
766
+ };
767
+ }
768
+ async initiate(t, r, s, a) {
769
+ if (!s.details)
770
+ throw new Error("Missing quote details");
771
+ $(me, s.details.relayInstructions).requests.forEach(({ request: u }) => {
772
+ if (u.type === "GasDropOffInstruction" && !u.recipient.equals(a.address.toUniversalAddress()))
773
+ throw new Error("Gas drop-off recipient does not match");
774
+ });
775
+ const o = await t.fromChain.getProtocol("CCTPW7Executor"), d = S.parseAddress(r.chain(), r.address());
776
+ let f = a;
777
+ if (a.chain === "Solana") {
778
+ const u = S.parseAddress("Solana", b.get(t.toChain.network, t.toChain.chain));
779
+ f = await t.toChain.getTokenAccount(a.address, u);
780
+ }
781
+ const m = await o.transfer(d, f, s.details), h = await Ke(t.fromChain, m, r);
782
+ return {
783
+ from: t.fromChain.chain,
784
+ to: t.toChain.chain,
785
+ state: _.SourceInitiated,
786
+ originTxs: h
787
+ };
788
+ }
789
+ async *track(t, r) {
790
+ if (ae(t) || ie(t))
791
+ return t;
792
+ let s = r || 60 * 60 * 1e3;
793
+ for (; s > 0; ) {
794
+ const a = Date.now();
795
+ if (Xe(t) || Je(t) || He(t))
796
+ try {
797
+ const [i] = await xt(this.wh.network, t.originTxs.at(-1).txid, t.from);
798
+ if (!i)
799
+ throw new Error("No transaction status found");
800
+ const o = i == null ? void 0 : i.status;
801
+ if ((o === w.Failed || // this could happen if simulation fails
802
+ o === w.Underpaid || // only happens if you don't pay at least the costEstimate
803
+ o === w.Unsupported || // capabilities check didn't pass
804
+ o === w.Aborted) && (t = {
805
+ ...t,
806
+ state: _.Failed,
807
+ error: new dt(`Relay failed with status: ${o}`)
808
+ }), o === w.Submitted && (t = {
809
+ ...t,
810
+ state: _.DestinationFinalized,
811
+ attestation: { id: i.id, attestation: {} }
812
+ }), yield t, ae(t) || ie(t))
813
+ return t;
814
+ } catch (i) {
815
+ console.error(`Error fetching transaction status: ${i.message || i}`);
816
+ }
817
+ await new Promise((i) => setTimeout(i, 3e3)), s -= Date.now() - a;
818
+ }
819
+ return t;
820
+ }
821
+ }
822
+ c(F, "NATIVE_GAS_DROPOFF_SUPPORTED", !0), c(F, "config", { referrerFeeDbps: 0n }), c(F, "meta", {
823
+ name: "CCTPW7ExecutorRoute",
824
+ provider: "W7 Executor"
825
+ });
826
+ export {
827
+ ar as cctpW7ExecutorRoute
828
+ };