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