@wormhole-foundation/wormhole-connect 2.5.0-beta.0-development → 2.5.0-beta.2-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 (133) hide show
  1. package/dist/assets/{aptos-t5JANz4b.js → aptos-BGyyK8mz.js} +3 -3
  2. package/dist/assets/{aptos-DvAOSqnD.js → aptos-Cepohe0c.js} +1 -1
  3. package/dist/assets/{blake2b-CzqSqyTv.js → blake2b-BwI-z5NJ.js} +1 -1
  4. package/dist/assets/{ccip-4EBcfi6P.js → ccip-BpjdU5zN.js} +1 -1
  5. package/dist/assets/{chunk-IMTC3J2M-Cms0K4gx.js → chunk-IMTC3J2M-CWE1FuDc.js} +1 -1
  6. package/dist/assets/events-6PekJgMN.js +1 -0
  7. package/dist/assets/{evm-8e-eySdo.js → evm-DS7RCBlt.js} +2 -2
  8. package/dist/assets/{evm-CYjbe4kH.js → evm-DvDOQf0K.js} +4 -4
  9. package/dist/assets/{index-M2j4uONF.js → index-5kmPKAJ_.js} +1 -1
  10. package/dist/assets/{index-DALVDBZq.js → index-BP8gdgNH.js} +1 -1
  11. package/dist/assets/{index-BgVVAYar.js → index-BXRb91Mn.js} +1 -1
  12. package/dist/assets/{index-SO_H3W5I.js → index-Bbr14gKC.js} +1 -1
  13. package/dist/assets/index-BjVbgKwL.js +1 -0
  14. package/dist/assets/{index-JtvUouOr.js → index-BwPu1wGj.js} +1 -1
  15. package/dist/assets/{index-CwGBYrGm.js → index-BxXKtU8j.js} +1 -1
  16. package/dist/assets/{index-BKj7Inys.js → index-BzNSt2uL.js} +1 -1
  17. package/dist/assets/{index-CSHmWPOV.js → index-C1f05Vbe.js} +1 -1
  18. package/dist/assets/{index-BcX-2q-J.js → index-C74fy0qh.js} +1 -1
  19. package/dist/assets/{index-Dl17aI3S.js → index-CCOom38X.js} +1 -1
  20. package/dist/assets/{index-C0rvraea.js → index-CHnF49kB.js} +1 -1
  21. package/dist/assets/{index-DmaqQuhH.js → index-CyxmcHOs.js} +1 -1
  22. package/dist/assets/{index-Chd_bwGM.js → index-D1MoRUWm.js} +1 -1
  23. package/dist/assets/{index-CqA1lXp5.js → index-D54DXHBu.js} +1 -1
  24. package/dist/assets/index-D8nnAO88.js +1 -0
  25. package/dist/assets/index-DpMc0uqY.js +1 -0
  26. package/dist/assets/{index-Ced_GF9G.js → index-FNyibGfB.js} +2 -2
  27. package/dist/assets/{index-D9U4BOHM.js → index-X7Qc-hll.js} +1 -1
  28. package/dist/assets/{index-CcMXeWAX.js → index-YqzS8F8M.js} +2 -2
  29. package/dist/assets/{index.es-Bzsluoyw.js → index.es-B2WvD5Rz.js} +6 -6
  30. package/dist/assets/{solana-BHeUantu.js → solana-Dj3oh4lV.js} +2 -2
  31. package/dist/assets/solana-DseaNtL0.js +2 -0
  32. package/dist/assets/solanaEmbed.esm-xl7iC7nm.js +37 -0
  33. package/dist/assets/sui-BdOrw1dc.js +2 -0
  34. package/dist/assets/{sui-CLrvrAHM.js → sui-Ck-FZzH_.js} +1 -1
  35. package/dist/assets/unsignedTransaction-arVvzoJx.js +1 -0
  36. package/dist/main.js +102 -102
  37. package/dist/src/AppRouter.d.ts.map +1 -1
  38. package/dist/src/utils/coingecko.d.ts.map +1 -1
  39. package/lib/{aptos-By3qLiAP.js → aptos-BHFBFxf9.js} +1 -1
  40. package/lib/{aptos-C3Ph4uY9.mjs → aptos-BusONhYq.mjs} +5 -5
  41. package/lib/{aptos-Cs46Nns5.mjs → aptos-DS0eK_De.mjs} +2 -2
  42. package/lib/{aptos-D7X5GMcO.js → aptos-Dqp93_ct.js} +2 -2
  43. package/lib/{base64-B-n8C-1n.js → base64-Cjk6rii_.js} +1 -1
  44. package/lib/{base64-DxqKuhqD.mjs → base64-Vgzj53Io.mjs} +1 -1
  45. package/lib/{ccip-BoG9ZHRV.js → ccip-BLUli_Dz.js} +1 -1
  46. package/lib/{ccip-DgwbitdX.mjs → ccip-FbY2UZlg.mjs} +1 -1
  47. package/lib/{chunk-IMTC3J2M-DfLEkM5Z.js → chunk-IMTC3J2M-6yduhw0s.js} +1 -1
  48. package/lib/{chunk-IMTC3J2M-w136PyXJ.mjs → chunk-IMTC3J2M-AkEA0_z6.mjs} +3 -3
  49. package/lib/{evm-Bta1KBsb.js → evm-BB0d_Gf4.js} +2 -2
  50. package/lib/{evm--NPB9x1d.mjs → evm-DAHEa0cY.mjs} +5 -5
  51. package/lib/{evm-BwXOj4Er.js → evm-DZww7tTt.js} +3 -3
  52. package/lib/{evm-OXQXmbRf.mjs → evm-gEzFFEsO.mjs} +6 -6
  53. package/lib/{index-C2jvFfvC.js → index-6m6Q8Vsa.js} +1 -1
  54. package/lib/{index-0m16n7L7.js → index-8STuBnQE.js} +1 -1
  55. package/lib/{index-hFtbBndd.js → index-B5i1j7Dy.js} +1 -1
  56. package/lib/{index-CoEGiDGu.js → index-BZh72NtL.js} +1 -1
  57. package/lib/{index-C86P0A0Y.mjs → index-BaMrMiTv.mjs} +1 -1
  58. package/lib/{index-BEHglvs0.js → index-BbxXJYWg.js} +1 -1
  59. package/lib/{index-ByicGRKs.mjs → index-Bcl7n3KD.mjs} +2 -2
  60. package/lib/{index-Bi6PAFR8.mjs → index-BeYO1LV3.mjs} +2 -2
  61. package/lib/{index-wsfzS6PN.js → index-Bhgci81L.js} +120 -120
  62. package/lib/{index-CWffCIQl.js → index-BuPKwE_4.js} +1 -1
  63. package/lib/{index-C5tynAhb.mjs → index-C27ZY3oS.mjs} +1 -1
  64. package/lib/{index-bDliG7yg.mjs → index-C6YOw6gB.mjs} +4 -4
  65. package/lib/{index-1WX3nZoM.mjs → index-CA09NOzo.mjs} +3 -3
  66. package/lib/index-CHaex8L3.mjs +75 -0
  67. package/lib/{index-B5z5oFY1.js → index-CSK3DRpf.js} +1 -1
  68. package/lib/{index-Cslbrg97.js → index-CT45reKG.js} +1 -1
  69. package/lib/{index-PnMJX4OC.mjs → index-CkXJo6xD.mjs} +1 -1
  70. package/lib/{index-FGc8swXY.mjs → index-Cs1dlfzD.mjs} +1 -1
  71. package/lib/{index-CKtZvS3X.mjs → index-CxTd6N-A.mjs} +2 -2
  72. package/lib/{index-CGbtcED2.mjs → index-D9hjnIst.mjs} +2 -2
  73. package/lib/{index-CksJcNrV.mjs → index-DDZaEBsC.mjs} +3 -3
  74. package/lib/{index-CDwpyfnd.mjs → index-DR-fv3uE.mjs} +2 -2
  75. package/lib/{index-BGqNMVpQ.js → index-DUC1gOTG.js} +1 -1
  76. package/lib/{index-Bpx_Rf1J.js → index-DUZnVNwZ.js} +1 -1
  77. package/lib/{index-DLiQpgMj.js → index-DXzXHly-.js} +1 -1
  78. package/lib/{index-MytorfyK.mjs → index-D_PIxJ0d.mjs} +2 -2
  79. package/lib/index-D_XBMeuk.js +1 -0
  80. package/lib/{index-DSejRtdA.js → index-DcYZkDfF.js} +1 -1
  81. package/lib/{index-cyTUScMF.js → index-DhR1_nfh.js} +1 -1
  82. package/lib/index-DhowVYVk.mjs +191 -0
  83. package/lib/{index-BLxoZ8qT.js → index-DlNp9VMO.js} +1 -1
  84. package/lib/{index-zMaT9P4V.mjs → index-DpeIjsSi.mjs} +1 -1
  85. package/lib/{index-B3smMSuW.js → index-Ds5QMWJr.js} +1 -1
  86. package/lib/{index-BXc3l4Br.mjs → index-Ds6Q5qfX.mjs} +2 -2
  87. package/lib/{index-DlW1-aGm.js → index-DtjJKYjA.js} +1 -1
  88. package/lib/{index-ILKgpNXM.js → index-FoZ3qnSm.js} +1 -1
  89. package/lib/{index-CoX_24Ky.mjs → index-GSQqQOXb.mjs} +1 -1
  90. package/lib/{index-m0543tB2.mjs → index-LdDD7AAy.mjs} +20959 -32801
  91. package/lib/index-OqOcvaDE.mjs +654 -0
  92. package/lib/{index-50mhIuON.mjs → index-QCqnETT_.mjs} +2 -2
  93. package/lib/index-j8CdhHvQ.js +1 -0
  94. package/lib/{index-Dt0J9sau.js → index-pWRTEePn.js} +1 -1
  95. package/lib/{index-DPM7TGSv.mjs → index-pg4EQbm-.mjs} +11 -2
  96. package/lib/index-s9pQs8eO.js +1 -0
  97. package/lib/{index-CANn2DFq.mjs → index-tI4rmxN8.mjs} +1 -1
  98. package/lib/{index-NTAse-vE.js → index-u05I0QmU.js} +1 -1
  99. package/lib/{index.es-DIL345_I.js → index.es-BeAVotPr.js} +2 -2
  100. package/lib/{index.es-Bh1QXm67.mjs → index.es-Z5ZsZIyC.mjs} +5 -5
  101. package/lib/index.js +1 -1
  102. package/lib/index.mjs +19 -19
  103. package/lib/{signer-CeNONJjb.mjs → signer-B0f07_6U.mjs} +1 -1
  104. package/lib/{signer-Br2-fgMa.js → signer-yr6Zpc2i.js} +1 -1
  105. package/lib/{solana-C5lAA_Eh.mjs → solana-C-LeRjT-.mjs} +4 -4
  106. package/lib/solana-Ci7N1M7R.js +1 -0
  107. package/lib/solana-DCefclYK.mjs +17 -0
  108. package/lib/{solana-Bwwk-8HE.js → solana-DWYDxAWP.js} +1 -1
  109. package/lib/{solanaEmbed.esm-_NPc8tZC.mjs → solanaEmbed.esm-CEtmCHNm.mjs} +1 -1
  110. package/lib/{solanaEmbed.esm-BMTrlSVI.js → solanaEmbed.esm-D5pFIuXZ.js} +1 -1
  111. package/lib/src/AppRouter.d.ts.map +1 -1
  112. package/lib/src/utils/coingecko.d.ts.map +1 -1
  113. package/lib/sui-756LVCZm.js +1 -0
  114. package/lib/{sui-zLYQBpSC.js → sui-BIUo4whG.js} +1 -1
  115. package/lib/sui-BuI3_sI0.mjs +585 -0
  116. package/lib/{sui-X62i5q3_.mjs → sui-naAV3r83.mjs} +1 -1
  117. package/package.json +17 -17
  118. package/dist/assets/index-BRtMY3at.js +0 -1
  119. package/dist/assets/index-BUlVFUMr.js +0 -1
  120. package/dist/assets/index-RBS_ALc7.js +0 -1
  121. package/dist/assets/solana-BEFCVrXa.js +0 -2
  122. package/dist/assets/solanaEmbed.esm-B7A7qKmk.js +0 -37
  123. package/dist/assets/sui-C1wbtvIC.js +0 -2
  124. package/lib/index-CNkTJOH_.js +0 -1
  125. package/lib/index-DN6dWOSB.js +0 -1
  126. package/lib/index-DUOnxuE_.mjs +0 -252
  127. package/lib/index-DqFY4i5u.js +0 -1
  128. package/lib/index-Eomc9IwB.mjs +0 -936
  129. package/lib/index-fkzogQYE.mjs +0 -376
  130. package/lib/solana-4Qcfxe9o.js +0 -1
  131. package/lib/solana-DM9nG3cQ.mjs +0 -17
  132. package/lib/sui-BvJu9wTN.mjs +0 -701
  133. package/lib/sui-pGBefbTJ.js +0 -1
@@ -1,701 +0,0 @@
1
- var ee = Object.defineProperty;
2
- var te = (n, e, t) => e in n ? ee(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var y = (n, e, t) => te(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { ab as S, ac as E, ad as B, ae as ne, af as re, ag as se, ah as M, ai as L, aj as ie, ak as H, al as z, am as ae, an as h, $ as oe, ao as ce, a0 as ue, a2 as le, ap as de, a3 as he, aq as fe, a5 as ge, a6 as _, a7 as ye, ar as K, a9 as we, U as pe } from "./index-m0543tB2.mjs";
5
- import { m as me } from "./index-CANn2DFq.mjs";
6
- var v = {};
7
- Object.defineProperty(v, "__esModule", { value: !0 });
8
- v.bech32m = b = v.bech32 = void 0;
9
- const k = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", V = {};
10
- for (let n = 0; n < k.length; n++) {
11
- const e = k.charAt(n);
12
- V[e] = n;
13
- }
14
- function p(n) {
15
- const e = n >> 25;
16
- return (n & 33554431) << 5 ^ -(e >> 0 & 1) & 996825010 ^ -(e >> 1 & 1) & 642813549 ^ -(e >> 2 & 1) & 513874426 ^ -(e >> 3 & 1) & 1027748829 ^ -(e >> 4 & 1) & 705979059;
17
- }
18
- function F(n) {
19
- let e = 1;
20
- for (let t = 0; t < n.length; ++t) {
21
- const r = n.charCodeAt(t);
22
- if (r < 33 || r > 126)
23
- return "Invalid prefix (" + n + ")";
24
- e = p(e) ^ r >> 5;
25
- }
26
- e = p(e);
27
- for (let t = 0; t < n.length; ++t) {
28
- const r = n.charCodeAt(t);
29
- e = p(e) ^ r & 31;
30
- }
31
- return e;
32
- }
33
- function D(n, e, t, r) {
34
- let i = 0, a = 0;
35
- const s = (1 << t) - 1, o = [];
36
- for (let c = 0; c < n.length; ++c)
37
- for (i = i << e | n[c], a += e; a >= t; )
38
- a -= t, o.push(i >> a & s);
39
- if (r)
40
- a > 0 && o.push(i << t - a & s);
41
- else {
42
- if (a >= e)
43
- return "Excess padding";
44
- if (i << t - a & s)
45
- return "Non-zero padding";
46
- }
47
- return o;
48
- }
49
- function Se(n) {
50
- return D(n, 8, 5, !0);
51
- }
52
- function Ee(n) {
53
- const e = D(n, 5, 8, !1);
54
- if (Array.isArray(e))
55
- return e;
56
- }
57
- function ve(n) {
58
- const e = D(n, 5, 8, !1);
59
- if (Array.isArray(e))
60
- return e;
61
- throw new Error(e);
62
- }
63
- function j(n) {
64
- let e;
65
- n === "bech32" ? e = 1 : e = 734539939;
66
- function t(s, o, c) {
67
- if (c = c || 90, s.length + 7 + o.length > c)
68
- throw new TypeError("Exceeds length limit");
69
- s = s.toLowerCase();
70
- let l = F(s);
71
- if (typeof l == "string")
72
- throw new Error(l);
73
- let g = s + "1";
74
- for (let u = 0; u < o.length; ++u) {
75
- const d = o[u];
76
- if (d >> 5)
77
- throw new Error("Non 5-bit word");
78
- l = p(l) ^ d, g += k.charAt(d);
79
- }
80
- for (let u = 0; u < 6; ++u)
81
- l = p(l);
82
- l ^= e;
83
- for (let u = 0; u < 6; ++u) {
84
- const d = l >> (5 - u) * 5 & 31;
85
- g += k.charAt(d);
86
- }
87
- return g;
88
- }
89
- function r(s, o) {
90
- if (o = o || 90, s.length < 8)
91
- return s + " too short";
92
- if (s.length > o)
93
- return "Exceeds length limit";
94
- const c = s.toLowerCase(), l = s.toUpperCase();
95
- if (s !== c && s !== l)
96
- return "Mixed-case string " + s;
97
- s = c;
98
- const g = s.lastIndexOf("1");
99
- if (g === -1)
100
- return "No separator character for " + s;
101
- if (g === 0)
102
- return "Missing prefix for " + s;
103
- const u = s.slice(0, g), d = s.slice(g + 1);
104
- if (d.length < 6)
105
- return "Data too short";
106
- let m = F(u);
107
- if (typeof m == "string")
108
- return m;
109
- const U = [];
110
- for (let C = 0; C < d.length; ++C) {
111
- const N = d.charAt(C), I = V[N];
112
- if (I === void 0)
113
- return "Unknown character " + N;
114
- m = p(m) ^ I, !(C + 6 >= d.length) && U.push(I);
115
- }
116
- return m !== e ? "Invalid checksum for " + s : { prefix: u, words: U };
117
- }
118
- function i(s, o) {
119
- const c = r(s, o);
120
- if (typeof c == "object")
121
- return c;
122
- }
123
- function a(s, o) {
124
- const c = r(s, o);
125
- if (typeof c == "object")
126
- return c;
127
- throw new Error(c);
128
- }
129
- return {
130
- decodeUnsafe: i,
131
- decode: a,
132
- encode: t,
133
- toWords: Se,
134
- fromWordsUnsafe: Ee,
135
- fromWords: ve
136
- };
137
- }
138
- var b = v.bech32 = j("bech32");
139
- v.bech32m = j("bech32m");
140
- function q(n, e) {
141
- return S.IntentMessage(S.fixedArray(e.length, S.u8())).serialize({
142
- intent: {
143
- scope: { [n]: !0 },
144
- version: { V0: !0 },
145
- appId: { Sui: !0 }
146
- },
147
- value: e
148
- }).toBytes();
149
- }
150
- const R = {
151
- ED25519: 0,
152
- Secp256k1: 1,
153
- Secp256r1: 2,
154
- MultiSig: 3,
155
- ZkLogin: 5,
156
- Passkey: 6
157
- }, be = {
158
- ED25519: 32,
159
- Secp256k1: 33,
160
- Secp256r1: 33
161
- }, G = {
162
- 0: "ED25519",
163
- 1: "Secp256k1",
164
- 2: "Secp256r1",
165
- 3: "MultiSig",
166
- 5: "ZkLogin",
167
- 6: "Passkey"
168
- };
169
- function Z(n, e) {
170
- if (n === e) return !0;
171
- if (n.length !== e.length)
172
- return !1;
173
- for (let t = 0; t < n.length; t++)
174
- if (n[t] !== e[t])
175
- return !1;
176
- return !0;
177
- }
178
- class Ae {
179
- /**
180
- * Checks if two public keys are equal
181
- */
182
- equals(e) {
183
- return Z(this.toRawBytes(), e.toRawBytes());
184
- }
185
- /**
186
- * Return the base-64 representation of the public key
187
- */
188
- toBase64() {
189
- return E(this.toRawBytes());
190
- }
191
- toString() {
192
- throw new Error(
193
- "`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead."
194
- );
195
- }
196
- /**
197
- * Return the Sui representation of the public key encoded in
198
- * base-64. A Sui public key is formed by the concatenation
199
- * of the scheme flag with the raw bytes of the public key
200
- */
201
- toSuiPublicKey() {
202
- const e = this.toSuiBytes();
203
- return E(e);
204
- }
205
- verifyWithIntent(e, t, r) {
206
- const i = q(r, e), a = B(i, { dkLen: 32 });
207
- return this.verify(a, t);
208
- }
209
- /**
210
- * Verifies that the signature is valid for for the provided PersonalMessage
211
- */
212
- verifyPersonalMessage(e, t) {
213
- return this.verifyWithIntent(
214
- S.vector(S.u8()).serialize(e).toBytes(),
215
- t,
216
- "PersonalMessage"
217
- );
218
- }
219
- /**
220
- * Verifies that the signature is valid for for the provided Transaction
221
- */
222
- verifyTransaction(e, t) {
223
- return this.verifyWithIntent(e, t, "TransactionData");
224
- }
225
- /**
226
- * Verifies that the public key is associated with the provided address
227
- */
228
- verifyAddress(e) {
229
- return this.toSuiAddress() === e;
230
- }
231
- /**
232
- * Returns the bytes representation of the public key
233
- * prefixed with the signature scheme flag
234
- */
235
- toSuiBytes() {
236
- const e = this.toRawBytes(), t = new Uint8Array(e.length + 1);
237
- return t.set([this.flag()]), t.set(e, 1), t;
238
- }
239
- /**
240
- * Return the Sui address associated with this Ed25519 public key
241
- */
242
- toSuiAddress() {
243
- return ne(
244
- re(B(this.toSuiBytes(), { dkLen: 32 })).slice(0, se * 2)
245
- );
246
- }
247
- }
248
- function Ce(n) {
249
- const e = M(n), t = G[e[0]];
250
- switch (t) {
251
- case "ED25519":
252
- case "Secp256k1":
253
- case "Secp256r1":
254
- const r = be[t], i = e.slice(1, e.length - r), a = e.slice(1 + i.length);
255
- return {
256
- serializedSignature: n,
257
- signatureScheme: t,
258
- signature: i,
259
- publicKey: a,
260
- bytes: e
261
- };
262
- default:
263
- throw new Error("Unsupported signature scheme");
264
- }
265
- }
266
- function Ke({
267
- signature: n,
268
- signatureScheme: e,
269
- publicKey: t
270
- }) {
271
- if (!t)
272
- throw new Error("`publicKey` is required");
273
- const r = t.toRawBytes(), i = new Uint8Array(1 + n.length + r.length);
274
- return i.set([R[e]]), i.set(n, 1), i.set(r, 1 + n.length), E(i);
275
- }
276
- const x = 32, Y = "suiprivkey";
277
- class xe {
278
- /**
279
- * Sign messages with a specific intent. By combining the message bytes with the intent before hashing and signing,
280
- * it ensures that a signed message is tied to a specific purpose and domain separator is provided
281
- */
282
- async signWithIntent(e, t) {
283
- const r = q(t, e), i = B(r, { dkLen: 32 });
284
- return {
285
- signature: Ke({
286
- signature: await this.sign(i),
287
- signatureScheme: this.getKeyScheme(),
288
- publicKey: this.getPublicKey()
289
- }),
290
- bytes: E(e)
291
- };
292
- }
293
- /**
294
- * Signs provided transaction by calling `signWithIntent()` with a `TransactionData` provided as intent scope
295
- */
296
- async signTransaction(e) {
297
- return this.signWithIntent(e, "TransactionData");
298
- }
299
- /**
300
- * Signs provided personal message by calling `signWithIntent()` with a `PersonalMessage` provided as intent scope
301
- */
302
- async signPersonalMessage(e) {
303
- const { signature: t } = await this.signWithIntent(
304
- L.vector(L.u8()).serialize(e).toBytes(),
305
- "PersonalMessage"
306
- );
307
- return {
308
- bytes: E(e),
309
- signature: t
310
- };
311
- }
312
- toSuiAddress() {
313
- return this.getPublicKey().toSuiAddress();
314
- }
315
- }
316
- class ke extends xe {
317
- }
318
- function Ie(n) {
319
- const { prefix: e, words: t } = b.decode(n);
320
- if (e !== Y)
321
- throw new Error("invalid private key prefix");
322
- const r = new Uint8Array(b.fromWords(t)), i = r.slice(1);
323
- return {
324
- schema: G[r[0]],
325
- secretKey: i
326
- };
327
- }
328
- function _e(n, e) {
329
- if (n.length !== x)
330
- throw new Error("Invalid bytes length");
331
- const t = R[e], r = new Uint8Array(n.length + 1);
332
- return r.set([t]), r.set(n, 1), b.encode(Y, b.toWords(r));
333
- }
334
- function O(n) {
335
- return !!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(n);
336
- }
337
- function Be(n) {
338
- return me(n, "");
339
- }
340
- function Pe(n) {
341
- return ie(Be(n));
342
- }
343
- const Te = "ed25519 seed", De = 2147483648, Re = new RegExp("^m(\\/[0-9]+')+$"), X = (n) => n.replace("'", ""), Ue = (n) => {
344
- const t = H.create(z, Te).update(ae(n)).digest(), r = t.slice(0, 32), i = t.slice(32);
345
- return {
346
- key: r,
347
- chainCode: i
348
- };
349
- }, Ne = ({ key: n, chainCode: e }, t) => {
350
- const r = new ArrayBuffer(4);
351
- new DataView(r).setUint32(0, t);
352
- const a = new Uint8Array(1 + n.length + r.byteLength);
353
- a.set(new Uint8Array(1).fill(0)), a.set(n, 1), a.set(new Uint8Array(r, 0, r.byteLength), n.length + 1);
354
- const s = H.create(z, e).update(a).digest(), o = s.slice(0, 32), c = s.slice(32);
355
- return {
356
- key: o,
357
- chainCode: c
358
- };
359
- }, Le = (n) => Re.test(n) ? !n.split("/").slice(1).map(X).some(
360
- isNaN
361
- /* ts T_T*/
362
- ) : !1, W = (n, e, t = De) => {
363
- if (!Le(n))
364
- throw new Error("Invalid derivation path");
365
- const { key: r, chainCode: i } = Ue(e);
366
- return n.split("/").slice(1).map(X).map((s) => parseInt(s, 10)).reduce((s, o) => Ne(s, o + t), {
367
- key: r,
368
- chainCode: i
369
- });
370
- }, P = 32;
371
- class J extends Ae {
372
- /**
373
- * Create a new Ed25519PublicKey object
374
- * @param value ed25519 public key as buffer or base-64 encoded string
375
- */
376
- constructor(e) {
377
- if (super(), typeof e == "string" ? this.data = M(e) : e instanceof Uint8Array ? this.data = e : this.data = Uint8Array.from(e), this.data.length !== P)
378
- throw new Error(
379
- `Invalid public key input. Expected ${P} bytes, got ${this.data.length}`
380
- );
381
- }
382
- /**
383
- * Checks if two Ed25519 public keys are equal
384
- */
385
- equals(e) {
386
- return super.equals(e);
387
- }
388
- /**
389
- * Return the byte array representation of the Ed25519 public key
390
- */
391
- toRawBytes() {
392
- return this.data;
393
- }
394
- /**
395
- * Return the Sui address associated with this Ed25519 public key
396
- */
397
- flag() {
398
- return R.ED25519;
399
- }
400
- /**
401
- * Verifies that the signature is valid for for the provided message
402
- */
403
- async verify(e, t) {
404
- let r;
405
- if (typeof t == "string") {
406
- const i = Ce(t);
407
- if (i.signatureScheme !== "ED25519")
408
- throw new Error("Invalid signature scheme");
409
- if (!Z(this.toRawBytes(), i.publicKey))
410
- throw new Error("Signature does not match public key");
411
- r = i.signature;
412
- } else
413
- r = t;
414
- return h.verify(r, e, this.toRawBytes());
415
- }
416
- }
417
- J.SIZE = P;
418
- const $ = "m/44'/784'/0'/0'/0'";
419
- class w extends ke {
420
- /**
421
- * Create a new Ed25519 keypair instance.
422
- * Generate random keypair if no {@link Ed25519Keypair} is provided.
423
- *
424
- * @param keypair Ed25519 keypair
425
- */
426
- constructor(e) {
427
- if (super(), e)
428
- this.keypair = {
429
- publicKey: e.publicKey,
430
- secretKey: e.secretKey.slice(0, 32)
431
- };
432
- else {
433
- const t = h.utils.randomPrivateKey();
434
- this.keypair = {
435
- publicKey: h.getPublicKey(t),
436
- secretKey: t
437
- };
438
- }
439
- }
440
- /**
441
- * Get the key scheme of the keypair ED25519
442
- */
443
- getKeyScheme() {
444
- return "ED25519";
445
- }
446
- /**
447
- * Generate a new random Ed25519 keypair
448
- */
449
- static generate() {
450
- const e = h.utils.randomPrivateKey();
451
- return new w({
452
- publicKey: h.getPublicKey(e),
453
- secretKey: e
454
- });
455
- }
456
- /**
457
- * Create a Ed25519 keypair from a raw secret key byte array, also known as seed.
458
- * This is NOT the private scalar which is result of hashing and bit clamping of
459
- * the raw secret key.
460
- *
461
- * @throws error if the provided secret key is invalid and validation is not skipped.
462
- *
463
- * @param secretKey secret key as a byte array or Bech32 secret key string
464
- * @param options: skip secret key validation
465
- */
466
- static fromSecretKey(e, t) {
467
- if (typeof e == "string") {
468
- const a = Ie(e);
469
- if (a.schema !== "ED25519")
470
- throw new Error(`Expected a ED25519 keypair, got ${a.schema}`);
471
- return this.fromSecretKey(a.secretKey, t);
472
- }
473
- const r = e.length;
474
- if (r !== x)
475
- throw new Error(
476
- `Wrong secretKey size. Expected ${x} bytes, got ${r}.`
477
- );
478
- const i = {
479
- publicKey: h.getPublicKey(e),
480
- secretKey: e
481
- };
482
- if (!t || !t.skipValidation) {
483
- const s = new TextEncoder().encode("sui validation"), o = h.sign(s, e);
484
- if (!h.verify(o, s, i.publicKey))
485
- throw new Error("provided secretKey is invalid");
486
- }
487
- return new w(i);
488
- }
489
- /**
490
- * The public key for this Ed25519 keypair
491
- */
492
- getPublicKey() {
493
- return new J(this.keypair.publicKey);
494
- }
495
- /**
496
- * The Bech32 secret key string for this Ed25519 keypair
497
- */
498
- getSecretKey() {
499
- return _e(
500
- this.keypair.secretKey.slice(0, x),
501
- this.getKeyScheme()
502
- );
503
- }
504
- /**
505
- * Return the signature for the provided data using Ed25519.
506
- */
507
- async sign(e) {
508
- return h.sign(e, this.keypair.secretKey);
509
- }
510
- /**
511
- * Derive Ed25519 keypair from mnemonics and path. The mnemonics must be normalized
512
- * and validated against the english wordlist.
513
- *
514
- * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
515
- * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
516
- */
517
- static deriveKeypair(e, t) {
518
- if (t == null && (t = $), !O(t))
519
- throw new Error("Invalid derivation path");
520
- const { key: r } = W(t, Pe(e));
521
- return w.fromSecretKey(r);
522
- }
523
- /**
524
- * Derive Ed25519 keypair from mnemonicSeed and path.
525
- *
526
- * If path is none, it will default to m/44'/784'/0'/0'/0', otherwise the path must
527
- * be compliant to SLIP-0010 in form m/44'/784'/{account_index}'/{change_index}'/{address_index}'.
528
- */
529
- static deriveKeypairFromSeed(e, t) {
530
- if (t == null && (t = $), !O(t))
531
- throw new Error("Invalid derivation path");
532
- const { key: r } = W(t, e);
533
- return w.fromSecretKey(r);
534
- }
535
- }
536
- class Q extends oe {
537
- }
538
- const T = "Sui", Fe = (n) => {
539
- var t;
540
- const e = (t = n.data) == null ? void 0 : t.content;
541
- return e && e.dataType === "moveObject" ? e.fields : null;
542
- }, Oe = async (n, e) => {
543
- if (!ce(e))
544
- throw new Error(`Invalid object ID: ${e}`);
545
- const t = await n.getObject({
546
- id: e,
547
- options: {
548
- showContent: !0
549
- }
550
- });
551
- return Fe(t);
552
- }, f = class f extends ue {
553
- constructor(e, t) {
554
- super(e, t ?? le(e, f._platform));
555
- }
556
- getRpc(e) {
557
- if (e in this.config)
558
- return new de({ url: this.config[e].rpc });
559
- throw new Error("No configuration available for chain: " + e);
560
- }
561
- getChain(e) {
562
- if (e in this.config)
563
- return new Q(e, this);
564
- throw new Error("No configuration available for chain: " + e);
565
- }
566
- static nativeTokenId(e, t) {
567
- if (!f.isSupportedChain(t))
568
- throw new Error(`invalid chain for ${T}: ${t}`);
569
- return he.tokenId(t, fe);
570
- }
571
- static isNativeTokenId(e, t, r) {
572
- return !f.isSupportedChain(t) || r.chain !== t ? !1 : this.nativeTokenId(e, t) === r;
573
- }
574
- static isSupportedChain(e) {
575
- return ge(e) === f._platform;
576
- }
577
- static async getDecimals(e, t, r) {
578
- if (_(r))
579
- return ye(f._platform);
580
- const i = new K(r);
581
- try {
582
- const s = await Oe(t, i.toString());
583
- if (s && "decimals" in s)
584
- return s.decimals;
585
- } catch {
586
- }
587
- const a = await t.getCoinMetadata({ coinType: i.toString() });
588
- if (a === null)
589
- throw new Error(`Can't fetch decimals for token ${i.toString()}`);
590
- return a.decimals;
591
- }
592
- static async getCoins(e, t, r) {
593
- let i = [], a = null;
594
- const s = new K(t).toString();
595
- do {
596
- const o = await e.getCoins({
597
- owner: s,
598
- coinType: r,
599
- cursor: a
600
- });
601
- i = [...i, ...o.data], a = o.hasNextPage ? o.nextCursor : null;
602
- } while (a);
603
- return i;
604
- }
605
- static async getBalance(e, t, r, i) {
606
- if (_(i)) {
607
- const { totalBalance: s } = await t.getBalance({
608
- owner: r
609
- });
610
- return BigInt(s);
611
- }
612
- const { totalBalance: a } = await t.getBalance({
613
- owner: r,
614
- coinType: i.toString()
615
- });
616
- return BigInt(a);
617
- }
618
- static async getBalances(e, t, r, i) {
619
- return (await Promise.all(i.map(async (s) => {
620
- const o = await this.getBalance(e, t, r, s);
621
- return { [_(s) ? "native" : new K(s).toString()]: o };
622
- }))).reduce((s, o) => Object.assign(s, o), {});
623
- }
624
- static async sendWait(e, t, r) {
625
- const i = [];
626
- for (const a of r) {
627
- const s = await t.executeTransactionBlock(a);
628
- await t.waitForTransaction({ digest: s.digest }), i.push(s.digest);
629
- }
630
- return i;
631
- }
632
- static async getLatestBlock(e) {
633
- return Number(await e.getLatestCheckpointSequenceNumber());
634
- }
635
- static async getLatestFinalizedBlock(e) {
636
- return this.getLatestBlock(e);
637
- }
638
- static chainFromChainId(e) {
639
- const t = we(f._platform, e);
640
- if (t === void 0)
641
- throw new Error(`Unknown native chain id ${e}`);
642
- const [r, i] = t;
643
- return [r, i];
644
- }
645
- static async chainFromRpc(e) {
646
- const t = await e.call("sui_getChainIdentifier", []);
647
- return this.chainFromChainId(t);
648
- }
649
- };
650
- y(f, "_platform", T);
651
- let A = f;
652
- async function We(n, e) {
653
- const [, t] = await A.chainFromRpc(n);
654
- return new $e(t, n, w.deriveKeypair(e, "m/44'/784'/0'/0'/0'"));
655
- }
656
- class $e {
657
- constructor(e, t, r, i) {
658
- y(this, "_chain");
659
- y(this, "_client");
660
- y(this, "_signer");
661
- y(this, "_debug");
662
- this._chain = e, this._client = t, this._signer = r, this._debug = i;
663
- }
664
- chain() {
665
- return this._chain;
666
- }
667
- address() {
668
- return this._signer.toSuiAddress();
669
- }
670
- async signAndSend(e) {
671
- const t = [];
672
- for (const r of e) {
673
- const { description: i, transaction: a } = r;
674
- this._debug && console.log(`Signing ${i} for ${this.address()}`);
675
- try {
676
- const s = await this._client.signAndExecuteTransaction({
677
- transaction: a,
678
- signer: this._signer
679
- });
680
- t.push(s.digest);
681
- } catch (s) {
682
- throw s;
683
- }
684
- }
685
- return t;
686
- }
687
- }
688
- const Ve = {
689
- Address: K,
690
- Platform: A,
691
- getSigner: We,
692
- protocols: {
693
- WormholeCore: () => import("./index-DUOnxuE_.mjs"),
694
- TokenBridge: () => import("./index-Eomc9IwB.mjs"),
695
- CircleBridge: () => import("./index-fkzogQYE.mjs")
696
- },
697
- getChain: (n, e, t) => new Q(e, new A(n, pe(n, T, { [e]: t })))
698
- };
699
- export {
700
- Ve as default
701
- };