signet.js 0.0.1-beta.7 → 0.0.1-beta.9

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 (92) hide show
  1. package/browser/index.browser.cjs +12 -0
  2. package/browser/index.browser.cjs.map +1 -0
  3. package/browser/index.browser.js +3927 -0
  4. package/browser/index.browser.js.map +1 -0
  5. package/node/index.node.cjs +19 -0
  6. package/node/index.node.cjs.map +1 -0
  7. package/node/index.node.js +4099 -0
  8. package/node/index.node.js.map +1 -0
  9. package/package.json +18 -12
  10. package/types/chains/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.d.ts +10 -0
  11. package/types/chains/Bitcoin/BTCRpcAdapter/Mempool/Mempool.d.ts +15 -0
  12. package/types/chains/Bitcoin/BTCRpcAdapter/Mempool/index.d.ts +1 -0
  13. package/types/chains/Bitcoin/BTCRpcAdapter/Mempool/types.d.ts +69 -0
  14. package/types/chains/Bitcoin/BTCRpcAdapter/index.d.ts +5 -0
  15. package/types/chains/Bitcoin/Bitcoin.d.ts +42 -0
  16. package/types/chains/Bitcoin/types.d.ts +42 -0
  17. package/types/chains/Bitcoin/utils.d.ts +2 -0
  18. package/types/chains/Chain.d.ts +21 -0
  19. package/types/chains/ChainSignatureContract.d.ts +18 -0
  20. package/types/chains/Cosmos/Cosmos.d.ts +38 -0
  21. package/types/chains/Cosmos/types.d.ts +30 -0
  22. package/types/chains/Cosmos/utils.d.ts +2 -0
  23. package/types/chains/EVM/EVM.d.ts +32 -0
  24. package/types/chains/EVM/types.d.ts +5 -0
  25. package/types/chains/EVM/utils.d.ts +7 -0
  26. package/types/chains/index.d.ts +11 -0
  27. package/types/chains/types.d.ts +18 -0
  28. package/types/index.d.ts +2 -0
  29. package/types/utils/chains/index.d.ts +1 -0
  30. package/types/utils/chains/near/ChainSignatureContract.d.ts +35 -0
  31. package/types/utils/chains/near/account.d.ts +13 -0
  32. package/types/utils/chains/near/constants.d.ts +3 -0
  33. package/types/utils/chains/near/index.d.ts +3 -0
  34. package/types/utils/chains/near/relayer/index.d.ts +1 -0
  35. package/types/utils/chains/near/relayer/relayer.d.ts +3 -0
  36. package/types/utils/chains/near/relayer/types.d.ts +22 -0
  37. package/types/utils/chains/near/signAndSend/index.d.ts +1 -0
  38. package/types/utils/chains/near/signAndSend/keypair.d.ts +5 -0
  39. package/types/utils/chains/near/transactionBuilder.d.ts +26 -0
  40. package/types/utils/chains/near/types.d.ts +54 -0
  41. package/types/utils/cryptography.d.ts +3 -0
  42. package/types/utils/index.d.ts +2 -0
  43. package/.eslintrc.json +0 -55
  44. package/.prettierrc +0 -1
  45. package/babel.config.js +0 -6
  46. package/docs/pages/chain-signatures-contract.mdx +0 -56
  47. package/docs/pages/chain.mdx +0 -45
  48. package/docs/pages/chains/bitcoin/bitcoin.mdx +0 -191
  49. package/docs/pages/chains/bitcoin/btc-rpc-adapter.mdx +0 -307
  50. package/docs/pages/chains/cosmos.mdx +0 -181
  51. package/docs/pages/chains/evm.mdx +0 -189
  52. package/docs/pages/index.mdx +0 -99
  53. package/docs/snippets/contract.ts +0 -21
  54. package/docs/snippets/env.ts +0 -13
  55. package/jest.config.ts +0 -199
  56. package/src/chains/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.ts +0 -11
  57. package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/Mempool.ts +0 -96
  58. package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/index.ts +0 -1
  59. package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/types.ts +0 -72
  60. package/src/chains/Bitcoin/BTCRpcAdapter/index.ts +0 -6
  61. package/src/chains/Bitcoin/Bitcoin.ts +0 -301
  62. package/src/chains/Bitcoin/types.ts +0 -45
  63. package/src/chains/Bitcoin/utils.ts +0 -14
  64. package/src/chains/Chain.ts +0 -96
  65. package/src/chains/ChainSignatureContract.ts +0 -48
  66. package/src/chains/Cosmos/Cosmos.ts +0 -279
  67. package/src/chains/Cosmos/types.ts +0 -35
  68. package/src/chains/Cosmos/utils.ts +0 -45
  69. package/src/chains/EVM/EVM.ts +0 -180
  70. package/src/chains/EVM/types.ts +0 -7
  71. package/src/chains/EVM/utils.ts +0 -26
  72. package/src/chains/index.ts +0 -34
  73. package/src/chains/types.ts +0 -35
  74. package/src/chains/utils.ts +0 -40
  75. package/src/index.ts +0 -2
  76. package/src/utils/chains/index.ts +0 -1
  77. package/src/utils/chains/near/ChainSignatureContract.ts +0 -195
  78. package/src/utils/chains/near/account.ts +0 -42
  79. package/src/utils/chains/near/constants.ts +0 -4
  80. package/src/utils/chains/near/index.ts +0 -3
  81. package/src/utils/chains/near/relayer/index.ts +0 -1
  82. package/src/utils/chains/near/relayer/relayer.ts +0 -39
  83. package/src/utils/chains/near/relayer/types.ts +0 -24
  84. package/src/utils/chains/near/signAndSend/index.ts +0 -1
  85. package/src/utils/chains/near/signAndSend/keypair.ts +0 -180
  86. package/src/utils/chains/near/transactionBuilder.ts +0 -138
  87. package/src/utils/chains/near/types.ts +0 -67
  88. package/src/utils/index.ts +0 -1
  89. package/tsconfig.eslint.json +0 -8
  90. package/tsconfig.json +0 -116
  91. package/vite.config.ts +0 -47
  92. package/vocs.config.ts +0 -60
@@ -0,0 +1,4099 @@
1
+ import ue from "bn.js";
2
+ import { fromHex as fe, toBase64 as jt, fromBase64 as Zt } from "@cosmjs/encoding";
3
+ import { ethers as H, keccak256 as Yt } from "ethers";
4
+ import * as re from "bitcoinjs-lib";
5
+ import { Connection as Qt, Account as en, Contract as tn } from "@near-js/accounts";
6
+ import { KeyPair as Lt } from "@near-js/crypto";
7
+ import { actionCreators as nn } from "@near-js/transactions";
8
+ import Jt from "bs58";
9
+ import rn from "path";
10
+ import { InMemoryKeyStore as on } from "@near-js/keystores";
11
+ import an from "coinselect";
12
+ import { encodeSecp256k1Pubkey as sn } from "@cosmjs/amino";
13
+ import { sha256 as Ze, ripemd160 as cn } from "@cosmjs/crypto";
14
+ import { Registry as un, encodePubkey as dn, makeAuthInfoBytes as fn, makeSignDoc as ln, makeSignBytes as pn } from "@cosmjs/proto-signing";
15
+ import { calculateFee as yn, GasPrice as hn, StargateClient as Ye } from "@cosmjs/stargate";
16
+ import { bech32 as Qe } from "bech32";
17
+ import { chains as gn, assets as mn } from "chain-registry";
18
+ var et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Ce = {}, W = {}, te = {}, ge = {}, tt;
19
+ function ze() {
20
+ return tt || (tt = 1, ge.__esModule = !0, ge.integers = void 0, ge.integers = ["u8", "u16", "u32", "u64", "u128", "i8", "i16", "i32", "i64", "i128", "f32", "f64"]), ge;
21
+ }
22
+ var ae = {}, nt;
23
+ function Kt() {
24
+ if (nt) return ae;
25
+ nt = 1, ae.__esModule = !0, ae.DecodeBuffer = ae.EncodeBuffer = void 0;
26
+ var r = (
27
+ /** @class */
28
+ function() {
29
+ function d() {
30
+ this.offset = 0, this.buffer_size = 256, this.buffer = new ArrayBuffer(this.buffer_size), this.view = new DataView(this.buffer);
31
+ }
32
+ return d.prototype.resize_if_necessary = function(c) {
33
+ if (this.buffer_size - this.offset < c) {
34
+ this.buffer_size = Math.max(this.buffer_size * 2, this.buffer_size + c);
35
+ var o = new ArrayBuffer(this.buffer_size);
36
+ new Uint8Array(o).set(new Uint8Array(this.buffer)), this.buffer = o, this.view = new DataView(o);
37
+ }
38
+ }, d.prototype.get_used_buffer = function() {
39
+ return new Uint8Array(this.buffer).slice(0, this.offset);
40
+ }, d.prototype.store_value = function(c, o) {
41
+ var a = o.substring(1), s = parseInt(a) / 8;
42
+ this.resize_if_necessary(s);
43
+ var u = o[0] === "f" ? "setFloat".concat(a) : o[0] === "i" ? "setInt".concat(a) : "setUint".concat(a);
44
+ this.view[u](this.offset, c, !0), this.offset += s;
45
+ }, d.prototype.store_bytes = function(c) {
46
+ this.resize_if_necessary(c.length), new Uint8Array(this.buffer).set(new Uint8Array(c), this.offset), this.offset += c.length;
47
+ }, d;
48
+ }()
49
+ );
50
+ ae.EncodeBuffer = r;
51
+ var i = (
52
+ /** @class */
53
+ function() {
54
+ function d(c) {
55
+ this.offset = 0, this.buffer_size = c.length, this.buffer = new ArrayBuffer(c.length), new Uint8Array(this.buffer).set(c), this.view = new DataView(this.buffer);
56
+ }
57
+ return d.prototype.assert_enough_buffer = function(c) {
58
+ if (this.offset + c > this.buffer.byteLength)
59
+ throw new Error("Error in schema, the buffer is smaller than expected");
60
+ }, d.prototype.consume_value = function(c) {
61
+ var o = c.substring(1), a = parseInt(o) / 8;
62
+ this.assert_enough_buffer(a);
63
+ var s = c[0] === "f" ? "getFloat".concat(o) : c[0] === "i" ? "getInt".concat(o) : "getUint".concat(o), u = this.view[s](this.offset, !0);
64
+ return this.offset += a, u;
65
+ }, d.prototype.consume_bytes = function(c) {
66
+ this.assert_enough_buffer(c);
67
+ var o = this.buffer.slice(this.offset, this.offset + c);
68
+ return this.offset += c, o;
69
+ }, d;
70
+ }()
71
+ );
72
+ return ae.DecodeBuffer = i, ae;
73
+ }
74
+ var K = {}, rt;
75
+ function qt() {
76
+ if (rt) return K;
77
+ rt = 1;
78
+ var r = K.__extends || /* @__PURE__ */ function() {
79
+ var h = function(m, w) {
80
+ return h = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(B, R) {
81
+ B.__proto__ = R;
82
+ } || function(B, R) {
83
+ for (var t in R) Object.prototype.hasOwnProperty.call(R, t) && (B[t] = R[t]);
84
+ }, h(m, w);
85
+ };
86
+ return function(m, w) {
87
+ if (typeof w != "function" && w !== null)
88
+ throw new TypeError("Class extends value " + String(w) + " is not a constructor or null");
89
+ h(m, w);
90
+ function B() {
91
+ this.constructor = m;
92
+ }
93
+ m.prototype = w === null ? Object.create(w) : (B.prototype = w.prototype, new B());
94
+ };
95
+ }();
96
+ K.__esModule = !0, K.validate_schema = K.ErrorSchema = K.expect_enum = K.expect_same_size = K.expect_bigint = K.expect_type = K.isArrayLike = void 0;
97
+ var i = ze();
98
+ function d(h) {
99
+ return Array.isArray(h) || !!h && typeof h == "object" && "length" in h && typeof h.length == "number" && (h.length === 0 || h.length > 0 && h.length - 1 in h);
100
+ }
101
+ K.isArrayLike = d;
102
+ function c(h, m, w) {
103
+ if (typeof h !== m)
104
+ throw new Error("Expected ".concat(m, " not ").concat(typeof h, "(").concat(h, ") at ").concat(w.join(".")));
105
+ }
106
+ K.expect_type = c;
107
+ function o(h, m) {
108
+ var w = ["number", "string", "bigint", "boolean"].includes(typeof h), B = typeof h == "object" && h !== null && "toString" in h;
109
+ if (!w && !B)
110
+ throw new Error("Expected bigint, number, boolean or string not ".concat(typeof h, "(").concat(h, ") at ").concat(m.join(".")));
111
+ }
112
+ K.expect_bigint = o;
113
+ function a(h, m, w) {
114
+ if (h !== m)
115
+ throw new Error("Array length ".concat(h, " does not match schema length ").concat(m, " at ").concat(w.join(".")));
116
+ }
117
+ K.expect_same_size = a;
118
+ function s(h, m) {
119
+ if (typeof h != "object" || h === null)
120
+ throw new Error("Expected object not ".concat(typeof h, "(").concat(h, ") at ").concat(m.join(".")));
121
+ }
122
+ K.expect_enum = s;
123
+ var u = i.integers.concat(["bool", "string"]), f = ["option", "enum", "array", "set", "map", "struct"], y = (
124
+ /** @class */
125
+ function(h) {
126
+ r(m, h);
127
+ function m(w, B) {
128
+ var R = "Invalid schema: ".concat(JSON.stringify(w), " expected ").concat(B);
129
+ return h.call(this, R) || this;
130
+ }
131
+ return m;
132
+ }(Error)
133
+ );
134
+ K.ErrorSchema = y;
135
+ function b(h) {
136
+ if (!(typeof h == "string" && u.includes(h))) {
137
+ if (h && typeof h == "object") {
138
+ var m = Object.keys(h);
139
+ if (m.length === 1 && f.includes(m[0])) {
140
+ var w = m[0];
141
+ if (w === "option")
142
+ return b(h[w]);
143
+ if (w === "enum")
144
+ return l(h[w]);
145
+ if (w === "array")
146
+ return I(h[w]);
147
+ if (w === "set")
148
+ return b(h[w]);
149
+ if (w === "map")
150
+ return p(h[w]);
151
+ if (w === "struct")
152
+ return g(h[w]);
153
+ }
154
+ }
155
+ throw new y(h, f.join(", ") + " or " + u.join(", "));
156
+ }
157
+ }
158
+ K.validate_schema = b;
159
+ function l(h) {
160
+ if (!Array.isArray(h))
161
+ throw new y(h, "Array");
162
+ for (var m = 0, w = h; m < w.length; m++) {
163
+ var B = w[m];
164
+ if (typeof B != "object" || !("struct" in B))
165
+ throw new Error('Missing "struct" key in enum schema');
166
+ if (typeof B.struct != "object" || Object.keys(B.struct).length !== 1)
167
+ throw new Error('The "struct" in each enum must have a single key');
168
+ b({ struct: B.struct });
169
+ }
170
+ }
171
+ function I(h) {
172
+ if (typeof h != "object")
173
+ throw new y(h, "{ type, len? }");
174
+ if (h.len && typeof h.len != "number")
175
+ throw new Error("Invalid schema: ".concat(h));
176
+ if ("type" in h)
177
+ return b(h.type);
178
+ throw new y(h, "{ type, len? }");
179
+ }
180
+ function p(h) {
181
+ if (typeof h == "object" && "key" in h && "value" in h)
182
+ b(h.key), b(h.value);
183
+ else
184
+ throw new y(h, "{ key, value }");
185
+ }
186
+ function g(h) {
187
+ if (typeof h != "object")
188
+ throw new y(h, "object");
189
+ for (var m in h)
190
+ b(h[m]);
191
+ }
192
+ return K;
193
+ }
194
+ var it;
195
+ function bn() {
196
+ if (it) return te;
197
+ it = 1;
198
+ var r = te.__createBinding || (Object.create ? function(u, f, y, b) {
199
+ b === void 0 && (b = y);
200
+ var l = Object.getOwnPropertyDescriptor(f, y);
201
+ (!l || ("get" in l ? !f.__esModule : l.writable || l.configurable)) && (l = { enumerable: !0, get: function() {
202
+ return f[y];
203
+ } }), Object.defineProperty(u, b, l);
204
+ } : function(u, f, y, b) {
205
+ b === void 0 && (b = y), u[b] = f[y];
206
+ }), i = te.__setModuleDefault || (Object.create ? function(u, f) {
207
+ Object.defineProperty(u, "default", { enumerable: !0, value: f });
208
+ } : function(u, f) {
209
+ u.default = f;
210
+ }), d = te.__importStar || function(u) {
211
+ if (u && u.__esModule) return u;
212
+ var f = {};
213
+ if (u != null) for (var y in u) y !== "default" && Object.prototype.hasOwnProperty.call(u, y) && r(f, u, y);
214
+ return i(f, u), f;
215
+ };
216
+ te.__esModule = !0, te.BorshSerializer = void 0;
217
+ var c = ze(), o = Kt(), a = d(qt()), s = (
218
+ /** @class */
219
+ function() {
220
+ function u(f) {
221
+ this.encoded = new o.EncodeBuffer(), this.fieldPath = ["value"], this.checkTypes = f;
222
+ }
223
+ return u.prototype.encode = function(f, y) {
224
+ return this.encode_value(f, y), this.encoded.get_used_buffer();
225
+ }, u.prototype.encode_value = function(f, y) {
226
+ if (typeof y == "string") {
227
+ if (c.integers.includes(y))
228
+ return this.encode_integer(f, y);
229
+ if (y === "string")
230
+ return this.encode_string(f);
231
+ if (y === "bool")
232
+ return this.encode_boolean(f);
233
+ }
234
+ if (typeof y == "object") {
235
+ if ("option" in y)
236
+ return this.encode_option(f, y);
237
+ if ("enum" in y)
238
+ return this.encode_enum(f, y);
239
+ if ("array" in y)
240
+ return this.encode_array(f, y);
241
+ if ("set" in y)
242
+ return this.encode_set(f, y);
243
+ if ("map" in y)
244
+ return this.encode_map(f, y);
245
+ if ("struct" in y)
246
+ return this.encode_struct(f, y);
247
+ }
248
+ }, u.prototype.encode_integer = function(f, y) {
249
+ var b = parseInt(y.substring(1));
250
+ b <= 32 || y == "f64" ? (this.checkTypes && a.expect_type(f, "number", this.fieldPath), this.encoded.store_value(f, y)) : (this.checkTypes && a.expect_bigint(f, this.fieldPath), this.encode_bigint(BigInt(f), b));
251
+ }, u.prototype.encode_bigint = function(f, y) {
252
+ for (var b = y / 8, l = new Uint8Array(b), I = 0; I < b; I++)
253
+ l[I] = Number(f & BigInt(255)), f = f >> BigInt(8);
254
+ this.encoded.store_bytes(new Uint8Array(l));
255
+ }, u.prototype.encode_string = function(f) {
256
+ this.checkTypes && a.expect_type(f, "string", this.fieldPath);
257
+ var y = f;
258
+ this.encoded.store_value(y.length, "u32");
259
+ for (var b = 0; b < y.length; b++)
260
+ this.encoded.store_value(y.charCodeAt(b), "u8");
261
+ }, u.prototype.encode_boolean = function(f) {
262
+ this.checkTypes && a.expect_type(f, "boolean", this.fieldPath), this.encoded.store_value(f ? 1 : 0, "u8");
263
+ }, u.prototype.encode_option = function(f, y) {
264
+ f == null ? this.encoded.store_value(0, "u8") : (this.encoded.store_value(1, "u8"), this.encode_value(f, y.option));
265
+ }, u.prototype.encode_enum = function(f, y) {
266
+ this.checkTypes && a.expect_enum(f, this.fieldPath);
267
+ for (var b = Object.keys(f)[0], l = 0; l < y.enum.length; l++) {
268
+ var I = y.enum[l];
269
+ if (b === Object.keys(I.struct)[0])
270
+ return this.encoded.store_value(l, "u8"), this.encode_struct(f, I);
271
+ }
272
+ throw new Error("Enum key (".concat(b, ") not found in enum schema: ").concat(JSON.stringify(y), " at ").concat(this.fieldPath.join(".")));
273
+ }, u.prototype.encode_array = function(f, y) {
274
+ if (a.isArrayLike(f))
275
+ return this.encode_arraylike(f, y);
276
+ if (f instanceof ArrayBuffer)
277
+ return this.encode_buffer(f, y);
278
+ throw new Error("Expected Array-like not ".concat(typeof f, "(").concat(f, ") at ").concat(this.fieldPath.join(".")));
279
+ }, u.prototype.encode_arraylike = function(f, y) {
280
+ y.array.len ? a.expect_same_size(f.length, y.array.len, this.fieldPath) : this.encoded.store_value(f.length, "u32");
281
+ for (var b = 0; b < f.length; b++)
282
+ this.encode_value(f[b], y.array.type);
283
+ }, u.prototype.encode_buffer = function(f, y) {
284
+ y.array.len ? a.expect_same_size(f.byteLength, y.array.len, this.fieldPath) : this.encoded.store_value(f.byteLength, "u32"), this.encoded.store_bytes(new Uint8Array(f));
285
+ }, u.prototype.encode_set = function(f, y) {
286
+ this.checkTypes && a.expect_type(f, "object", this.fieldPath);
287
+ var b = f instanceof Set, l = b ? Array.from(f.values()) : Object.values(f);
288
+ this.encoded.store_value(l.length, "u32");
289
+ for (var I = 0, p = l; I < p.length; I++) {
290
+ var g = p[I];
291
+ this.encode_value(g, y.set);
292
+ }
293
+ }, u.prototype.encode_map = function(f, y) {
294
+ this.checkTypes && a.expect_type(f, "object", this.fieldPath);
295
+ var b = f instanceof Map, l = b ? Array.from(f.keys()) : Object.keys(f);
296
+ this.encoded.store_value(l.length, "u32");
297
+ for (var I = 0, p = l; I < p.length; I++) {
298
+ var g = p[I];
299
+ this.encode_value(g, y.map.key), this.encode_value(b ? f.get(g) : f[g], y.map.value);
300
+ }
301
+ }, u.prototype.encode_struct = function(f, y) {
302
+ this.checkTypes && a.expect_type(f, "object", this.fieldPath);
303
+ for (var b = 0, l = Object.keys(y.struct); b < l.length; b++) {
304
+ var I = l[b];
305
+ this.fieldPath.push(I), this.encode_value(f[I], y.struct[I]), this.fieldPath.pop();
306
+ }
307
+ }, u;
308
+ }()
309
+ );
310
+ return te.BorshSerializer = s, te;
311
+ }
312
+ var me = {}, ot;
313
+ function _n() {
314
+ if (ot) return me;
315
+ ot = 1, me.__esModule = !0, me.BorshDeserializer = void 0;
316
+ var r = ze(), i = Kt(), d = (
317
+ /** @class */
318
+ function() {
319
+ function c(o) {
320
+ this.buffer = new i.DecodeBuffer(o);
321
+ }
322
+ return c.prototype.decode = function(o) {
323
+ return this.decode_value(o);
324
+ }, c.prototype.decode_value = function(o) {
325
+ if (typeof o == "string") {
326
+ if (r.integers.includes(o))
327
+ return this.decode_integer(o);
328
+ if (o === "string")
329
+ return this.decode_string();
330
+ if (o === "bool")
331
+ return this.decode_boolean();
332
+ }
333
+ if (typeof o == "object") {
334
+ if ("option" in o)
335
+ return this.decode_option(o);
336
+ if ("enum" in o)
337
+ return this.decode_enum(o);
338
+ if ("array" in o)
339
+ return this.decode_array(o);
340
+ if ("set" in o)
341
+ return this.decode_set(o);
342
+ if ("map" in o)
343
+ return this.decode_map(o);
344
+ if ("struct" in o)
345
+ return this.decode_struct(o);
346
+ }
347
+ throw new Error("Unsupported type: ".concat(o));
348
+ }, c.prototype.decode_integer = function(o) {
349
+ var a = parseInt(o.substring(1));
350
+ return a <= 32 || o == "f64" ? this.buffer.consume_value(o) : this.decode_bigint(a, o.startsWith("i"));
351
+ }, c.prototype.decode_bigint = function(o, a) {
352
+ a === void 0 && (a = !1);
353
+ var s = o / 8, u = new Uint8Array(this.buffer.consume_bytes(s)), f = u.reduceRight(function(y, b) {
354
+ return y + b.toString(16).padStart(2, "0");
355
+ }, "");
356
+ return a && u[s - 1] ? BigInt.asIntN(o, BigInt("0x".concat(f))) : BigInt("0x".concat(f));
357
+ }, c.prototype.decode_string = function() {
358
+ var o = this.decode_integer("u32"), a = new Uint8Array(this.buffer.consume_bytes(o));
359
+ return String.fromCharCode.apply(null, a);
360
+ }, c.prototype.decode_boolean = function() {
361
+ return this.buffer.consume_value("u8") > 0;
362
+ }, c.prototype.decode_option = function(o) {
363
+ var a = this.buffer.consume_value("u8");
364
+ if (a === 1)
365
+ return this.decode_value(o.option);
366
+ if (a !== 0)
367
+ throw new Error("Invalid option ".concat(a));
368
+ return null;
369
+ }, c.prototype.decode_enum = function(o) {
370
+ var a, s = this.buffer.consume_value("u8");
371
+ if (s > o.enum.length)
372
+ throw new Error("Enum option ".concat(s, " is not available"));
373
+ var u = o.enum[s].struct, f = Object.keys(u)[0];
374
+ return a = {}, a[f] = this.decode_value(u[f]), a;
375
+ }, c.prototype.decode_array = function(o) {
376
+ for (var a = [], s = o.array.len ? o.array.len : this.decode_integer("u32"), u = 0; u < s; ++u)
377
+ a.push(this.decode_value(o.array.type));
378
+ return a;
379
+ }, c.prototype.decode_set = function(o) {
380
+ for (var a = this.decode_integer("u32"), s = /* @__PURE__ */ new Set(), u = 0; u < a; ++u)
381
+ s.add(this.decode_value(o.set));
382
+ return s;
383
+ }, c.prototype.decode_map = function(o) {
384
+ for (var a = this.decode_integer("u32"), s = /* @__PURE__ */ new Map(), u = 0; u < a; ++u) {
385
+ var f = this.decode_value(o.map.key), y = this.decode_value(o.map.value);
386
+ s.set(f, y);
387
+ }
388
+ return s;
389
+ }, c.prototype.decode_struct = function(o) {
390
+ var a = {};
391
+ for (var s in o.struct)
392
+ a[s] = this.decode_value(o.struct[s]);
393
+ return a;
394
+ }, c;
395
+ }()
396
+ );
397
+ return me.BorshDeserializer = d, me;
398
+ }
399
+ var at;
400
+ function vn() {
401
+ if (at) return W;
402
+ at = 1;
403
+ var r = W.__createBinding || (Object.create ? function(f, y, b, l) {
404
+ l === void 0 && (l = b);
405
+ var I = Object.getOwnPropertyDescriptor(y, b);
406
+ (!I || ("get" in I ? !y.__esModule : I.writable || I.configurable)) && (I = { enumerable: !0, get: function() {
407
+ return y[b];
408
+ } }), Object.defineProperty(f, l, I);
409
+ } : function(f, y, b, l) {
410
+ l === void 0 && (l = b), f[l] = y[b];
411
+ }), i = W.__setModuleDefault || (Object.create ? function(f, y) {
412
+ Object.defineProperty(f, "default", { enumerable: !0, value: y });
413
+ } : function(f, y) {
414
+ f.default = y;
415
+ }), d = W.__importStar || function(f) {
416
+ if (f && f.__esModule) return f;
417
+ var y = {};
418
+ if (f != null) for (var b in f) b !== "default" && Object.prototype.hasOwnProperty.call(f, b) && r(y, f, b);
419
+ return i(y, f), y;
420
+ };
421
+ W.__esModule = !0, W.deserialize = W.serialize = void 0;
422
+ var c = bn(), o = _n(), a = d(qt());
423
+ function s(f, y, b) {
424
+ b === void 0 && (b = !0), b && a.validate_schema(f);
425
+ var l = new c.BorshSerializer(b);
426
+ return l.encode(y, f);
427
+ }
428
+ W.serialize = s;
429
+ function u(f, y, b) {
430
+ b === void 0 && (b = !0), b && a.validate_schema(f);
431
+ var l = new o.BorshDeserializer(y);
432
+ return l.decode(f);
433
+ }
434
+ return W.deserialize = u, W;
435
+ }
436
+ var be = {}, de = {}, st;
437
+ function Sn() {
438
+ if (st) return de;
439
+ st = 1;
440
+ var r = de.__importDefault || function(d) {
441
+ return d && d.__esModule ? d : { default: d };
442
+ };
443
+ Object.defineProperty(de, "__esModule", { value: !0 }), de.DEFAULT_FUNCTION_CALL_GAS = void 0;
444
+ const i = r(ue);
445
+ return de.DEFAULT_FUNCTION_CALL_GAS = new i.default("30000000000000"), de;
446
+ }
447
+ var Me = {}, _e = {}, Re = {}, ve = {}, Se = {}, ct;
448
+ function In() {
449
+ if (ct) return Se;
450
+ ct = 1, Object.defineProperty(Se, "__esModule", { value: !0 }), Se.ConsoleLogger = void 0;
451
+ class r {
452
+ constructor(d) {
453
+ this.logLevels = d, this.isLevelEnabled = (c) => this.logLevels.includes(c);
454
+ }
455
+ print(d, c, ...o) {
456
+ switch (d) {
457
+ case "error":
458
+ case "fatal":
459
+ return console.error(c, ...o);
460
+ case "warn":
461
+ return console.warn(c, ...o);
462
+ case "log":
463
+ return console.log(c, ...o);
464
+ case "debug":
465
+ case "verbose":
466
+ return console.debug(c, ...o);
467
+ }
468
+ }
469
+ verbose(d, ...c) {
470
+ this.isLevelEnabled("verbose") && this.print("verbose", d, ...c);
471
+ }
472
+ debug(d, ...c) {
473
+ this.isLevelEnabled("debug") && this.print("debug", d, ...c);
474
+ }
475
+ log(d, ...c) {
476
+ this.isLevelEnabled("log") && this.print("log", d, ...c);
477
+ }
478
+ warn(d, ...c) {
479
+ this.isLevelEnabled("warn") && this.print("warn", d, ...c);
480
+ }
481
+ error(d, ...c) {
482
+ this.isLevelEnabled("error") && this.print("error", d, ...c);
483
+ }
484
+ fatal(d, ...c) {
485
+ this.isLevelEnabled("fatal") && this.print("fatal", d, ...c);
486
+ }
487
+ }
488
+ return Se.ConsoleLogger = r, Se;
489
+ }
490
+ var ut;
491
+ function wn() {
492
+ if (ut) return ve;
493
+ ut = 1;
494
+ var r;
495
+ Object.defineProperty(ve, "__esModule", { value: !0 }), ve.Logger = void 0;
496
+ const i = In(), d = [
497
+ "verbose",
498
+ "debug",
499
+ "log",
500
+ "warn",
501
+ "error",
502
+ "fatal"
503
+ ], c = typeof process == "object" && process.env.NEAR_NO_LOGS ? void 0 : new i.ConsoleLogger(d);
504
+ class o {
505
+ static error(s, ...u) {
506
+ var f;
507
+ (f = this.instanceRef) === null || f === void 0 || f.error(s, ...u);
508
+ }
509
+ /**
510
+ * Write a 'log' level log.
511
+ */
512
+ static log(s, ...u) {
513
+ var f;
514
+ (f = this.instanceRef) === null || f === void 0 || f.log(s, ...u);
515
+ }
516
+ /**
517
+ * Write a 'warn' level log.
518
+ */
519
+ static warn(s, ...u) {
520
+ var f;
521
+ (f = this.instanceRef) === null || f === void 0 || f.warn(s, ...u);
522
+ }
523
+ /**
524
+ * Write a 'debug' level log.
525
+ */
526
+ static debug(s, ...u) {
527
+ var f, y;
528
+ (y = (f = this.instanceRef) === null || f === void 0 ? void 0 : f.debug) === null || y === void 0 || y.call(f, s, ...u);
529
+ }
530
+ /**
531
+ * Write a 'verbose' level log.
532
+ */
533
+ static verbose(s, ...u) {
534
+ var f, y;
535
+ (y = (f = this.instanceRef) === null || f === void 0 ? void 0 : f.verbose) === null || y === void 0 || y.call(f, s, ...u);
536
+ }
537
+ static fatal(s, ...u) {
538
+ var f, y;
539
+ (y = (f = this.instanceRef) === null || f === void 0 ? void 0 : f.fatal) === null || y === void 0 || y.call(f, s, ...u);
540
+ }
541
+ }
542
+ return ve.Logger = o, r = o, o.instanceRef = c, o.overrideLogger = (a) => {
543
+ r.instanceRef = a;
544
+ }, ve;
545
+ }
546
+ var dt;
547
+ function Ge() {
548
+ return dt || (dt = 1, function(r) {
549
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.Logger = void 0;
550
+ var i = wn();
551
+ Object.defineProperty(r, "Logger", { enumerable: !0, get: function() {
552
+ return i.Logger;
553
+ } });
554
+ }(Re)), Re;
555
+ }
556
+ var ft;
557
+ function En() {
558
+ if (ft) return _e;
559
+ ft = 1, Object.defineProperty(_e, "__esModule", { value: !0 }), _e.logWarning = void 0;
560
+ const r = Ge();
561
+ function i(...d) {
562
+ const [c, ...o] = d;
563
+ r.Logger.warn(c, ...o);
564
+ }
565
+ return _e.logWarning = i, _e;
566
+ }
567
+ var z = {}, Ie = {}, we = {}, lt;
568
+ function An() {
569
+ if (lt) return we;
570
+ lt = 1, Object.defineProperty(we, "__esModule", { value: !0 }), we.Assignable = void 0;
571
+ class r {
572
+ constructor(d) {
573
+ Object.keys(d).map((c) => {
574
+ this[c] = d[c];
575
+ });
576
+ }
577
+ }
578
+ return we.Assignable = r, we;
579
+ }
580
+ var V = {}, pt;
581
+ function Nn() {
582
+ if (pt) return V;
583
+ pt = 1, Object.defineProperty(V, "__esModule", { value: !0 }), V.ErrorContext = V.TypedError = V.ArgumentTypeError = V.PositionalArgsError = void 0;
584
+ class r extends Error {
585
+ constructor() {
586
+ super("Contract method calls expect named arguments wrapped in object, e.g. { argName1: argValue1, argName2: argValue2 }");
587
+ }
588
+ }
589
+ V.PositionalArgsError = r;
590
+ class i extends Error {
591
+ constructor(a, s, u) {
592
+ super(`Expected ${s} for '${a}' argument, but got '${JSON.stringify(u)}'`);
593
+ }
594
+ }
595
+ V.ArgumentTypeError = i;
596
+ class d extends Error {
597
+ constructor(a, s, u) {
598
+ super(a), this.type = s || "UntypedError", this.context = u;
599
+ }
600
+ }
601
+ V.TypedError = d;
602
+ class c {
603
+ constructor(a) {
604
+ this.transactionHash = a;
605
+ }
606
+ }
607
+ return V.ErrorContext = c, V;
608
+ }
609
+ var Fe = {}, Ue = {}, yt;
610
+ function Bn() {
611
+ return yt || (yt = 1, function(r) {
612
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.IdType = void 0, function(i) {
613
+ i.Transaction = "transaction", i.Receipt = "receipt";
614
+ }(r.IdType || (r.IdType = {}));
615
+ }(Ue)), Ue;
616
+ }
617
+ var Le = {}, ht;
618
+ function On() {
619
+ return ht || (ht = 1, function(r) {
620
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.FinalExecutionStatusBasic = r.ExecutionStatusBasic = void 0, function(i) {
621
+ i.Unknown = "Unknown", i.Pending = "Pending", i.Failure = "Failure";
622
+ }(r.ExecutionStatusBasic || (r.ExecutionStatusBasic = {})), function(i) {
623
+ i.NotStarted = "NotStarted", i.Started = "Started", i.Failure = "Failure";
624
+ }(r.FinalExecutionStatusBasic || (r.FinalExecutionStatusBasic = {}));
625
+ }(Le)), Le;
626
+ }
627
+ var gt;
628
+ function Tn() {
629
+ return gt || (gt = 1, function(r) {
630
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.FinalExecutionStatusBasic = r.ExecutionStatusBasic = r.IdType = void 0;
631
+ var i = Bn();
632
+ Object.defineProperty(r, "IdType", { enumerable: !0, get: function() {
633
+ return i.IdType;
634
+ } });
635
+ var d = On();
636
+ Object.defineProperty(r, "ExecutionStatusBasic", { enumerable: !0, get: function() {
637
+ return d.ExecutionStatusBasic;
638
+ } }), Object.defineProperty(r, "FinalExecutionStatusBasic", { enumerable: !0, get: function() {
639
+ return d.FinalExecutionStatusBasic;
640
+ } });
641
+ }(Fe)), Fe;
642
+ }
643
+ var mt;
644
+ function Dn() {
645
+ return mt || (mt = 1, function(r) {
646
+ var i = Ie.__createBinding || (Object.create ? function(c, o, a, s) {
647
+ s === void 0 && (s = a);
648
+ var u = Object.getOwnPropertyDescriptor(o, a);
649
+ (!u || ("get" in u ? !o.__esModule : u.writable || u.configurable)) && (u = { enumerable: !0, get: function() {
650
+ return o[a];
651
+ } }), Object.defineProperty(c, s, u);
652
+ } : function(c, o, a, s) {
653
+ s === void 0 && (s = a), c[s] = o[a];
654
+ }), d = Ie.__exportStar || function(c, o) {
655
+ for (var a in c) a !== "default" && !Object.prototype.hasOwnProperty.call(o, a) && i(o, c, a);
656
+ };
657
+ Object.defineProperty(r, "__esModule", { value: !0 }), d(An(), r), d(Nn(), r), d(Tn(), r);
658
+ }(Ie)), Ie;
659
+ }
660
+ var De = { exports: {} }, kn = De.exports, bt;
661
+ function xn() {
662
+ return bt || (bt = 1, function(r, i) {
663
+ (function(d, c) {
664
+ r.exports = c();
665
+ })(kn, function() {
666
+ /*!
667
+ * mustache.js - Logic-less {{mustache}} templates with JavaScript
668
+ * http://github.com/janl/mustache.js
669
+ */
670
+ var d = Object.prototype.toString, c = Array.isArray || function(E) {
671
+ return d.call(E) === "[object Array]";
672
+ };
673
+ function o(A) {
674
+ return typeof A == "function";
675
+ }
676
+ function a(A) {
677
+ return c(A) ? "array" : typeof A;
678
+ }
679
+ function s(A) {
680
+ return A.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
681
+ }
682
+ function u(A, E) {
683
+ return A != null && typeof A == "object" && E in A;
684
+ }
685
+ function f(A, E) {
686
+ return A != null && typeof A != "object" && A.hasOwnProperty && A.hasOwnProperty(E);
687
+ }
688
+ var y = RegExp.prototype.test;
689
+ function b(A, E) {
690
+ return y.call(A, E);
691
+ }
692
+ var l = /\S/;
693
+ function I(A) {
694
+ return !b(l, A);
695
+ }
696
+ var p = {
697
+ "&": "&amp;",
698
+ "<": "&lt;",
699
+ ">": "&gt;",
700
+ '"': "&quot;",
701
+ "'": "&#39;",
702
+ "/": "&#x2F;",
703
+ "`": "&#x60;",
704
+ "=": "&#x3D;"
705
+ };
706
+ function g(A) {
707
+ return String(A).replace(/[&<>"'`=\/]/g, function(N) {
708
+ return p[N];
709
+ });
710
+ }
711
+ var h = /\s*/, m = /\s+/, w = /\s*=/, B = /\s*\}/, R = /#|\^|\/|>|\{|&|=|!/;
712
+ function t(A, E) {
713
+ if (!A)
714
+ return [];
715
+ var N = !1, O = [], D = [], k = [], x = !1, P = !1, U = "", L = 0;
716
+ function Q() {
717
+ if (x && !P)
718
+ for (; k.length; )
719
+ delete D[k.pop()];
720
+ else
721
+ k = [];
722
+ x = !1, P = !1;
723
+ }
724
+ var ie, ye, Xe;
725
+ function je(X) {
726
+ if (typeof X == "string" && (X = X.split(m, 2)), !c(X) || X.length !== 2)
727
+ throw new Error("Invalid tags: " + X);
728
+ ie = new RegExp(s(X[0]) + "\\s*"), ye = new RegExp("\\s*" + s(X[1])), Xe = new RegExp("\\s*" + s("}" + X[1]));
729
+ }
730
+ je(E || T.tags);
731
+ for (var J = new v(A), ee, q, $, he, Be, oe; !J.eos(); ) {
732
+ if (ee = J.pos, $ = J.scanUntil(ie), $)
733
+ for (var Pe = 0, Xt = $.length; Pe < Xt; ++Pe)
734
+ he = $.charAt(Pe), I(he) ? (k.push(D.length), U += he) : (P = !0, N = !0, U += " "), D.push(["text", he, ee, ee + 1]), ee += 1, he === `
735
+ ` && (Q(), U = "", L = 0, N = !1);
736
+ if (!J.scan(ie))
737
+ break;
738
+ if (x = !0, q = J.scan(R) || "name", J.scan(h), q === "=" ? ($ = J.scanUntil(w), J.scan(w), J.scanUntil(ye)) : q === "{" ? ($ = J.scanUntil(Xe), J.scan(B), J.scanUntil(ye), q = "&") : $ = J.scanUntil(ye), !J.scan(ye))
739
+ throw new Error("Unclosed tag at " + J.pos);
740
+ if (q == ">" ? Be = [q, $, ee, J.pos, U, L, N] : Be = [q, $, ee, J.pos], L++, D.push(Be), q === "#" || q === "^")
741
+ O.push(Be);
742
+ else if (q === "/") {
743
+ if (oe = O.pop(), !oe)
744
+ throw new Error('Unopened section "' + $ + '" at ' + ee);
745
+ if (oe[1] !== $)
746
+ throw new Error('Unclosed section "' + oe[1] + '" at ' + ee);
747
+ } else q === "name" || q === "{" || q === "&" ? P = !0 : q === "=" && je($);
748
+ }
749
+ if (Q(), oe = O.pop(), oe)
750
+ throw new Error('Unclosed section "' + oe[1] + '" at ' + J.pos);
751
+ return n(e(D));
752
+ }
753
+ function e(A) {
754
+ for (var E = [], N, O, D = 0, k = A.length; D < k; ++D)
755
+ N = A[D], N && (N[0] === "text" && O && O[0] === "text" ? (O[1] += N[1], O[3] = N[3]) : (E.push(N), O = N));
756
+ return E;
757
+ }
758
+ function n(A) {
759
+ for (var E = [], N = E, O = [], D, k, x = 0, P = A.length; x < P; ++x)
760
+ switch (D = A[x], D[0]) {
761
+ case "#":
762
+ case "^":
763
+ N.push(D), O.push(D), N = D[4] = [];
764
+ break;
765
+ case "/":
766
+ k = O.pop(), k[5] = D[2], N = O.length > 0 ? O[O.length - 1][4] : E;
767
+ break;
768
+ default:
769
+ N.push(D);
770
+ }
771
+ return E;
772
+ }
773
+ function v(A) {
774
+ this.string = A, this.tail = A, this.pos = 0;
775
+ }
776
+ v.prototype.eos = function() {
777
+ return this.tail === "";
778
+ }, v.prototype.scan = function(E) {
779
+ var N = this.tail.match(E);
780
+ if (!N || N.index !== 0)
781
+ return "";
782
+ var O = N[0];
783
+ return this.tail = this.tail.substring(O.length), this.pos += O.length, O;
784
+ }, v.prototype.scanUntil = function(E) {
785
+ var N = this.tail.search(E), O;
786
+ switch (N) {
787
+ case -1:
788
+ O = this.tail, this.tail = "";
789
+ break;
790
+ case 0:
791
+ O = "";
792
+ break;
793
+ default:
794
+ O = this.tail.substring(0, N), this.tail = this.tail.substring(N);
795
+ }
796
+ return this.pos += O.length, O;
797
+ };
798
+ function _(A, E) {
799
+ this.view = A, this.cache = { ".": this.view }, this.parent = E;
800
+ }
801
+ _.prototype.push = function(E) {
802
+ return new _(E, this);
803
+ }, _.prototype.lookup = function(E) {
804
+ var N = this.cache, O;
805
+ if (N.hasOwnProperty(E))
806
+ O = N[E];
807
+ else {
808
+ for (var D = this, k, x, P, U = !1; D; ) {
809
+ if (E.indexOf(".") > 0)
810
+ for (k = D.view, x = E.split("."), P = 0; k != null && P < x.length; )
811
+ P === x.length - 1 && (U = u(k, x[P]) || f(k, x[P])), k = k[x[P++]];
812
+ else
813
+ k = D.view[E], U = u(D.view, E);
814
+ if (U) {
815
+ O = k;
816
+ break;
817
+ }
818
+ D = D.parent;
819
+ }
820
+ N[E] = O;
821
+ }
822
+ return o(O) && (O = O.call(this.view)), O;
823
+ };
824
+ function S() {
825
+ this.templateCache = {
826
+ _cache: {},
827
+ set: function(E, N) {
828
+ this._cache[E] = N;
829
+ },
830
+ get: function(E) {
831
+ return this._cache[E];
832
+ },
833
+ clear: function() {
834
+ this._cache = {};
835
+ }
836
+ };
837
+ }
838
+ S.prototype.clearCache = function() {
839
+ typeof this.templateCache < "u" && this.templateCache.clear();
840
+ }, S.prototype.parse = function(E, N) {
841
+ var O = this.templateCache, D = E + ":" + (N || T.tags).join(":"), k = typeof O < "u", x = k ? O.get(D) : void 0;
842
+ return x == null && (x = t(E, N), k && O.set(D, x)), x;
843
+ }, S.prototype.render = function(E, N, O, D) {
844
+ var k = this.parse(E, D), x = N instanceof _ ? N : new _(N, void 0);
845
+ return this.renderTokens(k, x, O, E, D);
846
+ }, S.prototype.renderTokens = function(E, N, O, D, k) {
847
+ for (var x = "", P, U, L, Q = 0, ie = E.length; Q < ie; ++Q)
848
+ L = void 0, P = E[Q], U = P[0], U === "#" ? L = this.renderSection(P, N, O, D) : U === "^" ? L = this.renderInverted(P, N, O, D) : U === ">" ? L = this.renderPartial(P, N, O, k) : U === "&" ? L = this.unescapedValue(P, N) : U === "name" ? L = this.escapedValue(P, N) : U === "text" && (L = this.rawValue(P)), L !== void 0 && (x += L);
849
+ return x;
850
+ }, S.prototype.renderSection = function(E, N, O, D) {
851
+ var k = this, x = "", P = N.lookup(E[1]);
852
+ function U(ie) {
853
+ return k.render(ie, N, O);
854
+ }
855
+ if (P) {
856
+ if (c(P))
857
+ for (var L = 0, Q = P.length; L < Q; ++L)
858
+ x += this.renderTokens(E[4], N.push(P[L]), O, D);
859
+ else if (typeof P == "object" || typeof P == "string" || typeof P == "number")
860
+ x += this.renderTokens(E[4], N.push(P), O, D);
861
+ else if (o(P)) {
862
+ if (typeof D != "string")
863
+ throw new Error("Cannot use higher-order sections without the original template");
864
+ P = P.call(N.view, D.slice(E[3], E[5]), U), P != null && (x += P);
865
+ } else
866
+ x += this.renderTokens(E[4], N, O, D);
867
+ return x;
868
+ }
869
+ }, S.prototype.renderInverted = function(E, N, O, D) {
870
+ var k = N.lookup(E[1]);
871
+ if (!k || c(k) && k.length === 0)
872
+ return this.renderTokens(E[4], N, O, D);
873
+ }, S.prototype.indentPartial = function(E, N, O) {
874
+ for (var D = N.replace(/[^ \t]/g, ""), k = E.split(`
875
+ `), x = 0; x < k.length; x++)
876
+ k[x].length && (x > 0 || !O) && (k[x] = D + k[x]);
877
+ return k.join(`
878
+ `);
879
+ }, S.prototype.renderPartial = function(E, N, O, D) {
880
+ if (O) {
881
+ var k = o(O) ? O(E[1]) : O[E[1]];
882
+ if (k != null) {
883
+ var x = E[6], P = E[5], U = E[4], L = k;
884
+ return P == 0 && U && (L = this.indentPartial(k, U, x)), this.renderTokens(this.parse(L, D), N, O, L);
885
+ }
886
+ }
887
+ }, S.prototype.unescapedValue = function(E, N) {
888
+ var O = N.lookup(E[1]);
889
+ if (O != null)
890
+ return O;
891
+ }, S.prototype.escapedValue = function(E, N) {
892
+ var O = N.lookup(E[1]);
893
+ if (O != null)
894
+ return T.escape(O);
895
+ }, S.prototype.rawValue = function(E) {
896
+ return E[1];
897
+ };
898
+ var T = {
899
+ name: "mustache.js",
900
+ version: "4.0.0",
901
+ tags: ["{{", "}}"],
902
+ clearCache: void 0,
903
+ escape: void 0,
904
+ parse: void 0,
905
+ render: void 0,
906
+ Scanner: void 0,
907
+ Context: void 0,
908
+ Writer: void 0,
909
+ /**
910
+ * Allows a user to override the default caching strategy, by providing an
911
+ * object with set, get and clear methods. This can also be used to disable
912
+ * the cache by setting it to the literal `undefined`.
913
+ */
914
+ set templateCache(A) {
915
+ C.templateCache = A;
916
+ },
917
+ /**
918
+ * Gets the default or overridden caching object from the default writer.
919
+ */
920
+ get templateCache() {
921
+ return C.templateCache;
922
+ }
923
+ }, C = new S();
924
+ return T.clearCache = function() {
925
+ return C.clearCache();
926
+ }, T.parse = function(E, N) {
927
+ return C.parse(E, N);
928
+ }, T.render = function(E, N, O, D) {
929
+ if (typeof E != "string")
930
+ throw new TypeError('Invalid template! Template should be a "string" but "' + a(E) + '" was given as the first argument for mustache#render(template, view, partials)');
931
+ return C.render(E, N, O, D);
932
+ }, T.escape = g, T.Scanner = v, T.Context = _, T.Writer = S, T;
933
+ });
934
+ }(De)), De.exports;
935
+ }
936
+ var Oe = {}, _t;
937
+ function zt() {
938
+ return _t || (_t = 1, function(r) {
939
+ var i = Oe.__importDefault || function(g) {
940
+ return g && g.__esModule ? g : { default: g };
941
+ };
942
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.baseDecode = r.baseEncode = r.parseNearAmount = r.formatNearAmount = r.NEAR_NOMINATION = r.NEAR_NOMINATION_EXP = void 0;
943
+ const d = i(ue), c = i(Jt);
944
+ r.NEAR_NOMINATION_EXP = 24, r.NEAR_NOMINATION = new d.default("10", 10).pow(new d.default(r.NEAR_NOMINATION_EXP, 10));
945
+ const o = [], a = new d.default(10);
946
+ for (let g = 0, h = new d.default(5); g < r.NEAR_NOMINATION_EXP; g++, h = h.mul(a))
947
+ o[g] = h;
948
+ function s(g, h = r.NEAR_NOMINATION_EXP) {
949
+ const m = new d.default(g, 10);
950
+ if (h !== r.NEAR_NOMINATION_EXP) {
951
+ const R = r.NEAR_NOMINATION_EXP - h - 1;
952
+ R > 0 && m.iadd(o[R]);
953
+ }
954
+ g = m.toString();
955
+ const w = g.substring(0, g.length - r.NEAR_NOMINATION_EXP) || "0", B = g.substring(g.length - r.NEAR_NOMINATION_EXP).padStart(r.NEAR_NOMINATION_EXP, "0").substring(0, h);
956
+ return y(`${l(w)}.${B}`);
957
+ }
958
+ r.formatNearAmount = s;
959
+ function u(g) {
960
+ if (!g)
961
+ return null;
962
+ g = f(g);
963
+ const h = g.split("."), m = h[0], w = h[1] || "";
964
+ if (h.length > 2 || w.length > r.NEAR_NOMINATION_EXP)
965
+ throw new Error(`Cannot parse '${g}' as NEAR amount`);
966
+ return b(m + w.padEnd(r.NEAR_NOMINATION_EXP, "0"));
967
+ }
968
+ r.parseNearAmount = u;
969
+ function f(g) {
970
+ return g.replace(/,/g, "").trim();
971
+ }
972
+ function y(g) {
973
+ return g.replace(/\.?0*$/, "");
974
+ }
975
+ function b(g) {
976
+ return g = g.replace(/^0+/, ""), g === "" ? "0" : g;
977
+ }
978
+ function l(g) {
979
+ const h = /(-?\d+)(\d{3})/;
980
+ for (; h.test(g); )
981
+ g = g.replace(h, "$1,$2");
982
+ return g;
983
+ }
984
+ function I(g) {
985
+ if (typeof g == "string") {
986
+ const h = [];
987
+ for (let m = 0; m < g.length; m++)
988
+ h.push(g.charCodeAt(m));
989
+ g = new Uint8Array(h);
990
+ }
991
+ return c.default.encode(g);
992
+ }
993
+ r.baseEncode = I;
994
+ function p(g) {
995
+ return new Uint8Array(c.default.decode(g));
996
+ }
997
+ r.baseDecode = p;
998
+ }(Oe)), Oe;
999
+ }
1000
+ const Pn = "Exceeded the maximum amount of gas allowed to burn per contract", Cn = "Method name is empty", Mn = "Wasmer compilation error: {{msg}}", Rn = "Smart contract panicked: {{panic_msg}}", Fn = "Error creating Wasm memory", Un = "Exceeded the prepaid gas", Ln = "Method name is not valid UTF8 string", Jn = "String encoding is bad UTF-16 sequence", Kn = "WebAssembly trap: {{msg}}", qn = "Gas instrumentation failed or contract has denied instructions.", zn = "{{promise_idx}} does not correspond to existing promises", Gn = "Accessed invalid promise result index: {{result_idx}}", $n = "Error happened while deserializing the module", Vn = "Contract method is not found", Wn = "Accessed invalid register id: {{register_id}}", Hn = "VM Logic returned an invalid receipt index: {{receipt_index}}", Xn = "Method name is empty in contract call", jn = "Returning joint promise is currently prohibited", Zn = "Stack instrumentation failed", Yn = "Cannot find contract code for account {{account_id}}", Qn = "Invalid method signature", er = "Integer overflow happened during contract execution", tr = "MemoryAccessViolation", nr = "Iterator index {{iterator_index}} does not exist", rr = "Iterator {{iterator_index}} was invalidated after its creation by performing a mutable operation on trie", ir = "VM Logic returned an invalid account id", or = "Error happened while serializing the module", ar = "Actions can only be appended to non-joint promise.", sr = "Internal memory declaration has been found in the module", cr = "Error happened during instantiation", ur = "{{method_name}} is not allowed in view calls", dr = "VM Logic returned an invalid method name", fr = "String encoding is bad UTF-8 sequence", lr = "Exceeded the account balance", pr = "Wasm contract link error: {{msg}}", yr = "VM Logic provided an invalid public key", hr = "Actor {{actor_id}} doesn't have permission to account {{account_id}} to complete the action", gr = "The account {{account_id}} wouldn't have enough balance to cover storage, required to have {{amount}} yoctoNEAR more", mr = "Wrong AccessKey used for transaction: transaction is sent to receiver_id={{tx_receiver}}, but is signed with function call access key that restricted to only use with receiver_id={{ak_receiver}}. Either change receiver_id in your transaction or switch to use a FullAccessKey.", br = "Transaction gas or balance cost is too high", _r = "Transaction is not signed with the given public key", vr = `Signer "{{account_id}}" doesn't have access key with the given public_key {{public_key}}`, Sr = "Sender {{signer_id}} does not have enough balance {{#formatNear}}{{balance}}{{/formatNear}} for operation costing {{#formatNear}}{{cost}}{{/formatNear}}", Ir = "Access Key {account_id}:{public_key} does not have enough balance {{#formatNear}}{{allowance}}{{/formatNear}} for transaction costing {{#formatNear}}{{cost}}{{/formatNear}}", wr = "Transaction has expired", Er = "Account {{account_id}} is staking and can not be deleted", Ar = "Signer {{signer_id}} does not exist", Nr = "Account {{account_id}} tried to stake {{#formatNear}}{{stake}}{{/formatNear}}, but has staked {{#formatNear}}{{locked}}{{/formatNear}} and only has {{#formatNear}}{{balance}}{{/formatNear}}", Br = "The public key {{public_key}} is already used for an existing access key", Or = "Invalid signer account ID {{signer_id}} according to requirements", Tr = "The new account_id {{account_id}} can't be created by {{predecessor_id}}", Dr = "The transaction contains more then one action, but it was signed with an access key which allows transaction to apply only one specific action. To apply more then one actions TX must be signed with a full access key", kr = "Account {{account_id}} is not yet staked, but tried to unstake", xr = "Transaction nonce {{tx_nonce}} must be larger than nonce of the used access key {{ak_nonce}}", Pr = "Can't create a new account {{account_id}}, because it already exists", Cr = "Transaction parent block hash doesn't belong to the current chain", Mr = "Can't complete the action because account {{account_id}} doesn't exist", Rr = "Can't complete the action because access key {{public_key}} doesn't exist", Fr = "Transaction method name {{method_name}} isn't allowed by the access key", Ur = "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover the rent", Lr = "Account {{account_id}} can't be deleted. It has {{#formatNear}}{{balance}}{{/formatNear}}, which is enough to cover it's storage", Jr = "Invalid receiver account ID {{receiver_id}} according to requirements", Kr = "Account {{account_id}} tries to remove an access key that doesn't exist", qr = "Timeout exceeded", zr = "Connection closed", Gr = {
1001
+ GasLimitExceeded: Pn,
1002
+ MethodEmptyName: Cn,
1003
+ WasmerCompileError: Mn,
1004
+ GuestPanic: Rn,
1005
+ Memory: Fn,
1006
+ GasExceeded: Un,
1007
+ MethodUTF8Error: Ln,
1008
+ BadUTF16: Jn,
1009
+ WasmTrap: Kn,
1010
+ GasInstrumentation: qn,
1011
+ InvalidPromiseIndex: zn,
1012
+ InvalidPromiseResultIndex: Gn,
1013
+ Deserialization: $n,
1014
+ MethodNotFound: Vn,
1015
+ InvalidRegisterId: Wn,
1016
+ InvalidReceiptIndex: Hn,
1017
+ EmptyMethodName: Xn,
1018
+ CannotReturnJointPromise: jn,
1019
+ StackHeightInstrumentation: Zn,
1020
+ CodeDoesNotExist: Yn,
1021
+ MethodInvalidSignature: Qn,
1022
+ IntegerOverflow: er,
1023
+ MemoryAccessViolation: tr,
1024
+ InvalidIteratorIndex: nr,
1025
+ IteratorWasInvalidated: rr,
1026
+ InvalidAccountId: ir,
1027
+ Serialization: or,
1028
+ CannotAppendActionToJointPromise: ar,
1029
+ InternalMemoryDeclared: sr,
1030
+ Instantiate: cr,
1031
+ ProhibitedInView: ur,
1032
+ InvalidMethodName: dr,
1033
+ BadUTF8: fr,
1034
+ BalanceExceeded: lr,
1035
+ LinkError: pr,
1036
+ InvalidPublicKey: yr,
1037
+ ActorNoPermission: hr,
1038
+ LackBalanceForState: gr,
1039
+ ReceiverMismatch: mr,
1040
+ CostOverflow: br,
1041
+ InvalidSignature: _r,
1042
+ AccessKeyNotFound: vr,
1043
+ NotEnoughBalance: Sr,
1044
+ NotEnoughAllowance: Ir,
1045
+ Expired: wr,
1046
+ DeleteAccountStaking: Er,
1047
+ SignerDoesNotExist: Ar,
1048
+ TriesToStake: Nr,
1049
+ AddKeyAlreadyExists: Br,
1050
+ InvalidSigner: Or,
1051
+ CreateAccountNotAllowed: Tr,
1052
+ RequiresFullAccess: Dr,
1053
+ TriesToUnstake: kr,
1054
+ InvalidNonce: xr,
1055
+ AccountAlreadyExists: Pr,
1056
+ InvalidChain: Cr,
1057
+ AccountDoesNotExist: Mr,
1058
+ AccessKeyDoesNotExist: Rr,
1059
+ MethodNameMismatch: Fr,
1060
+ DeleteAccountHasRent: Ur,
1061
+ DeleteAccountHasEnoughBalance: Lr,
1062
+ InvalidReceiver: Jr,
1063
+ DeleteKeyDoesNotExist: Kr,
1064
+ Timeout: qr,
1065
+ Closed: zr
1066
+ }, $r = JSON.parse('{"AccessKeyNotFound":{"name":"AccessKeyNotFound","subtypes":[],"props":{"account_id":"","public_key":""}},"AccountAlreadyExists":{"name":"AccountAlreadyExists","subtypes":[],"props":{"account_id":""}},"AccountDoesNotExist":{"name":"AccountDoesNotExist","subtypes":[],"props":{"account_id":""}},"ActionError":{"name":"ActionError","subtypes":["AccountAlreadyExists","AccountDoesNotExist","CreateAccountOnlyByRegistrar","CreateAccountNotAllowed","ActorNoPermission","DeleteKeyDoesNotExist","AddKeyAlreadyExists","DeleteAccountStaking","LackBalanceForState","TriesToUnstake","TriesToStake","InsufficientStake","FunctionCallError","NewReceiptValidationError","OnlyImplicitAccountCreationAllowed","DeleteAccountWithLargeState","DelegateActionInvalidSignature","DelegateActionSenderDoesNotMatchTxReceiver","DelegateActionExpired","DelegateActionAccessKeyError","DelegateActionInvalidNonce","DelegateActionNonceTooLarge"],"props":{"index":""}},"ActionsValidationError":{"name":"ActionsValidationError","subtypes":["DeleteActionMustBeFinal","TotalPrepaidGasExceeded","TotalNumberOfActionsExceeded","AddKeyMethodNamesNumberOfBytesExceeded","AddKeyMethodNameLengthExceeded","IntegerOverflow","InvalidAccountId","ContractSizeExceeded","FunctionCallMethodNameLengthExceeded","FunctionCallArgumentsLengthExceeded","UnsuitableStakingKey","FunctionCallZeroAttachedGas","DelegateActionMustBeOnlyOne","UnsupportedProtocolFeature"],"props":{}},"ActorNoPermission":{"name":"ActorNoPermission","subtypes":[],"props":{"account_id":"","actor_id":""}},"AddKeyAlreadyExists":{"name":"AddKeyAlreadyExists","subtypes":[],"props":{"account_id":"","public_key":""}},"AddKeyMethodNameLengthExceeded":{"name":"AddKeyMethodNameLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"AddKeyMethodNamesNumberOfBytesExceeded":{"name":"AddKeyMethodNamesNumberOfBytesExceeded","subtypes":[],"props":{"limit":"","total_number_of_bytes":""}},"AltBn128InvalidInput":{"name":"AltBn128InvalidInput","subtypes":[],"props":{"msg":""}},"BadUTF16":{"name":"BadUTF16","subtypes":[],"props":{}},"BadUTF8":{"name":"BadUTF8","subtypes":[],"props":{}},"BalanceExceeded":{"name":"BalanceExceeded","subtypes":[],"props":{}},"BalanceMismatchError":{"name":"BalanceMismatchError","subtypes":[],"props":{"final_accounts_balance":"","final_postponed_receipts_balance":"","incoming_receipts_balance":"","incoming_validator_rewards":"","initial_accounts_balance":"","initial_postponed_receipts_balance":"","new_delayed_receipts_balance":"","other_burnt_amount":"","outgoing_receipts_balance":"","processed_delayed_receipts_balance":"","slashed_burnt_amount":"","tx_burnt_amount":""}},"CallIndirectOOB":{"name":"CallIndirectOOB","subtypes":[],"props":{}},"CannotAppendActionToJointPromise":{"name":"CannotAppendActionToJointPromise","subtypes":[],"props":{}},"CannotReturnJointPromise":{"name":"CannotReturnJointPromise","subtypes":[],"props":{}},"CodeDoesNotExist":{"name":"CodeDoesNotExist","subtypes":[],"props":{"account_id":""}},"CompilationError":{"name":"CompilationError","subtypes":["CodeDoesNotExist","PrepareError","WasmerCompileError"],"props":{}},"ContractSizeExceeded":{"name":"ContractSizeExceeded","subtypes":[],"props":{"limit":"","size":""}},"CostOverflow":{"name":"CostOverflow","subtypes":[],"props":{}},"CreateAccountNotAllowed":{"name":"CreateAccountNotAllowed","subtypes":[],"props":{"account_id":"","predecessor_id":""}},"CreateAccountOnlyByRegistrar":{"name":"CreateAccountOnlyByRegistrar","subtypes":[],"props":{"account_id":"","predecessor_id":"","registrar_account_id":""}},"DelegateActionExpired":{"name":"DelegateActionExpired","subtypes":[],"props":{}},"DelegateActionInvalidNonce":{"name":"DelegateActionInvalidNonce","subtypes":[],"props":{"ak_nonce":"","delegate_nonce":""}},"DelegateActionInvalidSignature":{"name":"DelegateActionInvalidSignature","subtypes":[],"props":{}},"DelegateActionMustBeOnlyOne":{"name":"DelegateActionMustBeOnlyOne","subtypes":[],"props":{}},"DelegateActionNonceTooLarge":{"name":"DelegateActionNonceTooLarge","subtypes":[],"props":{"delegate_nonce":"","upper_bound":""}},"DelegateActionSenderDoesNotMatchTxReceiver":{"name":"DelegateActionSenderDoesNotMatchTxReceiver","subtypes":[],"props":{"receiver_id":"","sender_id":""}},"DeleteAccountStaking":{"name":"DeleteAccountStaking","subtypes":[],"props":{"account_id":""}},"DeleteAccountWithLargeState":{"name":"DeleteAccountWithLargeState","subtypes":[],"props":{"account_id":""}},"DeleteActionMustBeFinal":{"name":"DeleteActionMustBeFinal","subtypes":[],"props":{}},"DeleteKeyDoesNotExist":{"name":"DeleteKeyDoesNotExist","subtypes":[],"props":{"account_id":"","public_key":""}},"DepositWithFunctionCall":{"name":"DepositWithFunctionCall","subtypes":[],"props":{}},"Deprecated":{"name":"Deprecated","subtypes":[],"props":{"method_name":""}},"Deserialization":{"name":"Deserialization","subtypes":[],"props":{}},"ECRecoverError":{"name":"ECRecoverError","subtypes":[],"props":{"msg":""}},"Ed25519VerifyInvalidInput":{"name":"Ed25519VerifyInvalidInput","subtypes":[],"props":{"msg":""}},"EmptyMethodName":{"name":"EmptyMethodName","subtypes":[],"props":{}},"Expired":{"name":"Expired","subtypes":[],"props":{}},"FunctionCallArgumentsLengthExceeded":{"name":"FunctionCallArgumentsLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"FunctionCallMethodNameLengthExceeded":{"name":"FunctionCallMethodNameLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"FunctionCallZeroAttachedGas":{"name":"FunctionCallZeroAttachedGas","subtypes":[],"props":{}},"GasExceeded":{"name":"GasExceeded","subtypes":[],"props":{}},"GasInstrumentation":{"name":"GasInstrumentation","subtypes":[],"props":{}},"GasLimitExceeded":{"name":"GasLimitExceeded","subtypes":[],"props":{}},"GenericTrap":{"name":"GenericTrap","subtypes":[],"props":{}},"GuestPanic":{"name":"GuestPanic","subtypes":[],"props":{"panic_msg":""}},"HostError":{"name":"HostError","subtypes":["BadUTF16","BadUTF8","GasExceeded","GasLimitExceeded","BalanceExceeded","EmptyMethodName","GuestPanic","IntegerOverflow","InvalidPromiseIndex","CannotAppendActionToJointPromise","CannotReturnJointPromise","InvalidPromiseResultIndex","InvalidRegisterId","IteratorWasInvalidated","MemoryAccessViolation","InvalidReceiptIndex","InvalidIteratorIndex","InvalidAccountId","InvalidMethodName","InvalidPublicKey","ProhibitedInView","NumberOfLogsExceeded","KeyLengthExceeded","ValueLengthExceeded","TotalLogLengthExceeded","NumberPromisesExceeded","NumberInputDataDependenciesExceeded","ReturnedValueLengthExceeded","ContractSizeExceeded","Deprecated","ECRecoverError","AltBn128InvalidInput","Ed25519VerifyInvalidInput"],"props":{}},"IllegalArithmetic":{"name":"IllegalArithmetic","subtypes":[],"props":{}},"IncorrectCallIndirectSignature":{"name":"IncorrectCallIndirectSignature","subtypes":[],"props":{}},"IndirectCallToNull":{"name":"IndirectCallToNull","subtypes":[],"props":{}},"Instantiate":{"name":"Instantiate","subtypes":[],"props":{}},"InsufficientStake":{"name":"InsufficientStake","subtypes":[],"props":{"account_id":"","minimum_stake":"","stake":""}},"IntegerOverflow":{"name":"IntegerOverflow","subtypes":[],"props":{}},"InternalMemoryDeclared":{"name":"InternalMemoryDeclared","subtypes":[],"props":{}},"InvalidAccessKeyError":{"name":"InvalidAccessKeyError","subtypes":["AccessKeyNotFound","ReceiverMismatch","MethodNameMismatch","RequiresFullAccess","NotEnoughAllowance","DepositWithFunctionCall"],"props":{}},"InvalidAccountId":{"name":"InvalidAccountId","subtypes":[],"props":{}},"InvalidChain":{"name":"InvalidChain","subtypes":[],"props":{}},"InvalidDataReceiverId":{"name":"InvalidDataReceiverId","subtypes":[],"props":{"account_id":""}},"InvalidIteratorIndex":{"name":"InvalidIteratorIndex","subtypes":[],"props":{"iterator_index":""}},"InvalidMethodName":{"name":"InvalidMethodName","subtypes":[],"props":{}},"InvalidNonce":{"name":"InvalidNonce","subtypes":[],"props":{"ak_nonce":"","tx_nonce":""}},"InvalidPredecessorId":{"name":"InvalidPredecessorId","subtypes":[],"props":{"account_id":""}},"InvalidPromiseIndex":{"name":"InvalidPromiseIndex","subtypes":[],"props":{"promise_idx":""}},"InvalidPromiseResultIndex":{"name":"InvalidPromiseResultIndex","subtypes":[],"props":{"result_idx":""}},"InvalidPublicKey":{"name":"InvalidPublicKey","subtypes":[],"props":{}},"InvalidReceiptIndex":{"name":"InvalidReceiptIndex","subtypes":[],"props":{"receipt_index":""}},"InvalidReceiverId":{"name":"InvalidReceiverId","subtypes":[],"props":{"account_id":""}},"InvalidRegisterId":{"name":"InvalidRegisterId","subtypes":[],"props":{"register_id":""}},"InvalidSignature":{"name":"InvalidSignature","subtypes":[],"props":{}},"InvalidSignerId":{"name":"InvalidSignerId","subtypes":[],"props":{"account_id":""}},"InvalidTxError":{"name":"InvalidTxError","subtypes":["InvalidAccessKeyError","InvalidSignerId","SignerDoesNotExist","InvalidNonce","NonceTooLarge","InvalidReceiverId","InvalidSignature","NotEnoughBalance","LackBalanceForState","CostOverflow","InvalidChain","Expired","ActionsValidation","TransactionSizeExceeded"],"props":{}},"IteratorWasInvalidated":{"name":"IteratorWasInvalidated","subtypes":[],"props":{"iterator_index":""}},"KeyLengthExceeded":{"name":"KeyLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"LackBalanceForState":{"name":"LackBalanceForState","subtypes":[],"props":{"account_id":"","amount":""}},"Memory":{"name":"Memory","subtypes":[],"props":{}},"MemoryAccessViolation":{"name":"MemoryAccessViolation","subtypes":[],"props":{}},"MemoryOutOfBounds":{"name":"MemoryOutOfBounds","subtypes":[],"props":{}},"MethodEmptyName":{"name":"MethodEmptyName","subtypes":[],"props":{}},"MethodInvalidSignature":{"name":"MethodInvalidSignature","subtypes":[],"props":{}},"MethodNameMismatch":{"name":"MethodNameMismatch","subtypes":[],"props":{"method_name":""}},"MethodNotFound":{"name":"MethodNotFound","subtypes":[],"props":{}},"MethodResolveError":{"name":"MethodResolveError","subtypes":["MethodEmptyName","MethodNotFound","MethodInvalidSignature"],"props":{}},"MisalignedAtomicAccess":{"name":"MisalignedAtomicAccess","subtypes":[],"props":{}},"NonceTooLarge":{"name":"NonceTooLarge","subtypes":[],"props":{"tx_nonce":"","upper_bound":""}},"NotEnoughAllowance":{"name":"NotEnoughAllowance","subtypes":[],"props":{"account_id":"","allowance":"","cost":"","public_key":""}},"NotEnoughBalance":{"name":"NotEnoughBalance","subtypes":[],"props":{"balance":"","cost":"","signer_id":""}},"NumberInputDataDependenciesExceeded":{"name":"NumberInputDataDependenciesExceeded","subtypes":[],"props":{"limit":"","number_of_input_data_dependencies":""}},"NumberOfLogsExceeded":{"name":"NumberOfLogsExceeded","subtypes":[],"props":{"limit":""}},"NumberPromisesExceeded":{"name":"NumberPromisesExceeded","subtypes":[],"props":{"limit":"","number_of_promises":""}},"OnlyImplicitAccountCreationAllowed":{"name":"OnlyImplicitAccountCreationAllowed","subtypes":[],"props":{"account_id":""}},"PrepareError":{"name":"PrepareError","subtypes":["Serialization","Deserialization","InternalMemoryDeclared","GasInstrumentation","StackHeightInstrumentation","Instantiate","Memory","TooManyFunctions","TooManyLocals"],"props":{}},"ProhibitedInView":{"name":"ProhibitedInView","subtypes":[],"props":{"method_name":""}},"ReceiptValidationError":{"name":"ReceiptValidationError","subtypes":["InvalidPredecessorId","InvalidReceiverId","InvalidSignerId","InvalidDataReceiverId","ReturnedValueLengthExceeded","NumberInputDataDependenciesExceeded","ActionsValidation"],"props":{}},"ReceiverMismatch":{"name":"ReceiverMismatch","subtypes":[],"props":{"ak_receiver":"","tx_receiver":""}},"RequiresFullAccess":{"name":"RequiresFullAccess","subtypes":[],"props":{}},"ReturnedValueLengthExceeded":{"name":"ReturnedValueLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"Serialization":{"name":"Serialization","subtypes":[],"props":{}},"SignerDoesNotExist":{"name":"SignerDoesNotExist","subtypes":[],"props":{"signer_id":""}},"StackHeightInstrumentation":{"name":"StackHeightInstrumentation","subtypes":[],"props":{}},"StackOverflow":{"name":"StackOverflow","subtypes":[],"props":{}},"TooManyFunctions":{"name":"TooManyFunctions","subtypes":[],"props":{}},"TooManyLocals":{"name":"TooManyLocals","subtypes":[],"props":{}},"TotalLogLengthExceeded":{"name":"TotalLogLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"TotalNumberOfActionsExceeded":{"name":"TotalNumberOfActionsExceeded","subtypes":[],"props":{"limit":"","total_number_of_actions":""}},"TotalPrepaidGasExceeded":{"name":"TotalPrepaidGasExceeded","subtypes":[],"props":{"limit":"","total_prepaid_gas":""}},"TransactionSizeExceeded":{"name":"TransactionSizeExceeded","subtypes":[],"props":{"limit":"","size":""}},"TriesToStake":{"name":"TriesToStake","subtypes":[],"props":{"account_id":"","balance":"","locked":"","stake":""}},"TriesToUnstake":{"name":"TriesToUnstake","subtypes":[],"props":{"account_id":""}},"TxExecutionError":{"name":"TxExecutionError","subtypes":["ActionError","InvalidTxError"],"props":{}},"Unreachable":{"name":"Unreachable","subtypes":[],"props":{}},"UnsuitableStakingKey":{"name":"UnsuitableStakingKey","subtypes":[],"props":{"public_key":""}},"UnsupportedProtocolFeature":{"name":"UnsupportedProtocolFeature","subtypes":[],"props":{"protocol_feature":"","version":""}},"ValueLengthExceeded":{"name":"ValueLengthExceeded","subtypes":[],"props":{"length":"","limit":""}},"WasmTrap":{"name":"WasmTrap","subtypes":["Unreachable","IncorrectCallIndirectSignature","MemoryOutOfBounds","CallIndirectOOB","IllegalArithmetic","MisalignedAtomicAccess","IndirectCallToNull","StackOverflow","GenericTrap"],"props":{}},"WasmerCompileError":{"name":"WasmerCompileError","subtypes":[],"props":{"msg":""}},"Closed":{"name":"Closed","subtypes":[],"props":{}},"ServerError":{"name":"ServerError","subtypes":["TxExecutionError","Timeout","Closed"],"props":{}},"Timeout":{"name":"Timeout","subtypes":[],"props":{}}}'), Vr = {
1067
+ schema: $r
1068
+ };
1069
+ var vt;
1070
+ function Wr() {
1071
+ if (vt) return z;
1072
+ vt = 1;
1073
+ var r = z.__importDefault || function(m) {
1074
+ return m && m.__esModule ? m : { default: m };
1075
+ };
1076
+ Object.defineProperty(z, "__esModule", { value: !0 }), z.getErrorTypeFromErrorMessage = z.formatError = z.parseResultError = z.parseRpcError = z.ServerError = void 0;
1077
+ const i = Dn(), d = r(xn()), c = zt(), o = r(Gr), a = r(Vr), s = {
1078
+ formatNear: () => (m, w) => (0, c.formatNearAmount)(w(m))
1079
+ };
1080
+ class u extends i.TypedError {
1081
+ }
1082
+ z.ServerError = u;
1083
+ class f extends u {
1084
+ }
1085
+ function y(m) {
1086
+ const w = {}, B = I(m, a.default.schema, w, ""), R = new u(l(B, w), B);
1087
+ return Object.assign(R, w), R;
1088
+ }
1089
+ z.parseRpcError = y;
1090
+ function b(m) {
1091
+ const w = y(m.status.Failure), B = new f();
1092
+ return Object.assign(B, w), B.type = w.type, B.message = w.message, B.transaction_outcome = m.transaction_outcome, B;
1093
+ }
1094
+ z.parseResultError = b;
1095
+ function l(m, w) {
1096
+ return typeof o.default[m] == "string" ? d.default.render(o.default[m], Object.assign(Object.assign({}, w), s)) : JSON.stringify(w);
1097
+ }
1098
+ z.formatError = l;
1099
+ function I(m, w, B, R) {
1100
+ let t, e, n;
1101
+ for (const v in w) {
1102
+ if (h(m[v]))
1103
+ return m[v];
1104
+ if (g(m[v]))
1105
+ t = m[v], e = w[v], n = v;
1106
+ else if (g(m.kind) && g(m.kind[v]))
1107
+ t = m.kind[v], e = w[v], n = v;
1108
+ else
1109
+ continue;
1110
+ }
1111
+ if (t && e) {
1112
+ for (const v of Object.keys(e.props))
1113
+ B[v] = t[v];
1114
+ return I(t, w, B, n);
1115
+ } else
1116
+ return B.kind = m, R;
1117
+ }
1118
+ function p(m, w) {
1119
+ switch (!0) {
1120
+ case /^account .*? does not exist while viewing$/.test(m):
1121
+ return "AccountDoesNotExist";
1122
+ case /^Account .*? doesn't exist$/.test(m):
1123
+ return "AccountDoesNotExist";
1124
+ case /^access key .*? does not exist while viewing$/.test(m):
1125
+ return "AccessKeyDoesNotExist";
1126
+ case /wasm execution failed with error: FunctionCallError\(CompilationError\(CodeDoesNotExist/.test(m):
1127
+ return "CodeDoesNotExist";
1128
+ case /wasm execution failed with error: CompilationError\(CodeDoesNotExist/.test(m):
1129
+ return "CodeDoesNotExist";
1130
+ case /wasm execution failed with error: FunctionCallError\(MethodResolveError\(MethodNotFound/.test(m):
1131
+ return "MethodNotFound";
1132
+ case /wasm execution failed with error: MethodResolveError\(MethodNotFound/.test(m):
1133
+ return "MethodNotFound";
1134
+ case /Transaction nonce \d+ must be larger than nonce of the used access key \d+/.test(m):
1135
+ return "InvalidNonce";
1136
+ default:
1137
+ return w;
1138
+ }
1139
+ }
1140
+ z.getErrorTypeFromErrorMessage = p;
1141
+ function g(m) {
1142
+ return Object.prototype.toString.call(m) === "[object Object]";
1143
+ }
1144
+ function h(m) {
1145
+ return Object.prototype.toString.call(m) === "[object String]";
1146
+ }
1147
+ return z;
1148
+ }
1149
+ var St;
1150
+ function Gt() {
1151
+ return St || (St = 1, function(r) {
1152
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.parseRpcError = r.parseResultError = r.getErrorTypeFromErrorMessage = r.formatError = r.ServerError = r.logWarning = void 0;
1153
+ var i = En();
1154
+ Object.defineProperty(r, "logWarning", { enumerable: !0, get: function() {
1155
+ return i.logWarning;
1156
+ } });
1157
+ var d = Wr();
1158
+ Object.defineProperty(r, "ServerError", { enumerable: !0, get: function() {
1159
+ return d.ServerError;
1160
+ } }), Object.defineProperty(r, "formatError", { enumerable: !0, get: function() {
1161
+ return d.formatError;
1162
+ } }), Object.defineProperty(r, "getErrorTypeFromErrorMessage", { enumerable: !0, get: function() {
1163
+ return d.getErrorTypeFromErrorMessage;
1164
+ } }), Object.defineProperty(r, "parseResultError", { enumerable: !0, get: function() {
1165
+ return d.parseResultError;
1166
+ } }), Object.defineProperty(r, "parseRpcError", { enumerable: !0, get: function() {
1167
+ return d.parseRpcError;
1168
+ } });
1169
+ }(Me)), Me;
1170
+ }
1171
+ var se = {}, It;
1172
+ function Hr() {
1173
+ if (It) return se;
1174
+ It = 1, Object.defineProperty(se, "__esModule", { value: !0 }), se.printTxOutcomeLogs = se.printTxOutcomeLogsAndFailures = void 0;
1175
+ const r = Gt(), i = Ge();
1176
+ function d({ contractId: o, outcome: a }) {
1177
+ const s = [a.transaction_outcome, ...a.receipts_outcome].reduce((u, f) => {
1178
+ const y = typeof f.outcome.status == "object" && typeof f.outcome.status.Failure == "object";
1179
+ return f.outcome.logs.length || y ? u.concat({
1180
+ receiptIds: f.outcome.receipt_ids,
1181
+ logs: f.outcome.logs,
1182
+ failure: typeof f.outcome.status == "object" && f.outcome.status.Failure !== void 0 ? (0, r.parseRpcError)(f.outcome.status.Failure) : null
1183
+ }) : u;
1184
+ }, []);
1185
+ for (const u of s)
1186
+ i.Logger.log(`Receipt${u.receiptIds.length > 1 ? "s" : ""}: ${u.receiptIds.join(", ")}`), c({
1187
+ contractId: o,
1188
+ logs: u.logs,
1189
+ prefix: " "
1190
+ }), u.failure && i.Logger.warn(` Failure [${o}]: ${u.failure}`);
1191
+ }
1192
+ se.printTxOutcomeLogsAndFailures = d;
1193
+ function c({ contractId: o, logs: a, prefix: s = "" }) {
1194
+ for (const u of a)
1195
+ i.Logger.log(`${s}Log [${o}]: ${u}`);
1196
+ }
1197
+ return se.printTxOutcomeLogs = c, se;
1198
+ }
1199
+ var Ee = {}, wt;
1200
+ function Xr() {
1201
+ if (wt) return Ee;
1202
+ wt = 1, Object.defineProperty(Ee, "__esModule", { value: !0 }), Ee.getTransactionLastResult = void 0;
1203
+ function r(i) {
1204
+ if (typeof i.status == "object" && typeof i.status.SuccessValue == "string") {
1205
+ const d = Buffer.from(i.status.SuccessValue, "base64").toString();
1206
+ try {
1207
+ return JSON.parse(d);
1208
+ } catch {
1209
+ return d;
1210
+ }
1211
+ }
1212
+ return null;
1213
+ }
1214
+ return Ee.getTransactionLastResult = r, Ee;
1215
+ }
1216
+ var ne = {};
1217
+ /*!
1218
+ * depd
1219
+ * Copyright(c) 2014-2018 Douglas Christopher Wilson
1220
+ * MIT Licensed
1221
+ */
1222
+ var Je, Et;
1223
+ function jr() {
1224
+ if (Et) return Je;
1225
+ Et = 1;
1226
+ var r = rn.relative;
1227
+ Je = s;
1228
+ var i = process.cwd();
1229
+ function d(e, n) {
1230
+ for (var v = e.split(/[ ,]+/), _ = String(n).toLowerCase(), S = 0; S < v.length; S++) {
1231
+ var T = v[S];
1232
+ if (T && (T === "*" || T.toLowerCase() === _))
1233
+ return !0;
1234
+ }
1235
+ return !1;
1236
+ }
1237
+ function c(e, n, v) {
1238
+ var _ = Object.getOwnPropertyDescriptor(e, n), S = _.value;
1239
+ return _.get = function() {
1240
+ return S;
1241
+ }, _.writable && (_.set = function(C) {
1242
+ return S = C;
1243
+ }), delete _.value, delete _.writable, Object.defineProperty(e, n, _), _;
1244
+ }
1245
+ function o(e) {
1246
+ for (var n = "", v = 0; v < e; v++)
1247
+ n += ", arg" + v;
1248
+ return n.substr(2);
1249
+ }
1250
+ function a(e) {
1251
+ var n = this.name + ": " + this.namespace;
1252
+ this.message && (n += " deprecated " + this.message);
1253
+ for (var v = 0; v < e.length; v++)
1254
+ n += `
1255
+ at ` + e[v].toString();
1256
+ return n;
1257
+ }
1258
+ function s(e) {
1259
+ if (!e)
1260
+ throw new TypeError("argument namespace is required");
1261
+ var n = m(), v = l(n[1]), _ = v[0];
1262
+ function S(T) {
1263
+ b.call(S, T);
1264
+ }
1265
+ return S._file = _, S._ignored = f(e), S._namespace = e, S._traced = y(e), S._warned = /* @__PURE__ */ Object.create(null), S.function = B, S.property = R, S;
1266
+ }
1267
+ function u(e, n) {
1268
+ var v = typeof e.listenerCount != "function" ? e.listeners(n).length : e.listenerCount(n);
1269
+ return v > 0;
1270
+ }
1271
+ function f(e) {
1272
+ if (process.noDeprecation)
1273
+ return !0;
1274
+ var n = process.env.NO_DEPRECATION || "";
1275
+ return d(n, e);
1276
+ }
1277
+ function y(e) {
1278
+ if (process.traceDeprecation)
1279
+ return !0;
1280
+ var n = process.env.TRACE_DEPRECATION || "";
1281
+ return d(n, e);
1282
+ }
1283
+ function b(e, n) {
1284
+ var v = u(process, "deprecation");
1285
+ if (!(!v && this._ignored)) {
1286
+ var _, S, T, C, A = 0, E = !1, N = m(), O = this._file;
1287
+ for (n ? (C = n, T = l(N[1]), T.name = C.name, O = T[0]) : (A = 2, C = l(N[A]), T = C); A < N.length; A++)
1288
+ if (_ = l(N[A]), S = _[0], S === O)
1289
+ E = !0;
1290
+ else if (S === this._file)
1291
+ O = this._file;
1292
+ else if (E)
1293
+ break;
1294
+ var D = _ ? C.join(":") + "__" + _.join(":") : void 0;
1295
+ if (!(D !== void 0 && D in this._warned)) {
1296
+ this._warned[D] = !0;
1297
+ var k = e;
1298
+ if (k || (k = T === C || !T.name ? I(C) : I(T)), v) {
1299
+ var x = t(this._namespace, k, N.slice(A));
1300
+ process.emit("deprecation", x);
1301
+ return;
1302
+ }
1303
+ var P = process.stderr.isTTY ? g : p, U = P.call(this, k, _, N.slice(A));
1304
+ process.stderr.write(U + `
1305
+ `, "utf8");
1306
+ }
1307
+ }
1308
+ }
1309
+ function l(e) {
1310
+ var n = e.getFileName() || "<anonymous>", v = e.getLineNumber(), _ = e.getColumnNumber();
1311
+ e.isEval() && (n = e.getEvalOrigin() + ", " + n);
1312
+ var S = [n, v, _];
1313
+ return S.callSite = e, S.name = e.getFunctionName(), S;
1314
+ }
1315
+ function I(e) {
1316
+ var n = e.callSite, v = e.name;
1317
+ v || (v = "<anonymous@" + h(e) + ">");
1318
+ var _ = n.getThis(), S = _ && n.getTypeName();
1319
+ return S === "Object" && (S = void 0), S === "Function" && (S = _.name || S), S && n.getMethodName() ? S + "." + v : v;
1320
+ }
1321
+ function p(e, n, v) {
1322
+ var _ = (/* @__PURE__ */ new Date()).toUTCString(), S = _ + " " + this._namespace + " deprecated " + e;
1323
+ if (this._traced) {
1324
+ for (var T = 0; T < v.length; T++)
1325
+ S += `
1326
+ at ` + v[T].toString();
1327
+ return S;
1328
+ }
1329
+ return n && (S += " at " + h(n)), S;
1330
+ }
1331
+ function g(e, n, v) {
1332
+ var _ = "\x1B[36;1m" + this._namespace + "\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m" + e + "\x1B[39m";
1333
+ if (this._traced) {
1334
+ for (var S = 0; S < v.length; S++)
1335
+ _ += `
1336
+ \x1B[36mat ` + v[S].toString() + "\x1B[39m";
1337
+ return _;
1338
+ }
1339
+ return n && (_ += " \x1B[36m" + h(n) + "\x1B[39m"), _;
1340
+ }
1341
+ function h(e) {
1342
+ return r(i, e[0]) + ":" + e[1] + ":" + e[2];
1343
+ }
1344
+ function m() {
1345
+ var e = Error.stackTraceLimit, n = {}, v = Error.prepareStackTrace;
1346
+ Error.prepareStackTrace = w, Error.stackTraceLimit = Math.max(10, e), Error.captureStackTrace(n);
1347
+ var _ = n.stack.slice(1);
1348
+ return Error.prepareStackTrace = v, Error.stackTraceLimit = e, _;
1349
+ }
1350
+ function w(e, n) {
1351
+ return n;
1352
+ }
1353
+ function B(e, n) {
1354
+ if (typeof e != "function")
1355
+ throw new TypeError("argument fn must be a function");
1356
+ var v = o(e.length), _ = m(), S = l(_[1]);
1357
+ S.name = e.name;
1358
+ var T = new Function(
1359
+ "fn",
1360
+ "log",
1361
+ "deprecate",
1362
+ "message",
1363
+ "site",
1364
+ `"use strict"
1365
+ return function (` + v + `) {log.call(deprecate, message, site)
1366
+ return fn.apply(this, arguments)
1367
+ }`
1368
+ )(e, b, this, n, S);
1369
+ return T;
1370
+ }
1371
+ function R(e, n, v) {
1372
+ if (!e || typeof e != "object" && typeof e != "function")
1373
+ throw new TypeError("argument obj must be object");
1374
+ var _ = Object.getOwnPropertyDescriptor(e, n);
1375
+ if (!_)
1376
+ throw new TypeError("must call property on owner object");
1377
+ if (!_.configurable)
1378
+ throw new TypeError("property must be configurable");
1379
+ var S = this, T = m(), C = l(T[1]);
1380
+ C.name = n, "value" in _ && (_ = c(e, n));
1381
+ var A = _.get, E = _.set;
1382
+ typeof A == "function" && (_.get = function() {
1383
+ return b.call(S, v, C), A.apply(this, arguments);
1384
+ }), typeof E == "function" && (_.set = function() {
1385
+ return b.call(S, v, C), E.apply(this, arguments);
1386
+ }), Object.defineProperty(e, n, _);
1387
+ }
1388
+ function t(e, n, v) {
1389
+ var _ = new Error(), S;
1390
+ return Object.defineProperty(_, "constructor", {
1391
+ value: t
1392
+ }), Object.defineProperty(_, "message", {
1393
+ configurable: !0,
1394
+ enumerable: !1,
1395
+ value: n,
1396
+ writable: !0
1397
+ }), Object.defineProperty(_, "name", {
1398
+ enumerable: !1,
1399
+ configurable: !0,
1400
+ value: "DeprecationError",
1401
+ writable: !0
1402
+ }), Object.defineProperty(_, "namespace", {
1403
+ configurable: !0,
1404
+ enumerable: !1,
1405
+ value: e,
1406
+ writable: !0
1407
+ }), Object.defineProperty(_, "stack", {
1408
+ configurable: !0,
1409
+ enumerable: !1,
1410
+ get: function() {
1411
+ return S !== void 0 ? S : S = a.call(this, v);
1412
+ },
1413
+ set: function(C) {
1414
+ S = C;
1415
+ }
1416
+ }), _;
1417
+ }
1418
+ return Je;
1419
+ }
1420
+ var At;
1421
+ function Zr() {
1422
+ if (At) return ne;
1423
+ At = 1;
1424
+ var r = ne.__importDefault || function(u) {
1425
+ return u && u.__esModule ? u : { default: u };
1426
+ };
1427
+ Object.defineProperty(ne, "__esModule", { value: !0 }), ne.diffEpochValidators = ne.findSeatPrice = void 0;
1428
+ const i = r(ue), d = r(jr());
1429
+ function c(u, f, y, b) {
1430
+ return b && b < 49 ? o(u, f) : (y || ((0, d.default)("findSeatPrice(validators, maxNumberOfSeats)")("`use `findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio)` instead"), y = [1, 6250]), a(u, f, y));
1431
+ }
1432
+ ne.findSeatPrice = c;
1433
+ function o(u, f) {
1434
+ const y = u.map((g) => new i.default(g.stake, 10)).sort((g, h) => g.cmp(h)), b = new i.default(f), l = y.reduce((g, h) => g.add(h));
1435
+ if (l.lt(b))
1436
+ throw new Error("Stakes are below seats");
1437
+ let I = new i.default(1), p = l.add(new i.default(1));
1438
+ for (; !I.eq(p.sub(new i.default(1))); ) {
1439
+ const g = I.add(p).div(new i.default(2));
1440
+ let h = !1, m = new i.default(0);
1441
+ for (let w = 0; w < y.length; ++w)
1442
+ if (m = m.add(y[w].div(g)), m.gte(b)) {
1443
+ I = g, h = !0;
1444
+ break;
1445
+ }
1446
+ h || (p = g);
1447
+ }
1448
+ return I;
1449
+ }
1450
+ function a(u, f, y) {
1451
+ if (y.length != 2)
1452
+ throw Error("minimumStakeRatio should have 2 elements");
1453
+ const b = u.map((I) => new i.default(I.stake, 10)).sort((I, p) => I.cmp(p)), l = b.reduce((I, p) => I.add(p));
1454
+ return u.length < f ? l.mul(new i.default(y[0])).div(new i.default(y[1])) : b[0].add(new i.default(1));
1455
+ }
1456
+ function s(u, f) {
1457
+ const y = /* @__PURE__ */ new Map();
1458
+ u.forEach((l) => y.set(l.account_id, l));
1459
+ const b = new Set(f.map((l) => l.account_id));
1460
+ return {
1461
+ newValidators: f.filter((l) => !y.has(l.account_id)),
1462
+ removedValidators: u.filter((l) => !b.has(l.account_id)),
1463
+ changedValidators: f.filter((l) => y.has(l.account_id) && y.get(l.account_id).stake != l.stake).map((l) => ({ current: y.get(l.account_id), next: l }))
1464
+ };
1465
+ }
1466
+ return ne.diffEpochValidators = s, ne;
1467
+ }
1468
+ var Nt;
1469
+ function Yr() {
1470
+ return Nt || (Nt = 1, function(r) {
1471
+ var i = be.__createBinding || (Object.create ? function(c, o, a, s) {
1472
+ s === void 0 && (s = a);
1473
+ var u = Object.getOwnPropertyDescriptor(o, a);
1474
+ (!u || ("get" in u ? !o.__esModule : u.writable || u.configurable)) && (u = { enumerable: !0, get: function() {
1475
+ return o[a];
1476
+ } }), Object.defineProperty(c, s, u);
1477
+ } : function(c, o, a, s) {
1478
+ s === void 0 && (s = a), c[s] = o[a];
1479
+ }), d = be.__exportStar || function(c, o) {
1480
+ for (var a in c) a !== "default" && !Object.prototype.hasOwnProperty.call(o, a) && i(o, c, a);
1481
+ };
1482
+ Object.defineProperty(r, "__esModule", { value: !0 }), d(Sn(), r), d(Gt(), r), d(zt(), r), d(Hr(), r), d(Xr(), r), d(Zr(), r), d(Ge(), r);
1483
+ }(be)), be;
1484
+ }
1485
+ var Bt;
1486
+ function Qr() {
1487
+ return Bt || (Bt = 1, function(r) {
1488
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.base_decode = r.base_encode = r.deserialize = r.serialize = void 0;
1489
+ var i = vn();
1490
+ Object.defineProperty(r, "serialize", { enumerable: !0, get: function() {
1491
+ return i.serialize;
1492
+ } }), Object.defineProperty(r, "deserialize", { enumerable: !0, get: function() {
1493
+ return i.deserialize;
1494
+ } });
1495
+ var d = Yr();
1496
+ Object.defineProperty(r, "base_encode", { enumerable: !0, get: function() {
1497
+ return d.baseEncode;
1498
+ } }), Object.defineProperty(r, "base_decode", { enumerable: !0, get: function() {
1499
+ return d.baseDecode;
1500
+ } });
1501
+ }(Ce)), Ce;
1502
+ }
1503
+ var ei = Qr();
1504
+ class ti {
1505
+ }
1506
+ let ni = class extends ti {
1507
+ };
1508
+ const ke = new ue("300000000000000"), $e = "dontcare", xe = async ({
1509
+ networkId: r,
1510
+ accountId: i = $e,
1511
+ keypair: d = Lt.fromRandom("ed25519")
1512
+ }) => {
1513
+ const c = new on();
1514
+ await c.setKey(r, i, d);
1515
+ const o = Qt.fromConfig({
1516
+ networkId: r,
1517
+ provider: {
1518
+ type: "JsonRpcProvider",
1519
+ args: {
1520
+ url: {
1521
+ testnet: "https://rpc.testnet.near.org",
1522
+ mainnet: "https://rpc.mainnet.near.org"
1523
+ }[r]
1524
+ }
1525
+ },
1526
+ signer: { type: "InMemorySigner", keyStore: c }
1527
+ });
1528
+ return new en(o, i);
1529
+ };
1530
+ function ri(r) {
1531
+ return {
1532
+ delegate_action: {
1533
+ actions: r.delegateAction.actions.map((i) => {
1534
+ if (i.functionCall)
1535
+ return {
1536
+ FunctionCall: {
1537
+ method_name: i.functionCall.methodName,
1538
+ args: Buffer.from(i.functionCall.args).toString("base64"),
1539
+ gas: Number(i.functionCall.gas),
1540
+ deposit: i.functionCall.deposit.toString()
1541
+ }
1542
+ };
1543
+ }).flatMap((i) => i ? [i] : []),
1544
+ nonce: Number(r.delegateAction.nonce),
1545
+ max_block_height: Number(r.delegateAction.maxBlockHeight),
1546
+ public_key: r.delegateAction.publicKey.toString(),
1547
+ receiver_id: r.delegateAction.receiverId,
1548
+ sender_id: r.delegateAction.senderId
1549
+ },
1550
+ signature: `ed25519:${Jt.encode(r.signature.data)}`
1551
+ };
1552
+ }
1553
+ const Ot = (r) => `04${Buffer.from(ei.base_decode(r.split(":")[1])).toString("hex")}`, ii = (r) => {
1554
+ if (r === $e)
1555
+ throw new Error(
1556
+ "A valid account ID and keypair are required for change methods. Please instantiate a new contract with valid credentials."
1557
+ );
1558
+ };
1559
+ class pe extends ni {
1560
+ constructor({
1561
+ networkId: i,
1562
+ contractId: d,
1563
+ accountId: c = $e,
1564
+ keypair: o = Lt.fromRandom("ed25519")
1565
+ }) {
1566
+ super(), this.networkId = i, this.contractId = d, this.accountId = c, this.keypair = o;
1567
+ }
1568
+ async getContract() {
1569
+ const i = await xe({
1570
+ networkId: this.networkId,
1571
+ accountId: this.accountId,
1572
+ keypair: this.keypair
1573
+ });
1574
+ return new tn(i, this.contractId, {
1575
+ viewMethods: [
1576
+ "public_key",
1577
+ "experimental_signature_deposit",
1578
+ "derived_public_key"
1579
+ ],
1580
+ changeMethods: ["sign"],
1581
+ useLocalViewExecution: !1
1582
+ });
1583
+ }
1584
+ async getCurrentSignatureDeposit() {
1585
+ const i = await this.getContract();
1586
+ return new ue(
1587
+ (await i.experimental_signature_deposit()).toLocaleString(
1588
+ "fullwide",
1589
+ {
1590
+ useGrouping: !1
1591
+ }
1592
+ )
1593
+ );
1594
+ }
1595
+ async getDerivedPublicKey(i) {
1596
+ const c = await (await this.getContract()).derived_public_key(i);
1597
+ return Ot(c);
1598
+ }
1599
+ async getPublicKey() {
1600
+ const d = await (await this.getContract()).public_key();
1601
+ return Ot(d);
1602
+ }
1603
+ async sign(i) {
1604
+ ii(this.accountId);
1605
+ const d = await this.getContract(), c = await this.getCurrentSignatureDeposit(), o = await d.sign({
1606
+ args: { request: i },
1607
+ gas: ke,
1608
+ amount: c
1609
+ });
1610
+ return We(o);
1611
+ }
1612
+ static async signWithRelayer({
1613
+ account: i,
1614
+ contract: d,
1615
+ signArgs: c,
1616
+ deposit: o,
1617
+ relayerUrl: a
1618
+ }) {
1619
+ const s = nn.functionCall(
1620
+ "sign",
1621
+ { request: c },
1622
+ BigInt(ke.toString()),
1623
+ BigInt(o.toString())
1624
+ ), u = await i.signedDelegate({
1625
+ receiverId: d,
1626
+ actions: [s],
1627
+ blockHeightTtl: 60
1628
+ });
1629
+ delete i.accessKeyByPublicKeyCache[
1630
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
1631
+ u.delegateAction.publicKey.toString()
1632
+ ];
1633
+ const y = await (await fetch(`${a}/send_meta_tx_async`, {
1634
+ method: "POST",
1635
+ mode: "cors",
1636
+ body: JSON.stringify(ri(u)),
1637
+ headers: new Headers({ "Content-Type": "application/json" })
1638
+ })).text(), b = await i.connection.provider.txStatus(
1639
+ y,
1640
+ i.accountId,
1641
+ "FINAL"
1642
+ ), l = $t({
1643
+ response: b
1644
+ });
1645
+ if (!l)
1646
+ throw new Error("Signature error, please retry");
1647
+ return l;
1648
+ }
1649
+ }
1650
+ const oi = async ({
1651
+ networkId: r,
1652
+ contractId: i,
1653
+ mpcPayloads: d,
1654
+ path: c
1655
+ }) => {
1656
+ const a = await new pe({
1657
+ networkId: r,
1658
+ contractId: i
1659
+ }).getCurrentSignatureDeposit();
1660
+ return {
1661
+ receiverId: i,
1662
+ actions: d.map((s) => ({
1663
+ type: "FunctionCall",
1664
+ params: {
1665
+ methodName: "sign",
1666
+ args: {
1667
+ request: {
1668
+ payload: Array.from(s),
1669
+ path: c,
1670
+ key_version: 0
1671
+ }
1672
+ },
1673
+ gas: ke.div(new ue(d.length)).toString(),
1674
+ deposit: a?.toString() || "1"
1675
+ }
1676
+ }))
1677
+ };
1678
+ }, ai = async ({
1679
+ networkId: r,
1680
+ chainSigContract: i,
1681
+ nftKeysContract: d,
1682
+ mpcPayloads: c,
1683
+ path: o,
1684
+ tokenId: a
1685
+ }) => {
1686
+ const u = await new pe({
1687
+ networkId: r,
1688
+ contractId: i
1689
+ }).getCurrentSignatureDeposit();
1690
+ return {
1691
+ receiverId: d,
1692
+ actions: c.map((f) => ({
1693
+ type: "FunctionCall",
1694
+ params: {
1695
+ methodName: "ckt_sign_hash",
1696
+ args: {
1697
+ token_id: a,
1698
+ path: o,
1699
+ payload: Array.from(f)
1700
+ },
1701
+ gas: ke.div(new ue(c.length)).toString(),
1702
+ deposit: u?.toString() || "1"
1703
+ }
1704
+ }))
1705
+ };
1706
+ }, $t = ({
1707
+ response: r
1708
+ }) => {
1709
+ const i = r.receipts_outcome.reduce(
1710
+ (d, c) => {
1711
+ if (d)
1712
+ return d;
1713
+ const { status: o } = c.outcome;
1714
+ return typeof o == "object" && o.SuccessValue && o.SuccessValue !== "" && Buffer.from(o.SuccessValue, "base64").toString("utf-8") || "";
1715
+ },
1716
+ ""
1717
+ );
1718
+ if (i) {
1719
+ const d = JSON.parse(i);
1720
+ return We(d.Ok);
1721
+ } else
1722
+ return;
1723
+ }, si = /* @__PURE__ */ Object.freeze({ __proto__: null, mpcPayloadsToChainSigTransaction: oi, mpcPayloadsToNFTKeysTransaction: ai, responseToMpcSignature: $t });
1724
+ class Ve {
1725
+ }
1726
+ async function ci(r, i) {
1727
+ const d = new H.JsonRpcProvider(r), c = await d.estimateGas(i), o = await d.getFeeData(), a = o.maxFeePerGas ?? H.parseUnits("10", "gwei"), s = o.maxPriorityFeePerGas ?? H.parseUnits("10", "gwei");
1728
+ return {
1729
+ gasLimit: c,
1730
+ maxFeePerGas: a,
1731
+ maxPriorityFeePerGas: s,
1732
+ maxFee: a * c
1733
+ };
1734
+ }
1735
+ class ui extends Ve {
1736
+ /**
1737
+ * Creates a new EVM chain instance
1738
+ * @param params - Configuration parameters
1739
+ * @param params.rpcUrl - URL of the EVM JSON-RPC provider (e.g., Infura endpoint)
1740
+ * @param params.contract - Instance of the chain signature contract for MPC operations
1741
+ */
1742
+ constructor({
1743
+ rpcUrl: i,
1744
+ contract: d
1745
+ }) {
1746
+ super(), this.contract = d, this.provider = new H.JsonRpcProvider(i);
1747
+ }
1748
+ async attachGasAndNonce(i) {
1749
+ const d = await ci(
1750
+ this.provider._getConnection().url,
1751
+ i
1752
+ ), c = await this.provider.getTransactionCount(
1753
+ i.from,
1754
+ "latest"
1755
+ ), { from: o, ...a } = i;
1756
+ return {
1757
+ ...d,
1758
+ chainId: this.provider._network.chainId,
1759
+ nonce: c,
1760
+ type: 2,
1761
+ ...a
1762
+ };
1763
+ }
1764
+ parseSignature(i) {
1765
+ return H.Signature.from({
1766
+ r: `0x${i.r}`,
1767
+ s: `0x${i.s}`,
1768
+ v: i.v
1769
+ });
1770
+ }
1771
+ async deriveAddressAndPublicKey(i, d) {
1772
+ const c = await this.contract.getDerivedPublicKey({
1773
+ path: d,
1774
+ predecessor: i
1775
+ });
1776
+ if (!c)
1777
+ throw new Error("Failed to get derived public key");
1778
+ const o = c.startsWith("04") ? c.substring(2) : c, a = H.keccak256(fe(o));
1779
+ return {
1780
+ address: `0x${a.substring(a.length - 40)}`,
1781
+ publicKey: c
1782
+ };
1783
+ }
1784
+ async getBalance(i) {
1785
+ try {
1786
+ const d = await this.provider.getBalance(i);
1787
+ return H.formatEther(d);
1788
+ } catch (d) {
1789
+ throw console.error(`Failed to fetch balance for address ${i}:`, d), new Error("Failed to fetch balance.");
1790
+ }
1791
+ }
1792
+ setTransaction(i, d) {
1793
+ const c = JSON.stringify(
1794
+ i,
1795
+ (o, a) => typeof a == "bigint" ? a.toString() : a
1796
+ );
1797
+ window.localStorage.setItem(d, c);
1798
+ }
1799
+ getTransaction(i, d) {
1800
+ const c = window.localStorage.getItem(i);
1801
+ return d?.remove && window.localStorage.removeItem(i), c ? JSON.parse(c) : void 0;
1802
+ }
1803
+ async getMPCPayloadAndTransaction(i) {
1804
+ const d = await this.attachGasAndNonce(i), c = H.Transaction.from(d).unsignedSerialized, o = Yt(c), a = Array.from(H.getBytes(o));
1805
+ return {
1806
+ transaction: d,
1807
+ mpcPayloads: [a]
1808
+ };
1809
+ }
1810
+ addSignature({
1811
+ transaction: i,
1812
+ mpcSignatures: d
1813
+ }) {
1814
+ return H.Transaction.from({
1815
+ ...i,
1816
+ signature: this.parseSignature(d[0])
1817
+ }).serialized;
1818
+ }
1819
+ async broadcastTx(i) {
1820
+ try {
1821
+ return (await this.provider.broadcastTransaction(i)).hash;
1822
+ } catch (d) {
1823
+ throw console.error("Transaction broadcast failed:", d), new Error("Failed to broadcast transaction.");
1824
+ }
1825
+ }
1826
+ }
1827
+ function Tt(r) {
1828
+ switch (r.toLowerCase()) {
1829
+ case "mainnet":
1830
+ return re.networks.bitcoin;
1831
+ case "testnet":
1832
+ return re.networks.testnet;
1833
+ case "regtest":
1834
+ return re.networks.regtest;
1835
+ default:
1836
+ throw new Error(`Unknown Bitcoin network: ${r}`);
1837
+ }
1838
+ }
1839
+ class le extends Ve {
1840
+ static {
1841
+ this.SATOSHIS_PER_BTC = 1e8;
1842
+ }
1843
+ /**
1844
+ * Creates a new Bitcoin chain instance
1845
+ * @param params - Configuration parameters
1846
+ * @param params.network - Network identifier (mainnet/testnet)
1847
+ * @param params.contract - Instance of the chain signature contract for MPC operations
1848
+ * @param params.btcRpcAdapter - Bitcoin RPC adapter for network interactions
1849
+ */
1850
+ constructor({
1851
+ network: i,
1852
+ contract: d,
1853
+ btcRpcAdapter: c
1854
+ }) {
1855
+ super(), this.network = i, this.btcRpcAdapter = c, this.contract = d;
1856
+ }
1857
+ /**
1858
+ * Converts satoshis to BTC
1859
+ * @param satoshis - Amount in satoshis
1860
+ * @returns Amount in BTC
1861
+ */
1862
+ static toBTC(i) {
1863
+ return i / le.SATOSHIS_PER_BTC;
1864
+ }
1865
+ /**
1866
+ * Converts BTC to satoshis
1867
+ * @param btc - Amount in BTC
1868
+ * @returns Amount in satoshis (rounded)
1869
+ */
1870
+ static toSatoshi(i) {
1871
+ return Math.round(i * le.SATOSHIS_PER_BTC);
1872
+ }
1873
+ async fetchTransaction(i) {
1874
+ const d = await this.btcRpcAdapter.getTransaction(i), c = new re.Transaction();
1875
+ return d.vout.forEach((o) => {
1876
+ const a = Buffer.from(o.scriptpubkey, "hex");
1877
+ c.addOutput(a, Number(o.value));
1878
+ }), c;
1879
+ }
1880
+ static parseRSVSignature(i) {
1881
+ const d = i.r.padStart(64, "0"), c = i.s.padStart(64, "0"), o = Buffer.from(d + c, "hex");
1882
+ if (o.length !== 64)
1883
+ throw new Error("Invalid signature length.");
1884
+ return o;
1885
+ }
1886
+ /**
1887
+ * Creates a Partially Signed Bitcoin Transaction (PSBT)
1888
+ * @param params - Parameters for creating the PSBT
1889
+ * @param params.transactionRequest - Transaction request containing inputs and outputs
1890
+ * @returns Created PSBT instance
1891
+ */
1892
+ async createPSBT({
1893
+ transactionRequest: i
1894
+ }) {
1895
+ const { inputs: d, outputs: c } = i.inputs && i.outputs ? i : await this.btcRpcAdapter.selectUTXOs(i.from, [
1896
+ {
1897
+ address: i.to,
1898
+ value: parseFloat(i.value)
1899
+ }
1900
+ ]), o = new re.Psbt({ network: Tt(this.network) });
1901
+ return await Promise.all(
1902
+ d.map(async (a) => {
1903
+ if (!a.scriptPubKey) {
1904
+ const u = (await this.fetchTransaction(a.txid)).outs[a.vout];
1905
+ a.scriptPubKey = u.script;
1906
+ }
1907
+ o.addInput({
1908
+ hash: a.txid,
1909
+ index: a.vout,
1910
+ witnessUtxo: {
1911
+ script: a.scriptPubKey,
1912
+ value: a.value
1913
+ }
1914
+ });
1915
+ })
1916
+ ), c.forEach((a) => {
1917
+ a.address ? o.addOutput({
1918
+ address: a.address,
1919
+ value: a.value
1920
+ }) : a.script && o.addOutput({
1921
+ script: a.script,
1922
+ value: a.value
1923
+ });
1924
+ }), o;
1925
+ }
1926
+ async getBalance(i) {
1927
+ const d = await this.btcRpcAdapter.getBalance(i);
1928
+ return le.toBTC(d).toString();
1929
+ }
1930
+ async deriveAddressAndPublicKey(i, d) {
1931
+ const c = await this.contract.getDerivedPublicKey({
1932
+ path: d,
1933
+ predecessor: i
1934
+ });
1935
+ if (!c)
1936
+ throw new Error("Failed to get derived public key");
1937
+ const o = He(c), a = Buffer.from(o, "hex"), s = Tt(this.network), u = re.payments.p2wpkh({
1938
+ pubkey: a,
1939
+ network: s
1940
+ }), { address: f } = u;
1941
+ if (!f)
1942
+ throw new Error("Failed to generate Bitcoin address");
1943
+ return { address: f, publicKey: o };
1944
+ }
1945
+ setTransaction(i, d) {
1946
+ window.localStorage.setItem(
1947
+ d,
1948
+ JSON.stringify({
1949
+ psbt: i.psbt.toHex(),
1950
+ publicKey: i.publicKey
1951
+ })
1952
+ );
1953
+ }
1954
+ getTransaction(i, d) {
1955
+ const c = window.localStorage.getItem(i);
1956
+ if (!c) return;
1957
+ d?.remove && window.localStorage.removeItem(i);
1958
+ const o = JSON.parse(c);
1959
+ return {
1960
+ psbt: re.Psbt.fromHex(o.psbt),
1961
+ publicKey: o.publicKey
1962
+ };
1963
+ }
1964
+ async getMPCPayloadAndTransaction(i) {
1965
+ const d = Buffer.from(i.publicKey, "hex"), c = await this.createPSBT({
1966
+ transactionRequest: i
1967
+ }), o = c.toHex(), a = [], s = (u) => ({
1968
+ publicKey: d,
1969
+ sign: (f) => (a[u] = Array.from(f), Buffer.alloc(64))
1970
+ });
1971
+ for (let u = 0; u < c.inputCount; u++)
1972
+ c.signInput(u, s(u));
1973
+ return {
1974
+ transaction: {
1975
+ psbt: re.Psbt.fromHex(o),
1976
+ publicKey: i.publicKey
1977
+ },
1978
+ mpcPayloads: a
1979
+ };
1980
+ }
1981
+ addSignature({
1982
+ transaction: { psbt: i, publicKey: d },
1983
+ mpcSignatures: c
1984
+ }) {
1985
+ const o = Buffer.from(d, "hex"), a = (s) => ({
1986
+ publicKey: o,
1987
+ sign: () => {
1988
+ const u = c[s];
1989
+ return le.parseRSVSignature(u);
1990
+ }
1991
+ });
1992
+ for (let s = 0; s < i.inputCount; s++)
1993
+ i.signInput(s, a(s));
1994
+ return i.finalizeAllInputs(), i.extractTransaction().toHex();
1995
+ }
1996
+ async broadcastTx(i) {
1997
+ return await this.btcRpcAdapter.broadcastTransaction(i);
1998
+ }
1999
+ }
2000
+ class di {
2001
+ }
2002
+ class fi extends di {
2003
+ constructor(i) {
2004
+ super(), this.providerUrl = i;
2005
+ }
2006
+ async fetchFeeRate(i = 6) {
2007
+ const c = await (await fetch(`${this.providerUrl}/v1/fees/recommended`)).json();
2008
+ return i <= 1 ? c.fastestFee : i <= 3 ? c.halfHourFee : i <= 6 ? c.hourFee : c.economyFee;
2009
+ }
2010
+ async fetchUTXOs(i) {
2011
+ try {
2012
+ return await (await fetch(
2013
+ `${this.providerUrl}/address/${i}/utxo`
2014
+ )).json();
2015
+ } catch (d) {
2016
+ return console.error("Failed to fetch UTXOs:", d), [];
2017
+ }
2018
+ }
2019
+ async selectUTXOs(i, d, c = 6) {
2020
+ const o = await this.fetchUTXOs(i), a = await this.fetchFeeRate(c), s = an(o, d, Math.ceil(a + 1));
2021
+ if (!s.inputs || !s.outputs)
2022
+ throw new Error(
2023
+ "Invalid transaction: coinselect failed to find a suitable set of inputs and outputs. This could be due to insufficient funds, or no inputs being available that meet the criteria."
2024
+ );
2025
+ return {
2026
+ inputs: s.inputs,
2027
+ outputs: s.outputs
2028
+ };
2029
+ }
2030
+ async broadcastTransaction(i) {
2031
+ const d = await fetch(`${this.providerUrl}/tx`, {
2032
+ method: "POST",
2033
+ body: i
2034
+ });
2035
+ if (d.ok)
2036
+ return await d.text();
2037
+ throw new Error(`Failed to broadcast transaction: ${await d.text()}`);
2038
+ }
2039
+ async getBalance(i) {
2040
+ const c = await (await fetch(`${this.providerUrl}/address/${i}`)).json();
2041
+ return c.chain_stats.funded_txo_sum - c.chain_stats.spent_txo_sum;
2042
+ }
2043
+ async getTransaction(i) {
2044
+ return await (await fetch(`${this.providerUrl}/tx/${i}`)).json();
2045
+ }
2046
+ }
2047
+ const li = {
2048
+ Mempool: fi
2049
+ };
2050
+ var Ke = {}, j = {}, Z = {}, Y = {}, Dt;
2051
+ function pi() {
2052
+ if (Dt) return Y;
2053
+ Dt = 1, Object.defineProperty(Y, "__esModule", { value: !0 }), Y.utf8Write = Y.utf8Read = Y.utf8Length = void 0;
2054
+ function r(c) {
2055
+ let o = 0, a = 0;
2056
+ for (let s = 0; s < c.length; ++s)
2057
+ a = c.charCodeAt(s), a < 128 ? o += 1 : a < 2048 ? o += 2 : (a & 64512) === 55296 && (c.charCodeAt(s + 1) & 64512) === 56320 ? (++s, o += 4) : o += 3;
2058
+ return o;
2059
+ }
2060
+ Y.utf8Length = r;
2061
+ function i(c, o, a) {
2062
+ if (a - o < 1)
2063
+ return "";
2064
+ const u = [];
2065
+ let f = [], y = 0, b;
2066
+ for (; o < a; )
2067
+ b = c[o++], b < 128 ? u[y++] = b : b > 191 && b < 224 ? u[y++] = (b & 31) << 6 | c[o++] & 63 : b > 239 && b < 365 ? (b = ((b & 7) << 18 | (c[o++] & 63) << 12 | (c[o++] & 63) << 6 | c[o++] & 63) - 65536, u[y++] = 55296 + (b >> 10), u[y++] = 56320 + (b & 1023)) : u[y++] = (b & 15) << 12 | (c[o++] & 63) << 6 | c[o++] & 63, y > 8191 && (f.push(String.fromCharCode(...u)), y = 0);
2068
+ return y && f.push(String.fromCharCode(...u.slice(0, y))), f.join("");
2069
+ }
2070
+ Y.utf8Read = i;
2071
+ function d(c, o, a) {
2072
+ const s = a;
2073
+ let u, f;
2074
+ for (let y = 0; y < c.length; ++y)
2075
+ u = c.charCodeAt(y), u < 128 ? o[a++] = u : u < 2048 ? (o[a++] = u >> 6 | 192, o[a++] = u & 63 | 128) : (u & 64512) === 55296 && ((f = c.charCodeAt(y + 1)) & 64512) === 56320 ? (u = 65536 + ((u & 1023) << 10) + (f & 1023), ++y, o[a++] = u >> 18 | 240, o[a++] = u >> 12 & 63 | 128, o[a++] = u >> 6 & 63 | 128, o[a++] = u & 63 | 128) : (o[a++] = u >> 12 | 224, o[a++] = u >> 6 & 63 | 128, o[a++] = u & 63 | 128);
2076
+ return a - s;
2077
+ }
2078
+ return Y.utf8Write = d, Y;
2079
+ }
2080
+ var M = {}, kt;
2081
+ function yi() {
2082
+ if (kt) return M;
2083
+ kt = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.writeByte = M.writeFixed32 = M.int64Length = M.writeVarint64 = M.writeVarint32 = M.readInt32 = M.readUInt32 = M.zzDecode = M.zzEncode = M.varint32read = M.varint32write = M.uInt64ToString = M.int64ToString = M.int64FromString = M.varint64write = M.varint64read = void 0;
2084
+ function r() {
2085
+ let e = 0, n = 0;
2086
+ for (let _ = 0; _ < 28; _ += 7) {
2087
+ let S = this.buf[this.pos++];
2088
+ if (e |= (S & 127) << _, !(S & 128))
2089
+ return this.assertBounds(), [e, n];
2090
+ }
2091
+ let v = this.buf[this.pos++];
2092
+ if (e |= (v & 15) << 28, n = (v & 112) >> 4, !(v & 128))
2093
+ return this.assertBounds(), [e, n];
2094
+ for (let _ = 3; _ <= 31; _ += 7) {
2095
+ let S = this.buf[this.pos++];
2096
+ if (n |= (S & 127) << _, !(S & 128))
2097
+ return this.assertBounds(), [e, n];
2098
+ }
2099
+ throw new Error("invalid varint");
2100
+ }
2101
+ M.varint64read = r;
2102
+ function i(e, n, v) {
2103
+ for (let T = 0; T < 28; T = T + 7) {
2104
+ const C = e >>> T, A = !(!(C >>> 7) && n == 0), E = (A ? C | 128 : C) & 255;
2105
+ if (v.push(E), !A)
2106
+ return;
2107
+ }
2108
+ const _ = e >>> 28 & 15 | (n & 7) << 4, S = !!(n >> 3);
2109
+ if (v.push((S ? _ | 128 : _) & 255), !!S) {
2110
+ for (let T = 3; T < 31; T = T + 7) {
2111
+ const C = n >>> T, A = !!(C >>> 7), E = (A ? C | 128 : C) & 255;
2112
+ if (v.push(E), !A)
2113
+ return;
2114
+ }
2115
+ v.push(n >>> 31 & 1);
2116
+ }
2117
+ }
2118
+ M.varint64write = i;
2119
+ const d = 4294967296;
2120
+ function c(e) {
2121
+ const n = e[0] === "-";
2122
+ n && (e = e.slice(1));
2123
+ const v = 1e6;
2124
+ let _ = 0, S = 0;
2125
+ function T(C, A) {
2126
+ const E = Number(e.slice(C, A));
2127
+ S *= v, _ = _ * v + E, _ >= d && (S = S + (_ / d | 0), _ = _ % d);
2128
+ }
2129
+ return T(-24, -18), T(-18, -12), T(-12, -6), T(-6), n ? f(_, S) : u(_, S);
2130
+ }
2131
+ M.int64FromString = c;
2132
+ function o(e, n) {
2133
+ let v = u(e, n);
2134
+ const _ = v.hi & 2147483648;
2135
+ _ && (v = f(v.lo, v.hi));
2136
+ const S = a(v.lo, v.hi);
2137
+ return _ ? "-" + S : S;
2138
+ }
2139
+ M.int64ToString = o;
2140
+ function a(e, n) {
2141
+ if ({ lo: e, hi: n } = s(e, n), n <= 2097151)
2142
+ return String(d * n + e);
2143
+ const v = e & 16777215, _ = (e >>> 24 | n << 8) & 16777215, S = n >> 16 & 65535;
2144
+ let T = v + _ * 6777216 + S * 6710656, C = _ + S * 8147497, A = S * 2;
2145
+ const E = 1e7;
2146
+ return T >= E && (C += Math.floor(T / E), T %= E), C >= E && (A += Math.floor(C / E), C %= E), A.toString() + y(C) + y(T);
2147
+ }
2148
+ M.uInt64ToString = a;
2149
+ function s(e, n) {
2150
+ return { lo: e >>> 0, hi: n >>> 0 };
2151
+ }
2152
+ function u(e, n) {
2153
+ return { lo: e | 0, hi: n | 0 };
2154
+ }
2155
+ function f(e, n) {
2156
+ return n = ~n, e ? e = ~e + 1 : n += 1, u(e, n);
2157
+ }
2158
+ const y = (e) => {
2159
+ const n = String(e);
2160
+ return "0000000".slice(n.length) + n;
2161
+ };
2162
+ function b(e, n) {
2163
+ if (e >= 0) {
2164
+ for (; e > 127; )
2165
+ n.push(e & 127 | 128), e = e >>> 7;
2166
+ n.push(e);
2167
+ } else {
2168
+ for (let v = 0; v < 9; v++)
2169
+ n.push(e & 127 | 128), e = e >> 7;
2170
+ n.push(1);
2171
+ }
2172
+ }
2173
+ M.varint32write = b;
2174
+ function l() {
2175
+ let e = this.buf[this.pos++], n = e & 127;
2176
+ if (!(e & 128))
2177
+ return this.assertBounds(), n;
2178
+ if (e = this.buf[this.pos++], n |= (e & 127) << 7, !(e & 128))
2179
+ return this.assertBounds(), n;
2180
+ if (e = this.buf[this.pos++], n |= (e & 127) << 14, !(e & 128))
2181
+ return this.assertBounds(), n;
2182
+ if (e = this.buf[this.pos++], n |= (e & 127) << 21, !(e & 128))
2183
+ return this.assertBounds(), n;
2184
+ e = this.buf[this.pos++], n |= (e & 15) << 28;
2185
+ for (let v = 5; e & 128 && v < 10; v++)
2186
+ e = this.buf[this.pos++];
2187
+ if (e & 128)
2188
+ throw new Error("invalid varint");
2189
+ return this.assertBounds(), n >>> 0;
2190
+ }
2191
+ M.varint32read = l;
2192
+ function I(e, n) {
2193
+ let v = n >> 31;
2194
+ return n = ((n << 1 | e >>> 31) ^ v) >>> 0, e = (e << 1 ^ v) >>> 0, [e, n];
2195
+ }
2196
+ M.zzEncode = I;
2197
+ function p(e, n) {
2198
+ let v = -(e & 1);
2199
+ return e = ((e >>> 1 | n << 31) ^ v) >>> 0, n = (n >>> 1 ^ v) >>> 0, [e, n];
2200
+ }
2201
+ M.zzDecode = p;
2202
+ function g(e, n) {
2203
+ return (e[n] | e[n + 1] << 8 | e[n + 2] << 16) + e[n + 3] * 16777216;
2204
+ }
2205
+ M.readUInt32 = g;
2206
+ function h(e, n) {
2207
+ return (e[n] | e[n + 1] << 8 | e[n + 2] << 16) + (e[n + 3] << 24);
2208
+ }
2209
+ M.readInt32 = h;
2210
+ function m(e, n, v) {
2211
+ for (; e > 127; )
2212
+ n[v++] = e & 127 | 128, e >>>= 7;
2213
+ n[v] = e;
2214
+ }
2215
+ M.writeVarint32 = m;
2216
+ function w(e, n, v) {
2217
+ for (; e.hi; )
2218
+ n[v++] = e.lo & 127 | 128, e.lo = (e.lo >>> 7 | e.hi << 25) >>> 0, e.hi >>>= 7;
2219
+ for (; e.lo > 127; )
2220
+ n[v++] = e.lo & 127 | 128, e.lo = e.lo >>> 7;
2221
+ n[v++] = e.lo;
2222
+ }
2223
+ M.writeVarint64 = w;
2224
+ function B(e, n) {
2225
+ let v = e, _ = (e >>> 28 | n << 4) >>> 0, S = n >>> 24;
2226
+ return S === 0 ? _ === 0 ? v < 16384 ? v < 128 ? 1 : 2 : v < 2097152 ? 3 : 4 : _ < 16384 ? _ < 128 ? 5 : 6 : _ < 2097152 ? 7 : 8 : S < 128 ? 9 : 10;
2227
+ }
2228
+ M.int64Length = B;
2229
+ function R(e, n, v) {
2230
+ n[v] = e & 255, n[v + 1] = e >>> 8 & 255, n[v + 2] = e >>> 16 & 255, n[v + 3] = e >>> 24;
2231
+ }
2232
+ M.writeFixed32 = R;
2233
+ function t(e, n, v) {
2234
+ n[v] = e & 255;
2235
+ }
2236
+ return M.writeByte = t, M;
2237
+ }
2238
+ var xt;
2239
+ function Ae() {
2240
+ if (xt) return Z;
2241
+ xt = 1, Object.defineProperty(Z, "__esModule", { value: !0 }), Z.BinaryWriter = Z.BinaryReader = Z.WireType = void 0;
2242
+ const r = pi(), i = yi();
2243
+ var d;
2244
+ (function(b) {
2245
+ b[b.Varint = 0] = "Varint", b[b.Fixed64 = 1] = "Fixed64", b[b.Bytes = 2] = "Bytes", b[b.Fixed32 = 5] = "Fixed32";
2246
+ })(d || (Z.WireType = d = {}));
2247
+ class c {
2248
+ assertBounds() {
2249
+ if (this.pos > this.len)
2250
+ throw new RangeError("premature EOF");
2251
+ }
2252
+ constructor(l) {
2253
+ this.buf = l ? new Uint8Array(l) : new Uint8Array(0), this.pos = 0, this.type = 0, this.len = this.buf.length;
2254
+ }
2255
+ tag() {
2256
+ const l = this.uint32(), I = l >>> 3, p = l & 7;
2257
+ if (I <= 0 || p < 0 || p > 5)
2258
+ throw new Error("illegal tag: field no " + I + " wire type " + p);
2259
+ return [I, p, l];
2260
+ }
2261
+ skip(l) {
2262
+ if (typeof l == "number") {
2263
+ if (this.pos + l > this.len)
2264
+ throw y(this, l);
2265
+ this.pos += l;
2266
+ } else
2267
+ do
2268
+ if (this.pos >= this.len)
2269
+ throw y(this);
2270
+ while (this.buf[this.pos++] & 128);
2271
+ return this;
2272
+ }
2273
+ skipType(l) {
2274
+ switch (l) {
2275
+ case d.Varint:
2276
+ this.skip();
2277
+ break;
2278
+ case d.Fixed64:
2279
+ this.skip(8);
2280
+ break;
2281
+ case d.Bytes:
2282
+ this.skip(this.uint32());
2283
+ break;
2284
+ case 3:
2285
+ for (; (l = this.uint32() & 7) !== 4; )
2286
+ this.skipType(l);
2287
+ break;
2288
+ case d.Fixed32:
2289
+ this.skip(4);
2290
+ break;
2291
+ /* istanbul ignore next */
2292
+ default:
2293
+ throw Error("invalid wire type " + l + " at offset " + this.pos);
2294
+ }
2295
+ return this;
2296
+ }
2297
+ uint32() {
2298
+ return i.varint32read.bind(this)();
2299
+ }
2300
+ int32() {
2301
+ return this.uint32() | 0;
2302
+ }
2303
+ sint32() {
2304
+ const l = this.uint32();
2305
+ return l % 2 === 1 ? (l + 1) / -2 : l / 2;
2306
+ }
2307
+ fixed32() {
2308
+ const l = (0, i.readUInt32)(this.buf, this.pos);
2309
+ return this.pos += 4, l;
2310
+ }
2311
+ sfixed32() {
2312
+ const l = (0, i.readInt32)(this.buf, this.pos);
2313
+ return this.pos += 4, l;
2314
+ }
2315
+ int64() {
2316
+ const [l, I] = i.varint64read.bind(this)();
2317
+ return BigInt((0, i.int64ToString)(l, I));
2318
+ }
2319
+ uint64() {
2320
+ const [l, I] = i.varint64read.bind(this)();
2321
+ return BigInt((0, i.uInt64ToString)(l, I));
2322
+ }
2323
+ sint64() {
2324
+ let [l, I] = i.varint64read.bind(this)();
2325
+ return [l, I] = (0, i.zzDecode)(l, I), BigInt((0, i.int64ToString)(l, I));
2326
+ }
2327
+ fixed64() {
2328
+ const l = this.sfixed32(), I = this.sfixed32();
2329
+ return BigInt((0, i.uInt64ToString)(l, I));
2330
+ }
2331
+ sfixed64() {
2332
+ const l = this.sfixed32(), I = this.sfixed32();
2333
+ return BigInt((0, i.int64ToString)(l, I));
2334
+ }
2335
+ float() {
2336
+ throw new Error("float not supported");
2337
+ }
2338
+ double() {
2339
+ throw new Error("double not supported");
2340
+ }
2341
+ bool() {
2342
+ const [l, I] = i.varint64read.bind(this)();
2343
+ return l !== 0 || I !== 0;
2344
+ }
2345
+ bytes() {
2346
+ const l = this.uint32(), I = this.pos;
2347
+ return this.pos += l, this.assertBounds(), this.buf.subarray(I, I + l);
2348
+ }
2349
+ string() {
2350
+ const l = this.bytes();
2351
+ return (0, r.utf8Read)(l, 0, l.length);
2352
+ }
2353
+ }
2354
+ Z.BinaryReader = c;
2355
+ class o {
2356
+ constructor(l, I, p) {
2357
+ this.fn = l, this.len = I, this.val = p;
2358
+ }
2359
+ proceed(l, I) {
2360
+ this.fn && this.fn(this.val, l, I);
2361
+ }
2362
+ }
2363
+ class a {
2364
+ constructor(l) {
2365
+ this.head = l.head, this.tail = l.tail, this.len = l.len, this.next = l.states;
2366
+ }
2367
+ }
2368
+ class s {
2369
+ constructor() {
2370
+ this.len = 0, this.uint64 = s.prototype.int64, this.sfixed64 = s.prototype.fixed64, this.sfixed32 = s.prototype.fixed32, this.head = new o(null, 0, 0), this.tail = this.head, this.states = null;
2371
+ }
2372
+ static create() {
2373
+ return new s();
2374
+ }
2375
+ static alloc(l) {
2376
+ return typeof Uint8Array < "u" ? f((I) => new Uint8Array(I), Uint8Array.prototype.subarray)(l) : new Array(l);
2377
+ }
2378
+ _push(l, I, p) {
2379
+ return this.tail = this.tail.next = new o(l, I, p), this.len += I, this;
2380
+ }
2381
+ finish() {
2382
+ let l = this.head.next, I = 0;
2383
+ const p = s.alloc(this.len);
2384
+ for (; l; )
2385
+ l.proceed(p, I), I += l.len, l = l.next;
2386
+ return p;
2387
+ }
2388
+ fork() {
2389
+ return this.states = new a(this), this.head = this.tail = new o(null, 0, 0), this.len = 0, this;
2390
+ }
2391
+ reset() {
2392
+ return this.states ? (this.head = this.states.head, this.tail = this.states.tail, this.len = this.states.len, this.states = this.states.next) : (this.head = this.tail = new o(null, 0, 0), this.len = 0), this;
2393
+ }
2394
+ ldelim() {
2395
+ const l = this.head, I = this.tail, p = this.len;
2396
+ return this.reset().uint32(p), p && (this.tail.next = l.next, this.tail = I, this.len += p), this;
2397
+ }
2398
+ tag(l, I) {
2399
+ return this.uint32((l << 3 | I) >>> 0);
2400
+ }
2401
+ uint32(l) {
2402
+ return this.len += (this.tail = this.tail.next = new o(i.writeVarint32, (l = l >>> 0) < 128 ? 1 : l < 16384 ? 2 : l < 2097152 ? 3 : l < 268435456 ? 4 : 5, l)).len, this;
2403
+ }
2404
+ int32(l) {
2405
+ return l < 0 ? this._push(i.writeVarint64, 10, (0, i.int64FromString)(l.toString())) : this.uint32(l);
2406
+ }
2407
+ sint32(l) {
2408
+ return this.uint32((l << 1 ^ l >> 31) >>> 0);
2409
+ }
2410
+ int64(l) {
2411
+ const { lo: I, hi: p } = (0, i.int64FromString)(l.toString());
2412
+ return this._push(i.writeVarint64, (0, i.int64Length)(I, p), { lo: I, hi: p });
2413
+ }
2414
+ sint64(l) {
2415
+ let { lo: I, hi: p } = (0, i.int64FromString)(l.toString());
2416
+ return [I, p] = (0, i.zzEncode)(I, p), this._push(i.writeVarint64, (0, i.int64Length)(I, p), { lo: I, hi: p });
2417
+ }
2418
+ fixed64(l) {
2419
+ const { lo: I, hi: p } = (0, i.int64FromString)(l.toString());
2420
+ return this._push(i.writeFixed32, 4, I)._push(i.writeFixed32, 4, p);
2421
+ }
2422
+ bool(l) {
2423
+ return this._push(i.writeByte, 1, l ? 1 : 0);
2424
+ }
2425
+ fixed32(l) {
2426
+ return this._push(i.writeFixed32, 4, l >>> 0);
2427
+ }
2428
+ float(l) {
2429
+ throw new Error("float not supported" + l);
2430
+ }
2431
+ double(l) {
2432
+ throw new Error("double not supported" + l);
2433
+ }
2434
+ bytes(l) {
2435
+ const I = l.length >>> 0;
2436
+ return I ? this.uint32(I)._push(u, I, l) : this._push(i.writeByte, 1, 0);
2437
+ }
2438
+ string(l) {
2439
+ const I = (0, r.utf8Length)(l);
2440
+ return I ? this.uint32(I)._push(r.utf8Write, I, l) : this._push(i.writeByte, 1, 0);
2441
+ }
2442
+ }
2443
+ Z.BinaryWriter = s;
2444
+ function u(b, l, I) {
2445
+ if (typeof Uint8Array < "u")
2446
+ l.set(b, I);
2447
+ else
2448
+ for (let p = 0; p < b.length; ++p)
2449
+ l[I + p] = b[p];
2450
+ }
2451
+ function f(b, l, I) {
2452
+ let h = null, m = 8192;
2453
+ return function(B) {
2454
+ if (B < 1 || B > 4096)
2455
+ return b(B);
2456
+ m + B > 8192 && (h = b(8192), m = 0);
2457
+ const R = l.call(h, m, m += B);
2458
+ return m & 7 && (m = (m | 7) + 1), R;
2459
+ };
2460
+ }
2461
+ function y(b, l) {
2462
+ return RangeError("index out of range: " + b.pos + " + " + (l || 1) + " > " + b.len);
2463
+ }
2464
+ return Z;
2465
+ }
2466
+ var F = {}, Pt;
2467
+ function Ne() {
2468
+ if (Pt) return F;
2469
+ Pt = 1, Object.defineProperty(F, "__esModule", { value: !0 }), F.fromJsonTimestamp = F.fromTimestamp = F.toTimestamp = F.setPaginationParams = F.isObject = F.isSet = F.fromDuration = F.toDuration = F.omitDefault = F.base64FromBytes = F.bytesFromBase64 = void 0;
2470
+ var r = (() => {
2471
+ if (typeof r < "u")
2472
+ return r;
2473
+ if (typeof self < "u")
2474
+ return self;
2475
+ if (typeof window < "u")
2476
+ return window;
2477
+ if (typeof et < "u")
2478
+ return et;
2479
+ throw "Unable to locate global object";
2480
+ })();
2481
+ const i = r.atob || ((m) => r.Buffer.from(m, "base64").toString("binary"));
2482
+ function d(m) {
2483
+ const w = i(m), B = new Uint8Array(w.length);
2484
+ for (let R = 0; R < w.length; ++R)
2485
+ B[R] = w.charCodeAt(R);
2486
+ return B;
2487
+ }
2488
+ F.bytesFromBase64 = d;
2489
+ const c = r.btoa || ((m) => r.Buffer.from(m, "binary").toString("base64"));
2490
+ function o(m) {
2491
+ const w = [];
2492
+ return m.forEach((B) => {
2493
+ w.push(String.fromCharCode(B));
2494
+ }), c(w.join(""));
2495
+ }
2496
+ F.base64FromBytes = o;
2497
+ function a(m) {
2498
+ if (typeof m == "string")
2499
+ return m === "" ? void 0 : m;
2500
+ if (typeof m == "number")
2501
+ return m === 0 ? void 0 : m;
2502
+ if (typeof m == "bigint")
2503
+ return m === BigInt(0) ? void 0 : m;
2504
+ throw new Error(`Got unsupported type ${typeof m}`);
2505
+ }
2506
+ F.omitDefault = a;
2507
+ function s(m) {
2508
+ return {
2509
+ seconds: BigInt(Math.floor(parseInt(m) / 1e9)),
2510
+ nanos: parseInt(m) % 1e9
2511
+ };
2512
+ }
2513
+ F.toDuration = s;
2514
+ function u(m) {
2515
+ return (parseInt(m.seconds.toString()) * 1e9 + m.nanos).toString();
2516
+ }
2517
+ F.fromDuration = u;
2518
+ function f(m) {
2519
+ return m != null;
2520
+ }
2521
+ F.isSet = f;
2522
+ function y(m) {
2523
+ return typeof m == "object" && m !== null;
2524
+ }
2525
+ F.isObject = y;
2526
+ const b = (m, w) => (w && (typeof w?.countTotal < "u" && (m.params["pagination.count_total"] = w.countTotal), typeof w?.key < "u" && (m.params["pagination.key"] = Buffer.from(w.key).toString("base64")), typeof w?.limit < "u" && (m.params["pagination.limit"] = w.limit.toString()), typeof w?.offset < "u" && (m.params["pagination.offset"] = w.offset.toString()), typeof w?.reverse < "u" && (m.params["pagination.reverse"] = w.reverse)), m);
2527
+ F.setPaginationParams = b;
2528
+ function l(m) {
2529
+ const w = h(m.getTime() / 1e3), B = m.getTime() % 1e3 * 1e6;
2530
+ return {
2531
+ seconds: w,
2532
+ nanos: B
2533
+ };
2534
+ }
2535
+ F.toTimestamp = l;
2536
+ function I(m) {
2537
+ let w = Number(m.seconds) * 1e3;
2538
+ return w += m.nanos / 1e6, new Date(w);
2539
+ }
2540
+ F.fromTimestamp = I;
2541
+ const p = (m) => ({
2542
+ seconds: f(m.seconds) ? BigInt(m.seconds.toString()) : BigInt(0),
2543
+ nanos: f(m.nanos) ? Number(m.nanos) : 0
2544
+ });
2545
+ function g(m) {
2546
+ return m instanceof Date ? l(m) : typeof m == "string" ? l(new Date(m)) : p(m);
2547
+ }
2548
+ F.fromJsonTimestamp = g;
2549
+ function h(m) {
2550
+ return BigInt(Math.trunc(m));
2551
+ }
2552
+ return F;
2553
+ }
2554
+ var Ct;
2555
+ function Vt() {
2556
+ if (Ct) return j;
2557
+ Ct = 1, Object.defineProperty(j, "__esModule", { value: !0 }), j.CompactBitArray = j.MultiSignature = j.protobufPackage = void 0;
2558
+ const r = Ae(), i = Ne();
2559
+ j.protobufPackage = "cosmos.crypto.multisig.v1beta1";
2560
+ function d() {
2561
+ return {
2562
+ signatures: []
2563
+ };
2564
+ }
2565
+ j.MultiSignature = {
2566
+ typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature",
2567
+ encode(o, a = r.BinaryWriter.create()) {
2568
+ for (const s of o.signatures)
2569
+ a.uint32(10).bytes(s);
2570
+ return a;
2571
+ },
2572
+ decode(o, a) {
2573
+ const s = o instanceof r.BinaryReader ? o : new r.BinaryReader(o);
2574
+ let u = a === void 0 ? s.len : s.pos + a;
2575
+ const f = d();
2576
+ for (; s.pos < u; ) {
2577
+ const y = s.uint32();
2578
+ switch (y >>> 3) {
2579
+ case 1:
2580
+ f.signatures.push(s.bytes());
2581
+ break;
2582
+ default:
2583
+ s.skipType(y & 7);
2584
+ break;
2585
+ }
2586
+ }
2587
+ return f;
2588
+ },
2589
+ fromJSON(o) {
2590
+ const a = d();
2591
+ return Array.isArray(o?.signatures) && (a.signatures = o.signatures.map((s) => (0, i.bytesFromBase64)(s))), a;
2592
+ },
2593
+ toJSON(o) {
2594
+ const a = {};
2595
+ return o.signatures ? a.signatures = o.signatures.map((s) => (0, i.base64FromBytes)(s !== void 0 ? s : new Uint8Array())) : a.signatures = [], a;
2596
+ },
2597
+ fromPartial(o) {
2598
+ const a = d();
2599
+ return a.signatures = o.signatures?.map((s) => s) || [], a;
2600
+ }
2601
+ };
2602
+ function c() {
2603
+ return {
2604
+ extraBitsStored: 0,
2605
+ elems: new Uint8Array()
2606
+ };
2607
+ }
2608
+ return j.CompactBitArray = {
2609
+ typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray",
2610
+ encode(o, a = r.BinaryWriter.create()) {
2611
+ return o.extraBitsStored !== 0 && a.uint32(8).uint32(o.extraBitsStored), o.elems.length !== 0 && a.uint32(18).bytes(o.elems), a;
2612
+ },
2613
+ decode(o, a) {
2614
+ const s = o instanceof r.BinaryReader ? o : new r.BinaryReader(o);
2615
+ let u = a === void 0 ? s.len : s.pos + a;
2616
+ const f = c();
2617
+ for (; s.pos < u; ) {
2618
+ const y = s.uint32();
2619
+ switch (y >>> 3) {
2620
+ case 1:
2621
+ f.extraBitsStored = s.uint32();
2622
+ break;
2623
+ case 2:
2624
+ f.elems = s.bytes();
2625
+ break;
2626
+ default:
2627
+ s.skipType(y & 7);
2628
+ break;
2629
+ }
2630
+ }
2631
+ return f;
2632
+ },
2633
+ fromJSON(o) {
2634
+ const a = c();
2635
+ return (0, i.isSet)(o.extraBitsStored) && (a.extraBitsStored = Number(o.extraBitsStored)), (0, i.isSet)(o.elems) && (a.elems = (0, i.bytesFromBase64)(o.elems)), a;
2636
+ },
2637
+ toJSON(o) {
2638
+ const a = {};
2639
+ return o.extraBitsStored !== void 0 && (a.extraBitsStored = Math.round(o.extraBitsStored)), o.elems !== void 0 && (a.elems = (0, i.base64FromBytes)(o.elems !== void 0 ? o.elems : new Uint8Array())), a;
2640
+ },
2641
+ fromPartial(o) {
2642
+ const a = c();
2643
+ return a.extraBitsStored = o.extraBitsStored ?? 0, a.elems = o.elems ?? new Uint8Array(), a;
2644
+ }
2645
+ }, j;
2646
+ }
2647
+ var ce = {}, Mt;
2648
+ function Wt() {
2649
+ if (Mt) return ce;
2650
+ Mt = 1, Object.defineProperty(ce, "__esModule", { value: !0 }), ce.Any = ce.protobufPackage = void 0;
2651
+ const r = Ae(), i = Ne();
2652
+ ce.protobufPackage = "google.protobuf";
2653
+ function d() {
2654
+ return {
2655
+ typeUrl: "",
2656
+ value: new Uint8Array()
2657
+ };
2658
+ }
2659
+ return ce.Any = {
2660
+ typeUrl: "/google.protobuf.Any",
2661
+ encode(c, o = r.BinaryWriter.create()) {
2662
+ return c.typeUrl !== "" && o.uint32(10).string(c.typeUrl), c.value.length !== 0 && o.uint32(18).bytes(c.value), o;
2663
+ },
2664
+ decode(c, o) {
2665
+ const a = c instanceof r.BinaryReader ? c : new r.BinaryReader(c);
2666
+ let s = o === void 0 ? a.len : a.pos + o;
2667
+ const u = d();
2668
+ for (; a.pos < s; ) {
2669
+ const f = a.uint32();
2670
+ switch (f >>> 3) {
2671
+ case 1:
2672
+ u.typeUrl = a.string();
2673
+ break;
2674
+ case 2:
2675
+ u.value = a.bytes();
2676
+ break;
2677
+ default:
2678
+ a.skipType(f & 7);
2679
+ break;
2680
+ }
2681
+ }
2682
+ return u;
2683
+ },
2684
+ fromJSON(c) {
2685
+ const o = d();
2686
+ return (0, i.isSet)(c.typeUrl) && (o.typeUrl = String(c.typeUrl)), (0, i.isSet)(c.value) && (o.value = (0, i.bytesFromBase64)(c.value)), o;
2687
+ },
2688
+ toJSON(c) {
2689
+ const o = {};
2690
+ return c.typeUrl !== void 0 && (o.typeUrl = c.typeUrl), c.value !== void 0 && (o.value = (0, i.base64FromBytes)(c.value !== void 0 ? c.value : new Uint8Array())), o;
2691
+ },
2692
+ fromPartial(c) {
2693
+ const o = d();
2694
+ return o.typeUrl = c.typeUrl ?? "", o.value = c.value ?? new Uint8Array(), o;
2695
+ }
2696
+ }, ce;
2697
+ }
2698
+ var Rt;
2699
+ function Ht() {
2700
+ return Rt || (Rt = 1, function(r) {
2701
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.SignatureDescriptor_Data_Multi = r.SignatureDescriptor_Data_Single = r.SignatureDescriptor_Data = r.SignatureDescriptor = r.SignatureDescriptors = r.signModeToJSON = r.signModeFromJSON = r.SignMode = r.protobufPackage = void 0;
2702
+ const i = Vt(), d = Wt(), c = Ae(), o = Ne();
2703
+ r.protobufPackage = "cosmos.tx.signing.v1beta1";
2704
+ var a;
2705
+ (function(p) {
2706
+ p[p.SIGN_MODE_UNSPECIFIED = 0] = "SIGN_MODE_UNSPECIFIED", p[p.SIGN_MODE_DIRECT = 1] = "SIGN_MODE_DIRECT", p[p.SIGN_MODE_TEXTUAL = 2] = "SIGN_MODE_TEXTUAL", p[p.SIGN_MODE_DIRECT_AUX = 3] = "SIGN_MODE_DIRECT_AUX", p[p.SIGN_MODE_LEGACY_AMINO_JSON = 127] = "SIGN_MODE_LEGACY_AMINO_JSON", p[p.SIGN_MODE_EIP_191 = 191] = "SIGN_MODE_EIP_191", p[p.UNRECOGNIZED = -1] = "UNRECOGNIZED";
2707
+ })(a || (r.SignMode = a = {}));
2708
+ function s(p) {
2709
+ switch (p) {
2710
+ case 0:
2711
+ case "SIGN_MODE_UNSPECIFIED":
2712
+ return a.SIGN_MODE_UNSPECIFIED;
2713
+ case 1:
2714
+ case "SIGN_MODE_DIRECT":
2715
+ return a.SIGN_MODE_DIRECT;
2716
+ case 2:
2717
+ case "SIGN_MODE_TEXTUAL":
2718
+ return a.SIGN_MODE_TEXTUAL;
2719
+ case 3:
2720
+ case "SIGN_MODE_DIRECT_AUX":
2721
+ return a.SIGN_MODE_DIRECT_AUX;
2722
+ case 127:
2723
+ case "SIGN_MODE_LEGACY_AMINO_JSON":
2724
+ return a.SIGN_MODE_LEGACY_AMINO_JSON;
2725
+ case 191:
2726
+ case "SIGN_MODE_EIP_191":
2727
+ return a.SIGN_MODE_EIP_191;
2728
+ case -1:
2729
+ case "UNRECOGNIZED":
2730
+ default:
2731
+ return a.UNRECOGNIZED;
2732
+ }
2733
+ }
2734
+ r.signModeFromJSON = s;
2735
+ function u(p) {
2736
+ switch (p) {
2737
+ case a.SIGN_MODE_UNSPECIFIED:
2738
+ return "SIGN_MODE_UNSPECIFIED";
2739
+ case a.SIGN_MODE_DIRECT:
2740
+ return "SIGN_MODE_DIRECT";
2741
+ case a.SIGN_MODE_TEXTUAL:
2742
+ return "SIGN_MODE_TEXTUAL";
2743
+ case a.SIGN_MODE_DIRECT_AUX:
2744
+ return "SIGN_MODE_DIRECT_AUX";
2745
+ case a.SIGN_MODE_LEGACY_AMINO_JSON:
2746
+ return "SIGN_MODE_LEGACY_AMINO_JSON";
2747
+ case a.SIGN_MODE_EIP_191:
2748
+ return "SIGN_MODE_EIP_191";
2749
+ case a.UNRECOGNIZED:
2750
+ default:
2751
+ return "UNRECOGNIZED";
2752
+ }
2753
+ }
2754
+ r.signModeToJSON = u;
2755
+ function f() {
2756
+ return {
2757
+ signatures: []
2758
+ };
2759
+ }
2760
+ r.SignatureDescriptors = {
2761
+ typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors",
2762
+ encode(p, g = c.BinaryWriter.create()) {
2763
+ for (const h of p.signatures)
2764
+ r.SignatureDescriptor.encode(h, g.uint32(10).fork()).ldelim();
2765
+ return g;
2766
+ },
2767
+ decode(p, g) {
2768
+ const h = p instanceof c.BinaryReader ? p : new c.BinaryReader(p);
2769
+ let m = g === void 0 ? h.len : h.pos + g;
2770
+ const w = f();
2771
+ for (; h.pos < m; ) {
2772
+ const B = h.uint32();
2773
+ switch (B >>> 3) {
2774
+ case 1:
2775
+ w.signatures.push(r.SignatureDescriptor.decode(h, h.uint32()));
2776
+ break;
2777
+ default:
2778
+ h.skipType(B & 7);
2779
+ break;
2780
+ }
2781
+ }
2782
+ return w;
2783
+ },
2784
+ fromJSON(p) {
2785
+ const g = f();
2786
+ return Array.isArray(p?.signatures) && (g.signatures = p.signatures.map((h) => r.SignatureDescriptor.fromJSON(h))), g;
2787
+ },
2788
+ toJSON(p) {
2789
+ const g = {};
2790
+ return p.signatures ? g.signatures = p.signatures.map((h) => h ? r.SignatureDescriptor.toJSON(h) : void 0) : g.signatures = [], g;
2791
+ },
2792
+ fromPartial(p) {
2793
+ const g = f();
2794
+ return g.signatures = p.signatures?.map((h) => r.SignatureDescriptor.fromPartial(h)) || [], g;
2795
+ }
2796
+ };
2797
+ function y() {
2798
+ return {
2799
+ publicKey: void 0,
2800
+ data: void 0,
2801
+ sequence: BigInt(0)
2802
+ };
2803
+ }
2804
+ r.SignatureDescriptor = {
2805
+ typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor",
2806
+ encode(p, g = c.BinaryWriter.create()) {
2807
+ return p.publicKey !== void 0 && d.Any.encode(p.publicKey, g.uint32(10).fork()).ldelim(), p.data !== void 0 && r.SignatureDescriptor_Data.encode(p.data, g.uint32(18).fork()).ldelim(), p.sequence !== BigInt(0) && g.uint32(24).uint64(p.sequence), g;
2808
+ },
2809
+ decode(p, g) {
2810
+ const h = p instanceof c.BinaryReader ? p : new c.BinaryReader(p);
2811
+ let m = g === void 0 ? h.len : h.pos + g;
2812
+ const w = y();
2813
+ for (; h.pos < m; ) {
2814
+ const B = h.uint32();
2815
+ switch (B >>> 3) {
2816
+ case 1:
2817
+ w.publicKey = d.Any.decode(h, h.uint32());
2818
+ break;
2819
+ case 2:
2820
+ w.data = r.SignatureDescriptor_Data.decode(h, h.uint32());
2821
+ break;
2822
+ case 3:
2823
+ w.sequence = h.uint64();
2824
+ break;
2825
+ default:
2826
+ h.skipType(B & 7);
2827
+ break;
2828
+ }
2829
+ }
2830
+ return w;
2831
+ },
2832
+ fromJSON(p) {
2833
+ const g = y();
2834
+ return (0, o.isSet)(p.publicKey) && (g.publicKey = d.Any.fromJSON(p.publicKey)), (0, o.isSet)(p.data) && (g.data = r.SignatureDescriptor_Data.fromJSON(p.data)), (0, o.isSet)(p.sequence) && (g.sequence = BigInt(p.sequence.toString())), g;
2835
+ },
2836
+ toJSON(p) {
2837
+ const g = {};
2838
+ return p.publicKey !== void 0 && (g.publicKey = p.publicKey ? d.Any.toJSON(p.publicKey) : void 0), p.data !== void 0 && (g.data = p.data ? r.SignatureDescriptor_Data.toJSON(p.data) : void 0), p.sequence !== void 0 && (g.sequence = (p.sequence || BigInt(0)).toString()), g;
2839
+ },
2840
+ fromPartial(p) {
2841
+ const g = y();
2842
+ return p.publicKey !== void 0 && p.publicKey !== null && (g.publicKey = d.Any.fromPartial(p.publicKey)), p.data !== void 0 && p.data !== null && (g.data = r.SignatureDescriptor_Data.fromPartial(p.data)), p.sequence !== void 0 && p.sequence !== null && (g.sequence = BigInt(p.sequence.toString())), g;
2843
+ }
2844
+ };
2845
+ function b() {
2846
+ return {
2847
+ single: void 0,
2848
+ multi: void 0
2849
+ };
2850
+ }
2851
+ r.SignatureDescriptor_Data = {
2852
+ typeUrl: "/cosmos.tx.signing.v1beta1.Data",
2853
+ encode(p, g = c.BinaryWriter.create()) {
2854
+ return p.single !== void 0 && r.SignatureDescriptor_Data_Single.encode(p.single, g.uint32(10).fork()).ldelim(), p.multi !== void 0 && r.SignatureDescriptor_Data_Multi.encode(p.multi, g.uint32(18).fork()).ldelim(), g;
2855
+ },
2856
+ decode(p, g) {
2857
+ const h = p instanceof c.BinaryReader ? p : new c.BinaryReader(p);
2858
+ let m = g === void 0 ? h.len : h.pos + g;
2859
+ const w = b();
2860
+ for (; h.pos < m; ) {
2861
+ const B = h.uint32();
2862
+ switch (B >>> 3) {
2863
+ case 1:
2864
+ w.single = r.SignatureDescriptor_Data_Single.decode(h, h.uint32());
2865
+ break;
2866
+ case 2:
2867
+ w.multi = r.SignatureDescriptor_Data_Multi.decode(h, h.uint32());
2868
+ break;
2869
+ default:
2870
+ h.skipType(B & 7);
2871
+ break;
2872
+ }
2873
+ }
2874
+ return w;
2875
+ },
2876
+ fromJSON(p) {
2877
+ const g = b();
2878
+ return (0, o.isSet)(p.single) && (g.single = r.SignatureDescriptor_Data_Single.fromJSON(p.single)), (0, o.isSet)(p.multi) && (g.multi = r.SignatureDescriptor_Data_Multi.fromJSON(p.multi)), g;
2879
+ },
2880
+ toJSON(p) {
2881
+ const g = {};
2882
+ return p.single !== void 0 && (g.single = p.single ? r.SignatureDescriptor_Data_Single.toJSON(p.single) : void 0), p.multi !== void 0 && (g.multi = p.multi ? r.SignatureDescriptor_Data_Multi.toJSON(p.multi) : void 0), g;
2883
+ },
2884
+ fromPartial(p) {
2885
+ const g = b();
2886
+ return p.single !== void 0 && p.single !== null && (g.single = r.SignatureDescriptor_Data_Single.fromPartial(p.single)), p.multi !== void 0 && p.multi !== null && (g.multi = r.SignatureDescriptor_Data_Multi.fromPartial(p.multi)), g;
2887
+ }
2888
+ };
2889
+ function l() {
2890
+ return {
2891
+ mode: 0,
2892
+ signature: new Uint8Array()
2893
+ };
2894
+ }
2895
+ r.SignatureDescriptor_Data_Single = {
2896
+ typeUrl: "/cosmos.tx.signing.v1beta1.Single",
2897
+ encode(p, g = c.BinaryWriter.create()) {
2898
+ return p.mode !== 0 && g.uint32(8).int32(p.mode), p.signature.length !== 0 && g.uint32(18).bytes(p.signature), g;
2899
+ },
2900
+ decode(p, g) {
2901
+ const h = p instanceof c.BinaryReader ? p : new c.BinaryReader(p);
2902
+ let m = g === void 0 ? h.len : h.pos + g;
2903
+ const w = l();
2904
+ for (; h.pos < m; ) {
2905
+ const B = h.uint32();
2906
+ switch (B >>> 3) {
2907
+ case 1:
2908
+ w.mode = h.int32();
2909
+ break;
2910
+ case 2:
2911
+ w.signature = h.bytes();
2912
+ break;
2913
+ default:
2914
+ h.skipType(B & 7);
2915
+ break;
2916
+ }
2917
+ }
2918
+ return w;
2919
+ },
2920
+ fromJSON(p) {
2921
+ const g = l();
2922
+ return (0, o.isSet)(p.mode) && (g.mode = s(p.mode)), (0, o.isSet)(p.signature) && (g.signature = (0, o.bytesFromBase64)(p.signature)), g;
2923
+ },
2924
+ toJSON(p) {
2925
+ const g = {};
2926
+ return p.mode !== void 0 && (g.mode = u(p.mode)), p.signature !== void 0 && (g.signature = (0, o.base64FromBytes)(p.signature !== void 0 ? p.signature : new Uint8Array())), g;
2927
+ },
2928
+ fromPartial(p) {
2929
+ const g = l();
2930
+ return g.mode = p.mode ?? 0, g.signature = p.signature ?? new Uint8Array(), g;
2931
+ }
2932
+ };
2933
+ function I() {
2934
+ return {
2935
+ bitarray: void 0,
2936
+ signatures: []
2937
+ };
2938
+ }
2939
+ r.SignatureDescriptor_Data_Multi = {
2940
+ typeUrl: "/cosmos.tx.signing.v1beta1.Multi",
2941
+ encode(p, g = c.BinaryWriter.create()) {
2942
+ p.bitarray !== void 0 && i.CompactBitArray.encode(p.bitarray, g.uint32(10).fork()).ldelim();
2943
+ for (const h of p.signatures)
2944
+ r.SignatureDescriptor_Data.encode(h, g.uint32(18).fork()).ldelim();
2945
+ return g;
2946
+ },
2947
+ decode(p, g) {
2948
+ const h = p instanceof c.BinaryReader ? p : new c.BinaryReader(p);
2949
+ let m = g === void 0 ? h.len : h.pos + g;
2950
+ const w = I();
2951
+ for (; h.pos < m; ) {
2952
+ const B = h.uint32();
2953
+ switch (B >>> 3) {
2954
+ case 1:
2955
+ w.bitarray = i.CompactBitArray.decode(h, h.uint32());
2956
+ break;
2957
+ case 2:
2958
+ w.signatures.push(r.SignatureDescriptor_Data.decode(h, h.uint32()));
2959
+ break;
2960
+ default:
2961
+ h.skipType(B & 7);
2962
+ break;
2963
+ }
2964
+ }
2965
+ return w;
2966
+ },
2967
+ fromJSON(p) {
2968
+ const g = I();
2969
+ return (0, o.isSet)(p.bitarray) && (g.bitarray = i.CompactBitArray.fromJSON(p.bitarray)), Array.isArray(p?.signatures) && (g.signatures = p.signatures.map((h) => r.SignatureDescriptor_Data.fromJSON(h))), g;
2970
+ },
2971
+ toJSON(p) {
2972
+ const g = {};
2973
+ return p.bitarray !== void 0 && (g.bitarray = p.bitarray ? i.CompactBitArray.toJSON(p.bitarray) : void 0), p.signatures ? g.signatures = p.signatures.map((h) => h ? r.SignatureDescriptor_Data.toJSON(h) : void 0) : g.signatures = [], g;
2974
+ },
2975
+ fromPartial(p) {
2976
+ const g = I();
2977
+ return p.bitarray !== void 0 && p.bitarray !== null && (g.bitarray = i.CompactBitArray.fromPartial(p.bitarray)), g.signatures = p.signatures?.map((h) => r.SignatureDescriptor_Data.fromPartial(h)) || [], g;
2978
+ }
2979
+ };
2980
+ }(Ke)), Ke;
2981
+ }
2982
+ var hi = Ht(), qe = {}, G = {}, Ft;
2983
+ function gi() {
2984
+ if (Ft) return G;
2985
+ Ft = 1, Object.defineProperty(G, "__esModule", { value: !0 }), G.DecProto = G.IntProto = G.DecCoin = G.Coin = G.protobufPackage = void 0;
2986
+ const r = Ae(), i = Ne();
2987
+ G.protobufPackage = "cosmos.base.v1beta1";
2988
+ function d() {
2989
+ return {
2990
+ denom: "",
2991
+ amount: ""
2992
+ };
2993
+ }
2994
+ G.Coin = {
2995
+ typeUrl: "/cosmos.base.v1beta1.Coin",
2996
+ encode(s, u = r.BinaryWriter.create()) {
2997
+ return s.denom !== "" && u.uint32(10).string(s.denom), s.amount !== "" && u.uint32(18).string(s.amount), u;
2998
+ },
2999
+ decode(s, u) {
3000
+ const f = s instanceof r.BinaryReader ? s : new r.BinaryReader(s);
3001
+ let y = u === void 0 ? f.len : f.pos + u;
3002
+ const b = d();
3003
+ for (; f.pos < y; ) {
3004
+ const l = f.uint32();
3005
+ switch (l >>> 3) {
3006
+ case 1:
3007
+ b.denom = f.string();
3008
+ break;
3009
+ case 2:
3010
+ b.amount = f.string();
3011
+ break;
3012
+ default:
3013
+ f.skipType(l & 7);
3014
+ break;
3015
+ }
3016
+ }
3017
+ return b;
3018
+ },
3019
+ fromJSON(s) {
3020
+ const u = d();
3021
+ return (0, i.isSet)(s.denom) && (u.denom = String(s.denom)), (0, i.isSet)(s.amount) && (u.amount = String(s.amount)), u;
3022
+ },
3023
+ toJSON(s) {
3024
+ const u = {};
3025
+ return s.denom !== void 0 && (u.denom = s.denom), s.amount !== void 0 && (u.amount = s.amount), u;
3026
+ },
3027
+ fromPartial(s) {
3028
+ const u = d();
3029
+ return u.denom = s.denom ?? "", u.amount = s.amount ?? "", u;
3030
+ }
3031
+ };
3032
+ function c() {
3033
+ return {
3034
+ denom: "",
3035
+ amount: ""
3036
+ };
3037
+ }
3038
+ G.DecCoin = {
3039
+ typeUrl: "/cosmos.base.v1beta1.DecCoin",
3040
+ encode(s, u = r.BinaryWriter.create()) {
3041
+ return s.denom !== "" && u.uint32(10).string(s.denom), s.amount !== "" && u.uint32(18).string(s.amount), u;
3042
+ },
3043
+ decode(s, u) {
3044
+ const f = s instanceof r.BinaryReader ? s : new r.BinaryReader(s);
3045
+ let y = u === void 0 ? f.len : f.pos + u;
3046
+ const b = c();
3047
+ for (; f.pos < y; ) {
3048
+ const l = f.uint32();
3049
+ switch (l >>> 3) {
3050
+ case 1:
3051
+ b.denom = f.string();
3052
+ break;
3053
+ case 2:
3054
+ b.amount = f.string();
3055
+ break;
3056
+ default:
3057
+ f.skipType(l & 7);
3058
+ break;
3059
+ }
3060
+ }
3061
+ return b;
3062
+ },
3063
+ fromJSON(s) {
3064
+ const u = c();
3065
+ return (0, i.isSet)(s.denom) && (u.denom = String(s.denom)), (0, i.isSet)(s.amount) && (u.amount = String(s.amount)), u;
3066
+ },
3067
+ toJSON(s) {
3068
+ const u = {};
3069
+ return s.denom !== void 0 && (u.denom = s.denom), s.amount !== void 0 && (u.amount = s.amount), u;
3070
+ },
3071
+ fromPartial(s) {
3072
+ const u = c();
3073
+ return u.denom = s.denom ?? "", u.amount = s.amount ?? "", u;
3074
+ }
3075
+ };
3076
+ function o() {
3077
+ return {
3078
+ int: ""
3079
+ };
3080
+ }
3081
+ G.IntProto = {
3082
+ typeUrl: "/cosmos.base.v1beta1.IntProto",
3083
+ encode(s, u = r.BinaryWriter.create()) {
3084
+ return s.int !== "" && u.uint32(10).string(s.int), u;
3085
+ },
3086
+ decode(s, u) {
3087
+ const f = s instanceof r.BinaryReader ? s : new r.BinaryReader(s);
3088
+ let y = u === void 0 ? f.len : f.pos + u;
3089
+ const b = o();
3090
+ for (; f.pos < y; ) {
3091
+ const l = f.uint32();
3092
+ switch (l >>> 3) {
3093
+ case 1:
3094
+ b.int = f.string();
3095
+ break;
3096
+ default:
3097
+ f.skipType(l & 7);
3098
+ break;
3099
+ }
3100
+ }
3101
+ return b;
3102
+ },
3103
+ fromJSON(s) {
3104
+ const u = o();
3105
+ return (0, i.isSet)(s.int) && (u.int = String(s.int)), u;
3106
+ },
3107
+ toJSON(s) {
3108
+ const u = {};
3109
+ return s.int !== void 0 && (u.int = s.int), u;
3110
+ },
3111
+ fromPartial(s) {
3112
+ const u = o();
3113
+ return u.int = s.int ?? "", u;
3114
+ }
3115
+ };
3116
+ function a() {
3117
+ return {
3118
+ dec: ""
3119
+ };
3120
+ }
3121
+ return G.DecProto = {
3122
+ typeUrl: "/cosmos.base.v1beta1.DecProto",
3123
+ encode(s, u = r.BinaryWriter.create()) {
3124
+ return s.dec !== "" && u.uint32(10).string(s.dec), u;
3125
+ },
3126
+ decode(s, u) {
3127
+ const f = s instanceof r.BinaryReader ? s : new r.BinaryReader(s);
3128
+ let y = u === void 0 ? f.len : f.pos + u;
3129
+ const b = a();
3130
+ for (; f.pos < y; ) {
3131
+ const l = f.uint32();
3132
+ switch (l >>> 3) {
3133
+ case 1:
3134
+ b.dec = f.string();
3135
+ break;
3136
+ default:
3137
+ f.skipType(l & 7);
3138
+ break;
3139
+ }
3140
+ }
3141
+ return b;
3142
+ },
3143
+ fromJSON(s) {
3144
+ const u = a();
3145
+ return (0, i.isSet)(s.dec) && (u.dec = String(s.dec)), u;
3146
+ },
3147
+ toJSON(s) {
3148
+ const u = {};
3149
+ return s.dec !== void 0 && (u.dec = s.dec), u;
3150
+ },
3151
+ fromPartial(s) {
3152
+ const u = a();
3153
+ return u.dec = s.dec ?? "", u;
3154
+ }
3155
+ }, G;
3156
+ }
3157
+ var Ut;
3158
+ function mi() {
3159
+ return Ut || (Ut = 1, function(r) {
3160
+ Object.defineProperty(r, "__esModule", { value: !0 }), r.AuxSignerData = r.Tip = r.Fee = r.ModeInfo_Multi = r.ModeInfo_Single = r.ModeInfo = r.SignerInfo = r.AuthInfo = r.TxBody = r.SignDocDirectAux = r.SignDoc = r.TxRaw = r.Tx = r.protobufPackage = void 0;
3161
+ const i = Wt(), d = Ht(), c = Vt(), o = gi(), a = Ae(), s = Ne();
3162
+ r.protobufPackage = "cosmos.tx.v1beta1";
3163
+ function u() {
3164
+ return {
3165
+ body: void 0,
3166
+ authInfo: void 0,
3167
+ signatures: []
3168
+ };
3169
+ }
3170
+ r.Tx = {
3171
+ typeUrl: "/cosmos.tx.v1beta1.Tx",
3172
+ encode(t, e = a.BinaryWriter.create()) {
3173
+ t.body !== void 0 && r.TxBody.encode(t.body, e.uint32(10).fork()).ldelim(), t.authInfo !== void 0 && r.AuthInfo.encode(t.authInfo, e.uint32(18).fork()).ldelim();
3174
+ for (const n of t.signatures)
3175
+ e.uint32(26).bytes(n);
3176
+ return e;
3177
+ },
3178
+ decode(t, e) {
3179
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3180
+ let v = e === void 0 ? n.len : n.pos + e;
3181
+ const _ = u();
3182
+ for (; n.pos < v; ) {
3183
+ const S = n.uint32();
3184
+ switch (S >>> 3) {
3185
+ case 1:
3186
+ _.body = r.TxBody.decode(n, n.uint32());
3187
+ break;
3188
+ case 2:
3189
+ _.authInfo = r.AuthInfo.decode(n, n.uint32());
3190
+ break;
3191
+ case 3:
3192
+ _.signatures.push(n.bytes());
3193
+ break;
3194
+ default:
3195
+ n.skipType(S & 7);
3196
+ break;
3197
+ }
3198
+ }
3199
+ return _;
3200
+ },
3201
+ fromJSON(t) {
3202
+ const e = u();
3203
+ return (0, s.isSet)(t.body) && (e.body = r.TxBody.fromJSON(t.body)), (0, s.isSet)(t.authInfo) && (e.authInfo = r.AuthInfo.fromJSON(t.authInfo)), Array.isArray(t?.signatures) && (e.signatures = t.signatures.map((n) => (0, s.bytesFromBase64)(n))), e;
3204
+ },
3205
+ toJSON(t) {
3206
+ const e = {};
3207
+ return t.body !== void 0 && (e.body = t.body ? r.TxBody.toJSON(t.body) : void 0), t.authInfo !== void 0 && (e.authInfo = t.authInfo ? r.AuthInfo.toJSON(t.authInfo) : void 0), t.signatures ? e.signatures = t.signatures.map((n) => (0, s.base64FromBytes)(n !== void 0 ? n : new Uint8Array())) : e.signatures = [], e;
3208
+ },
3209
+ fromPartial(t) {
3210
+ const e = u();
3211
+ return t.body !== void 0 && t.body !== null && (e.body = r.TxBody.fromPartial(t.body)), t.authInfo !== void 0 && t.authInfo !== null && (e.authInfo = r.AuthInfo.fromPartial(t.authInfo)), e.signatures = t.signatures?.map((n) => n) || [], e;
3212
+ }
3213
+ };
3214
+ function f() {
3215
+ return {
3216
+ bodyBytes: new Uint8Array(),
3217
+ authInfoBytes: new Uint8Array(),
3218
+ signatures: []
3219
+ };
3220
+ }
3221
+ r.TxRaw = {
3222
+ typeUrl: "/cosmos.tx.v1beta1.TxRaw",
3223
+ encode(t, e = a.BinaryWriter.create()) {
3224
+ t.bodyBytes.length !== 0 && e.uint32(10).bytes(t.bodyBytes), t.authInfoBytes.length !== 0 && e.uint32(18).bytes(t.authInfoBytes);
3225
+ for (const n of t.signatures)
3226
+ e.uint32(26).bytes(n);
3227
+ return e;
3228
+ },
3229
+ decode(t, e) {
3230
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3231
+ let v = e === void 0 ? n.len : n.pos + e;
3232
+ const _ = f();
3233
+ for (; n.pos < v; ) {
3234
+ const S = n.uint32();
3235
+ switch (S >>> 3) {
3236
+ case 1:
3237
+ _.bodyBytes = n.bytes();
3238
+ break;
3239
+ case 2:
3240
+ _.authInfoBytes = n.bytes();
3241
+ break;
3242
+ case 3:
3243
+ _.signatures.push(n.bytes());
3244
+ break;
3245
+ default:
3246
+ n.skipType(S & 7);
3247
+ break;
3248
+ }
3249
+ }
3250
+ return _;
3251
+ },
3252
+ fromJSON(t) {
3253
+ const e = f();
3254
+ return (0, s.isSet)(t.bodyBytes) && (e.bodyBytes = (0, s.bytesFromBase64)(t.bodyBytes)), (0, s.isSet)(t.authInfoBytes) && (e.authInfoBytes = (0, s.bytesFromBase64)(t.authInfoBytes)), Array.isArray(t?.signatures) && (e.signatures = t.signatures.map((n) => (0, s.bytesFromBase64)(n))), e;
3255
+ },
3256
+ toJSON(t) {
3257
+ const e = {};
3258
+ return t.bodyBytes !== void 0 && (e.bodyBytes = (0, s.base64FromBytes)(t.bodyBytes !== void 0 ? t.bodyBytes : new Uint8Array())), t.authInfoBytes !== void 0 && (e.authInfoBytes = (0, s.base64FromBytes)(t.authInfoBytes !== void 0 ? t.authInfoBytes : new Uint8Array())), t.signatures ? e.signatures = t.signatures.map((n) => (0, s.base64FromBytes)(n !== void 0 ? n : new Uint8Array())) : e.signatures = [], e;
3259
+ },
3260
+ fromPartial(t) {
3261
+ const e = f();
3262
+ return e.bodyBytes = t.bodyBytes ?? new Uint8Array(), e.authInfoBytes = t.authInfoBytes ?? new Uint8Array(), e.signatures = t.signatures?.map((n) => n) || [], e;
3263
+ }
3264
+ };
3265
+ function y() {
3266
+ return {
3267
+ bodyBytes: new Uint8Array(),
3268
+ authInfoBytes: new Uint8Array(),
3269
+ chainId: "",
3270
+ accountNumber: BigInt(0)
3271
+ };
3272
+ }
3273
+ r.SignDoc = {
3274
+ typeUrl: "/cosmos.tx.v1beta1.SignDoc",
3275
+ encode(t, e = a.BinaryWriter.create()) {
3276
+ return t.bodyBytes.length !== 0 && e.uint32(10).bytes(t.bodyBytes), t.authInfoBytes.length !== 0 && e.uint32(18).bytes(t.authInfoBytes), t.chainId !== "" && e.uint32(26).string(t.chainId), t.accountNumber !== BigInt(0) && e.uint32(32).uint64(t.accountNumber), e;
3277
+ },
3278
+ decode(t, e) {
3279
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3280
+ let v = e === void 0 ? n.len : n.pos + e;
3281
+ const _ = y();
3282
+ for (; n.pos < v; ) {
3283
+ const S = n.uint32();
3284
+ switch (S >>> 3) {
3285
+ case 1:
3286
+ _.bodyBytes = n.bytes();
3287
+ break;
3288
+ case 2:
3289
+ _.authInfoBytes = n.bytes();
3290
+ break;
3291
+ case 3:
3292
+ _.chainId = n.string();
3293
+ break;
3294
+ case 4:
3295
+ _.accountNumber = n.uint64();
3296
+ break;
3297
+ default:
3298
+ n.skipType(S & 7);
3299
+ break;
3300
+ }
3301
+ }
3302
+ return _;
3303
+ },
3304
+ fromJSON(t) {
3305
+ const e = y();
3306
+ return (0, s.isSet)(t.bodyBytes) && (e.bodyBytes = (0, s.bytesFromBase64)(t.bodyBytes)), (0, s.isSet)(t.authInfoBytes) && (e.authInfoBytes = (0, s.bytesFromBase64)(t.authInfoBytes)), (0, s.isSet)(t.chainId) && (e.chainId = String(t.chainId)), (0, s.isSet)(t.accountNumber) && (e.accountNumber = BigInt(t.accountNumber.toString())), e;
3307
+ },
3308
+ toJSON(t) {
3309
+ const e = {};
3310
+ return t.bodyBytes !== void 0 && (e.bodyBytes = (0, s.base64FromBytes)(t.bodyBytes !== void 0 ? t.bodyBytes : new Uint8Array())), t.authInfoBytes !== void 0 && (e.authInfoBytes = (0, s.base64FromBytes)(t.authInfoBytes !== void 0 ? t.authInfoBytes : new Uint8Array())), t.chainId !== void 0 && (e.chainId = t.chainId), t.accountNumber !== void 0 && (e.accountNumber = (t.accountNumber || BigInt(0)).toString()), e;
3311
+ },
3312
+ fromPartial(t) {
3313
+ const e = y();
3314
+ return e.bodyBytes = t.bodyBytes ?? new Uint8Array(), e.authInfoBytes = t.authInfoBytes ?? new Uint8Array(), e.chainId = t.chainId ?? "", t.accountNumber !== void 0 && t.accountNumber !== null && (e.accountNumber = BigInt(t.accountNumber.toString())), e;
3315
+ }
3316
+ };
3317
+ function b() {
3318
+ return {
3319
+ bodyBytes: new Uint8Array(),
3320
+ publicKey: void 0,
3321
+ chainId: "",
3322
+ accountNumber: BigInt(0),
3323
+ sequence: BigInt(0),
3324
+ tip: void 0
3325
+ };
3326
+ }
3327
+ r.SignDocDirectAux = {
3328
+ typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux",
3329
+ encode(t, e = a.BinaryWriter.create()) {
3330
+ return t.bodyBytes.length !== 0 && e.uint32(10).bytes(t.bodyBytes), t.publicKey !== void 0 && i.Any.encode(t.publicKey, e.uint32(18).fork()).ldelim(), t.chainId !== "" && e.uint32(26).string(t.chainId), t.accountNumber !== BigInt(0) && e.uint32(32).uint64(t.accountNumber), t.sequence !== BigInt(0) && e.uint32(40).uint64(t.sequence), t.tip !== void 0 && r.Tip.encode(t.tip, e.uint32(50).fork()).ldelim(), e;
3331
+ },
3332
+ decode(t, e) {
3333
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3334
+ let v = e === void 0 ? n.len : n.pos + e;
3335
+ const _ = b();
3336
+ for (; n.pos < v; ) {
3337
+ const S = n.uint32();
3338
+ switch (S >>> 3) {
3339
+ case 1:
3340
+ _.bodyBytes = n.bytes();
3341
+ break;
3342
+ case 2:
3343
+ _.publicKey = i.Any.decode(n, n.uint32());
3344
+ break;
3345
+ case 3:
3346
+ _.chainId = n.string();
3347
+ break;
3348
+ case 4:
3349
+ _.accountNumber = n.uint64();
3350
+ break;
3351
+ case 5:
3352
+ _.sequence = n.uint64();
3353
+ break;
3354
+ case 6:
3355
+ _.tip = r.Tip.decode(n, n.uint32());
3356
+ break;
3357
+ default:
3358
+ n.skipType(S & 7);
3359
+ break;
3360
+ }
3361
+ }
3362
+ return _;
3363
+ },
3364
+ fromJSON(t) {
3365
+ const e = b();
3366
+ return (0, s.isSet)(t.bodyBytes) && (e.bodyBytes = (0, s.bytesFromBase64)(t.bodyBytes)), (0, s.isSet)(t.publicKey) && (e.publicKey = i.Any.fromJSON(t.publicKey)), (0, s.isSet)(t.chainId) && (e.chainId = String(t.chainId)), (0, s.isSet)(t.accountNumber) && (e.accountNumber = BigInt(t.accountNumber.toString())), (0, s.isSet)(t.sequence) && (e.sequence = BigInt(t.sequence.toString())), (0, s.isSet)(t.tip) && (e.tip = r.Tip.fromJSON(t.tip)), e;
3367
+ },
3368
+ toJSON(t) {
3369
+ const e = {};
3370
+ return t.bodyBytes !== void 0 && (e.bodyBytes = (0, s.base64FromBytes)(t.bodyBytes !== void 0 ? t.bodyBytes : new Uint8Array())), t.publicKey !== void 0 && (e.publicKey = t.publicKey ? i.Any.toJSON(t.publicKey) : void 0), t.chainId !== void 0 && (e.chainId = t.chainId), t.accountNumber !== void 0 && (e.accountNumber = (t.accountNumber || BigInt(0)).toString()), t.sequence !== void 0 && (e.sequence = (t.sequence || BigInt(0)).toString()), t.tip !== void 0 && (e.tip = t.tip ? r.Tip.toJSON(t.tip) : void 0), e;
3371
+ },
3372
+ fromPartial(t) {
3373
+ const e = b();
3374
+ return e.bodyBytes = t.bodyBytes ?? new Uint8Array(), t.publicKey !== void 0 && t.publicKey !== null && (e.publicKey = i.Any.fromPartial(t.publicKey)), e.chainId = t.chainId ?? "", t.accountNumber !== void 0 && t.accountNumber !== null && (e.accountNumber = BigInt(t.accountNumber.toString())), t.sequence !== void 0 && t.sequence !== null && (e.sequence = BigInt(t.sequence.toString())), t.tip !== void 0 && t.tip !== null && (e.tip = r.Tip.fromPartial(t.tip)), e;
3375
+ }
3376
+ };
3377
+ function l() {
3378
+ return {
3379
+ messages: [],
3380
+ memo: "",
3381
+ timeoutHeight: BigInt(0),
3382
+ extensionOptions: [],
3383
+ nonCriticalExtensionOptions: []
3384
+ };
3385
+ }
3386
+ r.TxBody = {
3387
+ typeUrl: "/cosmos.tx.v1beta1.TxBody",
3388
+ encode(t, e = a.BinaryWriter.create()) {
3389
+ for (const n of t.messages)
3390
+ i.Any.encode(n, e.uint32(10).fork()).ldelim();
3391
+ t.memo !== "" && e.uint32(18).string(t.memo), t.timeoutHeight !== BigInt(0) && e.uint32(24).uint64(t.timeoutHeight);
3392
+ for (const n of t.extensionOptions)
3393
+ i.Any.encode(n, e.uint32(8186).fork()).ldelim();
3394
+ for (const n of t.nonCriticalExtensionOptions)
3395
+ i.Any.encode(n, e.uint32(16378).fork()).ldelim();
3396
+ return e;
3397
+ },
3398
+ decode(t, e) {
3399
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3400
+ let v = e === void 0 ? n.len : n.pos + e;
3401
+ const _ = l();
3402
+ for (; n.pos < v; ) {
3403
+ const S = n.uint32();
3404
+ switch (S >>> 3) {
3405
+ case 1:
3406
+ _.messages.push(i.Any.decode(n, n.uint32()));
3407
+ break;
3408
+ case 2:
3409
+ _.memo = n.string();
3410
+ break;
3411
+ case 3:
3412
+ _.timeoutHeight = n.uint64();
3413
+ break;
3414
+ case 1023:
3415
+ _.extensionOptions.push(i.Any.decode(n, n.uint32()));
3416
+ break;
3417
+ case 2047:
3418
+ _.nonCriticalExtensionOptions.push(i.Any.decode(n, n.uint32()));
3419
+ break;
3420
+ default:
3421
+ n.skipType(S & 7);
3422
+ break;
3423
+ }
3424
+ }
3425
+ return _;
3426
+ },
3427
+ fromJSON(t) {
3428
+ const e = l();
3429
+ return Array.isArray(t?.messages) && (e.messages = t.messages.map((n) => i.Any.fromJSON(n))), (0, s.isSet)(t.memo) && (e.memo = String(t.memo)), (0, s.isSet)(t.timeoutHeight) && (e.timeoutHeight = BigInt(t.timeoutHeight.toString())), Array.isArray(t?.extensionOptions) && (e.extensionOptions = t.extensionOptions.map((n) => i.Any.fromJSON(n))), Array.isArray(t?.nonCriticalExtensionOptions) && (e.nonCriticalExtensionOptions = t.nonCriticalExtensionOptions.map((n) => i.Any.fromJSON(n))), e;
3430
+ },
3431
+ toJSON(t) {
3432
+ const e = {};
3433
+ return t.messages ? e.messages = t.messages.map((n) => n ? i.Any.toJSON(n) : void 0) : e.messages = [], t.memo !== void 0 && (e.memo = t.memo), t.timeoutHeight !== void 0 && (e.timeoutHeight = (t.timeoutHeight || BigInt(0)).toString()), t.extensionOptions ? e.extensionOptions = t.extensionOptions.map((n) => n ? i.Any.toJSON(n) : void 0) : e.extensionOptions = [], t.nonCriticalExtensionOptions ? e.nonCriticalExtensionOptions = t.nonCriticalExtensionOptions.map((n) => n ? i.Any.toJSON(n) : void 0) : e.nonCriticalExtensionOptions = [], e;
3434
+ },
3435
+ fromPartial(t) {
3436
+ const e = l();
3437
+ return e.messages = t.messages?.map((n) => i.Any.fromPartial(n)) || [], e.memo = t.memo ?? "", t.timeoutHeight !== void 0 && t.timeoutHeight !== null && (e.timeoutHeight = BigInt(t.timeoutHeight.toString())), e.extensionOptions = t.extensionOptions?.map((n) => i.Any.fromPartial(n)) || [], e.nonCriticalExtensionOptions = t.nonCriticalExtensionOptions?.map((n) => i.Any.fromPartial(n)) || [], e;
3438
+ }
3439
+ };
3440
+ function I() {
3441
+ return {
3442
+ signerInfos: [],
3443
+ fee: void 0,
3444
+ tip: void 0
3445
+ };
3446
+ }
3447
+ r.AuthInfo = {
3448
+ typeUrl: "/cosmos.tx.v1beta1.AuthInfo",
3449
+ encode(t, e = a.BinaryWriter.create()) {
3450
+ for (const n of t.signerInfos)
3451
+ r.SignerInfo.encode(n, e.uint32(10).fork()).ldelim();
3452
+ return t.fee !== void 0 && r.Fee.encode(t.fee, e.uint32(18).fork()).ldelim(), t.tip !== void 0 && r.Tip.encode(t.tip, e.uint32(26).fork()).ldelim(), e;
3453
+ },
3454
+ decode(t, e) {
3455
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3456
+ let v = e === void 0 ? n.len : n.pos + e;
3457
+ const _ = I();
3458
+ for (; n.pos < v; ) {
3459
+ const S = n.uint32();
3460
+ switch (S >>> 3) {
3461
+ case 1:
3462
+ _.signerInfos.push(r.SignerInfo.decode(n, n.uint32()));
3463
+ break;
3464
+ case 2:
3465
+ _.fee = r.Fee.decode(n, n.uint32());
3466
+ break;
3467
+ case 3:
3468
+ _.tip = r.Tip.decode(n, n.uint32());
3469
+ break;
3470
+ default:
3471
+ n.skipType(S & 7);
3472
+ break;
3473
+ }
3474
+ }
3475
+ return _;
3476
+ },
3477
+ fromJSON(t) {
3478
+ const e = I();
3479
+ return Array.isArray(t?.signerInfos) && (e.signerInfos = t.signerInfos.map((n) => r.SignerInfo.fromJSON(n))), (0, s.isSet)(t.fee) && (e.fee = r.Fee.fromJSON(t.fee)), (0, s.isSet)(t.tip) && (e.tip = r.Tip.fromJSON(t.tip)), e;
3480
+ },
3481
+ toJSON(t) {
3482
+ const e = {};
3483
+ return t.signerInfos ? e.signerInfos = t.signerInfos.map((n) => n ? r.SignerInfo.toJSON(n) : void 0) : e.signerInfos = [], t.fee !== void 0 && (e.fee = t.fee ? r.Fee.toJSON(t.fee) : void 0), t.tip !== void 0 && (e.tip = t.tip ? r.Tip.toJSON(t.tip) : void 0), e;
3484
+ },
3485
+ fromPartial(t) {
3486
+ const e = I();
3487
+ return e.signerInfos = t.signerInfos?.map((n) => r.SignerInfo.fromPartial(n)) || [], t.fee !== void 0 && t.fee !== null && (e.fee = r.Fee.fromPartial(t.fee)), t.tip !== void 0 && t.tip !== null && (e.tip = r.Tip.fromPartial(t.tip)), e;
3488
+ }
3489
+ };
3490
+ function p() {
3491
+ return {
3492
+ publicKey: void 0,
3493
+ modeInfo: void 0,
3494
+ sequence: BigInt(0)
3495
+ };
3496
+ }
3497
+ r.SignerInfo = {
3498
+ typeUrl: "/cosmos.tx.v1beta1.SignerInfo",
3499
+ encode(t, e = a.BinaryWriter.create()) {
3500
+ return t.publicKey !== void 0 && i.Any.encode(t.publicKey, e.uint32(10).fork()).ldelim(), t.modeInfo !== void 0 && r.ModeInfo.encode(t.modeInfo, e.uint32(18).fork()).ldelim(), t.sequence !== BigInt(0) && e.uint32(24).uint64(t.sequence), e;
3501
+ },
3502
+ decode(t, e) {
3503
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3504
+ let v = e === void 0 ? n.len : n.pos + e;
3505
+ const _ = p();
3506
+ for (; n.pos < v; ) {
3507
+ const S = n.uint32();
3508
+ switch (S >>> 3) {
3509
+ case 1:
3510
+ _.publicKey = i.Any.decode(n, n.uint32());
3511
+ break;
3512
+ case 2:
3513
+ _.modeInfo = r.ModeInfo.decode(n, n.uint32());
3514
+ break;
3515
+ case 3:
3516
+ _.sequence = n.uint64();
3517
+ break;
3518
+ default:
3519
+ n.skipType(S & 7);
3520
+ break;
3521
+ }
3522
+ }
3523
+ return _;
3524
+ },
3525
+ fromJSON(t) {
3526
+ const e = p();
3527
+ return (0, s.isSet)(t.publicKey) && (e.publicKey = i.Any.fromJSON(t.publicKey)), (0, s.isSet)(t.modeInfo) && (e.modeInfo = r.ModeInfo.fromJSON(t.modeInfo)), (0, s.isSet)(t.sequence) && (e.sequence = BigInt(t.sequence.toString())), e;
3528
+ },
3529
+ toJSON(t) {
3530
+ const e = {};
3531
+ return t.publicKey !== void 0 && (e.publicKey = t.publicKey ? i.Any.toJSON(t.publicKey) : void 0), t.modeInfo !== void 0 && (e.modeInfo = t.modeInfo ? r.ModeInfo.toJSON(t.modeInfo) : void 0), t.sequence !== void 0 && (e.sequence = (t.sequence || BigInt(0)).toString()), e;
3532
+ },
3533
+ fromPartial(t) {
3534
+ const e = p();
3535
+ return t.publicKey !== void 0 && t.publicKey !== null && (e.publicKey = i.Any.fromPartial(t.publicKey)), t.modeInfo !== void 0 && t.modeInfo !== null && (e.modeInfo = r.ModeInfo.fromPartial(t.modeInfo)), t.sequence !== void 0 && t.sequence !== null && (e.sequence = BigInt(t.sequence.toString())), e;
3536
+ }
3537
+ };
3538
+ function g() {
3539
+ return {
3540
+ single: void 0,
3541
+ multi: void 0
3542
+ };
3543
+ }
3544
+ r.ModeInfo = {
3545
+ typeUrl: "/cosmos.tx.v1beta1.ModeInfo",
3546
+ encode(t, e = a.BinaryWriter.create()) {
3547
+ return t.single !== void 0 && r.ModeInfo_Single.encode(t.single, e.uint32(10).fork()).ldelim(), t.multi !== void 0 && r.ModeInfo_Multi.encode(t.multi, e.uint32(18).fork()).ldelim(), e;
3548
+ },
3549
+ decode(t, e) {
3550
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3551
+ let v = e === void 0 ? n.len : n.pos + e;
3552
+ const _ = g();
3553
+ for (; n.pos < v; ) {
3554
+ const S = n.uint32();
3555
+ switch (S >>> 3) {
3556
+ case 1:
3557
+ _.single = r.ModeInfo_Single.decode(n, n.uint32());
3558
+ break;
3559
+ case 2:
3560
+ _.multi = r.ModeInfo_Multi.decode(n, n.uint32());
3561
+ break;
3562
+ default:
3563
+ n.skipType(S & 7);
3564
+ break;
3565
+ }
3566
+ }
3567
+ return _;
3568
+ },
3569
+ fromJSON(t) {
3570
+ const e = g();
3571
+ return (0, s.isSet)(t.single) && (e.single = r.ModeInfo_Single.fromJSON(t.single)), (0, s.isSet)(t.multi) && (e.multi = r.ModeInfo_Multi.fromJSON(t.multi)), e;
3572
+ },
3573
+ toJSON(t) {
3574
+ const e = {};
3575
+ return t.single !== void 0 && (e.single = t.single ? r.ModeInfo_Single.toJSON(t.single) : void 0), t.multi !== void 0 && (e.multi = t.multi ? r.ModeInfo_Multi.toJSON(t.multi) : void 0), e;
3576
+ },
3577
+ fromPartial(t) {
3578
+ const e = g();
3579
+ return t.single !== void 0 && t.single !== null && (e.single = r.ModeInfo_Single.fromPartial(t.single)), t.multi !== void 0 && t.multi !== null && (e.multi = r.ModeInfo_Multi.fromPartial(t.multi)), e;
3580
+ }
3581
+ };
3582
+ function h() {
3583
+ return {
3584
+ mode: 0
3585
+ };
3586
+ }
3587
+ r.ModeInfo_Single = {
3588
+ typeUrl: "/cosmos.tx.v1beta1.Single",
3589
+ encode(t, e = a.BinaryWriter.create()) {
3590
+ return t.mode !== 0 && e.uint32(8).int32(t.mode), e;
3591
+ },
3592
+ decode(t, e) {
3593
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3594
+ let v = e === void 0 ? n.len : n.pos + e;
3595
+ const _ = h();
3596
+ for (; n.pos < v; ) {
3597
+ const S = n.uint32();
3598
+ switch (S >>> 3) {
3599
+ case 1:
3600
+ _.mode = n.int32();
3601
+ break;
3602
+ default:
3603
+ n.skipType(S & 7);
3604
+ break;
3605
+ }
3606
+ }
3607
+ return _;
3608
+ },
3609
+ fromJSON(t) {
3610
+ const e = h();
3611
+ return (0, s.isSet)(t.mode) && (e.mode = (0, d.signModeFromJSON)(t.mode)), e;
3612
+ },
3613
+ toJSON(t) {
3614
+ const e = {};
3615
+ return t.mode !== void 0 && (e.mode = (0, d.signModeToJSON)(t.mode)), e;
3616
+ },
3617
+ fromPartial(t) {
3618
+ const e = h();
3619
+ return e.mode = t.mode ?? 0, e;
3620
+ }
3621
+ };
3622
+ function m() {
3623
+ return {
3624
+ bitarray: void 0,
3625
+ modeInfos: []
3626
+ };
3627
+ }
3628
+ r.ModeInfo_Multi = {
3629
+ typeUrl: "/cosmos.tx.v1beta1.Multi",
3630
+ encode(t, e = a.BinaryWriter.create()) {
3631
+ t.bitarray !== void 0 && c.CompactBitArray.encode(t.bitarray, e.uint32(10).fork()).ldelim();
3632
+ for (const n of t.modeInfos)
3633
+ r.ModeInfo.encode(n, e.uint32(18).fork()).ldelim();
3634
+ return e;
3635
+ },
3636
+ decode(t, e) {
3637
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3638
+ let v = e === void 0 ? n.len : n.pos + e;
3639
+ const _ = m();
3640
+ for (; n.pos < v; ) {
3641
+ const S = n.uint32();
3642
+ switch (S >>> 3) {
3643
+ case 1:
3644
+ _.bitarray = c.CompactBitArray.decode(n, n.uint32());
3645
+ break;
3646
+ case 2:
3647
+ _.modeInfos.push(r.ModeInfo.decode(n, n.uint32()));
3648
+ break;
3649
+ default:
3650
+ n.skipType(S & 7);
3651
+ break;
3652
+ }
3653
+ }
3654
+ return _;
3655
+ },
3656
+ fromJSON(t) {
3657
+ const e = m();
3658
+ return (0, s.isSet)(t.bitarray) && (e.bitarray = c.CompactBitArray.fromJSON(t.bitarray)), Array.isArray(t?.modeInfos) && (e.modeInfos = t.modeInfos.map((n) => r.ModeInfo.fromJSON(n))), e;
3659
+ },
3660
+ toJSON(t) {
3661
+ const e = {};
3662
+ return t.bitarray !== void 0 && (e.bitarray = t.bitarray ? c.CompactBitArray.toJSON(t.bitarray) : void 0), t.modeInfos ? e.modeInfos = t.modeInfos.map((n) => n ? r.ModeInfo.toJSON(n) : void 0) : e.modeInfos = [], e;
3663
+ },
3664
+ fromPartial(t) {
3665
+ const e = m();
3666
+ return t.bitarray !== void 0 && t.bitarray !== null && (e.bitarray = c.CompactBitArray.fromPartial(t.bitarray)), e.modeInfos = t.modeInfos?.map((n) => r.ModeInfo.fromPartial(n)) || [], e;
3667
+ }
3668
+ };
3669
+ function w() {
3670
+ return {
3671
+ amount: [],
3672
+ gasLimit: BigInt(0),
3673
+ payer: "",
3674
+ granter: ""
3675
+ };
3676
+ }
3677
+ r.Fee = {
3678
+ typeUrl: "/cosmos.tx.v1beta1.Fee",
3679
+ encode(t, e = a.BinaryWriter.create()) {
3680
+ for (const n of t.amount)
3681
+ o.Coin.encode(n, e.uint32(10).fork()).ldelim();
3682
+ return t.gasLimit !== BigInt(0) && e.uint32(16).uint64(t.gasLimit), t.payer !== "" && e.uint32(26).string(t.payer), t.granter !== "" && e.uint32(34).string(t.granter), e;
3683
+ },
3684
+ decode(t, e) {
3685
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3686
+ let v = e === void 0 ? n.len : n.pos + e;
3687
+ const _ = w();
3688
+ for (; n.pos < v; ) {
3689
+ const S = n.uint32();
3690
+ switch (S >>> 3) {
3691
+ case 1:
3692
+ _.amount.push(o.Coin.decode(n, n.uint32()));
3693
+ break;
3694
+ case 2:
3695
+ _.gasLimit = n.uint64();
3696
+ break;
3697
+ case 3:
3698
+ _.payer = n.string();
3699
+ break;
3700
+ case 4:
3701
+ _.granter = n.string();
3702
+ break;
3703
+ default:
3704
+ n.skipType(S & 7);
3705
+ break;
3706
+ }
3707
+ }
3708
+ return _;
3709
+ },
3710
+ fromJSON(t) {
3711
+ const e = w();
3712
+ return Array.isArray(t?.amount) && (e.amount = t.amount.map((n) => o.Coin.fromJSON(n))), (0, s.isSet)(t.gasLimit) && (e.gasLimit = BigInt(t.gasLimit.toString())), (0, s.isSet)(t.payer) && (e.payer = String(t.payer)), (0, s.isSet)(t.granter) && (e.granter = String(t.granter)), e;
3713
+ },
3714
+ toJSON(t) {
3715
+ const e = {};
3716
+ return t.amount ? e.amount = t.amount.map((n) => n ? o.Coin.toJSON(n) : void 0) : e.amount = [], t.gasLimit !== void 0 && (e.gasLimit = (t.gasLimit || BigInt(0)).toString()), t.payer !== void 0 && (e.payer = t.payer), t.granter !== void 0 && (e.granter = t.granter), e;
3717
+ },
3718
+ fromPartial(t) {
3719
+ const e = w();
3720
+ return e.amount = t.amount?.map((n) => o.Coin.fromPartial(n)) || [], t.gasLimit !== void 0 && t.gasLimit !== null && (e.gasLimit = BigInt(t.gasLimit.toString())), e.payer = t.payer ?? "", e.granter = t.granter ?? "", e;
3721
+ }
3722
+ };
3723
+ function B() {
3724
+ return {
3725
+ amount: [],
3726
+ tipper: ""
3727
+ };
3728
+ }
3729
+ r.Tip = {
3730
+ typeUrl: "/cosmos.tx.v1beta1.Tip",
3731
+ encode(t, e = a.BinaryWriter.create()) {
3732
+ for (const n of t.amount)
3733
+ o.Coin.encode(n, e.uint32(10).fork()).ldelim();
3734
+ return t.tipper !== "" && e.uint32(18).string(t.tipper), e;
3735
+ },
3736
+ decode(t, e) {
3737
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3738
+ let v = e === void 0 ? n.len : n.pos + e;
3739
+ const _ = B();
3740
+ for (; n.pos < v; ) {
3741
+ const S = n.uint32();
3742
+ switch (S >>> 3) {
3743
+ case 1:
3744
+ _.amount.push(o.Coin.decode(n, n.uint32()));
3745
+ break;
3746
+ case 2:
3747
+ _.tipper = n.string();
3748
+ break;
3749
+ default:
3750
+ n.skipType(S & 7);
3751
+ break;
3752
+ }
3753
+ }
3754
+ return _;
3755
+ },
3756
+ fromJSON(t) {
3757
+ const e = B();
3758
+ return Array.isArray(t?.amount) && (e.amount = t.amount.map((n) => o.Coin.fromJSON(n))), (0, s.isSet)(t.tipper) && (e.tipper = String(t.tipper)), e;
3759
+ },
3760
+ toJSON(t) {
3761
+ const e = {};
3762
+ return t.amount ? e.amount = t.amount.map((n) => n ? o.Coin.toJSON(n) : void 0) : e.amount = [], t.tipper !== void 0 && (e.tipper = t.tipper), e;
3763
+ },
3764
+ fromPartial(t) {
3765
+ const e = B();
3766
+ return e.amount = t.amount?.map((n) => o.Coin.fromPartial(n)) || [], e.tipper = t.tipper ?? "", e;
3767
+ }
3768
+ };
3769
+ function R() {
3770
+ return {
3771
+ address: "",
3772
+ signDoc: void 0,
3773
+ mode: 0,
3774
+ sig: new Uint8Array()
3775
+ };
3776
+ }
3777
+ r.AuxSignerData = {
3778
+ typeUrl: "/cosmos.tx.v1beta1.AuxSignerData",
3779
+ encode(t, e = a.BinaryWriter.create()) {
3780
+ return t.address !== "" && e.uint32(10).string(t.address), t.signDoc !== void 0 && r.SignDocDirectAux.encode(t.signDoc, e.uint32(18).fork()).ldelim(), t.mode !== 0 && e.uint32(24).int32(t.mode), t.sig.length !== 0 && e.uint32(34).bytes(t.sig), e;
3781
+ },
3782
+ decode(t, e) {
3783
+ const n = t instanceof a.BinaryReader ? t : new a.BinaryReader(t);
3784
+ let v = e === void 0 ? n.len : n.pos + e;
3785
+ const _ = R();
3786
+ for (; n.pos < v; ) {
3787
+ const S = n.uint32();
3788
+ switch (S >>> 3) {
3789
+ case 1:
3790
+ _.address = n.string();
3791
+ break;
3792
+ case 2:
3793
+ _.signDoc = r.SignDocDirectAux.decode(n, n.uint32());
3794
+ break;
3795
+ case 3:
3796
+ _.mode = n.int32();
3797
+ break;
3798
+ case 4:
3799
+ _.sig = n.bytes();
3800
+ break;
3801
+ default:
3802
+ n.skipType(S & 7);
3803
+ break;
3804
+ }
3805
+ }
3806
+ return _;
3807
+ },
3808
+ fromJSON(t) {
3809
+ const e = R();
3810
+ return (0, s.isSet)(t.address) && (e.address = String(t.address)), (0, s.isSet)(t.signDoc) && (e.signDoc = r.SignDocDirectAux.fromJSON(t.signDoc)), (0, s.isSet)(t.mode) && (e.mode = (0, d.signModeFromJSON)(t.mode)), (0, s.isSet)(t.sig) && (e.sig = (0, s.bytesFromBase64)(t.sig)), e;
3811
+ },
3812
+ toJSON(t) {
3813
+ const e = {};
3814
+ return t.address !== void 0 && (e.address = t.address), t.signDoc !== void 0 && (e.signDoc = t.signDoc ? r.SignDocDirectAux.toJSON(t.signDoc) : void 0), t.mode !== void 0 && (e.mode = (0, d.signModeToJSON)(t.mode)), t.sig !== void 0 && (e.sig = (0, s.base64FromBytes)(t.sig !== void 0 ? t.sig : new Uint8Array())), e;
3815
+ },
3816
+ fromPartial(t) {
3817
+ const e = R();
3818
+ return e.address = t.address ?? "", t.signDoc !== void 0 && t.signDoc !== null && (e.signDoc = r.SignDocDirectAux.fromPartial(t.signDoc)), e.mode = t.mode ?? 0, e.sig = t.sig ?? new Uint8Array(), e;
3819
+ }
3820
+ };
3821
+ }(qe)), qe;
3822
+ }
3823
+ var Te = mi();
3824
+ const bi = async (r) => {
3825
+ const i = gn.find((l) => l.chain_id === r);
3826
+ if (!i)
3827
+ throw new Error(`Chain info not found for chainId: ${r}`);
3828
+ const { bech32_prefix: d, chain_id: c } = i, o = i.staking?.staking_tokens?.[0]?.denom, a = i.apis?.rpc?.[0]?.address, s = i.apis?.rest?.[0]?.address, u = i.fees?.fee_tokens?.[0]?.average_gas_price;
3829
+ if (!d || !o || !a || !s || !c || u === void 0)
3830
+ throw new Error(
3831
+ `Missing required chain information for ${i.chain_name}`
3832
+ );
3833
+ const y = mn.find(
3834
+ (l) => l.chain_name === i.chain_name
3835
+ )?.assets.find((l) => l.base === o), b = y?.denom_units.find(
3836
+ (l) => l.denom === y.display
3837
+ )?.exponent;
3838
+ if (b === void 0)
3839
+ throw new Error(
3840
+ `Could not find decimals for ${o} on chain ${i.chain_name}`
3841
+ );
3842
+ return { prefix: d, denom: o, rpcUrl: a, restUrl: s, expectedChainId: c, gasPrice: u, decimals: b };
3843
+ };
3844
+ class _i extends Ve {
3845
+ /**
3846
+ * Creates a new Cosmos chain instance
3847
+ * @param params - Configuration parameters
3848
+ * @param params.chainId - Chain id for the Cosmos network
3849
+ * @param params.contract - Instance of the chain signature contract for MPC operations
3850
+ * @param params.endpoints - Optional RPC and REST endpoints
3851
+ * @param params.endpoints.rpcUrl - Optional RPC endpoint URL
3852
+ * @param params.endpoints.restUrl - Optional REST endpoint URL
3853
+ */
3854
+ constructor({
3855
+ chainId: i,
3856
+ contract: d,
3857
+ endpoints: c
3858
+ }) {
3859
+ super(), this.contract = d, this.registry = new un(), this.chainId = i, this.endpoints = c;
3860
+ }
3861
+ parseRSVSignature(i) {
3862
+ return new Uint8Array([
3863
+ ...fe(i.r),
3864
+ ...fe(i.s)
3865
+ ]);
3866
+ }
3867
+ async getChainInfo() {
3868
+ return {
3869
+ ...await bi(this.chainId),
3870
+ ...this.endpoints
3871
+ };
3872
+ }
3873
+ async getBalance(i) {
3874
+ try {
3875
+ const { restUrl: d, denom: c, decimals: o } = await this.getChainInfo(), a = await fetch(
3876
+ `${d}/cosmos/bank/v1beta1/balances/${i}`
3877
+ );
3878
+ if (!a.ok)
3879
+ throw new Error(`HTTP error! status: ${a.status}`);
3880
+ const f = (await a.json()).balances.find((b) => b.denom === c)?.amount ?? "0";
3881
+ return (parseInt(f) / Math.pow(10, o)).toString();
3882
+ } catch (d) {
3883
+ throw console.error("Failed to fetch Cosmos balance:", d), new Error("Failed to fetch Cosmos balance");
3884
+ }
3885
+ }
3886
+ async deriveAddressAndPublicKey(i, d) {
3887
+ const { prefix: c } = await this.getChainInfo(), o = await this.contract.getDerivedPublicKey({
3888
+ path: d,
3889
+ predecessor: i
3890
+ });
3891
+ if (!o)
3892
+ throw new Error("Failed to get derived public key");
3893
+ const a = He(o), s = Ze(fe(a)), u = cn(s);
3894
+ return { address: Qe.encode(c, Qe.toWords(u)), publicKey: a };
3895
+ }
3896
+ setTransaction(i, d) {
3897
+ const c = Te.TxRaw.encode(i).finish();
3898
+ window.localStorage.setItem(d, jt(c));
3899
+ }
3900
+ getTransaction(i, d) {
3901
+ const c = window.localStorage.getItem(i);
3902
+ if (c)
3903
+ return d?.remove && window.localStorage.removeItem(i), Te.TxRaw.decode(Zt(c));
3904
+ }
3905
+ async getMPCPayloadAndTransaction(i) {
3906
+ const { denom: d, rpcUrl: c, gasPrice: o } = await this.getChainInfo(), a = fe(i.publicKey), s = i.gas || 2e5, u = yn(
3907
+ s,
3908
+ hn.fromString(`${o}${d}`)
3909
+ ), y = await (await Ye.connect(c)).getAccount(i.address);
3910
+ if (!y)
3911
+ throw new Error(
3912
+ `Account ${i.address} does not exist on chain`
3913
+ );
3914
+ const { accountNumber: b, sequence: l } = y, I = {
3915
+ typeUrl: "/cosmos.tx.v1beta1.TxBody",
3916
+ value: {
3917
+ messages: i.messages,
3918
+ memo: i.memo || ""
3919
+ }
3920
+ }, p = this.registry.encode(I), g = dn(sn(a)), h = fn(
3921
+ [
3922
+ {
3923
+ pubkey: g,
3924
+ sequence: l
3925
+ }
3926
+ ],
3927
+ u.amount,
3928
+ Number(u.gas),
3929
+ void 0,
3930
+ void 0,
3931
+ hi.SignMode.SIGN_MODE_DIRECT
3932
+ ), m = ln(
3933
+ p,
3934
+ h,
3935
+ this.chainId,
3936
+ b
3937
+ ), w = pn(m), B = Array.from(Ze(w));
3938
+ return {
3939
+ transaction: Te.TxRaw.fromPartial({
3940
+ bodyBytes: p,
3941
+ authInfoBytes: h,
3942
+ signatures: []
3943
+ }),
3944
+ mpcPayloads: [B]
3945
+ };
3946
+ }
3947
+ addSignature({
3948
+ transaction: i,
3949
+ mpcSignatures: d
3950
+ }) {
3951
+ i.signatures = d.map(
3952
+ (o) => this.parseRSVSignature(o)
3953
+ );
3954
+ const c = Te.TxRaw.encode(i).finish();
3955
+ return Buffer.from(c).toString("hex");
3956
+ }
3957
+ async broadcastTx(i) {
3958
+ try {
3959
+ const { rpcUrl: d } = await this.getChainInfo(), c = await Ye.connect(d), o = fe(i), a = await c.broadcastTx(o);
3960
+ if (a.code !== 0)
3961
+ throw new Error(`Broadcast error: ${a.rawLog}`);
3962
+ return a.transactionHash;
3963
+ } catch (d) {
3964
+ throw console.error("Transaction broadcast failed:", d), new Error("Failed to broadcast transaction.");
3965
+ }
3966
+ }
3967
+ }
3968
+ const vi = async (r, i) => {
3969
+ try {
3970
+ const d = await xe({
3971
+ networkId: r.nearAuthentication.networkId,
3972
+ accountId: r.nearAuthentication.accountId,
3973
+ keypair: i
3974
+ }), c = new pe({
3975
+ networkId: r.nearAuthentication.networkId,
3976
+ contractId: r.chainConfig.contract,
3977
+ accountId: d.accountId,
3978
+ keypair: i
3979
+ }), o = new ui({
3980
+ rpcUrl: r.chainConfig.providerUrl,
3981
+ contract: c
3982
+ }), { transaction: a, mpcPayloads: s } = await o.getMPCPayloadAndTransaction(
3983
+ r.transaction
3984
+ ), u = await c.sign({
3985
+ payload: s[0],
3986
+ path: r.derivationPath,
3987
+ key_version: 0
3988
+ }), f = o.addSignature({
3989
+ transaction: a,
3990
+ mpcSignatures: [u]
3991
+ });
3992
+ return {
3993
+ transactionHash: await o.broadcastTx(f),
3994
+ success: !0
3995
+ };
3996
+ } catch (d) {
3997
+ return console.error(d), {
3998
+ success: !1,
3999
+ errorMessage: d instanceof Error ? d.message : String(d)
4000
+ };
4001
+ }
4002
+ }, Si = async (r, i) => {
4003
+ try {
4004
+ const d = await xe({
4005
+ networkId: r.nearAuthentication.networkId,
4006
+ accountId: r.nearAuthentication.accountId,
4007
+ keypair: i
4008
+ }), c = new pe({
4009
+ networkId: r.nearAuthentication.networkId,
4010
+ contractId: r.chainConfig.contract,
4011
+ accountId: d.accountId,
4012
+ keypair: i
4013
+ }), o = new le({
4014
+ btcRpcAdapter: new li.Mempool(r.chainConfig.providerUrl),
4015
+ contract: c,
4016
+ network: r.chainConfig.network
4017
+ }), { transaction: a, mpcPayloads: s } = await o.getMPCPayloadAndTransaction(
4018
+ r.transaction
4019
+ ), u = await Promise.all(
4020
+ s.map(
4021
+ async (b) => await c.sign({
4022
+ payload: b,
4023
+ path: r.derivationPath,
4024
+ key_version: 0
4025
+ })
4026
+ )
4027
+ ), f = o.addSignature({
4028
+ transaction: a,
4029
+ mpcSignatures: u
4030
+ });
4031
+ return {
4032
+ transactionHash: await o.broadcastTx(f),
4033
+ success: !0
4034
+ };
4035
+ } catch (d) {
4036
+ return {
4037
+ success: !1,
4038
+ errorMessage: d instanceof Error ? d.message : String(d)
4039
+ };
4040
+ }
4041
+ }, Ii = async (r, i) => {
4042
+ try {
4043
+ const d = await xe({
4044
+ networkId: r.nearAuthentication.networkId,
4045
+ accountId: r.nearAuthentication.accountId,
4046
+ keypair: i
4047
+ }), c = new pe({
4048
+ networkId: r.nearAuthentication.networkId,
4049
+ contractId: r.chainConfig.contract,
4050
+ accountId: d.accountId,
4051
+ keypair: i
4052
+ }), o = new _i({
4053
+ contract: c,
4054
+ chainId: r.chainConfig.chainId
4055
+ }), { transaction: a, mpcPayloads: s } = await o.getMPCPayloadAndTransaction(r.transaction), u = await Promise.all(
4056
+ s.map(
4057
+ async (b) => await c.sign({
4058
+ payload: b,
4059
+ path: r.derivationPath,
4060
+ key_version: 0
4061
+ })
4062
+ )
4063
+ ), f = o.addSignature({
4064
+ transaction: a,
4065
+ mpcSignatures: u
4066
+ });
4067
+ return {
4068
+ transactionHash: await o.broadcastTx(f),
4069
+ success: !0
4070
+ };
4071
+ } catch (d) {
4072
+ return console.error(d), {
4073
+ success: !1,
4074
+ errorMessage: d instanceof Error ? d.message : String(d)
4075
+ };
4076
+ }
4077
+ }, wi = /* @__PURE__ */ Object.freeze({ __proto__: null, BTCTransaction: Si, CosmosTransaction: Ii, EVMTransaction: vi }), Ei = /* @__PURE__ */ Object.freeze({ __proto__: null, keypair: wi }), Ai = /* @__PURE__ */ Object.freeze({ __proto__: null, ChainSignatureContract: pe, signAndSend: Ei, transactionBuilder: si }), Ni = /* @__PURE__ */ Object.freeze({ __proto__: null, near: Ai }), We = (r) => ({
4078
+ r: r.big_r.affine_point.substring(2),
4079
+ s: r.s.scalar,
4080
+ v: r.recovery_id
4081
+ }), He = (r) => {
4082
+ const i = r.slice(2);
4083
+ if (i.length !== 128)
4084
+ throw new Error("Invalid uncompressed public key length");
4085
+ const d = i.slice(0, 64), c = i.slice(64);
4086
+ return (parseInt(c.slice(-1), 16) % 2 === 0 ? "02" : "03") + d;
4087
+ }, Bi = /* @__PURE__ */ Object.freeze({ __proto__: null, compressPubKey: He, toRSV: We }), $i = /* @__PURE__ */ Object.freeze({ __proto__: null, chains: Ni, cryptography: Bi });
4088
+ export {
4089
+ di as BTCRpcAdapter,
4090
+ li as BTCRpcAdapters,
4091
+ le as Bitcoin,
4092
+ Ve as Chain,
4093
+ ni as ChainSignatureContract,
4094
+ _i as Cosmos,
4095
+ ui as EVM,
4096
+ ci as fetchEVMFeeProperties,
4097
+ $i as utils
4098
+ };
4099
+ //# sourceMappingURL=index.node.js.map