@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.
- package/dist/main.js +49 -49
- package/dist/src/components/SampleApp/index.d.ts.map +1 -1
- package/dist/src/config/index.d.ts.map +1 -1
- package/dist/src/config/types.d.ts +2 -0
- package/dist/src/config/types.d.ts.map +1 -1
- package/dist/src/exports/executor.d.ts +2 -0
- package/dist/src/exports/executor.d.ts.map +1 -0
- package/dist/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/sdkv2.d.ts +0 -1
- package/dist/src/utils/sdkv2.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/lib/account-CKUCmcgT.mjs +30 -0
- package/lib/account-QG_Hi4er.js +1 -0
- package/lib/address-B-_yHNB2.js +1 -0
- package/lib/{address-D74XlMdi.mjs → address-B9anhmbU.mjs} +5 -5
- package/lib/address-Cj96wodd.mjs +64 -0
- package/lib/{address-DXFbgyJW.mjs → address-Drr_9OcK.mjs} +93 -93
- package/lib/aptos-BZ2mcuTd.js +2 -0
- package/lib/aptos-DPIwkCrX.mjs +68 -0
- package/lib/{aptos-WhWqMfkU.js → aptos-Da6iqpC-.js} +1 -1
- package/lib/{aptos-BckWT_Pe.mjs → aptos-Dz4Js3_d.mjs} +3 -3
- package/lib/{base64-DPCMLrON.mjs → base64-BcnUThiU.mjs} +1 -1
- package/lib/{blake2b-BmQx89Cf.mjs → blake2b-CnkNeJT4.mjs} +1 -1
- package/lib/{browser-ponyfill-Zjbs5ehD.mjs → browser-ponyfill-oWZrCgRw.mjs} +1 -1
- package/lib/{ccip-DiNEz9KN.js → ccip-Bb-IPrNA.js} +1 -1
- package/lib/{ccip-B45dpIhp.mjs → ccip-Ceg_B70t.mjs} +1 -1
- package/lib/{chain-DaAd2Ztf.mjs → chain-CNVMEdrk.mjs} +1 -1
- package/lib/{chunk-IMTC3J2M-Bn3rs7tb.mjs → chunk-IMTC3J2M-B7fKwIuX.mjs} +3 -3
- package/lib/{constants-CbKC2uxb.mjs → constants-Ba9GwEM1.mjs} +1 -1
- package/lib/constants-BqqwmYZc.js +1 -0
- package/lib/{contract-BI_HDILr.mjs → contract-DANWVftx.mjs} +1 -1
- package/lib/{create-CzWSWmF_.mjs → create-B9LwWha4.mjs} +1 -1
- package/lib/{evm-DFyxDQ-x.js → evm-1T5rGzcO.js} +3 -3
- package/lib/{evm-DgG5biHb.mjs → evm-B552wdhN.mjs} +9 -9
- package/lib/{evm-Es3E89UO.mjs → evm-DarNu22s.mjs} +9 -9
- package/lib/executor.d.ts +2 -0
- package/lib/executor.js +1 -0
- package/lib/executor.mjs +828 -0
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/index-2f5GRlqp.mjs +46 -0
- package/lib/{index-Blt9MjZK.mjs → index-B1XGfrNH.mjs} +1 -1
- package/lib/{index-DUiyW0v6.js → index-B40ktVOy.js} +1 -1
- package/lib/{index-jfL73ugq.mjs → index-B4NYDFvU.mjs} +5 -5
- package/lib/{index--QOOnO1S.mjs → index-BAuH_G93.mjs} +5 -5
- package/lib/{index-C9ZemP81.mjs → index-BHMN5Px3.mjs} +2 -2
- package/lib/{index-CGbZMLbJ.mjs → index-BO0DC-jc.mjs} +3 -3
- package/lib/{index-BziywkBj.mjs → index-BQ0RlDhv.mjs} +246 -272
- package/lib/{index-Cuu-xM0U.mjs → index-BR4w3fuE.mjs} +5 -5
- package/lib/{index-DnOkd5VL.js → index-BTNmmLkb.js} +1 -1
- package/lib/{index-BQwsEzas.mjs → index-BlJpOhTM.mjs} +5 -5
- package/lib/{index-CjL3WbDp.js → index-Blzzdktm.js} +1 -1
- package/lib/{index-Bc7EWiox.js → index-Bn1o04G7.js} +80 -80
- package/lib/index-C2Pe6i5V.js +1 -0
- package/lib/{index-5xE5bjpW.mjs → index-C9XIIFQK.mjs} +1 -1
- package/lib/{index-XFRw6zfV.mjs → index-CCRPy0B_.mjs} +2 -2
- package/lib/index-CE0rxdUf.js +1 -0
- package/lib/{index-Bu6LLuxH.mjs → index-CEXcD8Mw.mjs} +4 -4
- package/lib/{index-BLYjmYmu.mjs → index-CKg04pdA.mjs} +5 -5
- package/lib/{index-CxW1HjrT.mjs → index-CM_IP492.mjs} +14 -14
- package/lib/{index-pjyIirVB.mjs → index-CT2-qOL1.mjs} +2 -2
- package/lib/{index-DFHQnDR7.mjs → index-CYdhveYx.mjs} +6 -6
- package/lib/{index-COkWxUoe.mjs → index-Cda4HnP1.mjs} +5 -5
- package/lib/{index-BYzONVwG.mjs → index-CfC3_uPF.mjs} +7 -7
- package/lib/index-DC1ot7tO.js +1 -0
- package/lib/{index-v0MO46Zl.mjs → index-DHAgduQ-.mjs} +4 -4
- package/lib/{index-DQjqwKVk.mjs → index-DSSOE7Me.mjs} +2 -2
- package/lib/{index-BbCcdl9J.mjs → index-DoFo485M.mjs} +73 -72
- package/lib/{index-BNjB0Q50.mjs → index-DvxmZnxH.mjs} +5 -5
- package/lib/{index-ju2wtFjy.mjs → index-Dw7INWis.mjs} +7 -7
- package/lib/{index-t94-e3qG.js → index-VhcNuaP6.js} +1 -1
- package/lib/index-dpkTW-H8.js +1 -0
- package/lib/index-f_27F6WX.js +1 -0
- package/lib/{index-BkHLwIMc.mjs → index-l0sxQXRT.mjs} +1 -1
- package/lib/{index-CdOqWihR.mjs → index-mXHkgOxH.mjs} +4 -4
- package/lib/{index-C2jOUiub.mjs → index-pN0Dgjjf.mjs} +5 -5
- package/lib/{index-B7U-me-L.mjs → index-pNqQSm4p.mjs} +6628 -6659
- package/lib/{index.es-BYLVcsBS.js → index.es-_N4sKEIC.js} +1 -1
- package/lib/{index.es-BrgiiIYV.mjs → index.es-rEir51oG.mjs} +7 -7
- package/lib/index.js +1 -1
- package/lib/index.mjs +5 -5
- package/lib/mayan.mjs +10 -10
- package/lib/{mint-BjwZUbPm.mjs → mint-DVxIczlI.mjs} +2 -2
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +10 -10
- package/lib/{platform-pi9E7cPR.mjs → platform-CbDx4hex.mjs} +4 -4
- package/lib/platform-CyTWPtDR.js +1 -0
- package/lib/{platform-C-edrCmf.mjs → platform-D-nUFU0e.mjs} +6 -6
- package/lib/platform-PaIJsXKV.mjs +118 -0
- package/lib/{provider-jsonrpc-BjcoR80W.mjs → provider-jsonrpc-C_IZFSfB.mjs} +2 -2
- package/lib/{sha3-B1KxiAa7.mjs → sha3-DQQvDwj1.mjs} +1 -1
- package/lib/{signer-CgLO7fBA.mjs → signer-CsMX8mEc.mjs} +6 -6
- package/lib/{solana-DA48rYUK.js → solana-BRQmi9BN.js} +1 -1
- package/lib/solana-C_0khyJw.mjs +18 -0
- package/lib/{solana-Pjpx_PkM.js → solana-CrjSp_Zk.js} +1 -1
- package/lib/{solana-CvaeYBIB.mjs → solana-SQhnN3yB.mjs} +6 -6
- package/lib/{solanaEmbed.esm-jxAhxZ9V.js → solanaEmbed.esm-B7IRXgnI.js} +1 -1
- package/lib/{solanaEmbed.esm-Gti-Nr19.mjs → solanaEmbed.esm-Din0Z51P.mjs} +3 -3
- package/lib/src/components/SampleApp/index.d.ts.map +1 -1
- package/lib/src/config/index.d.ts.map +1 -1
- package/lib/src/config/types.d.ts +2 -0
- package/lib/src/config/types.d.ts.map +1 -1
- package/lib/src/exports/executor.d.ts +2 -0
- package/lib/src/exports/executor.d.ts.map +1 -0
- package/lib/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/sdkv2.d.ts +0 -1
- package/lib/src/utils/sdkv2.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
- package/lib/{sui-CuwmPzXZ.mjs → sui-BSLo7-bI.mjs} +14 -14
- package/lib/{sui-Bi1J0W_P.mjs → sui-BePFnRSc.mjs} +3 -3
- package/lib/{sui-uSCH-o_h.js → sui-C7KPm3kD.js} +1 -1
- package/lib/{tokens-DcqY0jHv.js → tokens-CChVRIuE.js} +1 -1
- package/lib/{tokens-DOx4hiaR.mjs → tokens-CyKAZUN-.mjs} +4 -4
- package/lib/{units-YO78Cq5F.mjs → units-DP5zqyxn.mjs} +9 -9
- package/lib/{unsignedTransaction-Cj476rGh.mjs → unsignedTransaction-fSrwDjHx.mjs} +9 -9
- package/lib/{web3--AtxvLIy.mjs → web3-DCo8oN-v.mjs} +4 -4
- package/package.json +16 -1
- package/lib/aptos-VwYOwtQy.mjs +0 -179
- package/lib/aptos-hc5GrCHO.js +0 -2
- package/lib/constants-Cib4VRZO.js +0 -1
- package/lib/index-BlzRxQ82.js +0 -1
- package/lib/index-CJXmILJz.js +0 -1
- package/lib/index-C_dsyQjC.mjs +0 -46
- package/lib/index-CpuzvBlL.js +0 -1
- package/lib/index-Cxg2C7RE.js +0 -1
- package/lib/index-DDAGOrv0.js +0 -1
- package/lib/solana-qHqB-cdc.mjs +0 -18
|
@@ -1,56 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var u = (r, e, t) =>
|
|
4
|
-
import { ae as
|
|
5
|
-
import { d as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
pubkey: new m(r),
|
|
16
|
-
isWritable: !0,
|
|
17
|
-
isSigner: e
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function bt(r, e) {
|
|
21
|
-
return {
|
|
22
|
-
pubkey: new m(r),
|
|
23
|
-
isWritable: !1,
|
|
24
|
-
isSigner: e
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function z(r) {
|
|
28
|
-
if (r === null)
|
|
29
|
-
throw Error("account info is null");
|
|
30
|
-
return r.data;
|
|
31
|
-
}
|
|
32
|
-
const ue = new m("BPFLoaderUpgradeab1e11111111111111111111111");
|
|
33
|
-
function Re(r) {
|
|
34
|
-
return b([new m(r).toBuffer()], ue);
|
|
35
|
-
}
|
|
36
|
-
class $e extends Error {
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var Ue = (r, e, t) => e in r ? Le(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var u = (r, e, t) => Ue(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ae as p, a_ as Te, aJ as ne, d, as as Ce, cB as _e, an as M, bV as ke, aP as L, aq as U, ap as V, b1 as q, aX as ie, cC as Pe, cD as ve, ao as re, b2 as j, aA as ze, b3 as Ke } from "./address-Drr_9OcK.mjs";
|
|
5
|
+
import { d as m, P as qe, c as Fe } from "./index-l0sxQXRT.mjs";
|
|
6
|
+
import { d as b, g as z } from "./account-CKUCmcgT.mjs";
|
|
7
|
+
import { a as Ve, S as De } from "./unsignedTransaction-fSrwDjHx.mjs";
|
|
8
|
+
import { c as Ge } from "./create-B9LwWha4.mjs";
|
|
9
|
+
import { r as Oe } from "./chain-CNVMEdrk.mjs";
|
|
10
|
+
const oe = new p("BPFLoaderUpgradeab1e11111111111111111111111");
|
|
11
|
+
function Ne(r) {
|
|
12
|
+
return b([new p(r).toBuffer()], oe);
|
|
13
|
+
}
|
|
14
|
+
class Re extends Error {
|
|
37
15
|
constructor(e) {
|
|
38
16
|
super(e), this.name = "IdlError";
|
|
39
17
|
}
|
|
40
18
|
}
|
|
41
|
-
function
|
|
19
|
+
function ue(r, e) {
|
|
42
20
|
switch (e.type.kind) {
|
|
43
21
|
case "struct":
|
|
44
|
-
return e.type.fields.map((t) =>
|
|
22
|
+
return e.type.fields.map((t) => A(r, t.type)).reduce((t, n) => t + n, 0);
|
|
45
23
|
case "enum": {
|
|
46
|
-
const t = e.type.variants.map((n) => n.fields ? n.fields.map((s) => typeof s == "object" && "name" in s ?
|
|
24
|
+
const t = e.type.variants.map((n) => n.fields ? n.fields.map((s) => typeof s == "object" && "name" in s ? A(r, s.type) : A(r, s)).reduce((s, a) => s + a, 0) : 0);
|
|
47
25
|
return Math.max(...t) + 1;
|
|
48
26
|
}
|
|
49
27
|
case "alias":
|
|
50
|
-
return
|
|
28
|
+
return A(r, e.type.value);
|
|
51
29
|
}
|
|
52
30
|
}
|
|
53
|
-
function
|
|
31
|
+
function A(r, e) {
|
|
54
32
|
var t;
|
|
55
33
|
switch (e) {
|
|
56
34
|
case "bool":
|
|
@@ -93,32 +71,32 @@ function I(r, e) {
|
|
|
93
71
|
if ("vec" in e)
|
|
94
72
|
return 1;
|
|
95
73
|
if ("option" in e)
|
|
96
|
-
return 1 +
|
|
74
|
+
return 1 + A(r, e.option);
|
|
97
75
|
if ("coption" in e)
|
|
98
|
-
return 4 +
|
|
76
|
+
return 4 + A(r, e.coption);
|
|
99
77
|
if ("defined" in e) {
|
|
100
78
|
const n = ((t = r.types) == null ? void 0 : t.filter((a) => a.name === e.defined)) ?? [];
|
|
101
79
|
if (n.length !== 1)
|
|
102
|
-
throw new
|
|
80
|
+
throw new Re(`Type not found: ${JSON.stringify(e)}`);
|
|
103
81
|
let s = n[0];
|
|
104
|
-
return
|
|
82
|
+
return ue(r, s);
|
|
105
83
|
}
|
|
106
84
|
if ("array" in e) {
|
|
107
85
|
let n = e.array[0], s = e.array[1];
|
|
108
|
-
return
|
|
86
|
+
return A(r, n) * s;
|
|
109
87
|
}
|
|
110
88
|
throw new Error(`Invalid type ${JSON.stringify(e)}`);
|
|
111
89
|
}
|
|
112
90
|
}
|
|
113
|
-
function
|
|
91
|
+
function k(r) {
|
|
114
92
|
return r.replace(/(?:^\w|[A-Z]|\b\w)/g, function(e, t) {
|
|
115
93
|
return t === 0 ? e.toLowerCase() : e.toUpperCase();
|
|
116
94
|
}).replace(/[\s\-_]+/g, "");
|
|
117
95
|
}
|
|
118
|
-
function
|
|
96
|
+
function $e(r) {
|
|
119
97
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
120
98
|
}
|
|
121
|
-
const
|
|
99
|
+
const ce = [
|
|
122
100
|
{ name: "discriminator", binary: "bytes", size: 4 },
|
|
123
101
|
{ name: "consistencyLevel", binary: "uint", size: 1, endianness: "little" },
|
|
124
102
|
{ name: "emitterAuthority", ...ne },
|
|
@@ -132,31 +110,31 @@ const ge = [
|
|
|
132
110
|
{ name: "payloadLength", binary: "uint", size: 4, endianness: "little" },
|
|
133
111
|
{ name: "payload", binary: "bytes" }
|
|
134
112
|
];
|
|
135
|
-
function
|
|
136
|
-
return
|
|
113
|
+
function ge(r) {
|
|
114
|
+
return Te(ce, r);
|
|
137
115
|
}
|
|
138
116
|
function T(r, e, t, n) {
|
|
139
|
-
const s = typeof e == "string" ?
|
|
117
|
+
const s = typeof e == "string" ? d.Buffer.from(e, "hex") : d.Buffer.from(e);
|
|
140
118
|
if (s.length != 32)
|
|
141
119
|
throw Error("address.length != 32");
|
|
142
|
-
const a =
|
|
120
|
+
const a = d.Buffer.alloc(8);
|
|
143
121
|
return a.writeBigUInt64BE(typeof n == "number" ? BigInt(n) : n), b([
|
|
144
122
|
s,
|
|
145
123
|
(() => {
|
|
146
|
-
const i =
|
|
124
|
+
const i = d.Buffer.alloc(2);
|
|
147
125
|
return i.writeUInt16BE(t), i;
|
|
148
126
|
})(),
|
|
149
127
|
a
|
|
150
128
|
], r);
|
|
151
129
|
}
|
|
152
|
-
async function
|
|
130
|
+
async function Ye(r, e, t, n, s, a) {
|
|
153
131
|
return r.getAccountInfo(T(e, t, n, s), a).then((i) => !!z(i)[0]);
|
|
154
132
|
}
|
|
155
133
|
function S(r) {
|
|
156
|
-
return b([
|
|
134
|
+
return b([d.Buffer.from("Bridge")], r);
|
|
157
135
|
}
|
|
158
|
-
async function
|
|
159
|
-
return r.getAccountInfo(S(e), t).then((n) =>
|
|
136
|
+
async function de(r, e, t) {
|
|
137
|
+
return r.getAccountInfo(S(e), t).then((n) => G.deserialize(z(n)));
|
|
160
138
|
}
|
|
161
139
|
class D {
|
|
162
140
|
constructor(e, t) {
|
|
@@ -171,7 +149,7 @@ class D {
|
|
|
171
149
|
return new D(t, n);
|
|
172
150
|
}
|
|
173
151
|
}
|
|
174
|
-
class
|
|
152
|
+
class G {
|
|
175
153
|
constructor(e, t, n) {
|
|
176
154
|
u(this, "guardianSetIndex");
|
|
177
155
|
u(this, "lastLamports");
|
|
@@ -182,14 +160,14 @@ class O {
|
|
|
182
160
|
if (e.length != 24)
|
|
183
161
|
throw new Error("data.length != 24");
|
|
184
162
|
const t = e.readUInt32LE(0), n = e.readBigUInt64LE(4), s = D.deserialize(e.subarray(12));
|
|
185
|
-
return new
|
|
163
|
+
return new G(t, n, s);
|
|
186
164
|
}
|
|
187
165
|
}
|
|
188
|
-
function
|
|
189
|
-
return b([
|
|
166
|
+
function O(r, e) {
|
|
167
|
+
return b([d.Buffer.from("Sequence"), new p(r).toBytes()], e);
|
|
190
168
|
}
|
|
191
|
-
async function
|
|
192
|
-
return r.getAccountInfo(
|
|
169
|
+
async function fe(r, e, t, n) {
|
|
170
|
+
return r.getAccountInfo(O(e, t), n).then((s) => N.deserialize(z(s)));
|
|
193
171
|
}
|
|
194
172
|
class N {
|
|
195
173
|
constructor(e, t, n) {
|
|
@@ -209,25 +187,25 @@ class N {
|
|
|
209
187
|
return this.sequence;
|
|
210
188
|
}
|
|
211
189
|
}
|
|
212
|
-
function
|
|
213
|
-
return b([
|
|
190
|
+
function H(r) {
|
|
191
|
+
return b([d.Buffer.from("emitter")], r);
|
|
214
192
|
}
|
|
215
|
-
function
|
|
216
|
-
const t =
|
|
193
|
+
function J(r, e) {
|
|
194
|
+
const t = H(r);
|
|
217
195
|
return {
|
|
218
196
|
emitter: t,
|
|
219
|
-
sequence:
|
|
197
|
+
sequence: O(t, e)
|
|
220
198
|
};
|
|
221
199
|
}
|
|
222
|
-
async function
|
|
223
|
-
return
|
|
200
|
+
async function je(r, e, t, n) {
|
|
201
|
+
return fe(r, H(e), t, n);
|
|
224
202
|
}
|
|
225
203
|
function C(r) {
|
|
226
|
-
return b([
|
|
204
|
+
return b([d.Buffer.from("fee_collector")], r);
|
|
227
205
|
}
|
|
228
|
-
const
|
|
206
|
+
const se = 65, P = 20;
|
|
229
207
|
function He(r, e, t) {
|
|
230
|
-
return new
|
|
208
|
+
return new Ce({
|
|
231
209
|
keys: [],
|
|
232
210
|
programId: _e.programId,
|
|
233
211
|
data: Je.serialize(r, e, t)
|
|
@@ -279,31 +257,31 @@ class Je {
|
|
|
279
257
|
throw Error("signatures.length != keys.length");
|
|
280
258
|
if (n.length != 32)
|
|
281
259
|
throw Error("message.length != 32");
|
|
282
|
-
const s = e.length, a = 11, i = 1 + s * a, o =
|
|
283
|
-
|
|
284
|
-
for (let
|
|
285
|
-
const y = e.at(
|
|
286
|
-
if ((y == null ? void 0 : y.length) !=
|
|
287
|
-
throw Error(`signatures[${
|
|
288
|
-
const h = t.at(
|
|
260
|
+
const s = e.length, a = 11, i = 1 + s * a, o = se + P, c = i + s * o, f = 32, g = d.Buffer.alloc(c + f);
|
|
261
|
+
g.writeUInt8(s, 0), g.write(n.toString("hex"), c, "hex");
|
|
262
|
+
for (let l = 0; l < s; ++l) {
|
|
263
|
+
const y = e.at(l);
|
|
264
|
+
if ((y == null ? void 0 : y.length) != se)
|
|
265
|
+
throw Error(`signatures[${l}].length != 65`);
|
|
266
|
+
const h = t.at(l);
|
|
289
267
|
if ((h == null ? void 0 : h.length) != P)
|
|
290
|
-
throw Error(`keys[${
|
|
291
|
-
const
|
|
292
|
-
|
|
268
|
+
throw Error(`keys[${l}].length != 20`);
|
|
269
|
+
const I = i + o * l, _ = I + 65;
|
|
270
|
+
g.writeUInt16LE(I, 1 + l * a), g.writeUInt8(0, 3 + l * a), g.writeUInt16LE(_, 4 + l * a), g.writeUInt8(0, 6 + l * a), g.writeUInt16LE(c, 7 + l * a), g.writeUInt16LE(f, 9 + l * a), g.writeUInt8(0, 10 + l * a), g.write(y.toString("hex"), I, "hex"), g.write(h.toString("hex"), _, "hex");
|
|
293
271
|
}
|
|
294
|
-
return
|
|
272
|
+
return g;
|
|
295
273
|
}
|
|
296
274
|
}
|
|
297
275
|
function x(r, e) {
|
|
298
276
|
return b([
|
|
299
|
-
|
|
277
|
+
d.Buffer.from("GuardianSet"),
|
|
300
278
|
(() => {
|
|
301
|
-
const t =
|
|
279
|
+
const t = d.Buffer.alloc(4);
|
|
302
280
|
return t.writeUInt32BE(e), t;
|
|
303
281
|
})()
|
|
304
282
|
], r);
|
|
305
283
|
}
|
|
306
|
-
async function
|
|
284
|
+
async function W(r, e, t, n) {
|
|
307
285
|
return r.getAccountInfo(x(e, t), n).then((s) => R.deserialize(z(s)));
|
|
308
286
|
}
|
|
309
287
|
class R {
|
|
@@ -324,10 +302,10 @@ class R {
|
|
|
324
302
|
}
|
|
325
303
|
}
|
|
326
304
|
function E(r, e) {
|
|
327
|
-
return b([
|
|
305
|
+
return b([d.Buffer.from("PostedVAA"), e], r);
|
|
328
306
|
}
|
|
329
|
-
async function
|
|
330
|
-
return r.getAccountInfo(new
|
|
307
|
+
async function We(r, e, t) {
|
|
308
|
+
return r.getAccountInfo(new p(e), t).then((n) => $.deserialize(z(n)));
|
|
331
309
|
}
|
|
332
310
|
class $ {
|
|
333
311
|
constructor(e, t, n) {
|
|
@@ -341,17 +319,17 @@ class $ {
|
|
|
341
319
|
return new $(n, a, i);
|
|
342
320
|
}
|
|
343
321
|
}
|
|
344
|
-
function
|
|
345
|
-
return b([
|
|
322
|
+
function me(r) {
|
|
323
|
+
return b([d.Buffer.from("upgrade")], r);
|
|
346
324
|
}
|
|
347
|
-
function
|
|
325
|
+
function le(r, e, t) {
|
|
348
326
|
return M.transfer({
|
|
349
|
-
fromPubkey: new
|
|
327
|
+
fromPubkey: new p(e),
|
|
350
328
|
toPubkey: C(r),
|
|
351
329
|
lamports: t
|
|
352
330
|
});
|
|
353
331
|
}
|
|
354
|
-
class
|
|
332
|
+
class Xe {
|
|
355
333
|
constructor(e) {
|
|
356
334
|
u(this, "idl");
|
|
357
335
|
this.idl = e;
|
|
@@ -383,10 +361,10 @@ class Qe {
|
|
|
383
361
|
}
|
|
384
362
|
}
|
|
385
363
|
size(e) {
|
|
386
|
-
return
|
|
364
|
+
return ue(this.idl, e) ?? 0;
|
|
387
365
|
}
|
|
388
366
|
}
|
|
389
|
-
class
|
|
367
|
+
class Qe {
|
|
390
368
|
constructor(e) {
|
|
391
369
|
}
|
|
392
370
|
decode(e) {
|
|
@@ -395,52 +373,52 @@ class Ze {
|
|
|
395
373
|
}
|
|
396
374
|
class B {
|
|
397
375
|
static fieldLayout(e, t) {
|
|
398
|
-
const n = e.name !== void 0 ?
|
|
376
|
+
const n = e.name !== void 0 ? k(e.name) : void 0;
|
|
399
377
|
switch (e.type) {
|
|
400
378
|
case "bool":
|
|
401
|
-
return
|
|
379
|
+
return m.bool(n);
|
|
402
380
|
case "u8":
|
|
403
|
-
return
|
|
381
|
+
return m.u8(n);
|
|
404
382
|
case "i8":
|
|
405
|
-
return
|
|
383
|
+
return m.i8(n);
|
|
406
384
|
case "u16":
|
|
407
|
-
return
|
|
385
|
+
return m.u16(n);
|
|
408
386
|
case "i16":
|
|
409
|
-
return
|
|
387
|
+
return m.i16(n);
|
|
410
388
|
case "u32":
|
|
411
|
-
return
|
|
389
|
+
return m.u32(n);
|
|
412
390
|
case "i32":
|
|
413
|
-
return
|
|
391
|
+
return m.i32(n);
|
|
414
392
|
case "f32":
|
|
415
|
-
return
|
|
393
|
+
return m.f32(n);
|
|
416
394
|
case "u64":
|
|
417
|
-
return
|
|
395
|
+
return m.u64(n);
|
|
418
396
|
case "i64":
|
|
419
|
-
return
|
|
397
|
+
return m.i64(n);
|
|
420
398
|
case "f64":
|
|
421
|
-
return
|
|
399
|
+
return m.f64(n);
|
|
422
400
|
case "u128":
|
|
423
|
-
return
|
|
401
|
+
return m.u128(n);
|
|
424
402
|
case "i128":
|
|
425
|
-
return
|
|
403
|
+
return m.i128(n);
|
|
426
404
|
case "u256":
|
|
427
|
-
return
|
|
405
|
+
return m.u256(n);
|
|
428
406
|
case "i256":
|
|
429
|
-
return
|
|
407
|
+
return m.i256(n);
|
|
430
408
|
case "bytes":
|
|
431
|
-
return
|
|
409
|
+
return m.vecU8(n);
|
|
432
410
|
case "string":
|
|
433
|
-
return
|
|
411
|
+
return m.str(n);
|
|
434
412
|
case "publicKey":
|
|
435
|
-
return
|
|
413
|
+
return m.publicKey(n);
|
|
436
414
|
default: {
|
|
437
415
|
if ("vec" in e.type)
|
|
438
|
-
return
|
|
416
|
+
return m.vec(B.fieldLayout({
|
|
439
417
|
name: void 0,
|
|
440
418
|
type: e.type.vec
|
|
441
419
|
}, t), n);
|
|
442
420
|
if ("option" in e.type)
|
|
443
|
-
return
|
|
421
|
+
return m.option(B.fieldLayout({
|
|
444
422
|
name: void 0,
|
|
445
423
|
type: e.type.option
|
|
446
424
|
}, t), n);
|
|
@@ -449,7 +427,7 @@ class B {
|
|
|
449
427
|
name: void 0,
|
|
450
428
|
type: s
|
|
451
429
|
}, t);
|
|
452
|
-
return
|
|
430
|
+
return m.array(i, a, n);
|
|
453
431
|
} else
|
|
454
432
|
throw new Error(`Not yet implemented: ${e}`);
|
|
455
433
|
}
|
|
@@ -464,29 +442,29 @@ class X {
|
|
|
464
442
|
static parseIxLayout(e) {
|
|
465
443
|
const n = (e.instructions ? e.instructions : []).map((s) => {
|
|
466
444
|
let a = s.args.map((o) => B.fieldLayout(o, Array.from([...e.accounts ?? [], ...e.types ?? []])));
|
|
467
|
-
const i =
|
|
468
|
-
return [i,
|
|
445
|
+
const i = k(s.name);
|
|
446
|
+
return [i, m.struct(a, i)];
|
|
469
447
|
}).concat(e.instructions.map((s) => {
|
|
470
448
|
let a = s.args.map((o) => B.fieldLayout(o, Array.from([...e.accounts ?? [], ...e.types ?? []])));
|
|
471
|
-
const i =
|
|
472
|
-
return [i,
|
|
449
|
+
const i = k(s.name);
|
|
450
|
+
return [i, m.struct(a, i)];
|
|
473
451
|
}));
|
|
474
452
|
return new Map(n);
|
|
475
453
|
}
|
|
476
454
|
encode(e, t) {
|
|
477
|
-
const n =
|
|
455
|
+
const n = d.Buffer.alloc(1e3), s = k(e), a = this.ixLayout.get(s);
|
|
478
456
|
if (!a)
|
|
479
457
|
throw new Error(`Unknown method: ${s}`);
|
|
480
458
|
const i = a.encode(t, n), o = n.slice(0, i);
|
|
481
|
-
return
|
|
459
|
+
return Ze(F[$e(s)], o);
|
|
482
460
|
}
|
|
483
461
|
encodeState(e, t) {
|
|
484
462
|
throw new Error("Wormhole program does not have state");
|
|
485
463
|
}
|
|
486
464
|
decode(e, t = "hex") {
|
|
487
465
|
var o;
|
|
488
|
-
typeof e == "string" && (e = t === "hex" ?
|
|
489
|
-
let n =
|
|
466
|
+
typeof e == "string" && (e = t === "hex" ? d.Buffer.from(e, "hex") : ke.decode(e));
|
|
467
|
+
let n = d.Buffer.from(e.slice(0, 1)).readInt8(), s = d.Buffer.from(e.slice(1)), a = k(F[n] ?? "");
|
|
490
468
|
return this.ixLayout.get(a) ? { data: (o = this.ixLayout.get(a)) == null ? void 0 : o.decode(s), name: a } : null;
|
|
491
469
|
}
|
|
492
470
|
}
|
|
@@ -494,11 +472,11 @@ var F;
|
|
|
494
472
|
(function(r) {
|
|
495
473
|
r[r.Initialize = 0] = "Initialize", r[r.PostMessage = 1] = "PostMessage", r[r.PostVaa = 2] = "PostVaa", r[r.SetFees = 3] = "SetFees", r[r.TransferFees = 4] = "TransferFees", r[r.UpgradeContract = 5] = "UpgradeContract", r[r.UpgradeGuardianSet = 6] = "UpgradeGuardianSet", r[r.VerifySignatures = 7] = "VerifySignatures", r[r.PostMessageUnreliable = 8] = "PostMessageUnreliable";
|
|
496
474
|
})(F || (F = {}));
|
|
497
|
-
function
|
|
498
|
-
const t =
|
|
475
|
+
function Ze(r, e) {
|
|
476
|
+
const t = d.Buffer.alloc(1 + (e === void 0 ? 0 : e.length));
|
|
499
477
|
return t.writeUInt8(r, 0), e !== void 0 && t.write(e.toString("hex"), 1, "hex"), t;
|
|
500
478
|
}
|
|
501
|
-
class
|
|
479
|
+
class et {
|
|
502
480
|
constructor(e) {
|
|
503
481
|
}
|
|
504
482
|
encode(e, t) {
|
|
@@ -508,7 +486,7 @@ class tt {
|
|
|
508
486
|
throw new Error("Wormhole program does not have state");
|
|
509
487
|
}
|
|
510
488
|
}
|
|
511
|
-
class
|
|
489
|
+
class tt {
|
|
512
490
|
constructor(e) {
|
|
513
491
|
}
|
|
514
492
|
encode(e, t) {
|
|
@@ -518,14 +496,14 @@ class nt {
|
|
|
518
496
|
throw new Error("Wormhole program does not have user-defined types");
|
|
519
497
|
}
|
|
520
498
|
}
|
|
521
|
-
class
|
|
499
|
+
class nt {
|
|
522
500
|
constructor(e) {
|
|
523
501
|
u(this, "instruction");
|
|
524
502
|
u(this, "accounts");
|
|
525
503
|
u(this, "state");
|
|
526
504
|
u(this, "events");
|
|
527
505
|
u(this, "types");
|
|
528
|
-
this.instruction = new X(e), this.accounts = new
|
|
506
|
+
this.instruction = new X(e), this.accounts = new Xe(e), this.state = new et(e), this.events = new Qe(e), this.types = new tt(e);
|
|
529
507
|
}
|
|
530
508
|
}
|
|
531
509
|
const Q = {
|
|
@@ -1139,130 +1117,130 @@ const Q = {
|
|
|
1139
1117
|
}
|
|
1140
1118
|
]
|
|
1141
1119
|
};
|
|
1142
|
-
function
|
|
1143
|
-
return new
|
|
1120
|
+
function pe(r, e) {
|
|
1121
|
+
return new qe(Q, new p(r), e === void 0 ? { connection: null } : e, ye());
|
|
1144
1122
|
}
|
|
1145
1123
|
function w(r, e) {
|
|
1146
|
-
return
|
|
1124
|
+
return pe(r, Fe(e));
|
|
1147
1125
|
}
|
|
1148
|
-
function
|
|
1149
|
-
return new
|
|
1126
|
+
function ye() {
|
|
1127
|
+
return new nt(Q);
|
|
1150
1128
|
}
|
|
1151
|
-
function
|
|
1129
|
+
function rt(r, e, t, n) {
|
|
1152
1130
|
const s = w(e, r).methods.setFees();
|
|
1153
1131
|
return s._ixFn(...s._args, {
|
|
1154
|
-
accounts:
|
|
1132
|
+
accounts: he(e, t, n),
|
|
1155
1133
|
signers: void 0,
|
|
1156
1134
|
remainingAccounts: void 0,
|
|
1157
1135
|
preInstructions: void 0,
|
|
1158
1136
|
postInstructions: void 0
|
|
1159
1137
|
});
|
|
1160
1138
|
}
|
|
1161
|
-
function
|
|
1139
|
+
function he(r, e, t) {
|
|
1162
1140
|
return {
|
|
1163
|
-
payer: new
|
|
1141
|
+
payer: new p(e),
|
|
1164
1142
|
bridge: S(r),
|
|
1165
|
-
vaa: E(r,
|
|
1143
|
+
vaa: E(r, d.Buffer.from(t.hash)),
|
|
1166
1144
|
claim: T(r, t.emitterAddress.toString(), L(t.emitterChain), t.sequence),
|
|
1167
1145
|
systemProgram: M.programId
|
|
1168
1146
|
};
|
|
1169
1147
|
}
|
|
1170
|
-
function
|
|
1148
|
+
function st(r, e, t, n, s) {
|
|
1171
1149
|
const a = w(e, r).methods.transferFees();
|
|
1172
1150
|
return a._ixFn(...a._args, {
|
|
1173
|
-
accounts:
|
|
1151
|
+
accounts: Se(e, t, n, s),
|
|
1174
1152
|
signers: void 0,
|
|
1175
1153
|
remainingAccounts: void 0,
|
|
1176
1154
|
preInstructions: void 0,
|
|
1177
1155
|
postInstructions: void 0
|
|
1178
1156
|
});
|
|
1179
1157
|
}
|
|
1180
|
-
function
|
|
1158
|
+
function Se(r, e, t, n) {
|
|
1181
1159
|
return {
|
|
1182
|
-
payer: new
|
|
1160
|
+
payer: new p(e),
|
|
1183
1161
|
bridge: S(r),
|
|
1184
|
-
vaa: E(r,
|
|
1162
|
+
vaa: E(r, d.Buffer.from(n.hash)),
|
|
1185
1163
|
claim: T(r, n.emitterAddress.toString(), L(n.emitterChain), n.sequence),
|
|
1186
1164
|
feeCollector: C(r),
|
|
1187
|
-
recipient: new
|
|
1165
|
+
recipient: new p(t),
|
|
1188
1166
|
rent: U,
|
|
1189
1167
|
systemProgram: M.programId
|
|
1190
1168
|
};
|
|
1191
1169
|
}
|
|
1192
|
-
function
|
|
1170
|
+
function at(r, e, t, n) {
|
|
1193
1171
|
const s = w(e, r).methods.upgradeGuardianSet();
|
|
1194
1172
|
return s._ixFn(...s._args, {
|
|
1195
|
-
accounts:
|
|
1173
|
+
accounts: we(e, t, n),
|
|
1196
1174
|
signers: void 0,
|
|
1197
1175
|
remainingAccounts: void 0,
|
|
1198
1176
|
preInstructions: void 0,
|
|
1199
1177
|
postInstructions: void 0
|
|
1200
1178
|
});
|
|
1201
1179
|
}
|
|
1202
|
-
function
|
|
1180
|
+
function we(r, e, t) {
|
|
1203
1181
|
return {
|
|
1204
|
-
payer: new
|
|
1182
|
+
payer: new p(e),
|
|
1205
1183
|
bridge: S(r),
|
|
1206
|
-
vaa: E(r,
|
|
1184
|
+
vaa: E(r, d.Buffer.from(t.hash)),
|
|
1207
1185
|
claim: T(r, t.emitterAddress.toString(), L(t.emitterChain), t.sequence),
|
|
1208
1186
|
guardianSetOld: x(r, t.guardianSet),
|
|
1209
1187
|
guardianSetNew: x(r, t.guardianSet + 1),
|
|
1210
1188
|
systemProgram: M.programId
|
|
1211
1189
|
};
|
|
1212
1190
|
}
|
|
1213
|
-
function
|
|
1191
|
+
function it(r, e, t, n) {
|
|
1214
1192
|
const s = w(e, r).methods.upgradeContract();
|
|
1215
1193
|
return s._ixFn(...s._args, {
|
|
1216
|
-
accounts:
|
|
1194
|
+
accounts: Me(e, t, n),
|
|
1217
1195
|
signers: void 0,
|
|
1218
1196
|
remainingAccounts: void 0,
|
|
1219
1197
|
preInstructions: void 0,
|
|
1220
1198
|
postInstructions: void 0
|
|
1221
1199
|
});
|
|
1222
1200
|
}
|
|
1223
|
-
function
|
|
1201
|
+
function Me(r, e, t, n) {
|
|
1224
1202
|
const { newContract: s } = t.payload.actionArgs;
|
|
1225
1203
|
return {
|
|
1226
|
-
payer: new
|
|
1204
|
+
payer: new p(e),
|
|
1227
1205
|
bridge: S(r),
|
|
1228
|
-
vaa: E(r,
|
|
1206
|
+
vaa: E(r, d.Buffer.from(t.hash)),
|
|
1229
1207
|
claim: T(r, t.emitterAddress.toString(), L(t.emitterChain), t.sequence),
|
|
1230
|
-
upgradeAuthority:
|
|
1231
|
-
spill: new
|
|
1208
|
+
upgradeAuthority: me(r),
|
|
1209
|
+
spill: new p(n === void 0 ? e : n),
|
|
1232
1210
|
implementation: new q(s).unwrap(),
|
|
1233
|
-
programData:
|
|
1234
|
-
wormholeProgram: new
|
|
1211
|
+
programData: Ne(r),
|
|
1212
|
+
wormholeProgram: new p(r),
|
|
1235
1213
|
rent: U,
|
|
1236
1214
|
clock: V,
|
|
1237
|
-
bpfLoaderUpgradeable:
|
|
1215
|
+
bpfLoaderUpgradeable: oe,
|
|
1238
1216
|
systemProgram: M.programId
|
|
1239
1217
|
};
|
|
1240
1218
|
}
|
|
1241
|
-
function
|
|
1242
|
-
const i = w(e, r).methods.initialize(n, new
|
|
1219
|
+
function ot(r, e, t, n, s, a) {
|
|
1220
|
+
const i = w(e, r).methods.initialize(n, new ie(s.toString()), [
|
|
1243
1221
|
...a.map((o) => [...new Uint8Array(o)])
|
|
1244
1222
|
]);
|
|
1245
1223
|
return i._ixFn(...i._args, {
|
|
1246
|
-
accounts:
|
|
1224
|
+
accounts: be(e, t),
|
|
1247
1225
|
signers: void 0,
|
|
1248
1226
|
remainingAccounts: void 0,
|
|
1249
1227
|
preInstructions: void 0,
|
|
1250
1228
|
postInstructions: void 0
|
|
1251
1229
|
});
|
|
1252
1230
|
}
|
|
1253
|
-
function
|
|
1231
|
+
function be(r, e) {
|
|
1254
1232
|
return {
|
|
1255
1233
|
bridge: S(r),
|
|
1256
1234
|
guardianSet: x(r, 0),
|
|
1257
1235
|
feeCollector: C(r),
|
|
1258
|
-
payer: new
|
|
1236
|
+
payer: new p(e),
|
|
1259
1237
|
clock: V,
|
|
1260
1238
|
rent: U,
|
|
1261
1239
|
systemProgram: M.programId
|
|
1262
1240
|
};
|
|
1263
1241
|
}
|
|
1264
1242
|
function Ie(r, e, t, n, s, a, i) {
|
|
1265
|
-
const o = w(e, r).methods.postMessage(a,
|
|
1243
|
+
const o = w(e, r).methods.postMessage(a, d.Buffer.from(s), i);
|
|
1266
1244
|
return o._ixFn(...o._args, {
|
|
1267
1245
|
accounts: Z(e, t, n),
|
|
1268
1246
|
signers: void 0,
|
|
@@ -1273,19 +1251,19 @@ function Ie(r, e, t, n, s, a, i) {
|
|
|
1273
1251
|
}
|
|
1274
1252
|
function Z(r, e, t, n) {
|
|
1275
1253
|
let s;
|
|
1276
|
-
return n ? { emitter: n, sequence: s } =
|
|
1254
|
+
return n ? { emitter: n, sequence: s } = J(n, r) : (n = e, s = O(n, r)), {
|
|
1277
1255
|
bridge: S(r),
|
|
1278
|
-
message: new
|
|
1279
|
-
emitter: new
|
|
1256
|
+
message: new p(t),
|
|
1257
|
+
emitter: new p(n),
|
|
1280
1258
|
sequence: s,
|
|
1281
|
-
payer: new
|
|
1259
|
+
payer: new p(e),
|
|
1282
1260
|
feeCollector: C(r),
|
|
1283
1261
|
clock: V,
|
|
1284
1262
|
rent: U,
|
|
1285
1263
|
systemProgram: M.programId
|
|
1286
1264
|
};
|
|
1287
1265
|
}
|
|
1288
|
-
function
|
|
1266
|
+
function Ae(r, e, t, n, s) {
|
|
1289
1267
|
const a = w(e, r).methods.postVaa(
|
|
1290
1268
|
1,
|
|
1291
1269
|
// TODO: hardcoded VAA version
|
|
@@ -1294,66 +1272,66 @@ function xe(r, e, t, n, s) {
|
|
|
1294
1272
|
n.nonce,
|
|
1295
1273
|
L(n.emitterChain),
|
|
1296
1274
|
[...n.emitterAddress.toUint8Array()],
|
|
1297
|
-
new
|
|
1275
|
+
new ie(n.sequence.toString()),
|
|
1298
1276
|
n.consistencyLevel,
|
|
1299
1277
|
// Note: This _must_ be a Buffer, a Uint8Array does not work
|
|
1300
|
-
|
|
1278
|
+
d.Buffer.from(Pe(n.payloadLiteral, n.payload))
|
|
1301
1279
|
);
|
|
1302
1280
|
return a._ixFn(...a._args, {
|
|
1303
|
-
accounts:
|
|
1281
|
+
accounts: xe(e, t, s, n),
|
|
1304
1282
|
signers: void 0,
|
|
1305
1283
|
remainingAccounts: void 0,
|
|
1306
1284
|
preInstructions: void 0,
|
|
1307
1285
|
postInstructions: void 0
|
|
1308
1286
|
});
|
|
1309
1287
|
}
|
|
1310
|
-
function
|
|
1288
|
+
function xe(r, e, t, n) {
|
|
1311
1289
|
return {
|
|
1312
1290
|
guardianSet: x(r, n.guardianSet),
|
|
1313
1291
|
bridge: S(r),
|
|
1314
|
-
signatureSet: new
|
|
1315
|
-
vaa: E(r,
|
|
1316
|
-
payer: new
|
|
1292
|
+
signatureSet: new p(t),
|
|
1293
|
+
vaa: E(r, d.Buffer.from(n.hash)),
|
|
1294
|
+
payer: new p(e),
|
|
1317
1295
|
clock: V,
|
|
1318
1296
|
rent: U,
|
|
1319
1297
|
systemProgram: M.programId
|
|
1320
1298
|
};
|
|
1321
1299
|
}
|
|
1322
|
-
const
|
|
1323
|
-
async function
|
|
1324
|
-
const i = n.guardianSet, o = await
|
|
1325
|
-
for (let y = 0; y < Math.ceil(c.length /
|
|
1326
|
-
const h = y *
|
|
1327
|
-
for (let K = 0; K <
|
|
1300
|
+
const ut = 19;
|
|
1301
|
+
async function Ee(r, e, t, n, s, a) {
|
|
1302
|
+
const i = n.guardianSet, o = await W(r, e, i, a), c = n.signatures, f = o.keys, g = 7, l = [];
|
|
1303
|
+
for (let y = 0; y < Math.ceil(c.length / g); ++y) {
|
|
1304
|
+
const h = y * g, I = Math.min(c.length, (y + 1) * g), _ = new Array(ut).fill(-1), ee = [], te = [];
|
|
1305
|
+
for (let K = 0; K < I - h; ++K) {
|
|
1328
1306
|
const Y = c.at(K + h);
|
|
1329
|
-
ee.push(
|
|
1307
|
+
ee.push(d.Buffer.from(Y.signature.encode())), te.push(f.at(Y.guardianIndex)), _[Y.guardianIndex] = K;
|
|
1330
1308
|
}
|
|
1331
|
-
|
|
1309
|
+
l.push(He(ee, te, d.Buffer.from(n.hash))), l.push(ct(r, e, t, n, s, _));
|
|
1332
1310
|
}
|
|
1333
|
-
return
|
|
1311
|
+
return l;
|
|
1334
1312
|
}
|
|
1335
|
-
function
|
|
1313
|
+
function ct(r, e, t, n, s, a) {
|
|
1336
1314
|
const i = w(e, r).methods.verifySignatures(a);
|
|
1337
1315
|
return i._ixFn(...i._args, {
|
|
1338
|
-
accounts:
|
|
1316
|
+
accounts: Be(e, t, s, n),
|
|
1339
1317
|
signers: void 0,
|
|
1340
1318
|
remainingAccounts: void 0,
|
|
1341
1319
|
preInstructions: void 0,
|
|
1342
1320
|
postInstructions: void 0
|
|
1343
1321
|
});
|
|
1344
1322
|
}
|
|
1345
|
-
function
|
|
1323
|
+
function Be(r, e, t, n) {
|
|
1346
1324
|
return {
|
|
1347
|
-
payer: new
|
|
1325
|
+
payer: new p(e),
|
|
1348
1326
|
guardianSet: x(r, n.guardianSet),
|
|
1349
|
-
signatureSet: new
|
|
1350
|
-
instructions:
|
|
1327
|
+
signatureSet: new p(t),
|
|
1328
|
+
instructions: ve,
|
|
1351
1329
|
rent: U,
|
|
1352
1330
|
systemProgram: M.programId
|
|
1353
1331
|
};
|
|
1354
1332
|
}
|
|
1355
|
-
function
|
|
1356
|
-
const { emitter: t, sequence: n } =
|
|
1333
|
+
function gt(r, e) {
|
|
1334
|
+
const { emitter: t, sequence: n } = J(r, e);
|
|
1357
1335
|
return {
|
|
1358
1336
|
wormholeBridge: S(e),
|
|
1359
1337
|
wormholeEmitter: t,
|
|
@@ -1361,7 +1339,7 @@ function dt(r, e) {
|
|
|
1361
1339
|
wormholeFeeCollector: C(e)
|
|
1362
1340
|
};
|
|
1363
1341
|
}
|
|
1364
|
-
function
|
|
1342
|
+
function dt(r, e, t, n) {
|
|
1365
1343
|
const s = Z(e, t, n, r);
|
|
1366
1344
|
return {
|
|
1367
1345
|
payer: s.payer,
|
|
@@ -1375,51 +1353,51 @@ function ft(r, e, t, n) {
|
|
|
1375
1353
|
systemProgram: s.systemProgram
|
|
1376
1354
|
};
|
|
1377
1355
|
}
|
|
1378
|
-
const
|
|
1356
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1379
1357
|
__proto__: null,
|
|
1380
1358
|
BridgeConfig: D,
|
|
1381
|
-
BridgeData:
|
|
1359
|
+
BridgeData: G,
|
|
1382
1360
|
GuardianSetData: R,
|
|
1383
1361
|
SequenceTracker: N,
|
|
1384
1362
|
SignatureSetData: $,
|
|
1385
|
-
coder:
|
|
1386
|
-
createBridgeFeeTransferInstruction:
|
|
1387
|
-
createInitializeInstruction:
|
|
1363
|
+
coder: ye,
|
|
1364
|
+
createBridgeFeeTransferInstruction: le,
|
|
1365
|
+
createInitializeInstruction: ot,
|
|
1388
1366
|
createPostMessageInstruction: Ie,
|
|
1389
|
-
createPostVaaInstruction:
|
|
1367
|
+
createPostVaaInstruction: Ae,
|
|
1390
1368
|
createReadOnlyWormholeProgramInterface: w,
|
|
1391
|
-
createSetFeesInstruction:
|
|
1392
|
-
createTransferFeesInstruction:
|
|
1393
|
-
createUpgradeContractInstruction:
|
|
1394
|
-
createUpgradeGuardianSetInstruction:
|
|
1395
|
-
createVerifySignaturesInstructions:
|
|
1396
|
-
createWormholeProgramInterface:
|
|
1369
|
+
createSetFeesInstruction: rt,
|
|
1370
|
+
createTransferFeesInstruction: st,
|
|
1371
|
+
createUpgradeContractInstruction: it,
|
|
1372
|
+
createUpgradeGuardianSetInstruction: at,
|
|
1373
|
+
createVerifySignaturesInstructions: Ee,
|
|
1374
|
+
createWormholeProgramInterface: pe,
|
|
1397
1375
|
deriveClaimKey: T,
|
|
1398
|
-
deriveEmitterSequenceKey:
|
|
1376
|
+
deriveEmitterSequenceKey: O,
|
|
1399
1377
|
deriveFeeCollectorKey: C,
|
|
1400
1378
|
deriveGuardianSetKey: x,
|
|
1401
1379
|
derivePostedVaaKey: E,
|
|
1402
|
-
deriveUpgradeAuthorityKey:
|
|
1380
|
+
deriveUpgradeAuthorityKey: me,
|
|
1403
1381
|
deriveWormholeBridgeDataKey: S,
|
|
1404
|
-
deriveWormholeEmitterKey:
|
|
1405
|
-
getClaim:
|
|
1406
|
-
getEmitterKeys:
|
|
1407
|
-
getGuardianSet:
|
|
1408
|
-
getInitializeAccounts:
|
|
1382
|
+
deriveWormholeEmitterKey: H,
|
|
1383
|
+
getClaim: Ye,
|
|
1384
|
+
getEmitterKeys: J,
|
|
1385
|
+
getGuardianSet: W,
|
|
1386
|
+
getInitializeAccounts: be,
|
|
1409
1387
|
getPostMessageAccounts: Z,
|
|
1410
|
-
getPostMessageCpiAccounts:
|
|
1411
|
-
getPostVaaAccounts:
|
|
1412
|
-
getProgramSequenceTracker:
|
|
1413
|
-
getSequenceTracker:
|
|
1414
|
-
getSetFeesAccounts:
|
|
1415
|
-
getSignatureSetData:
|
|
1416
|
-
getTransferFeesAccounts:
|
|
1417
|
-
getUpgradeContractAccounts:
|
|
1418
|
-
getUpgradeGuardianSetAccounts:
|
|
1419
|
-
getVerifySignatureAccounts:
|
|
1420
|
-
getWormholeBridgeData:
|
|
1421
|
-
getWormholeDerivedAccounts:
|
|
1422
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1388
|
+
getPostMessageCpiAccounts: dt,
|
|
1389
|
+
getPostVaaAccounts: xe,
|
|
1390
|
+
getProgramSequenceTracker: je,
|
|
1391
|
+
getSequenceTracker: fe,
|
|
1392
|
+
getSetFeesAccounts: he,
|
|
1393
|
+
getSignatureSetData: We,
|
|
1394
|
+
getTransferFeesAccounts: Se,
|
|
1395
|
+
getUpgradeContractAccounts: Me,
|
|
1396
|
+
getUpgradeGuardianSetAccounts: we,
|
|
1397
|
+
getVerifySignatureAccounts: Be,
|
|
1398
|
+
getWormholeBridgeData: de,
|
|
1399
|
+
getWormholeDerivedAccounts: gt
|
|
1400
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = "Program log: Sequence: ";
|
|
1423
1401
|
class v {
|
|
1424
1402
|
constructor(e, t, n, s) {
|
|
1425
1403
|
u(this, "network");
|
|
@@ -1437,7 +1415,7 @@ class v {
|
|
|
1437
1415
|
this.address = a, this.coreBridge = w(a, n);
|
|
1438
1416
|
}
|
|
1439
1417
|
async getGuardianSet(e) {
|
|
1440
|
-
const t = await
|
|
1418
|
+
const t = await W(this.connection, this.coreBridge.programId, e);
|
|
1441
1419
|
return {
|
|
1442
1420
|
index: t.index,
|
|
1443
1421
|
keys: t.keys.map((n) => n.toString("hex")),
|
|
@@ -1445,13 +1423,13 @@ class v {
|
|
|
1445
1423
|
};
|
|
1446
1424
|
}
|
|
1447
1425
|
static async fromRpc(e, t) {
|
|
1448
|
-
const [n, s] = await
|
|
1426
|
+
const [n, s] = await Ve.chainFromRpc(e), a = t[s];
|
|
1449
1427
|
if (a.network !== n)
|
|
1450
1428
|
throw new Error(`Network mismatch for chain ${s}: ${a.network} != ${n}`);
|
|
1451
1429
|
return new v(n, s, e, t[s].contracts);
|
|
1452
1430
|
}
|
|
1453
1431
|
async ensureBridgeConfig() {
|
|
1454
|
-
this.bridgeData || (this.bridgeData = await
|
|
1432
|
+
this.bridgeData || (this.bridgeData = await de(this.connection, this.coreBridge.programId));
|
|
1455
1433
|
}
|
|
1456
1434
|
async getMessageFee() {
|
|
1457
1435
|
return await this.ensureBridgeConfig(), this.bridgeData.config.fee;
|
|
@@ -1460,39 +1438,39 @@ class v {
|
|
|
1460
1438
|
return await this.ensureBridgeConfig(), this.bridgeData.guardianSetIndex;
|
|
1461
1439
|
}
|
|
1462
1440
|
async *publishMessage(e, t, n, s) {
|
|
1463
|
-
const a = re.generate(), i = new q(e).unwrap(), o = Ie(this.connection, this.coreBridge.programId, i, a.publicKey, t, n, s), c = await this.getMessageFee(), f =
|
|
1464
|
-
|
|
1441
|
+
const a = re.generate(), i = new q(e).unwrap(), o = Ie(this.connection, this.coreBridge.programId, i, a.publicKey, t, n, s), c = await this.getMessageFee(), f = le(this.coreBridge.programId, i, c), g = new j();
|
|
1442
|
+
g.feePayer = i, g.add(f, o), yield this.createUnsignedTx({ transaction: g, signers: [a] }, "Core.PublishMessage");
|
|
1465
1443
|
}
|
|
1466
1444
|
async *verifyMessage(e, t) {
|
|
1467
1445
|
yield* this.postVaa(e, t);
|
|
1468
1446
|
}
|
|
1469
1447
|
async *postVaa(e, t) {
|
|
1470
|
-
const n = E(this.coreBridge.programId,
|
|
1448
|
+
const n = E(this.coreBridge.programId, d.Buffer.from(t.hash));
|
|
1471
1449
|
if (await this.connection.getAccountInfo(n))
|
|
1472
1450
|
return;
|
|
1473
|
-
const a = new q(e).unwrap(), i = re.generate(), o = await
|
|
1451
|
+
const a = new q(e).unwrap(), i = re.generate(), o = await Ee(this.connection, this.coreBridge.programId, a, t, i.publicKey);
|
|
1474
1452
|
for (let f = 0; f < o.length; f += 2) {
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1453
|
+
const g = new j().add(...o.slice(f, f + 2));
|
|
1454
|
+
g.feePayer = a, yield this.createUnsignedTx({ transaction: g, signers: [i] }, "Core.VerifySignature", !0);
|
|
1477
1455
|
}
|
|
1478
|
-
const c = new j().add(
|
|
1456
|
+
const c = new j().add(Ae(this.connection, this.coreBridge.programId, a, t, i.publicKey));
|
|
1479
1457
|
c.feePayer = a, yield this.createUnsignedTx({ transaction: c }, "Core.PostVAA");
|
|
1480
1458
|
}
|
|
1481
1459
|
static parseSequenceFromLog(e, t) {
|
|
1482
|
-
var c, f,
|
|
1460
|
+
var c, f, g, l;
|
|
1483
1461
|
const { meta: n, transaction: { message: s } } = t;
|
|
1484
1462
|
if (!((c = n == null ? void 0 : n.innerInstructions) != null && c.length))
|
|
1485
1463
|
return [];
|
|
1486
1464
|
const a = s.staticAccountKeys;
|
|
1487
1465
|
if (a.filter((y) => y.toString() === e).length === 0)
|
|
1488
1466
|
return [];
|
|
1489
|
-
const i = (
|
|
1467
|
+
const i = (l = (g = (f = n == null ? void 0 : n.logMessages) == null ? void 0 : f.filter((y) => y.startsWith(ae))) == null ? void 0 : g[0]) == null ? void 0 : l.replace(ae, "");
|
|
1490
1468
|
if (!i)
|
|
1491
1469
|
return [];
|
|
1492
1470
|
const o = [];
|
|
1493
1471
|
for (const y of n == null ? void 0 : n.innerInstructions) {
|
|
1494
1472
|
const h = y.instructions;
|
|
1495
|
-
o.push(...h.filter((
|
|
1473
|
+
o.push(...h.filter((I) => I.programIdIndex in a && a[I.programIdIndex].toString() === e));
|
|
1496
1474
|
}
|
|
1497
1475
|
return o.length < 1 ? [] : a.length < 3 ? [] : o.map((y) => [new q(a[y.accounts[2]]).toUniversalAddress(), BigInt(i)]).filter((y) => y !== null);
|
|
1498
1476
|
}
|
|
@@ -1522,7 +1500,7 @@ class v {
|
|
|
1522
1500
|
var c;
|
|
1523
1501
|
const { meta: n, transaction: { message: s } } = t, a = this.coreBridge.programId, i = (c = n.innerInstructions) == null ? void 0 : c.flatMap((f) => f.instructions.filter(
|
|
1524
1502
|
// find the instructions where the programId equals the Wormhole ProgramId
|
|
1525
|
-
(
|
|
1503
|
+
(g) => a.toString() === e.get(g.programIdIndex).toString()
|
|
1526
1504
|
)).map((f) => ({
|
|
1527
1505
|
programIdIndex: f.programIdIndex,
|
|
1528
1506
|
accountKeyIndexes: f.accounts
|
|
@@ -1533,10 +1511,10 @@ class v {
|
|
|
1533
1511
|
const t = await this.connection.getAccountInfo(e);
|
|
1534
1512
|
if (!(t != null && t.data))
|
|
1535
1513
|
throw new Error("No data found in message account");
|
|
1536
|
-
const { timestamp: n, emitterAddress: s, emitterChain: a, consistencyLevel: i, sequence: o, nonce: c, payload: f } =
|
|
1514
|
+
const { timestamp: n, emitterAddress: s, emitterChain: a, consistencyLevel: i, sequence: o, nonce: c, payload: f } = ge(new Uint8Array(t == null ? void 0 : t.data));
|
|
1537
1515
|
return Ge("Uint8Array", {
|
|
1538
1516
|
guardianSet: await this.getGuardianSetIndex(),
|
|
1539
|
-
emitterChain:
|
|
1517
|
+
emitterChain: ze(a),
|
|
1540
1518
|
timestamp: n,
|
|
1541
1519
|
emitterAddress: s,
|
|
1542
1520
|
consistencyLevel: i,
|
|
@@ -1595,39 +1573,35 @@ class v {
|
|
|
1595
1573
|
return await Promise.all(a);
|
|
1596
1574
|
}
|
|
1597
1575
|
createUnsignedTx(e, t, n = !1) {
|
|
1598
|
-
return new
|
|
1576
|
+
return new De(e, this.network, this.chain, t, n);
|
|
1599
1577
|
}
|
|
1600
1578
|
}
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1579
|
+
Oe(Ke, "WormholeCore", v);
|
|
1580
|
+
const Mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1603
1581
|
__proto__: null,
|
|
1604
1582
|
IDL: Q,
|
|
1605
1583
|
SolanaWormholeCore: v,
|
|
1606
|
-
deserializePostMessage:
|
|
1607
|
-
postMessageLayout:
|
|
1608
|
-
utils:
|
|
1584
|
+
deserializePostMessage: ge,
|
|
1585
|
+
postMessageLayout: ce,
|
|
1586
|
+
utils: ft
|
|
1609
1587
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1610
1588
|
export {
|
|
1611
|
-
|
|
1589
|
+
oe as B,
|
|
1612
1590
|
v as S,
|
|
1613
1591
|
C as a,
|
|
1614
|
-
|
|
1592
|
+
je as b,
|
|
1615
1593
|
S as c,
|
|
1616
1594
|
E as d,
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1595
|
+
H as e,
|
|
1596
|
+
O as f,
|
|
1597
|
+
gt as g,
|
|
1620
1598
|
T as h,
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
ft as q,
|
|
1630
|
-
je as r,
|
|
1631
|
-
pe as s,
|
|
1632
|
-
At as t
|
|
1599
|
+
ue as i,
|
|
1600
|
+
Z as j,
|
|
1601
|
+
Ne as k,
|
|
1602
|
+
me as l,
|
|
1603
|
+
dt as m,
|
|
1604
|
+
Ye as n,
|
|
1605
|
+
le as o,
|
|
1606
|
+
Mt as p
|
|
1633
1607
|
};
|