signet.js 0.0.1-beta.6 → 0.0.1-beta.8
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/LICENSE +19 -0
- package/README.md +42 -14
- package/{src/chains → chains}/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.d.ts +1 -1
- package/{src/chains → chains}/Bitcoin/BTCRpcAdapter/Mempool/Mempool.d.ts +2 -2
- package/{src/chains → chains}/Bitcoin/Bitcoin.d.ts +5 -5
- package/{src/chains → chains}/Chain.d.ts +10 -25
- package/chains/ChainSignatureContract.d.ts +41 -0
- package/{src/chains → chains}/Cosmos/Cosmos.d.ts +3 -3
- package/{src/chains → chains}/Cosmos/types.d.ts +2 -2
- package/{src/chains → chains}/Cosmos/utils.d.ts +1 -1
- package/{src/chains → chains}/EVM/EVM.d.ts +3 -3
- package/{src/chains → chains}/types.d.ts +1 -1
- package/{src/chains → chains}/utils.d.ts +1 -1
- package/index.cjs +2 -0
- package/index.cjs.map +1 -0
- package/index.js +2674 -0
- package/index.js.map +1 -0
- package/package.json +20 -10
- package/{src/utils/chains/near/contract.d.ts → utils/chains/near/ChainSignatureContract.d.ts} +6 -8
- package/{src/utils → utils}/chains/near/constants.d.ts +1 -1
- package/{src/utils → utils}/chains/near/index.d.ts +1 -1
- package/{src/utils → utils}/chains/near/relayer/relayer.d.ts +2 -2
- package/{src/utils → utils}/chains/near/signAndSend/keypair.d.ts +3 -3
- package/{src/utils → utils}/chains/near/transactionBuilder.d.ts +3 -3
- package/{src/utils → utils}/chains/near/types.d.ts +4 -4
- package/src/chains/Bitcoin/BTCRpcAdapter/BTCRpcAdapter.js +0 -2
- package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/Mempool.js +0 -69
- package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/index.js +0 -1
- package/src/chains/Bitcoin/BTCRpcAdapter/Mempool/types.js +0 -1
- package/src/chains/Bitcoin/BTCRpcAdapter/index.js +0 -5
- package/src/chains/Bitcoin/Bitcoin.js +0 -198
- package/src/chains/Bitcoin/types.js +0 -1
- package/src/chains/Bitcoin/utils.js +0 -13
- package/src/chains/Chain.js +0 -9
- package/src/chains/ChainSignatureContract.d.ts +0 -62
- package/src/chains/ChainSignatureContract.js +0 -7
- package/src/chains/Cosmos/Cosmos.js +0 -157
- package/src/chains/Cosmos/types.js +0 -1
- package/src/chains/Cosmos/utils.js +0 -27
- package/src/chains/EVM/EVM.js +0 -109
- package/src/chains/EVM/types.js +0 -1
- package/src/chains/EVM/utils.js +0 -14
- package/src/chains/index.js +0 -12
- package/src/chains/types.js +0 -1
- package/src/chains/utils.js +0 -27
- package/src/index.js +0 -2
- package/src/utils/chains/index.js +0 -1
- package/src/utils/chains/near/account.js +0 -22
- package/src/utils/chains/near/constants.js +0 -3
- package/src/utils/chains/near/contract.js +0 -102
- package/src/utils/chains/near/index.js +0 -3
- package/src/utils/chains/near/relayer/index.js +0 -1
- package/src/utils/chains/near/relayer/relayer.js +0 -33
- package/src/utils/chains/near/relayer/types.js +0 -1
- package/src/utils/chains/near/signAndSend/index.js +0 -1
- package/src/utils/chains/near/signAndSend/keypair.js +0 -127
- package/src/utils/chains/near/transactionBuilder.js +0 -72
- package/src/utils/chains/near/types.js +0 -1
- package/src/utils/index.js +0 -1
- package/vocs.config.d.ts +0 -3
- package/vocs.config.js +0 -71
- /package/{src/chains → chains}/Bitcoin/BTCRpcAdapter/Mempool/index.d.ts +0 -0
- /package/{src/chains → chains}/Bitcoin/BTCRpcAdapter/Mempool/types.d.ts +0 -0
- /package/{src/chains → chains}/Bitcoin/BTCRpcAdapter/index.d.ts +0 -0
- /package/{src/chains → chains}/Bitcoin/types.d.ts +0 -0
- /package/{src/chains → chains}/Bitcoin/utils.d.ts +0 -0
- /package/{src/chains → chains}/EVM/types.d.ts +0 -0
- /package/{src/chains → chains}/EVM/utils.d.ts +0 -0
- /package/{src/chains → chains}/index.d.ts +0 -0
- /package/{src/index.d.ts → index.d.ts} +0 -0
- /package/{src/utils → utils}/chains/index.d.ts +0 -0
- /package/{src/utils → utils}/chains/near/account.d.ts +0 -0
- /package/{src/utils → utils}/chains/near/relayer/index.d.ts +0 -0
- /package/{src/utils → utils}/chains/near/relayer/types.d.ts +0 -0
- /package/{src/utils → utils}/chains/near/signAndSend/index.d.ts +0 -0
- /package/{src/utils → utils}/index.d.ts +0 -0
package/index.js
ADDED
|
@@ -0,0 +1,2674 @@
|
|
|
1
|
+
import $ from "bn.js";
|
|
2
|
+
import { fromHex as K, toBase64 as we, fromBase64 as _e } from "@cosmjs/encoding";
|
|
3
|
+
import { ethers as C, keccak256 as Oe } from "ethers";
|
|
4
|
+
import * as U from "bitcoinjs-lib";
|
|
5
|
+
import ke from "coinselect";
|
|
6
|
+
import { encodeSecp256k1Pubkey as Ne } from "@cosmjs/amino";
|
|
7
|
+
import { sha256 as ee, ripemd160 as Ae } from "@cosmjs/crypto";
|
|
8
|
+
import { Registry as De, encodePubkey as Te, makeAuthInfoBytes as ve, makeSignDoc as Pe, makeSignBytes as Ee } from "@cosmjs/proto-signing";
|
|
9
|
+
import { calculateFee as Ce, GasPrice as xe, StargateClient as ne } from "@cosmjs/stargate";
|
|
10
|
+
import { bech32 as te } from "bech32";
|
|
11
|
+
import { chains as Me, assets as Je } from "chain-registry";
|
|
12
|
+
import { Connection as Ue, Account as Re, Contract as Fe } from "@near-js/accounts";
|
|
13
|
+
import { KeyPair as me } from "@near-js/crypto";
|
|
14
|
+
import { actionCreators as Ke } from "@near-js/transactions";
|
|
15
|
+
import Ge from "borsh";
|
|
16
|
+
import He from "@near-js/utils";
|
|
17
|
+
import { InMemoryKeyStore as Le } from "@near-js/keystores";
|
|
18
|
+
import qe from "bs58";
|
|
19
|
+
class Q {
|
|
20
|
+
}
|
|
21
|
+
let ze = class {
|
|
22
|
+
};
|
|
23
|
+
const pe = (i) => ({
|
|
24
|
+
r: i.big_r.affine_point.substring(2),
|
|
25
|
+
s: i.s.scalar,
|
|
26
|
+
v: i.recovery_id
|
|
27
|
+
}), ge = (i) => {
|
|
28
|
+
const r = i.slice(2);
|
|
29
|
+
if (r.length !== 128)
|
|
30
|
+
throw new Error("Invalid uncompressed public key length");
|
|
31
|
+
const c = r.slice(0, 64), d = r.slice(64);
|
|
32
|
+
return (parseInt(d.slice(-1), 16) % 2 === 0 ? "02" : "03") + c;
|
|
33
|
+
};
|
|
34
|
+
async function $e(i, r) {
|
|
35
|
+
const c = new C.JsonRpcProvider(i), d = await c.estimateGas(r), s = await c.getFeeData(), o = s.maxFeePerGas ?? C.parseUnits("10", "gwei"), a = s.maxPriorityFeePerGas ?? C.parseUnits("10", "gwei");
|
|
36
|
+
return {
|
|
37
|
+
gasLimit: d,
|
|
38
|
+
maxFeePerGas: o,
|
|
39
|
+
maxPriorityFeePerGas: a,
|
|
40
|
+
maxFee: o * d
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
class We extends Q {
|
|
44
|
+
/**
|
|
45
|
+
* Creates a new EVM chain instance
|
|
46
|
+
* @param params - Configuration parameters
|
|
47
|
+
* @param params.rpcUrl - URL of the EVM JSON-RPC provider (e.g., Infura endpoint)
|
|
48
|
+
* @param params.contract - Instance of the chain signature contract for MPC operations
|
|
49
|
+
*/
|
|
50
|
+
constructor({
|
|
51
|
+
rpcUrl: r,
|
|
52
|
+
contract: c
|
|
53
|
+
}) {
|
|
54
|
+
super(), this.contract = c, this.provider = new C.JsonRpcProvider(r);
|
|
55
|
+
}
|
|
56
|
+
async attachGasAndNonce(r) {
|
|
57
|
+
const c = await $e(
|
|
58
|
+
this.provider._getConnection().url,
|
|
59
|
+
r
|
|
60
|
+
), d = await this.provider.getTransactionCount(
|
|
61
|
+
r.from,
|
|
62
|
+
"latest"
|
|
63
|
+
), { from: s, ...o } = r;
|
|
64
|
+
return {
|
|
65
|
+
...c,
|
|
66
|
+
chainId: this.provider._network.chainId,
|
|
67
|
+
nonce: d,
|
|
68
|
+
type: 2,
|
|
69
|
+
...o
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
parseSignature(r) {
|
|
73
|
+
return C.Signature.from({
|
|
74
|
+
r: `0x${r.r}`,
|
|
75
|
+
s: `0x${r.s}`,
|
|
76
|
+
v: r.v
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
async deriveAddressAndPublicKey(r, c) {
|
|
80
|
+
const d = await this.contract.getDerivedPublicKey({
|
|
81
|
+
path: c,
|
|
82
|
+
predecessor: r
|
|
83
|
+
});
|
|
84
|
+
if (!d)
|
|
85
|
+
throw new Error("Failed to get derived public key");
|
|
86
|
+
const s = d.startsWith("04") ? d.substring(2) : d, o = C.keccak256(K(s));
|
|
87
|
+
return {
|
|
88
|
+
address: `0x${o.substring(o.length - 40)}`,
|
|
89
|
+
publicKey: d
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
async getBalance(r) {
|
|
93
|
+
try {
|
|
94
|
+
const c = await this.provider.getBalance(r);
|
|
95
|
+
return C.formatEther(c);
|
|
96
|
+
} catch (c) {
|
|
97
|
+
throw console.error(`Failed to fetch balance for address ${r}:`, c), new Error("Failed to fetch balance.");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
setTransaction(r, c) {
|
|
101
|
+
const d = JSON.stringify(
|
|
102
|
+
r,
|
|
103
|
+
(s, o) => typeof o == "bigint" ? o.toString() : o
|
|
104
|
+
);
|
|
105
|
+
window.localStorage.setItem(c, d);
|
|
106
|
+
}
|
|
107
|
+
getTransaction(r, c) {
|
|
108
|
+
const d = window.localStorage.getItem(r);
|
|
109
|
+
return c != null && c.remove && window.localStorage.removeItem(r), d ? JSON.parse(d) : void 0;
|
|
110
|
+
}
|
|
111
|
+
async getMPCPayloadAndTransaction(r) {
|
|
112
|
+
const c = await this.attachGasAndNonce(r), d = C.Transaction.from(c).unsignedSerialized, s = Oe(d), o = Array.from(C.getBytes(s));
|
|
113
|
+
return {
|
|
114
|
+
transaction: c,
|
|
115
|
+
mpcPayloads: [
|
|
116
|
+
{
|
|
117
|
+
index: 0,
|
|
118
|
+
payload: o
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
addSignature({
|
|
124
|
+
transaction: r,
|
|
125
|
+
mpcSignatures: c
|
|
126
|
+
}) {
|
|
127
|
+
return C.Transaction.from({
|
|
128
|
+
...r,
|
|
129
|
+
signature: this.parseSignature(c[0])
|
|
130
|
+
}).serialized;
|
|
131
|
+
}
|
|
132
|
+
async broadcastTx(r) {
|
|
133
|
+
try {
|
|
134
|
+
return (await this.provider.broadcastTransaction(r)).hash;
|
|
135
|
+
} catch (c) {
|
|
136
|
+
throw console.error("Transaction broadcast failed:", c), new Error("Failed to broadcast transaction.");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function re(i) {
|
|
141
|
+
switch (i.toLowerCase()) {
|
|
142
|
+
case "mainnet":
|
|
143
|
+
return U.networks.bitcoin;
|
|
144
|
+
case "testnet":
|
|
145
|
+
return U.networks.testnet;
|
|
146
|
+
case "regtest":
|
|
147
|
+
return U.networks.regtest;
|
|
148
|
+
default:
|
|
149
|
+
throw new Error(`Unknown Bitcoin network: ${i}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const F = class F extends Q {
|
|
153
|
+
/**
|
|
154
|
+
* Creates a new Bitcoin chain instance
|
|
155
|
+
* @param params - Configuration parameters
|
|
156
|
+
* @param params.network - Network identifier (mainnet/testnet)
|
|
157
|
+
* @param params.contract - Instance of the chain signature contract for MPC operations
|
|
158
|
+
* @param params.btcRpcAdapter - Bitcoin RPC adapter for network interactions
|
|
159
|
+
*/
|
|
160
|
+
constructor({
|
|
161
|
+
network: r,
|
|
162
|
+
contract: c,
|
|
163
|
+
btcRpcAdapter: d
|
|
164
|
+
}) {
|
|
165
|
+
super(), this.network = r, this.btcRpcAdapter = d, this.contract = c;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Converts satoshis to BTC
|
|
169
|
+
* @param satoshis - Amount in satoshis
|
|
170
|
+
* @returns Amount in BTC
|
|
171
|
+
*/
|
|
172
|
+
static toBTC(r) {
|
|
173
|
+
return r / F.SATOSHIS_PER_BTC;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Converts BTC to satoshis
|
|
177
|
+
* @param btc - Amount in BTC
|
|
178
|
+
* @returns Amount in satoshis (rounded)
|
|
179
|
+
*/
|
|
180
|
+
static toSatoshi(r) {
|
|
181
|
+
return Math.round(r * F.SATOSHIS_PER_BTC);
|
|
182
|
+
}
|
|
183
|
+
async fetchTransaction(r) {
|
|
184
|
+
const c = await this.btcRpcAdapter.getTransaction(r), d = new U.Transaction();
|
|
185
|
+
return c.vout.forEach((s) => {
|
|
186
|
+
const o = Buffer.from(s.scriptpubkey, "hex");
|
|
187
|
+
d.addOutput(o, Number(s.value));
|
|
188
|
+
}), d;
|
|
189
|
+
}
|
|
190
|
+
static parseRSVSignature(r) {
|
|
191
|
+
const c = r.r.padStart(64, "0"), d = r.s.padStart(64, "0"), s = Buffer.from(c + d, "hex");
|
|
192
|
+
if (s.length !== 64)
|
|
193
|
+
throw new Error("Invalid signature length.");
|
|
194
|
+
return s;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Creates a Partially Signed Bitcoin Transaction (PSBT)
|
|
198
|
+
* @param params - Parameters for creating the PSBT
|
|
199
|
+
* @param params.transactionRequest - Transaction request containing inputs and outputs
|
|
200
|
+
* @returns Created PSBT instance
|
|
201
|
+
*/
|
|
202
|
+
async createPSBT({
|
|
203
|
+
transactionRequest: r
|
|
204
|
+
}) {
|
|
205
|
+
const { inputs: c, outputs: d } = r.inputs && r.outputs ? r : await this.btcRpcAdapter.selectUTXOs(r.from, [
|
|
206
|
+
{
|
|
207
|
+
address: r.to,
|
|
208
|
+
value: parseFloat(r.value)
|
|
209
|
+
}
|
|
210
|
+
]), s = new U.Psbt({ network: re(this.network) });
|
|
211
|
+
return await Promise.all(
|
|
212
|
+
c.map(async (o) => {
|
|
213
|
+
if (!o.scriptPubKey) {
|
|
214
|
+
const f = (await this.fetchTransaction(o.txid)).outs[o.vout];
|
|
215
|
+
o.scriptPubKey = f.script;
|
|
216
|
+
}
|
|
217
|
+
s.addInput({
|
|
218
|
+
hash: o.txid,
|
|
219
|
+
index: o.vout,
|
|
220
|
+
witnessUtxo: {
|
|
221
|
+
script: o.scriptPubKey,
|
|
222
|
+
value: o.value
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
})
|
|
226
|
+
), d.forEach((o) => {
|
|
227
|
+
o.address ? s.addOutput({
|
|
228
|
+
address: o.address,
|
|
229
|
+
value: o.value
|
|
230
|
+
}) : o.script && s.addOutput({
|
|
231
|
+
script: o.script,
|
|
232
|
+
value: o.value
|
|
233
|
+
});
|
|
234
|
+
}), s;
|
|
235
|
+
}
|
|
236
|
+
async getBalance(r) {
|
|
237
|
+
const c = await this.btcRpcAdapter.getBalance(r);
|
|
238
|
+
return F.toBTC(c).toString();
|
|
239
|
+
}
|
|
240
|
+
async deriveAddressAndPublicKey(r, c) {
|
|
241
|
+
const d = await this.contract.getDerivedPublicKey({
|
|
242
|
+
path: c,
|
|
243
|
+
predecessor: r
|
|
244
|
+
});
|
|
245
|
+
if (!d)
|
|
246
|
+
throw new Error("Failed to get derived public key");
|
|
247
|
+
const s = ge(d), o = Buffer.from(s, "hex"), a = re(this.network), f = U.payments.p2wpkh({
|
|
248
|
+
pubkey: o,
|
|
249
|
+
network: a
|
|
250
|
+
}), { address: g } = f;
|
|
251
|
+
if (!g)
|
|
252
|
+
throw new Error("Failed to generate Bitcoin address");
|
|
253
|
+
return { address: g, publicKey: s };
|
|
254
|
+
}
|
|
255
|
+
setTransaction(r, c) {
|
|
256
|
+
window.localStorage.setItem(
|
|
257
|
+
c,
|
|
258
|
+
JSON.stringify({
|
|
259
|
+
psbt: r.psbt.toHex(),
|
|
260
|
+
publicKey: r.publicKey
|
|
261
|
+
})
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
getTransaction(r, c) {
|
|
265
|
+
const d = window.localStorage.getItem(r);
|
|
266
|
+
if (!d) return;
|
|
267
|
+
c != null && c.remove && window.localStorage.removeItem(r);
|
|
268
|
+
const s = JSON.parse(d);
|
|
269
|
+
return {
|
|
270
|
+
psbt: U.Psbt.fromHex(s.psbt),
|
|
271
|
+
publicKey: s.publicKey
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
async getMPCPayloadAndTransaction(r) {
|
|
275
|
+
const c = Buffer.from(r.publicKey, "hex"), d = await this.createPSBT({
|
|
276
|
+
transactionRequest: r
|
|
277
|
+
}), s = d.toHex(), o = [], a = (f) => ({
|
|
278
|
+
publicKey: c,
|
|
279
|
+
sign: (g) => (o.push({
|
|
280
|
+
index: f,
|
|
281
|
+
payload: Array.from(g)
|
|
282
|
+
}), Buffer.alloc(64))
|
|
283
|
+
});
|
|
284
|
+
for (let f = 0; f < d.inputCount; f++)
|
|
285
|
+
d.signInput(f, a(f));
|
|
286
|
+
return {
|
|
287
|
+
transaction: {
|
|
288
|
+
psbt: U.Psbt.fromHex(s),
|
|
289
|
+
publicKey: r.publicKey
|
|
290
|
+
},
|
|
291
|
+
mpcPayloads: o.sort((f, g) => f.index - g.index)
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
addSignature({
|
|
295
|
+
transaction: { psbt: r, publicKey: c },
|
|
296
|
+
mpcSignatures: d
|
|
297
|
+
}) {
|
|
298
|
+
const s = Buffer.from(c, "hex"), o = (a) => ({
|
|
299
|
+
publicKey: s,
|
|
300
|
+
sign: () => {
|
|
301
|
+
const f = d[a];
|
|
302
|
+
return F.parseRSVSignature(f);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
for (let a = 0; a < r.inputCount; a++)
|
|
306
|
+
r.signInput(a, o(a));
|
|
307
|
+
return r.finalizeAllInputs(), r.extractTransaction().toHex();
|
|
308
|
+
}
|
|
309
|
+
async broadcastTx(r) {
|
|
310
|
+
return await this.btcRpcAdapter.broadcastTransaction(r);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
F.SATOSHIS_PER_BTC = 1e8;
|
|
314
|
+
let Y = F;
|
|
315
|
+
class Ve {
|
|
316
|
+
}
|
|
317
|
+
class Xe extends Ve {
|
|
318
|
+
constructor(r) {
|
|
319
|
+
super(), this.providerUrl = r;
|
|
320
|
+
}
|
|
321
|
+
async fetchFeeRate(r = 6) {
|
|
322
|
+
const d = await (await fetch(`${this.providerUrl}/v1/fees/recommended`)).json();
|
|
323
|
+
return r <= 1 ? d.fastestFee : r <= 3 ? d.halfHourFee : r <= 6 ? d.hourFee : d.economyFee;
|
|
324
|
+
}
|
|
325
|
+
async fetchUTXOs(r) {
|
|
326
|
+
try {
|
|
327
|
+
return await (await fetch(
|
|
328
|
+
`${this.providerUrl}/address/${r}/utxo`
|
|
329
|
+
)).json();
|
|
330
|
+
} catch (c) {
|
|
331
|
+
return console.error("Failed to fetch UTXOs:", c), [];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
async selectUTXOs(r, c, d = 6) {
|
|
335
|
+
const s = await this.fetchUTXOs(r), o = await this.fetchFeeRate(d), a = ke(s, c, Math.ceil(o + 1));
|
|
336
|
+
if (!a.inputs || !a.outputs)
|
|
337
|
+
throw new Error(
|
|
338
|
+
"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."
|
|
339
|
+
);
|
|
340
|
+
return {
|
|
341
|
+
inputs: a.inputs,
|
|
342
|
+
outputs: a.outputs
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
async broadcastTransaction(r) {
|
|
346
|
+
const c = await fetch(`${this.providerUrl}/tx`, {
|
|
347
|
+
method: "POST",
|
|
348
|
+
body: r
|
|
349
|
+
});
|
|
350
|
+
if (c.ok)
|
|
351
|
+
return await c.text();
|
|
352
|
+
throw new Error(`Failed to broadcast transaction: ${await c.text()}`);
|
|
353
|
+
}
|
|
354
|
+
async getBalance(r) {
|
|
355
|
+
const d = await (await fetch(`${this.providerUrl}/address/${r}`)).json();
|
|
356
|
+
return d.chain_stats.funded_txo_sum - d.chain_stats.spent_txo_sum;
|
|
357
|
+
}
|
|
358
|
+
async getTransaction(r) {
|
|
359
|
+
return await (await fetch(`${this.providerUrl}/tx/${r}`)).json();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
const Ze = {
|
|
363
|
+
Mempool: Xe
|
|
364
|
+
};
|
|
365
|
+
var ie = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, V = {}, x = {}, M = {}, J = {}, ae;
|
|
366
|
+
function Ye() {
|
|
367
|
+
if (ae) return J;
|
|
368
|
+
ae = 1, Object.defineProperty(J, "__esModule", { value: !0 }), J.utf8Write = J.utf8Read = J.utf8Length = void 0;
|
|
369
|
+
function i(d) {
|
|
370
|
+
let s = 0, o = 0;
|
|
371
|
+
for (let a = 0; a < d.length; ++a)
|
|
372
|
+
o = d.charCodeAt(a), o < 128 ? s += 1 : o < 2048 ? s += 2 : (o & 64512) === 55296 && (d.charCodeAt(a + 1) & 64512) === 56320 ? (++a, s += 4) : s += 3;
|
|
373
|
+
return s;
|
|
374
|
+
}
|
|
375
|
+
J.utf8Length = i;
|
|
376
|
+
function r(d, s, o) {
|
|
377
|
+
if (o - s < 1)
|
|
378
|
+
return "";
|
|
379
|
+
const f = [];
|
|
380
|
+
let g = [], _ = 0, b;
|
|
381
|
+
for (; s < o; )
|
|
382
|
+
b = d[s++], b < 128 ? f[_++] = b : b > 191 && b < 224 ? f[_++] = (b & 31) << 6 | d[s++] & 63 : b > 239 && b < 365 ? (b = ((b & 7) << 18 | (d[s++] & 63) << 12 | (d[s++] & 63) << 6 | d[s++] & 63) - 65536, f[_++] = 55296 + (b >> 10), f[_++] = 56320 + (b & 1023)) : f[_++] = (b & 15) << 12 | (d[s++] & 63) << 6 | d[s++] & 63, _ > 8191 && (g.push(String.fromCharCode(...f)), _ = 0);
|
|
383
|
+
return _ && g.push(String.fromCharCode(...f.slice(0, _))), g.join("");
|
|
384
|
+
}
|
|
385
|
+
J.utf8Read = r;
|
|
386
|
+
function c(d, s, o) {
|
|
387
|
+
const a = o;
|
|
388
|
+
let f, g;
|
|
389
|
+
for (let _ = 0; _ < d.length; ++_)
|
|
390
|
+
f = d.charCodeAt(_), f < 128 ? s[o++] = f : f < 2048 ? (s[o++] = f >> 6 | 192, s[o++] = f & 63 | 128) : (f & 64512) === 55296 && ((g = d.charCodeAt(_ + 1)) & 64512) === 56320 ? (f = 65536 + ((f & 1023) << 10) + (g & 1023), ++_, s[o++] = f >> 18 | 240, s[o++] = f >> 12 & 63 | 128, s[o++] = f >> 6 & 63 | 128, s[o++] = f & 63 | 128) : (s[o++] = f >> 12 | 224, s[o++] = f >> 6 & 63 | 128, s[o++] = f & 63 | 128);
|
|
391
|
+
return o - a;
|
|
392
|
+
}
|
|
393
|
+
return J.utf8Write = c, J;
|
|
394
|
+
}
|
|
395
|
+
var k = {}, oe;
|
|
396
|
+
function Qe() {
|
|
397
|
+
if (oe) return k;
|
|
398
|
+
oe = 1, Object.defineProperty(k, "__esModule", { value: !0 }), k.writeByte = k.writeFixed32 = k.int64Length = k.writeVarint64 = k.writeVarint32 = k.readInt32 = k.readUInt32 = k.zzDecode = k.zzEncode = k.varint32read = k.varint32write = k.uInt64ToString = k.int64ToString = k.int64FromString = k.varint64write = k.varint64read = void 0;
|
|
399
|
+
function i() {
|
|
400
|
+
let n = 0, t = 0;
|
|
401
|
+
for (let h = 0; h < 28; h += 7) {
|
|
402
|
+
let B = this.buf[this.pos++];
|
|
403
|
+
if (n |= (B & 127) << h, !(B & 128))
|
|
404
|
+
return this.assertBounds(), [n, t];
|
|
405
|
+
}
|
|
406
|
+
let m = this.buf[this.pos++];
|
|
407
|
+
if (n |= (m & 15) << 28, t = (m & 112) >> 4, !(m & 128))
|
|
408
|
+
return this.assertBounds(), [n, t];
|
|
409
|
+
for (let h = 3; h <= 31; h += 7) {
|
|
410
|
+
let B = this.buf[this.pos++];
|
|
411
|
+
if (t |= (B & 127) << h, !(B & 128))
|
|
412
|
+
return this.assertBounds(), [n, t];
|
|
413
|
+
}
|
|
414
|
+
throw new Error("invalid varint");
|
|
415
|
+
}
|
|
416
|
+
k.varint64read = i;
|
|
417
|
+
function r(n, t, m) {
|
|
418
|
+
for (let A = 0; A < 28; A = A + 7) {
|
|
419
|
+
const T = n >>> A, E = !(!(T >>> 7) && t == 0), P = (E ? T | 128 : T) & 255;
|
|
420
|
+
if (m.push(P), !E)
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const h = n >>> 28 & 15 | (t & 7) << 4, B = !!(t >> 3);
|
|
424
|
+
if (m.push((B ? h | 128 : h) & 255), !!B) {
|
|
425
|
+
for (let A = 3; A < 31; A = A + 7) {
|
|
426
|
+
const T = t >>> A, E = !!(T >>> 7), P = (E ? T | 128 : T) & 255;
|
|
427
|
+
if (m.push(P), !E)
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
m.push(t >>> 31 & 1);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
k.varint64write = r;
|
|
434
|
+
const c = 4294967296;
|
|
435
|
+
function d(n) {
|
|
436
|
+
const t = n[0] === "-";
|
|
437
|
+
t && (n = n.slice(1));
|
|
438
|
+
const m = 1e6;
|
|
439
|
+
let h = 0, B = 0;
|
|
440
|
+
function A(T, E) {
|
|
441
|
+
const P = Number(n.slice(T, E));
|
|
442
|
+
B *= m, h = h * m + P, h >= c && (B = B + (h / c | 0), h = h % c);
|
|
443
|
+
}
|
|
444
|
+
return A(-24, -18), A(-18, -12), A(-12, -6), A(-6), t ? g(h, B) : f(h, B);
|
|
445
|
+
}
|
|
446
|
+
k.int64FromString = d;
|
|
447
|
+
function s(n, t) {
|
|
448
|
+
let m = f(n, t);
|
|
449
|
+
const h = m.hi & 2147483648;
|
|
450
|
+
h && (m = g(m.lo, m.hi));
|
|
451
|
+
const B = o(m.lo, m.hi);
|
|
452
|
+
return h ? "-" + B : B;
|
|
453
|
+
}
|
|
454
|
+
k.int64ToString = s;
|
|
455
|
+
function o(n, t) {
|
|
456
|
+
if ({ lo: n, hi: t } = a(n, t), t <= 2097151)
|
|
457
|
+
return String(c * t + n);
|
|
458
|
+
const m = n & 16777215, h = (n >>> 24 | t << 8) & 16777215, B = t >> 16 & 65535;
|
|
459
|
+
let A = m + h * 6777216 + B * 6710656, T = h + B * 8147497, E = B * 2;
|
|
460
|
+
const P = 1e7;
|
|
461
|
+
return A >= P && (T += Math.floor(A / P), A %= P), T >= P && (E += Math.floor(T / P), T %= P), E.toString() + _(T) + _(A);
|
|
462
|
+
}
|
|
463
|
+
k.uInt64ToString = o;
|
|
464
|
+
function a(n, t) {
|
|
465
|
+
return { lo: n >>> 0, hi: t >>> 0 };
|
|
466
|
+
}
|
|
467
|
+
function f(n, t) {
|
|
468
|
+
return { lo: n | 0, hi: t | 0 };
|
|
469
|
+
}
|
|
470
|
+
function g(n, t) {
|
|
471
|
+
return t = ~t, n ? n = ~n + 1 : t += 1, f(n, t);
|
|
472
|
+
}
|
|
473
|
+
const _ = (n) => {
|
|
474
|
+
const t = String(n);
|
|
475
|
+
return "0000000".slice(t.length) + t;
|
|
476
|
+
};
|
|
477
|
+
function b(n, t) {
|
|
478
|
+
if (n >= 0) {
|
|
479
|
+
for (; n > 127; )
|
|
480
|
+
t.push(n & 127 | 128), n = n >>> 7;
|
|
481
|
+
t.push(n);
|
|
482
|
+
} else {
|
|
483
|
+
for (let m = 0; m < 9; m++)
|
|
484
|
+
t.push(n & 127 | 128), n = n >> 7;
|
|
485
|
+
t.push(1);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
k.varint32write = b;
|
|
489
|
+
function l() {
|
|
490
|
+
let n = this.buf[this.pos++], t = n & 127;
|
|
491
|
+
if (!(n & 128))
|
|
492
|
+
return this.assertBounds(), t;
|
|
493
|
+
if (n = this.buf[this.pos++], t |= (n & 127) << 7, !(n & 128))
|
|
494
|
+
return this.assertBounds(), t;
|
|
495
|
+
if (n = this.buf[this.pos++], t |= (n & 127) << 14, !(n & 128))
|
|
496
|
+
return this.assertBounds(), t;
|
|
497
|
+
if (n = this.buf[this.pos++], t |= (n & 127) << 21, !(n & 128))
|
|
498
|
+
return this.assertBounds(), t;
|
|
499
|
+
n = this.buf[this.pos++], t |= (n & 15) << 28;
|
|
500
|
+
for (let m = 5; n & 128 && m < 10; m++)
|
|
501
|
+
n = this.buf[this.pos++];
|
|
502
|
+
if (n & 128)
|
|
503
|
+
throw new Error("invalid varint");
|
|
504
|
+
return this.assertBounds(), t >>> 0;
|
|
505
|
+
}
|
|
506
|
+
k.varint32read = l;
|
|
507
|
+
function I(n, t) {
|
|
508
|
+
let m = t >> 31;
|
|
509
|
+
return t = ((t << 1 | n >>> 31) ^ m) >>> 0, n = (n << 1 ^ m) >>> 0, [n, t];
|
|
510
|
+
}
|
|
511
|
+
k.zzEncode = I;
|
|
512
|
+
function u(n, t) {
|
|
513
|
+
let m = -(n & 1);
|
|
514
|
+
return n = ((n >>> 1 | t << 31) ^ m) >>> 0, t = (t >>> 1 ^ m) >>> 0, [n, t];
|
|
515
|
+
}
|
|
516
|
+
k.zzDecode = u;
|
|
517
|
+
function y(n, t) {
|
|
518
|
+
return (n[t] | n[t + 1] << 8 | n[t + 2] << 16) + n[t + 3] * 16777216;
|
|
519
|
+
}
|
|
520
|
+
k.readUInt32 = y;
|
|
521
|
+
function S(n, t) {
|
|
522
|
+
return (n[t] | n[t + 1] << 8 | n[t + 2] << 16) + (n[t + 3] << 24);
|
|
523
|
+
}
|
|
524
|
+
k.readInt32 = S;
|
|
525
|
+
function p(n, t, m) {
|
|
526
|
+
for (; n > 127; )
|
|
527
|
+
t[m++] = n & 127 | 128, n >>>= 7;
|
|
528
|
+
t[m] = n;
|
|
529
|
+
}
|
|
530
|
+
k.writeVarint32 = p;
|
|
531
|
+
function w(n, t, m) {
|
|
532
|
+
for (; n.hi; )
|
|
533
|
+
t[m++] = n.lo & 127 | 128, n.lo = (n.lo >>> 7 | n.hi << 25) >>> 0, n.hi >>>= 7;
|
|
534
|
+
for (; n.lo > 127; )
|
|
535
|
+
t[m++] = n.lo & 127 | 128, n.lo = n.lo >>> 7;
|
|
536
|
+
t[m++] = n.lo;
|
|
537
|
+
}
|
|
538
|
+
k.writeVarint64 = w;
|
|
539
|
+
function O(n, t) {
|
|
540
|
+
let m = n, h = (n >>> 28 | t << 4) >>> 0, B = t >>> 24;
|
|
541
|
+
return B === 0 ? h === 0 ? m < 16384 ? m < 128 ? 1 : 2 : m < 2097152 ? 3 : 4 : h < 16384 ? h < 128 ? 5 : 6 : h < 2097152 ? 7 : 8 : B < 128 ? 9 : 10;
|
|
542
|
+
}
|
|
543
|
+
k.int64Length = O;
|
|
544
|
+
function D(n, t, m) {
|
|
545
|
+
t[m] = n & 255, t[m + 1] = n >>> 8 & 255, t[m + 2] = n >>> 16 & 255, t[m + 3] = n >>> 24;
|
|
546
|
+
}
|
|
547
|
+
k.writeFixed32 = D;
|
|
548
|
+
function e(n, t, m) {
|
|
549
|
+
t[m] = n & 255;
|
|
550
|
+
}
|
|
551
|
+
return k.writeByte = e, k;
|
|
552
|
+
}
|
|
553
|
+
var se;
|
|
554
|
+
function H() {
|
|
555
|
+
if (se) return M;
|
|
556
|
+
se = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.BinaryWriter = M.BinaryReader = M.WireType = void 0;
|
|
557
|
+
const i = Ye(), r = Qe();
|
|
558
|
+
var c;
|
|
559
|
+
(function(b) {
|
|
560
|
+
b[b.Varint = 0] = "Varint", b[b.Fixed64 = 1] = "Fixed64", b[b.Bytes = 2] = "Bytes", b[b.Fixed32 = 5] = "Fixed32";
|
|
561
|
+
})(c || (M.WireType = c = {}));
|
|
562
|
+
class d {
|
|
563
|
+
assertBounds() {
|
|
564
|
+
if (this.pos > this.len)
|
|
565
|
+
throw new RangeError("premature EOF");
|
|
566
|
+
}
|
|
567
|
+
constructor(l) {
|
|
568
|
+
this.buf = l ? new Uint8Array(l) : new Uint8Array(0), this.pos = 0, this.type = 0, this.len = this.buf.length;
|
|
569
|
+
}
|
|
570
|
+
tag() {
|
|
571
|
+
const l = this.uint32(), I = l >>> 3, u = l & 7;
|
|
572
|
+
if (I <= 0 || u < 0 || u > 5)
|
|
573
|
+
throw new Error("illegal tag: field no " + I + " wire type " + u);
|
|
574
|
+
return [I, u, l];
|
|
575
|
+
}
|
|
576
|
+
skip(l) {
|
|
577
|
+
if (typeof l == "number") {
|
|
578
|
+
if (this.pos + l > this.len)
|
|
579
|
+
throw _(this, l);
|
|
580
|
+
this.pos += l;
|
|
581
|
+
} else
|
|
582
|
+
do
|
|
583
|
+
if (this.pos >= this.len)
|
|
584
|
+
throw _(this);
|
|
585
|
+
while (this.buf[this.pos++] & 128);
|
|
586
|
+
return this;
|
|
587
|
+
}
|
|
588
|
+
skipType(l) {
|
|
589
|
+
switch (l) {
|
|
590
|
+
case c.Varint:
|
|
591
|
+
this.skip();
|
|
592
|
+
break;
|
|
593
|
+
case c.Fixed64:
|
|
594
|
+
this.skip(8);
|
|
595
|
+
break;
|
|
596
|
+
case c.Bytes:
|
|
597
|
+
this.skip(this.uint32());
|
|
598
|
+
break;
|
|
599
|
+
case 3:
|
|
600
|
+
for (; (l = this.uint32() & 7) !== 4; )
|
|
601
|
+
this.skipType(l);
|
|
602
|
+
break;
|
|
603
|
+
case c.Fixed32:
|
|
604
|
+
this.skip(4);
|
|
605
|
+
break;
|
|
606
|
+
/* istanbul ignore next */
|
|
607
|
+
default:
|
|
608
|
+
throw Error("invalid wire type " + l + " at offset " + this.pos);
|
|
609
|
+
}
|
|
610
|
+
return this;
|
|
611
|
+
}
|
|
612
|
+
uint32() {
|
|
613
|
+
return r.varint32read.bind(this)();
|
|
614
|
+
}
|
|
615
|
+
int32() {
|
|
616
|
+
return this.uint32() | 0;
|
|
617
|
+
}
|
|
618
|
+
sint32() {
|
|
619
|
+
const l = this.uint32();
|
|
620
|
+
return l % 2 === 1 ? (l + 1) / -2 : l / 2;
|
|
621
|
+
}
|
|
622
|
+
fixed32() {
|
|
623
|
+
const l = (0, r.readUInt32)(this.buf, this.pos);
|
|
624
|
+
return this.pos += 4, l;
|
|
625
|
+
}
|
|
626
|
+
sfixed32() {
|
|
627
|
+
const l = (0, r.readInt32)(this.buf, this.pos);
|
|
628
|
+
return this.pos += 4, l;
|
|
629
|
+
}
|
|
630
|
+
int64() {
|
|
631
|
+
const [l, I] = r.varint64read.bind(this)();
|
|
632
|
+
return BigInt((0, r.int64ToString)(l, I));
|
|
633
|
+
}
|
|
634
|
+
uint64() {
|
|
635
|
+
const [l, I] = r.varint64read.bind(this)();
|
|
636
|
+
return BigInt((0, r.uInt64ToString)(l, I));
|
|
637
|
+
}
|
|
638
|
+
sint64() {
|
|
639
|
+
let [l, I] = r.varint64read.bind(this)();
|
|
640
|
+
return [l, I] = (0, r.zzDecode)(l, I), BigInt((0, r.int64ToString)(l, I));
|
|
641
|
+
}
|
|
642
|
+
fixed64() {
|
|
643
|
+
const l = this.sfixed32(), I = this.sfixed32();
|
|
644
|
+
return BigInt((0, r.uInt64ToString)(l, I));
|
|
645
|
+
}
|
|
646
|
+
sfixed64() {
|
|
647
|
+
const l = this.sfixed32(), I = this.sfixed32();
|
|
648
|
+
return BigInt((0, r.int64ToString)(l, I));
|
|
649
|
+
}
|
|
650
|
+
float() {
|
|
651
|
+
throw new Error("float not supported");
|
|
652
|
+
}
|
|
653
|
+
double() {
|
|
654
|
+
throw new Error("double not supported");
|
|
655
|
+
}
|
|
656
|
+
bool() {
|
|
657
|
+
const [l, I] = r.varint64read.bind(this)();
|
|
658
|
+
return l !== 0 || I !== 0;
|
|
659
|
+
}
|
|
660
|
+
bytes() {
|
|
661
|
+
const l = this.uint32(), I = this.pos;
|
|
662
|
+
return this.pos += l, this.assertBounds(), this.buf.subarray(I, I + l);
|
|
663
|
+
}
|
|
664
|
+
string() {
|
|
665
|
+
const l = this.bytes();
|
|
666
|
+
return (0, i.utf8Read)(l, 0, l.length);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
M.BinaryReader = d;
|
|
670
|
+
class s {
|
|
671
|
+
constructor(l, I, u) {
|
|
672
|
+
this.fn = l, this.len = I, this.val = u;
|
|
673
|
+
}
|
|
674
|
+
proceed(l, I) {
|
|
675
|
+
this.fn && this.fn(this.val, l, I);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
class o {
|
|
679
|
+
constructor(l) {
|
|
680
|
+
this.head = l.head, this.tail = l.tail, this.len = l.len, this.next = l.states;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
class a {
|
|
684
|
+
constructor() {
|
|
685
|
+
this.len = 0, this.uint64 = a.prototype.int64, this.sfixed64 = a.prototype.fixed64, this.sfixed32 = a.prototype.fixed32, this.head = new s(null, 0, 0), this.tail = this.head, this.states = null;
|
|
686
|
+
}
|
|
687
|
+
static create() {
|
|
688
|
+
return new a();
|
|
689
|
+
}
|
|
690
|
+
static alloc(l) {
|
|
691
|
+
return typeof Uint8Array < "u" ? g((I) => new Uint8Array(I), Uint8Array.prototype.subarray)(l) : new Array(l);
|
|
692
|
+
}
|
|
693
|
+
_push(l, I, u) {
|
|
694
|
+
return this.tail = this.tail.next = new s(l, I, u), this.len += I, this;
|
|
695
|
+
}
|
|
696
|
+
finish() {
|
|
697
|
+
let l = this.head.next, I = 0;
|
|
698
|
+
const u = a.alloc(this.len);
|
|
699
|
+
for (; l; )
|
|
700
|
+
l.proceed(u, I), I += l.len, l = l.next;
|
|
701
|
+
return u;
|
|
702
|
+
}
|
|
703
|
+
fork() {
|
|
704
|
+
return this.states = new o(this), this.head = this.tail = new s(null, 0, 0), this.len = 0, this;
|
|
705
|
+
}
|
|
706
|
+
reset() {
|
|
707
|
+
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 s(null, 0, 0), this.len = 0), this;
|
|
708
|
+
}
|
|
709
|
+
ldelim() {
|
|
710
|
+
const l = this.head, I = this.tail, u = this.len;
|
|
711
|
+
return this.reset().uint32(u), u && (this.tail.next = l.next, this.tail = I, this.len += u), this;
|
|
712
|
+
}
|
|
713
|
+
tag(l, I) {
|
|
714
|
+
return this.uint32((l << 3 | I) >>> 0);
|
|
715
|
+
}
|
|
716
|
+
uint32(l) {
|
|
717
|
+
return this.len += (this.tail = this.tail.next = new s(r.writeVarint32, (l = l >>> 0) < 128 ? 1 : l < 16384 ? 2 : l < 2097152 ? 3 : l < 268435456 ? 4 : 5, l)).len, this;
|
|
718
|
+
}
|
|
719
|
+
int32(l) {
|
|
720
|
+
return l < 0 ? this._push(r.writeVarint64, 10, (0, r.int64FromString)(l.toString())) : this.uint32(l);
|
|
721
|
+
}
|
|
722
|
+
sint32(l) {
|
|
723
|
+
return this.uint32((l << 1 ^ l >> 31) >>> 0);
|
|
724
|
+
}
|
|
725
|
+
int64(l) {
|
|
726
|
+
const { lo: I, hi: u } = (0, r.int64FromString)(l.toString());
|
|
727
|
+
return this._push(r.writeVarint64, (0, r.int64Length)(I, u), { lo: I, hi: u });
|
|
728
|
+
}
|
|
729
|
+
sint64(l) {
|
|
730
|
+
let { lo: I, hi: u } = (0, r.int64FromString)(l.toString());
|
|
731
|
+
return [I, u] = (0, r.zzEncode)(I, u), this._push(r.writeVarint64, (0, r.int64Length)(I, u), { lo: I, hi: u });
|
|
732
|
+
}
|
|
733
|
+
fixed64(l) {
|
|
734
|
+
const { lo: I, hi: u } = (0, r.int64FromString)(l.toString());
|
|
735
|
+
return this._push(r.writeFixed32, 4, I)._push(r.writeFixed32, 4, u);
|
|
736
|
+
}
|
|
737
|
+
bool(l) {
|
|
738
|
+
return this._push(r.writeByte, 1, l ? 1 : 0);
|
|
739
|
+
}
|
|
740
|
+
fixed32(l) {
|
|
741
|
+
return this._push(r.writeFixed32, 4, l >>> 0);
|
|
742
|
+
}
|
|
743
|
+
float(l) {
|
|
744
|
+
throw new Error("float not supported" + l);
|
|
745
|
+
}
|
|
746
|
+
double(l) {
|
|
747
|
+
throw new Error("double not supported" + l);
|
|
748
|
+
}
|
|
749
|
+
bytes(l) {
|
|
750
|
+
const I = l.length >>> 0;
|
|
751
|
+
return I ? this.uint32(I)._push(f, I, l) : this._push(r.writeByte, 1, 0);
|
|
752
|
+
}
|
|
753
|
+
string(l) {
|
|
754
|
+
const I = (0, i.utf8Length)(l);
|
|
755
|
+
return I ? this.uint32(I)._push(i.utf8Write, I, l) : this._push(r.writeByte, 1, 0);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
M.BinaryWriter = a;
|
|
759
|
+
function f(b, l, I) {
|
|
760
|
+
if (typeof Uint8Array < "u")
|
|
761
|
+
l.set(b, I);
|
|
762
|
+
else
|
|
763
|
+
for (let u = 0; u < b.length; ++u)
|
|
764
|
+
l[I + u] = b[u];
|
|
765
|
+
}
|
|
766
|
+
function g(b, l, I) {
|
|
767
|
+
let S = null, p = 8192;
|
|
768
|
+
return function(O) {
|
|
769
|
+
if (O < 1 || O > 4096)
|
|
770
|
+
return b(O);
|
|
771
|
+
p + O > 8192 && (S = b(8192), p = 0);
|
|
772
|
+
const D = l.call(S, p, p += O);
|
|
773
|
+
return p & 7 && (p = (p | 7) + 1), D;
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
function _(b, l) {
|
|
777
|
+
return RangeError("index out of range: " + b.pos + " + " + (l || 1) + " > " + b.len);
|
|
778
|
+
}
|
|
779
|
+
return M;
|
|
780
|
+
}
|
|
781
|
+
var N = {}, ue;
|
|
782
|
+
function L() {
|
|
783
|
+
if (ue) return N;
|
|
784
|
+
ue = 1, Object.defineProperty(N, "__esModule", { value: !0 }), N.fromJsonTimestamp = N.fromTimestamp = N.toTimestamp = N.setPaginationParams = N.isObject = N.isSet = N.fromDuration = N.toDuration = N.omitDefault = N.base64FromBytes = N.bytesFromBase64 = void 0;
|
|
785
|
+
var i = (() => {
|
|
786
|
+
if (typeof i < "u")
|
|
787
|
+
return i;
|
|
788
|
+
if (typeof self < "u")
|
|
789
|
+
return self;
|
|
790
|
+
if (typeof window < "u")
|
|
791
|
+
return window;
|
|
792
|
+
if (typeof ie < "u")
|
|
793
|
+
return ie;
|
|
794
|
+
throw "Unable to locate global object";
|
|
795
|
+
})();
|
|
796
|
+
const r = i.atob || ((p) => i.Buffer.from(p, "base64").toString("binary"));
|
|
797
|
+
function c(p) {
|
|
798
|
+
const w = r(p), O = new Uint8Array(w.length);
|
|
799
|
+
for (let D = 0; D < w.length; ++D)
|
|
800
|
+
O[D] = w.charCodeAt(D);
|
|
801
|
+
return O;
|
|
802
|
+
}
|
|
803
|
+
N.bytesFromBase64 = c;
|
|
804
|
+
const d = i.btoa || ((p) => i.Buffer.from(p, "binary").toString("base64"));
|
|
805
|
+
function s(p) {
|
|
806
|
+
const w = [];
|
|
807
|
+
return p.forEach((O) => {
|
|
808
|
+
w.push(String.fromCharCode(O));
|
|
809
|
+
}), d(w.join(""));
|
|
810
|
+
}
|
|
811
|
+
N.base64FromBytes = s;
|
|
812
|
+
function o(p) {
|
|
813
|
+
if (typeof p == "string")
|
|
814
|
+
return p === "" ? void 0 : p;
|
|
815
|
+
if (typeof p == "number")
|
|
816
|
+
return p === 0 ? void 0 : p;
|
|
817
|
+
if (typeof p == "bigint")
|
|
818
|
+
return p === BigInt(0) ? void 0 : p;
|
|
819
|
+
throw new Error(`Got unsupported type ${typeof p}`);
|
|
820
|
+
}
|
|
821
|
+
N.omitDefault = o;
|
|
822
|
+
function a(p) {
|
|
823
|
+
return {
|
|
824
|
+
seconds: BigInt(Math.floor(parseInt(p) / 1e9)),
|
|
825
|
+
nanos: parseInt(p) % 1e9
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
N.toDuration = a;
|
|
829
|
+
function f(p) {
|
|
830
|
+
return (parseInt(p.seconds.toString()) * 1e9 + p.nanos).toString();
|
|
831
|
+
}
|
|
832
|
+
N.fromDuration = f;
|
|
833
|
+
function g(p) {
|
|
834
|
+
return p != null;
|
|
835
|
+
}
|
|
836
|
+
N.isSet = g;
|
|
837
|
+
function _(p) {
|
|
838
|
+
return typeof p == "object" && p !== null;
|
|
839
|
+
}
|
|
840
|
+
N.isObject = _;
|
|
841
|
+
const b = (p, w) => (w && (typeof (w == null ? void 0 : w.countTotal) < "u" && (p.params["pagination.count_total"] = w.countTotal), typeof (w == null ? void 0 : w.key) < "u" && (p.params["pagination.key"] = Buffer.from(w.key).toString("base64")), typeof (w == null ? void 0 : w.limit) < "u" && (p.params["pagination.limit"] = w.limit.toString()), typeof (w == null ? void 0 : w.offset) < "u" && (p.params["pagination.offset"] = w.offset.toString()), typeof (w == null ? void 0 : w.reverse) < "u" && (p.params["pagination.reverse"] = w.reverse)), p);
|
|
842
|
+
N.setPaginationParams = b;
|
|
843
|
+
function l(p) {
|
|
844
|
+
const w = S(p.getTime() / 1e3), O = p.getTime() % 1e3 * 1e6;
|
|
845
|
+
return {
|
|
846
|
+
seconds: w,
|
|
847
|
+
nanos: O
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
N.toTimestamp = l;
|
|
851
|
+
function I(p) {
|
|
852
|
+
let w = Number(p.seconds) * 1e3;
|
|
853
|
+
return w += p.nanos / 1e6, new Date(w);
|
|
854
|
+
}
|
|
855
|
+
N.fromTimestamp = I;
|
|
856
|
+
const u = (p) => ({
|
|
857
|
+
seconds: g(p.seconds) ? BigInt(p.seconds.toString()) : BigInt(0),
|
|
858
|
+
nanos: g(p.nanos) ? Number(p.nanos) : 0
|
|
859
|
+
});
|
|
860
|
+
function y(p) {
|
|
861
|
+
return p instanceof Date ? l(p) : typeof p == "string" ? l(new Date(p)) : u(p);
|
|
862
|
+
}
|
|
863
|
+
N.fromJsonTimestamp = y;
|
|
864
|
+
function S(p) {
|
|
865
|
+
return BigInt(Math.trunc(p));
|
|
866
|
+
}
|
|
867
|
+
return N;
|
|
868
|
+
}
|
|
869
|
+
var de;
|
|
870
|
+
function Se() {
|
|
871
|
+
if (de) return x;
|
|
872
|
+
de = 1, Object.defineProperty(x, "__esModule", { value: !0 }), x.CompactBitArray = x.MultiSignature = x.protobufPackage = void 0;
|
|
873
|
+
const i = H(), r = L();
|
|
874
|
+
x.protobufPackage = "cosmos.crypto.multisig.v1beta1";
|
|
875
|
+
function c() {
|
|
876
|
+
return {
|
|
877
|
+
signatures: []
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
x.MultiSignature = {
|
|
881
|
+
typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature",
|
|
882
|
+
encode(s, o = i.BinaryWriter.create()) {
|
|
883
|
+
for (const a of s.signatures)
|
|
884
|
+
o.uint32(10).bytes(a);
|
|
885
|
+
return o;
|
|
886
|
+
},
|
|
887
|
+
decode(s, o) {
|
|
888
|
+
const a = s instanceof i.BinaryReader ? s : new i.BinaryReader(s);
|
|
889
|
+
let f = o === void 0 ? a.len : a.pos + o;
|
|
890
|
+
const g = c();
|
|
891
|
+
for (; a.pos < f; ) {
|
|
892
|
+
const _ = a.uint32();
|
|
893
|
+
switch (_ >>> 3) {
|
|
894
|
+
case 1:
|
|
895
|
+
g.signatures.push(a.bytes());
|
|
896
|
+
break;
|
|
897
|
+
default:
|
|
898
|
+
a.skipType(_ & 7);
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
return g;
|
|
903
|
+
},
|
|
904
|
+
fromJSON(s) {
|
|
905
|
+
const o = c();
|
|
906
|
+
return Array.isArray(s == null ? void 0 : s.signatures) && (o.signatures = s.signatures.map((a) => (0, r.bytesFromBase64)(a))), o;
|
|
907
|
+
},
|
|
908
|
+
toJSON(s) {
|
|
909
|
+
const o = {};
|
|
910
|
+
return s.signatures ? o.signatures = s.signatures.map((a) => (0, r.base64FromBytes)(a !== void 0 ? a : new Uint8Array())) : o.signatures = [], o;
|
|
911
|
+
},
|
|
912
|
+
fromPartial(s) {
|
|
913
|
+
var a;
|
|
914
|
+
const o = c();
|
|
915
|
+
return o.signatures = ((a = s.signatures) == null ? void 0 : a.map((f) => f)) || [], o;
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
function d() {
|
|
919
|
+
return {
|
|
920
|
+
extraBitsStored: 0,
|
|
921
|
+
elems: new Uint8Array()
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
return x.CompactBitArray = {
|
|
925
|
+
typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray",
|
|
926
|
+
encode(s, o = i.BinaryWriter.create()) {
|
|
927
|
+
return s.extraBitsStored !== 0 && o.uint32(8).uint32(s.extraBitsStored), s.elems.length !== 0 && o.uint32(18).bytes(s.elems), o;
|
|
928
|
+
},
|
|
929
|
+
decode(s, o) {
|
|
930
|
+
const a = s instanceof i.BinaryReader ? s : new i.BinaryReader(s);
|
|
931
|
+
let f = o === void 0 ? a.len : a.pos + o;
|
|
932
|
+
const g = d();
|
|
933
|
+
for (; a.pos < f; ) {
|
|
934
|
+
const _ = a.uint32();
|
|
935
|
+
switch (_ >>> 3) {
|
|
936
|
+
case 1:
|
|
937
|
+
g.extraBitsStored = a.uint32();
|
|
938
|
+
break;
|
|
939
|
+
case 2:
|
|
940
|
+
g.elems = a.bytes();
|
|
941
|
+
break;
|
|
942
|
+
default:
|
|
943
|
+
a.skipType(_ & 7);
|
|
944
|
+
break;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
return g;
|
|
948
|
+
},
|
|
949
|
+
fromJSON(s) {
|
|
950
|
+
const o = d();
|
|
951
|
+
return (0, r.isSet)(s.extraBitsStored) && (o.extraBitsStored = Number(s.extraBitsStored)), (0, r.isSet)(s.elems) && (o.elems = (0, r.bytesFromBase64)(s.elems)), o;
|
|
952
|
+
},
|
|
953
|
+
toJSON(s) {
|
|
954
|
+
const o = {};
|
|
955
|
+
return s.extraBitsStored !== void 0 && (o.extraBitsStored = Math.round(s.extraBitsStored)), s.elems !== void 0 && (o.elems = (0, r.base64FromBytes)(s.elems !== void 0 ? s.elems : new Uint8Array())), o;
|
|
956
|
+
},
|
|
957
|
+
fromPartial(s) {
|
|
958
|
+
const o = d();
|
|
959
|
+
return o.extraBitsStored = s.extraBitsStored ?? 0, o.elems = s.elems ?? new Uint8Array(), o;
|
|
960
|
+
}
|
|
961
|
+
}, x;
|
|
962
|
+
}
|
|
963
|
+
var R = {}, ce;
|
|
964
|
+
function Ie() {
|
|
965
|
+
if (ce) return R;
|
|
966
|
+
ce = 1, Object.defineProperty(R, "__esModule", { value: !0 }), R.Any = R.protobufPackage = void 0;
|
|
967
|
+
const i = H(), r = L();
|
|
968
|
+
R.protobufPackage = "google.protobuf";
|
|
969
|
+
function c() {
|
|
970
|
+
return {
|
|
971
|
+
typeUrl: "",
|
|
972
|
+
value: new Uint8Array()
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
return R.Any = {
|
|
976
|
+
typeUrl: "/google.protobuf.Any",
|
|
977
|
+
encode(d, s = i.BinaryWriter.create()) {
|
|
978
|
+
return d.typeUrl !== "" && s.uint32(10).string(d.typeUrl), d.value.length !== 0 && s.uint32(18).bytes(d.value), s;
|
|
979
|
+
},
|
|
980
|
+
decode(d, s) {
|
|
981
|
+
const o = d instanceof i.BinaryReader ? d : new i.BinaryReader(d);
|
|
982
|
+
let a = s === void 0 ? o.len : o.pos + s;
|
|
983
|
+
const f = c();
|
|
984
|
+
for (; o.pos < a; ) {
|
|
985
|
+
const g = o.uint32();
|
|
986
|
+
switch (g >>> 3) {
|
|
987
|
+
case 1:
|
|
988
|
+
f.typeUrl = o.string();
|
|
989
|
+
break;
|
|
990
|
+
case 2:
|
|
991
|
+
f.value = o.bytes();
|
|
992
|
+
break;
|
|
993
|
+
default:
|
|
994
|
+
o.skipType(g & 7);
|
|
995
|
+
break;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
return f;
|
|
999
|
+
},
|
|
1000
|
+
fromJSON(d) {
|
|
1001
|
+
const s = c();
|
|
1002
|
+
return (0, r.isSet)(d.typeUrl) && (s.typeUrl = String(d.typeUrl)), (0, r.isSet)(d.value) && (s.value = (0, r.bytesFromBase64)(d.value)), s;
|
|
1003
|
+
},
|
|
1004
|
+
toJSON(d) {
|
|
1005
|
+
const s = {};
|
|
1006
|
+
return d.typeUrl !== void 0 && (s.typeUrl = d.typeUrl), d.value !== void 0 && (s.value = (0, r.base64FromBytes)(d.value !== void 0 ? d.value : new Uint8Array())), s;
|
|
1007
|
+
},
|
|
1008
|
+
fromPartial(d) {
|
|
1009
|
+
const s = c();
|
|
1010
|
+
return s.typeUrl = d.typeUrl ?? "", s.value = d.value ?? new Uint8Array(), s;
|
|
1011
|
+
}
|
|
1012
|
+
}, R;
|
|
1013
|
+
}
|
|
1014
|
+
var fe;
|
|
1015
|
+
function be() {
|
|
1016
|
+
return fe || (fe = 1, function(i) {
|
|
1017
|
+
Object.defineProperty(i, "__esModule", { value: !0 }), i.SignatureDescriptor_Data_Multi = i.SignatureDescriptor_Data_Single = i.SignatureDescriptor_Data = i.SignatureDescriptor = i.SignatureDescriptors = i.signModeToJSON = i.signModeFromJSON = i.SignMode = i.protobufPackage = void 0;
|
|
1018
|
+
const r = Se(), c = Ie(), d = H(), s = L();
|
|
1019
|
+
i.protobufPackage = "cosmos.tx.signing.v1beta1";
|
|
1020
|
+
var o;
|
|
1021
|
+
(function(u) {
|
|
1022
|
+
u[u.SIGN_MODE_UNSPECIFIED = 0] = "SIGN_MODE_UNSPECIFIED", u[u.SIGN_MODE_DIRECT = 1] = "SIGN_MODE_DIRECT", u[u.SIGN_MODE_TEXTUAL = 2] = "SIGN_MODE_TEXTUAL", u[u.SIGN_MODE_DIRECT_AUX = 3] = "SIGN_MODE_DIRECT_AUX", u[u.SIGN_MODE_LEGACY_AMINO_JSON = 127] = "SIGN_MODE_LEGACY_AMINO_JSON", u[u.SIGN_MODE_EIP_191 = 191] = "SIGN_MODE_EIP_191", u[u.UNRECOGNIZED = -1] = "UNRECOGNIZED";
|
|
1023
|
+
})(o || (i.SignMode = o = {}));
|
|
1024
|
+
function a(u) {
|
|
1025
|
+
switch (u) {
|
|
1026
|
+
case 0:
|
|
1027
|
+
case "SIGN_MODE_UNSPECIFIED":
|
|
1028
|
+
return o.SIGN_MODE_UNSPECIFIED;
|
|
1029
|
+
case 1:
|
|
1030
|
+
case "SIGN_MODE_DIRECT":
|
|
1031
|
+
return o.SIGN_MODE_DIRECT;
|
|
1032
|
+
case 2:
|
|
1033
|
+
case "SIGN_MODE_TEXTUAL":
|
|
1034
|
+
return o.SIGN_MODE_TEXTUAL;
|
|
1035
|
+
case 3:
|
|
1036
|
+
case "SIGN_MODE_DIRECT_AUX":
|
|
1037
|
+
return o.SIGN_MODE_DIRECT_AUX;
|
|
1038
|
+
case 127:
|
|
1039
|
+
case "SIGN_MODE_LEGACY_AMINO_JSON":
|
|
1040
|
+
return o.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
1041
|
+
case 191:
|
|
1042
|
+
case "SIGN_MODE_EIP_191":
|
|
1043
|
+
return o.SIGN_MODE_EIP_191;
|
|
1044
|
+
case -1:
|
|
1045
|
+
case "UNRECOGNIZED":
|
|
1046
|
+
default:
|
|
1047
|
+
return o.UNRECOGNIZED;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
i.signModeFromJSON = a;
|
|
1051
|
+
function f(u) {
|
|
1052
|
+
switch (u) {
|
|
1053
|
+
case o.SIGN_MODE_UNSPECIFIED:
|
|
1054
|
+
return "SIGN_MODE_UNSPECIFIED";
|
|
1055
|
+
case o.SIGN_MODE_DIRECT:
|
|
1056
|
+
return "SIGN_MODE_DIRECT";
|
|
1057
|
+
case o.SIGN_MODE_TEXTUAL:
|
|
1058
|
+
return "SIGN_MODE_TEXTUAL";
|
|
1059
|
+
case o.SIGN_MODE_DIRECT_AUX:
|
|
1060
|
+
return "SIGN_MODE_DIRECT_AUX";
|
|
1061
|
+
case o.SIGN_MODE_LEGACY_AMINO_JSON:
|
|
1062
|
+
return "SIGN_MODE_LEGACY_AMINO_JSON";
|
|
1063
|
+
case o.SIGN_MODE_EIP_191:
|
|
1064
|
+
return "SIGN_MODE_EIP_191";
|
|
1065
|
+
case o.UNRECOGNIZED:
|
|
1066
|
+
default:
|
|
1067
|
+
return "UNRECOGNIZED";
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
i.signModeToJSON = f;
|
|
1071
|
+
function g() {
|
|
1072
|
+
return {
|
|
1073
|
+
signatures: []
|
|
1074
|
+
};
|
|
1075
|
+
}
|
|
1076
|
+
i.SignatureDescriptors = {
|
|
1077
|
+
typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors",
|
|
1078
|
+
encode(u, y = d.BinaryWriter.create()) {
|
|
1079
|
+
for (const S of u.signatures)
|
|
1080
|
+
i.SignatureDescriptor.encode(S, y.uint32(10).fork()).ldelim();
|
|
1081
|
+
return y;
|
|
1082
|
+
},
|
|
1083
|
+
decode(u, y) {
|
|
1084
|
+
const S = u instanceof d.BinaryReader ? u : new d.BinaryReader(u);
|
|
1085
|
+
let p = y === void 0 ? S.len : S.pos + y;
|
|
1086
|
+
const w = g();
|
|
1087
|
+
for (; S.pos < p; ) {
|
|
1088
|
+
const O = S.uint32();
|
|
1089
|
+
switch (O >>> 3) {
|
|
1090
|
+
case 1:
|
|
1091
|
+
w.signatures.push(i.SignatureDescriptor.decode(S, S.uint32()));
|
|
1092
|
+
break;
|
|
1093
|
+
default:
|
|
1094
|
+
S.skipType(O & 7);
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return w;
|
|
1099
|
+
},
|
|
1100
|
+
fromJSON(u) {
|
|
1101
|
+
const y = g();
|
|
1102
|
+
return Array.isArray(u == null ? void 0 : u.signatures) && (y.signatures = u.signatures.map((S) => i.SignatureDescriptor.fromJSON(S))), y;
|
|
1103
|
+
},
|
|
1104
|
+
toJSON(u) {
|
|
1105
|
+
const y = {};
|
|
1106
|
+
return u.signatures ? y.signatures = u.signatures.map((S) => S ? i.SignatureDescriptor.toJSON(S) : void 0) : y.signatures = [], y;
|
|
1107
|
+
},
|
|
1108
|
+
fromPartial(u) {
|
|
1109
|
+
var S;
|
|
1110
|
+
const y = g();
|
|
1111
|
+
return y.signatures = ((S = u.signatures) == null ? void 0 : S.map((p) => i.SignatureDescriptor.fromPartial(p))) || [], y;
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
function _() {
|
|
1115
|
+
return {
|
|
1116
|
+
publicKey: void 0,
|
|
1117
|
+
data: void 0,
|
|
1118
|
+
sequence: BigInt(0)
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
i.SignatureDescriptor = {
|
|
1122
|
+
typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor",
|
|
1123
|
+
encode(u, y = d.BinaryWriter.create()) {
|
|
1124
|
+
return u.publicKey !== void 0 && c.Any.encode(u.publicKey, y.uint32(10).fork()).ldelim(), u.data !== void 0 && i.SignatureDescriptor_Data.encode(u.data, y.uint32(18).fork()).ldelim(), u.sequence !== BigInt(0) && y.uint32(24).uint64(u.sequence), y;
|
|
1125
|
+
},
|
|
1126
|
+
decode(u, y) {
|
|
1127
|
+
const S = u instanceof d.BinaryReader ? u : new d.BinaryReader(u);
|
|
1128
|
+
let p = y === void 0 ? S.len : S.pos + y;
|
|
1129
|
+
const w = _();
|
|
1130
|
+
for (; S.pos < p; ) {
|
|
1131
|
+
const O = S.uint32();
|
|
1132
|
+
switch (O >>> 3) {
|
|
1133
|
+
case 1:
|
|
1134
|
+
w.publicKey = c.Any.decode(S, S.uint32());
|
|
1135
|
+
break;
|
|
1136
|
+
case 2:
|
|
1137
|
+
w.data = i.SignatureDescriptor_Data.decode(S, S.uint32());
|
|
1138
|
+
break;
|
|
1139
|
+
case 3:
|
|
1140
|
+
w.sequence = S.uint64();
|
|
1141
|
+
break;
|
|
1142
|
+
default:
|
|
1143
|
+
S.skipType(O & 7);
|
|
1144
|
+
break;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
return w;
|
|
1148
|
+
},
|
|
1149
|
+
fromJSON(u) {
|
|
1150
|
+
const y = _();
|
|
1151
|
+
return (0, s.isSet)(u.publicKey) && (y.publicKey = c.Any.fromJSON(u.publicKey)), (0, s.isSet)(u.data) && (y.data = i.SignatureDescriptor_Data.fromJSON(u.data)), (0, s.isSet)(u.sequence) && (y.sequence = BigInt(u.sequence.toString())), y;
|
|
1152
|
+
},
|
|
1153
|
+
toJSON(u) {
|
|
1154
|
+
const y = {};
|
|
1155
|
+
return u.publicKey !== void 0 && (y.publicKey = u.publicKey ? c.Any.toJSON(u.publicKey) : void 0), u.data !== void 0 && (y.data = u.data ? i.SignatureDescriptor_Data.toJSON(u.data) : void 0), u.sequence !== void 0 && (y.sequence = (u.sequence || BigInt(0)).toString()), y;
|
|
1156
|
+
},
|
|
1157
|
+
fromPartial(u) {
|
|
1158
|
+
const y = _();
|
|
1159
|
+
return u.publicKey !== void 0 && u.publicKey !== null && (y.publicKey = c.Any.fromPartial(u.publicKey)), u.data !== void 0 && u.data !== null && (y.data = i.SignatureDescriptor_Data.fromPartial(u.data)), u.sequence !== void 0 && u.sequence !== null && (y.sequence = BigInt(u.sequence.toString())), y;
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
function b() {
|
|
1163
|
+
return {
|
|
1164
|
+
single: void 0,
|
|
1165
|
+
multi: void 0
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
i.SignatureDescriptor_Data = {
|
|
1169
|
+
typeUrl: "/cosmos.tx.signing.v1beta1.Data",
|
|
1170
|
+
encode(u, y = d.BinaryWriter.create()) {
|
|
1171
|
+
return u.single !== void 0 && i.SignatureDescriptor_Data_Single.encode(u.single, y.uint32(10).fork()).ldelim(), u.multi !== void 0 && i.SignatureDescriptor_Data_Multi.encode(u.multi, y.uint32(18).fork()).ldelim(), y;
|
|
1172
|
+
},
|
|
1173
|
+
decode(u, y) {
|
|
1174
|
+
const S = u instanceof d.BinaryReader ? u : new d.BinaryReader(u);
|
|
1175
|
+
let p = y === void 0 ? S.len : S.pos + y;
|
|
1176
|
+
const w = b();
|
|
1177
|
+
for (; S.pos < p; ) {
|
|
1178
|
+
const O = S.uint32();
|
|
1179
|
+
switch (O >>> 3) {
|
|
1180
|
+
case 1:
|
|
1181
|
+
w.single = i.SignatureDescriptor_Data_Single.decode(S, S.uint32());
|
|
1182
|
+
break;
|
|
1183
|
+
case 2:
|
|
1184
|
+
w.multi = i.SignatureDescriptor_Data_Multi.decode(S, S.uint32());
|
|
1185
|
+
break;
|
|
1186
|
+
default:
|
|
1187
|
+
S.skipType(O & 7);
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
return w;
|
|
1192
|
+
},
|
|
1193
|
+
fromJSON(u) {
|
|
1194
|
+
const y = b();
|
|
1195
|
+
return (0, s.isSet)(u.single) && (y.single = i.SignatureDescriptor_Data_Single.fromJSON(u.single)), (0, s.isSet)(u.multi) && (y.multi = i.SignatureDescriptor_Data_Multi.fromJSON(u.multi)), y;
|
|
1196
|
+
},
|
|
1197
|
+
toJSON(u) {
|
|
1198
|
+
const y = {};
|
|
1199
|
+
return u.single !== void 0 && (y.single = u.single ? i.SignatureDescriptor_Data_Single.toJSON(u.single) : void 0), u.multi !== void 0 && (y.multi = u.multi ? i.SignatureDescriptor_Data_Multi.toJSON(u.multi) : void 0), y;
|
|
1200
|
+
},
|
|
1201
|
+
fromPartial(u) {
|
|
1202
|
+
const y = b();
|
|
1203
|
+
return u.single !== void 0 && u.single !== null && (y.single = i.SignatureDescriptor_Data_Single.fromPartial(u.single)), u.multi !== void 0 && u.multi !== null && (y.multi = i.SignatureDescriptor_Data_Multi.fromPartial(u.multi)), y;
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
function l() {
|
|
1207
|
+
return {
|
|
1208
|
+
mode: 0,
|
|
1209
|
+
signature: new Uint8Array()
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
i.SignatureDescriptor_Data_Single = {
|
|
1213
|
+
typeUrl: "/cosmos.tx.signing.v1beta1.Single",
|
|
1214
|
+
encode(u, y = d.BinaryWriter.create()) {
|
|
1215
|
+
return u.mode !== 0 && y.uint32(8).int32(u.mode), u.signature.length !== 0 && y.uint32(18).bytes(u.signature), y;
|
|
1216
|
+
},
|
|
1217
|
+
decode(u, y) {
|
|
1218
|
+
const S = u instanceof d.BinaryReader ? u : new d.BinaryReader(u);
|
|
1219
|
+
let p = y === void 0 ? S.len : S.pos + y;
|
|
1220
|
+
const w = l();
|
|
1221
|
+
for (; S.pos < p; ) {
|
|
1222
|
+
const O = S.uint32();
|
|
1223
|
+
switch (O >>> 3) {
|
|
1224
|
+
case 1:
|
|
1225
|
+
w.mode = S.int32();
|
|
1226
|
+
break;
|
|
1227
|
+
case 2:
|
|
1228
|
+
w.signature = S.bytes();
|
|
1229
|
+
break;
|
|
1230
|
+
default:
|
|
1231
|
+
S.skipType(O & 7);
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
return w;
|
|
1236
|
+
},
|
|
1237
|
+
fromJSON(u) {
|
|
1238
|
+
const y = l();
|
|
1239
|
+
return (0, s.isSet)(u.mode) && (y.mode = a(u.mode)), (0, s.isSet)(u.signature) && (y.signature = (0, s.bytesFromBase64)(u.signature)), y;
|
|
1240
|
+
},
|
|
1241
|
+
toJSON(u) {
|
|
1242
|
+
const y = {};
|
|
1243
|
+
return u.mode !== void 0 && (y.mode = f(u.mode)), u.signature !== void 0 && (y.signature = (0, s.base64FromBytes)(u.signature !== void 0 ? u.signature : new Uint8Array())), y;
|
|
1244
|
+
},
|
|
1245
|
+
fromPartial(u) {
|
|
1246
|
+
const y = l();
|
|
1247
|
+
return y.mode = u.mode ?? 0, y.signature = u.signature ?? new Uint8Array(), y;
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
function I() {
|
|
1251
|
+
return {
|
|
1252
|
+
bitarray: void 0,
|
|
1253
|
+
signatures: []
|
|
1254
|
+
};
|
|
1255
|
+
}
|
|
1256
|
+
i.SignatureDescriptor_Data_Multi = {
|
|
1257
|
+
typeUrl: "/cosmos.tx.signing.v1beta1.Multi",
|
|
1258
|
+
encode(u, y = d.BinaryWriter.create()) {
|
|
1259
|
+
u.bitarray !== void 0 && r.CompactBitArray.encode(u.bitarray, y.uint32(10).fork()).ldelim();
|
|
1260
|
+
for (const S of u.signatures)
|
|
1261
|
+
i.SignatureDescriptor_Data.encode(S, y.uint32(18).fork()).ldelim();
|
|
1262
|
+
return y;
|
|
1263
|
+
},
|
|
1264
|
+
decode(u, y) {
|
|
1265
|
+
const S = u instanceof d.BinaryReader ? u : new d.BinaryReader(u);
|
|
1266
|
+
let p = y === void 0 ? S.len : S.pos + y;
|
|
1267
|
+
const w = I();
|
|
1268
|
+
for (; S.pos < p; ) {
|
|
1269
|
+
const O = S.uint32();
|
|
1270
|
+
switch (O >>> 3) {
|
|
1271
|
+
case 1:
|
|
1272
|
+
w.bitarray = r.CompactBitArray.decode(S, S.uint32());
|
|
1273
|
+
break;
|
|
1274
|
+
case 2:
|
|
1275
|
+
w.signatures.push(i.SignatureDescriptor_Data.decode(S, S.uint32()));
|
|
1276
|
+
break;
|
|
1277
|
+
default:
|
|
1278
|
+
S.skipType(O & 7);
|
|
1279
|
+
break;
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return w;
|
|
1283
|
+
},
|
|
1284
|
+
fromJSON(u) {
|
|
1285
|
+
const y = I();
|
|
1286
|
+
return (0, s.isSet)(u.bitarray) && (y.bitarray = r.CompactBitArray.fromJSON(u.bitarray)), Array.isArray(u == null ? void 0 : u.signatures) && (y.signatures = u.signatures.map((S) => i.SignatureDescriptor_Data.fromJSON(S))), y;
|
|
1287
|
+
},
|
|
1288
|
+
toJSON(u) {
|
|
1289
|
+
const y = {};
|
|
1290
|
+
return u.bitarray !== void 0 && (y.bitarray = u.bitarray ? r.CompactBitArray.toJSON(u.bitarray) : void 0), u.signatures ? y.signatures = u.signatures.map((S) => S ? i.SignatureDescriptor_Data.toJSON(S) : void 0) : y.signatures = [], y;
|
|
1291
|
+
},
|
|
1292
|
+
fromPartial(u) {
|
|
1293
|
+
var S;
|
|
1294
|
+
const y = I();
|
|
1295
|
+
return u.bitarray !== void 0 && u.bitarray !== null && (y.bitarray = r.CompactBitArray.fromPartial(u.bitarray)), y.signatures = ((S = u.signatures) == null ? void 0 : S.map((p) => i.SignatureDescriptor_Data.fromPartial(p))) || [], y;
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
}(V)), V;
|
|
1299
|
+
}
|
|
1300
|
+
var je = be(), X = {}, v = {}, le;
|
|
1301
|
+
function en() {
|
|
1302
|
+
if (le) return v;
|
|
1303
|
+
le = 1, Object.defineProperty(v, "__esModule", { value: !0 }), v.DecProto = v.IntProto = v.DecCoin = v.Coin = v.protobufPackage = void 0;
|
|
1304
|
+
const i = H(), r = L();
|
|
1305
|
+
v.protobufPackage = "cosmos.base.v1beta1";
|
|
1306
|
+
function c() {
|
|
1307
|
+
return {
|
|
1308
|
+
denom: "",
|
|
1309
|
+
amount: ""
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
v.Coin = {
|
|
1313
|
+
typeUrl: "/cosmos.base.v1beta1.Coin",
|
|
1314
|
+
encode(a, f = i.BinaryWriter.create()) {
|
|
1315
|
+
return a.denom !== "" && f.uint32(10).string(a.denom), a.amount !== "" && f.uint32(18).string(a.amount), f;
|
|
1316
|
+
},
|
|
1317
|
+
decode(a, f) {
|
|
1318
|
+
const g = a instanceof i.BinaryReader ? a : new i.BinaryReader(a);
|
|
1319
|
+
let _ = f === void 0 ? g.len : g.pos + f;
|
|
1320
|
+
const b = c();
|
|
1321
|
+
for (; g.pos < _; ) {
|
|
1322
|
+
const l = g.uint32();
|
|
1323
|
+
switch (l >>> 3) {
|
|
1324
|
+
case 1:
|
|
1325
|
+
b.denom = g.string();
|
|
1326
|
+
break;
|
|
1327
|
+
case 2:
|
|
1328
|
+
b.amount = g.string();
|
|
1329
|
+
break;
|
|
1330
|
+
default:
|
|
1331
|
+
g.skipType(l & 7);
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
return b;
|
|
1336
|
+
},
|
|
1337
|
+
fromJSON(a) {
|
|
1338
|
+
const f = c();
|
|
1339
|
+
return (0, r.isSet)(a.denom) && (f.denom = String(a.denom)), (0, r.isSet)(a.amount) && (f.amount = String(a.amount)), f;
|
|
1340
|
+
},
|
|
1341
|
+
toJSON(a) {
|
|
1342
|
+
const f = {};
|
|
1343
|
+
return a.denom !== void 0 && (f.denom = a.denom), a.amount !== void 0 && (f.amount = a.amount), f;
|
|
1344
|
+
},
|
|
1345
|
+
fromPartial(a) {
|
|
1346
|
+
const f = c();
|
|
1347
|
+
return f.denom = a.denom ?? "", f.amount = a.amount ?? "", f;
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
function d() {
|
|
1351
|
+
return {
|
|
1352
|
+
denom: "",
|
|
1353
|
+
amount: ""
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
v.DecCoin = {
|
|
1357
|
+
typeUrl: "/cosmos.base.v1beta1.DecCoin",
|
|
1358
|
+
encode(a, f = i.BinaryWriter.create()) {
|
|
1359
|
+
return a.denom !== "" && f.uint32(10).string(a.denom), a.amount !== "" && f.uint32(18).string(a.amount), f;
|
|
1360
|
+
},
|
|
1361
|
+
decode(a, f) {
|
|
1362
|
+
const g = a instanceof i.BinaryReader ? a : new i.BinaryReader(a);
|
|
1363
|
+
let _ = f === void 0 ? g.len : g.pos + f;
|
|
1364
|
+
const b = d();
|
|
1365
|
+
for (; g.pos < _; ) {
|
|
1366
|
+
const l = g.uint32();
|
|
1367
|
+
switch (l >>> 3) {
|
|
1368
|
+
case 1:
|
|
1369
|
+
b.denom = g.string();
|
|
1370
|
+
break;
|
|
1371
|
+
case 2:
|
|
1372
|
+
b.amount = g.string();
|
|
1373
|
+
break;
|
|
1374
|
+
default:
|
|
1375
|
+
g.skipType(l & 7);
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
return b;
|
|
1380
|
+
},
|
|
1381
|
+
fromJSON(a) {
|
|
1382
|
+
const f = d();
|
|
1383
|
+
return (0, r.isSet)(a.denom) && (f.denom = String(a.denom)), (0, r.isSet)(a.amount) && (f.amount = String(a.amount)), f;
|
|
1384
|
+
},
|
|
1385
|
+
toJSON(a) {
|
|
1386
|
+
const f = {};
|
|
1387
|
+
return a.denom !== void 0 && (f.denom = a.denom), a.amount !== void 0 && (f.amount = a.amount), f;
|
|
1388
|
+
},
|
|
1389
|
+
fromPartial(a) {
|
|
1390
|
+
const f = d();
|
|
1391
|
+
return f.denom = a.denom ?? "", f.amount = a.amount ?? "", f;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
function s() {
|
|
1395
|
+
return {
|
|
1396
|
+
int: ""
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
v.IntProto = {
|
|
1400
|
+
typeUrl: "/cosmos.base.v1beta1.IntProto",
|
|
1401
|
+
encode(a, f = i.BinaryWriter.create()) {
|
|
1402
|
+
return a.int !== "" && f.uint32(10).string(a.int), f;
|
|
1403
|
+
},
|
|
1404
|
+
decode(a, f) {
|
|
1405
|
+
const g = a instanceof i.BinaryReader ? a : new i.BinaryReader(a);
|
|
1406
|
+
let _ = f === void 0 ? g.len : g.pos + f;
|
|
1407
|
+
const b = s();
|
|
1408
|
+
for (; g.pos < _; ) {
|
|
1409
|
+
const l = g.uint32();
|
|
1410
|
+
switch (l >>> 3) {
|
|
1411
|
+
case 1:
|
|
1412
|
+
b.int = g.string();
|
|
1413
|
+
break;
|
|
1414
|
+
default:
|
|
1415
|
+
g.skipType(l & 7);
|
|
1416
|
+
break;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
return b;
|
|
1420
|
+
},
|
|
1421
|
+
fromJSON(a) {
|
|
1422
|
+
const f = s();
|
|
1423
|
+
return (0, r.isSet)(a.int) && (f.int = String(a.int)), f;
|
|
1424
|
+
},
|
|
1425
|
+
toJSON(a) {
|
|
1426
|
+
const f = {};
|
|
1427
|
+
return a.int !== void 0 && (f.int = a.int), f;
|
|
1428
|
+
},
|
|
1429
|
+
fromPartial(a) {
|
|
1430
|
+
const f = s();
|
|
1431
|
+
return f.int = a.int ?? "", f;
|
|
1432
|
+
}
|
|
1433
|
+
};
|
|
1434
|
+
function o() {
|
|
1435
|
+
return {
|
|
1436
|
+
dec: ""
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
return v.DecProto = {
|
|
1440
|
+
typeUrl: "/cosmos.base.v1beta1.DecProto",
|
|
1441
|
+
encode(a, f = i.BinaryWriter.create()) {
|
|
1442
|
+
return a.dec !== "" && f.uint32(10).string(a.dec), f;
|
|
1443
|
+
},
|
|
1444
|
+
decode(a, f) {
|
|
1445
|
+
const g = a instanceof i.BinaryReader ? a : new i.BinaryReader(a);
|
|
1446
|
+
let _ = f === void 0 ? g.len : g.pos + f;
|
|
1447
|
+
const b = o();
|
|
1448
|
+
for (; g.pos < _; ) {
|
|
1449
|
+
const l = g.uint32();
|
|
1450
|
+
switch (l >>> 3) {
|
|
1451
|
+
case 1:
|
|
1452
|
+
b.dec = g.string();
|
|
1453
|
+
break;
|
|
1454
|
+
default:
|
|
1455
|
+
g.skipType(l & 7);
|
|
1456
|
+
break;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
return b;
|
|
1460
|
+
},
|
|
1461
|
+
fromJSON(a) {
|
|
1462
|
+
const f = o();
|
|
1463
|
+
return (0, r.isSet)(a.dec) && (f.dec = String(a.dec)), f;
|
|
1464
|
+
},
|
|
1465
|
+
toJSON(a) {
|
|
1466
|
+
const f = {};
|
|
1467
|
+
return a.dec !== void 0 && (f.dec = a.dec), f;
|
|
1468
|
+
},
|
|
1469
|
+
fromPartial(a) {
|
|
1470
|
+
const f = o();
|
|
1471
|
+
return f.dec = a.dec ?? "", f;
|
|
1472
|
+
}
|
|
1473
|
+
}, v;
|
|
1474
|
+
}
|
|
1475
|
+
var ye;
|
|
1476
|
+
function nn() {
|
|
1477
|
+
return ye || (ye = 1, function(i) {
|
|
1478
|
+
Object.defineProperty(i, "__esModule", { value: !0 }), i.AuxSignerData = i.Tip = i.Fee = i.ModeInfo_Multi = i.ModeInfo_Single = i.ModeInfo = i.SignerInfo = i.AuthInfo = i.TxBody = i.SignDocDirectAux = i.SignDoc = i.TxRaw = i.Tx = i.protobufPackage = void 0;
|
|
1479
|
+
const r = Ie(), c = be(), d = Se(), s = en(), o = H(), a = L();
|
|
1480
|
+
i.protobufPackage = "cosmos.tx.v1beta1";
|
|
1481
|
+
function f() {
|
|
1482
|
+
return {
|
|
1483
|
+
body: void 0,
|
|
1484
|
+
authInfo: void 0,
|
|
1485
|
+
signatures: []
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
i.Tx = {
|
|
1489
|
+
typeUrl: "/cosmos.tx.v1beta1.Tx",
|
|
1490
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1491
|
+
e.body !== void 0 && i.TxBody.encode(e.body, n.uint32(10).fork()).ldelim(), e.authInfo !== void 0 && i.AuthInfo.encode(e.authInfo, n.uint32(18).fork()).ldelim();
|
|
1492
|
+
for (const t of e.signatures)
|
|
1493
|
+
n.uint32(26).bytes(t);
|
|
1494
|
+
return n;
|
|
1495
|
+
},
|
|
1496
|
+
decode(e, n) {
|
|
1497
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1498
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1499
|
+
const h = f();
|
|
1500
|
+
for (; t.pos < m; ) {
|
|
1501
|
+
const B = t.uint32();
|
|
1502
|
+
switch (B >>> 3) {
|
|
1503
|
+
case 1:
|
|
1504
|
+
h.body = i.TxBody.decode(t, t.uint32());
|
|
1505
|
+
break;
|
|
1506
|
+
case 2:
|
|
1507
|
+
h.authInfo = i.AuthInfo.decode(t, t.uint32());
|
|
1508
|
+
break;
|
|
1509
|
+
case 3:
|
|
1510
|
+
h.signatures.push(t.bytes());
|
|
1511
|
+
break;
|
|
1512
|
+
default:
|
|
1513
|
+
t.skipType(B & 7);
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
return h;
|
|
1518
|
+
},
|
|
1519
|
+
fromJSON(e) {
|
|
1520
|
+
const n = f();
|
|
1521
|
+
return (0, a.isSet)(e.body) && (n.body = i.TxBody.fromJSON(e.body)), (0, a.isSet)(e.authInfo) && (n.authInfo = i.AuthInfo.fromJSON(e.authInfo)), Array.isArray(e == null ? void 0 : e.signatures) && (n.signatures = e.signatures.map((t) => (0, a.bytesFromBase64)(t))), n;
|
|
1522
|
+
},
|
|
1523
|
+
toJSON(e) {
|
|
1524
|
+
const n = {};
|
|
1525
|
+
return e.body !== void 0 && (n.body = e.body ? i.TxBody.toJSON(e.body) : void 0), e.authInfo !== void 0 && (n.authInfo = e.authInfo ? i.AuthInfo.toJSON(e.authInfo) : void 0), e.signatures ? n.signatures = e.signatures.map((t) => (0, a.base64FromBytes)(t !== void 0 ? t : new Uint8Array())) : n.signatures = [], n;
|
|
1526
|
+
},
|
|
1527
|
+
fromPartial(e) {
|
|
1528
|
+
var t;
|
|
1529
|
+
const n = f();
|
|
1530
|
+
return e.body !== void 0 && e.body !== null && (n.body = i.TxBody.fromPartial(e.body)), e.authInfo !== void 0 && e.authInfo !== null && (n.authInfo = i.AuthInfo.fromPartial(e.authInfo)), n.signatures = ((t = e.signatures) == null ? void 0 : t.map((m) => m)) || [], n;
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
function g() {
|
|
1534
|
+
return {
|
|
1535
|
+
bodyBytes: new Uint8Array(),
|
|
1536
|
+
authInfoBytes: new Uint8Array(),
|
|
1537
|
+
signatures: []
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
i.TxRaw = {
|
|
1541
|
+
typeUrl: "/cosmos.tx.v1beta1.TxRaw",
|
|
1542
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1543
|
+
e.bodyBytes.length !== 0 && n.uint32(10).bytes(e.bodyBytes), e.authInfoBytes.length !== 0 && n.uint32(18).bytes(e.authInfoBytes);
|
|
1544
|
+
for (const t of e.signatures)
|
|
1545
|
+
n.uint32(26).bytes(t);
|
|
1546
|
+
return n;
|
|
1547
|
+
},
|
|
1548
|
+
decode(e, n) {
|
|
1549
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1550
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1551
|
+
const h = g();
|
|
1552
|
+
for (; t.pos < m; ) {
|
|
1553
|
+
const B = t.uint32();
|
|
1554
|
+
switch (B >>> 3) {
|
|
1555
|
+
case 1:
|
|
1556
|
+
h.bodyBytes = t.bytes();
|
|
1557
|
+
break;
|
|
1558
|
+
case 2:
|
|
1559
|
+
h.authInfoBytes = t.bytes();
|
|
1560
|
+
break;
|
|
1561
|
+
case 3:
|
|
1562
|
+
h.signatures.push(t.bytes());
|
|
1563
|
+
break;
|
|
1564
|
+
default:
|
|
1565
|
+
t.skipType(B & 7);
|
|
1566
|
+
break;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
return h;
|
|
1570
|
+
},
|
|
1571
|
+
fromJSON(e) {
|
|
1572
|
+
const n = g();
|
|
1573
|
+
return (0, a.isSet)(e.bodyBytes) && (n.bodyBytes = (0, a.bytesFromBase64)(e.bodyBytes)), (0, a.isSet)(e.authInfoBytes) && (n.authInfoBytes = (0, a.bytesFromBase64)(e.authInfoBytes)), Array.isArray(e == null ? void 0 : e.signatures) && (n.signatures = e.signatures.map((t) => (0, a.bytesFromBase64)(t))), n;
|
|
1574
|
+
},
|
|
1575
|
+
toJSON(e) {
|
|
1576
|
+
const n = {};
|
|
1577
|
+
return e.bodyBytes !== void 0 && (n.bodyBytes = (0, a.base64FromBytes)(e.bodyBytes !== void 0 ? e.bodyBytes : new Uint8Array())), e.authInfoBytes !== void 0 && (n.authInfoBytes = (0, a.base64FromBytes)(e.authInfoBytes !== void 0 ? e.authInfoBytes : new Uint8Array())), e.signatures ? n.signatures = e.signatures.map((t) => (0, a.base64FromBytes)(t !== void 0 ? t : new Uint8Array())) : n.signatures = [], n;
|
|
1578
|
+
},
|
|
1579
|
+
fromPartial(e) {
|
|
1580
|
+
var t;
|
|
1581
|
+
const n = g();
|
|
1582
|
+
return n.bodyBytes = e.bodyBytes ?? new Uint8Array(), n.authInfoBytes = e.authInfoBytes ?? new Uint8Array(), n.signatures = ((t = e.signatures) == null ? void 0 : t.map((m) => m)) || [], n;
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
function _() {
|
|
1586
|
+
return {
|
|
1587
|
+
bodyBytes: new Uint8Array(),
|
|
1588
|
+
authInfoBytes: new Uint8Array(),
|
|
1589
|
+
chainId: "",
|
|
1590
|
+
accountNumber: BigInt(0)
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
i.SignDoc = {
|
|
1594
|
+
typeUrl: "/cosmos.tx.v1beta1.SignDoc",
|
|
1595
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1596
|
+
return e.bodyBytes.length !== 0 && n.uint32(10).bytes(e.bodyBytes), e.authInfoBytes.length !== 0 && n.uint32(18).bytes(e.authInfoBytes), e.chainId !== "" && n.uint32(26).string(e.chainId), e.accountNumber !== BigInt(0) && n.uint32(32).uint64(e.accountNumber), n;
|
|
1597
|
+
},
|
|
1598
|
+
decode(e, n) {
|
|
1599
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1600
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1601
|
+
const h = _();
|
|
1602
|
+
for (; t.pos < m; ) {
|
|
1603
|
+
const B = t.uint32();
|
|
1604
|
+
switch (B >>> 3) {
|
|
1605
|
+
case 1:
|
|
1606
|
+
h.bodyBytes = t.bytes();
|
|
1607
|
+
break;
|
|
1608
|
+
case 2:
|
|
1609
|
+
h.authInfoBytes = t.bytes();
|
|
1610
|
+
break;
|
|
1611
|
+
case 3:
|
|
1612
|
+
h.chainId = t.string();
|
|
1613
|
+
break;
|
|
1614
|
+
case 4:
|
|
1615
|
+
h.accountNumber = t.uint64();
|
|
1616
|
+
break;
|
|
1617
|
+
default:
|
|
1618
|
+
t.skipType(B & 7);
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
return h;
|
|
1623
|
+
},
|
|
1624
|
+
fromJSON(e) {
|
|
1625
|
+
const n = _();
|
|
1626
|
+
return (0, a.isSet)(e.bodyBytes) && (n.bodyBytes = (0, a.bytesFromBase64)(e.bodyBytes)), (0, a.isSet)(e.authInfoBytes) && (n.authInfoBytes = (0, a.bytesFromBase64)(e.authInfoBytes)), (0, a.isSet)(e.chainId) && (n.chainId = String(e.chainId)), (0, a.isSet)(e.accountNumber) && (n.accountNumber = BigInt(e.accountNumber.toString())), n;
|
|
1627
|
+
},
|
|
1628
|
+
toJSON(e) {
|
|
1629
|
+
const n = {};
|
|
1630
|
+
return e.bodyBytes !== void 0 && (n.bodyBytes = (0, a.base64FromBytes)(e.bodyBytes !== void 0 ? e.bodyBytes : new Uint8Array())), e.authInfoBytes !== void 0 && (n.authInfoBytes = (0, a.base64FromBytes)(e.authInfoBytes !== void 0 ? e.authInfoBytes : new Uint8Array())), e.chainId !== void 0 && (n.chainId = e.chainId), e.accountNumber !== void 0 && (n.accountNumber = (e.accountNumber || BigInt(0)).toString()), n;
|
|
1631
|
+
},
|
|
1632
|
+
fromPartial(e) {
|
|
1633
|
+
const n = _();
|
|
1634
|
+
return n.bodyBytes = e.bodyBytes ?? new Uint8Array(), n.authInfoBytes = e.authInfoBytes ?? new Uint8Array(), n.chainId = e.chainId ?? "", e.accountNumber !== void 0 && e.accountNumber !== null && (n.accountNumber = BigInt(e.accountNumber.toString())), n;
|
|
1635
|
+
}
|
|
1636
|
+
};
|
|
1637
|
+
function b() {
|
|
1638
|
+
return {
|
|
1639
|
+
bodyBytes: new Uint8Array(),
|
|
1640
|
+
publicKey: void 0,
|
|
1641
|
+
chainId: "",
|
|
1642
|
+
accountNumber: BigInt(0),
|
|
1643
|
+
sequence: BigInt(0),
|
|
1644
|
+
tip: void 0
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
i.SignDocDirectAux = {
|
|
1648
|
+
typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux",
|
|
1649
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1650
|
+
return e.bodyBytes.length !== 0 && n.uint32(10).bytes(e.bodyBytes), e.publicKey !== void 0 && r.Any.encode(e.publicKey, n.uint32(18).fork()).ldelim(), e.chainId !== "" && n.uint32(26).string(e.chainId), e.accountNumber !== BigInt(0) && n.uint32(32).uint64(e.accountNumber), e.sequence !== BigInt(0) && n.uint32(40).uint64(e.sequence), e.tip !== void 0 && i.Tip.encode(e.tip, n.uint32(50).fork()).ldelim(), n;
|
|
1651
|
+
},
|
|
1652
|
+
decode(e, n) {
|
|
1653
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1654
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1655
|
+
const h = b();
|
|
1656
|
+
for (; t.pos < m; ) {
|
|
1657
|
+
const B = t.uint32();
|
|
1658
|
+
switch (B >>> 3) {
|
|
1659
|
+
case 1:
|
|
1660
|
+
h.bodyBytes = t.bytes();
|
|
1661
|
+
break;
|
|
1662
|
+
case 2:
|
|
1663
|
+
h.publicKey = r.Any.decode(t, t.uint32());
|
|
1664
|
+
break;
|
|
1665
|
+
case 3:
|
|
1666
|
+
h.chainId = t.string();
|
|
1667
|
+
break;
|
|
1668
|
+
case 4:
|
|
1669
|
+
h.accountNumber = t.uint64();
|
|
1670
|
+
break;
|
|
1671
|
+
case 5:
|
|
1672
|
+
h.sequence = t.uint64();
|
|
1673
|
+
break;
|
|
1674
|
+
case 6:
|
|
1675
|
+
h.tip = i.Tip.decode(t, t.uint32());
|
|
1676
|
+
break;
|
|
1677
|
+
default:
|
|
1678
|
+
t.skipType(B & 7);
|
|
1679
|
+
break;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
return h;
|
|
1683
|
+
},
|
|
1684
|
+
fromJSON(e) {
|
|
1685
|
+
const n = b();
|
|
1686
|
+
return (0, a.isSet)(e.bodyBytes) && (n.bodyBytes = (0, a.bytesFromBase64)(e.bodyBytes)), (0, a.isSet)(e.publicKey) && (n.publicKey = r.Any.fromJSON(e.publicKey)), (0, a.isSet)(e.chainId) && (n.chainId = String(e.chainId)), (0, a.isSet)(e.accountNumber) && (n.accountNumber = BigInt(e.accountNumber.toString())), (0, a.isSet)(e.sequence) && (n.sequence = BigInt(e.sequence.toString())), (0, a.isSet)(e.tip) && (n.tip = i.Tip.fromJSON(e.tip)), n;
|
|
1687
|
+
},
|
|
1688
|
+
toJSON(e) {
|
|
1689
|
+
const n = {};
|
|
1690
|
+
return e.bodyBytes !== void 0 && (n.bodyBytes = (0, a.base64FromBytes)(e.bodyBytes !== void 0 ? e.bodyBytes : new Uint8Array())), e.publicKey !== void 0 && (n.publicKey = e.publicKey ? r.Any.toJSON(e.publicKey) : void 0), e.chainId !== void 0 && (n.chainId = e.chainId), e.accountNumber !== void 0 && (n.accountNumber = (e.accountNumber || BigInt(0)).toString()), e.sequence !== void 0 && (n.sequence = (e.sequence || BigInt(0)).toString()), e.tip !== void 0 && (n.tip = e.tip ? i.Tip.toJSON(e.tip) : void 0), n;
|
|
1691
|
+
},
|
|
1692
|
+
fromPartial(e) {
|
|
1693
|
+
const n = b();
|
|
1694
|
+
return n.bodyBytes = e.bodyBytes ?? new Uint8Array(), e.publicKey !== void 0 && e.publicKey !== null && (n.publicKey = r.Any.fromPartial(e.publicKey)), n.chainId = e.chainId ?? "", e.accountNumber !== void 0 && e.accountNumber !== null && (n.accountNumber = BigInt(e.accountNumber.toString())), e.sequence !== void 0 && e.sequence !== null && (n.sequence = BigInt(e.sequence.toString())), e.tip !== void 0 && e.tip !== null && (n.tip = i.Tip.fromPartial(e.tip)), n;
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
function l() {
|
|
1698
|
+
return {
|
|
1699
|
+
messages: [],
|
|
1700
|
+
memo: "",
|
|
1701
|
+
timeoutHeight: BigInt(0),
|
|
1702
|
+
extensionOptions: [],
|
|
1703
|
+
nonCriticalExtensionOptions: []
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
i.TxBody = {
|
|
1707
|
+
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
1708
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1709
|
+
for (const t of e.messages)
|
|
1710
|
+
r.Any.encode(t, n.uint32(10).fork()).ldelim();
|
|
1711
|
+
e.memo !== "" && n.uint32(18).string(e.memo), e.timeoutHeight !== BigInt(0) && n.uint32(24).uint64(e.timeoutHeight);
|
|
1712
|
+
for (const t of e.extensionOptions)
|
|
1713
|
+
r.Any.encode(t, n.uint32(8186).fork()).ldelim();
|
|
1714
|
+
for (const t of e.nonCriticalExtensionOptions)
|
|
1715
|
+
r.Any.encode(t, n.uint32(16378).fork()).ldelim();
|
|
1716
|
+
return n;
|
|
1717
|
+
},
|
|
1718
|
+
decode(e, n) {
|
|
1719
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1720
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1721
|
+
const h = l();
|
|
1722
|
+
for (; t.pos < m; ) {
|
|
1723
|
+
const B = t.uint32();
|
|
1724
|
+
switch (B >>> 3) {
|
|
1725
|
+
case 1:
|
|
1726
|
+
h.messages.push(r.Any.decode(t, t.uint32()));
|
|
1727
|
+
break;
|
|
1728
|
+
case 2:
|
|
1729
|
+
h.memo = t.string();
|
|
1730
|
+
break;
|
|
1731
|
+
case 3:
|
|
1732
|
+
h.timeoutHeight = t.uint64();
|
|
1733
|
+
break;
|
|
1734
|
+
case 1023:
|
|
1735
|
+
h.extensionOptions.push(r.Any.decode(t, t.uint32()));
|
|
1736
|
+
break;
|
|
1737
|
+
case 2047:
|
|
1738
|
+
h.nonCriticalExtensionOptions.push(r.Any.decode(t, t.uint32()));
|
|
1739
|
+
break;
|
|
1740
|
+
default:
|
|
1741
|
+
t.skipType(B & 7);
|
|
1742
|
+
break;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
return h;
|
|
1746
|
+
},
|
|
1747
|
+
fromJSON(e) {
|
|
1748
|
+
const n = l();
|
|
1749
|
+
return Array.isArray(e == null ? void 0 : e.messages) && (n.messages = e.messages.map((t) => r.Any.fromJSON(t))), (0, a.isSet)(e.memo) && (n.memo = String(e.memo)), (0, a.isSet)(e.timeoutHeight) && (n.timeoutHeight = BigInt(e.timeoutHeight.toString())), Array.isArray(e == null ? void 0 : e.extensionOptions) && (n.extensionOptions = e.extensionOptions.map((t) => r.Any.fromJSON(t))), Array.isArray(e == null ? void 0 : e.nonCriticalExtensionOptions) && (n.nonCriticalExtensionOptions = e.nonCriticalExtensionOptions.map((t) => r.Any.fromJSON(t))), n;
|
|
1750
|
+
},
|
|
1751
|
+
toJSON(e) {
|
|
1752
|
+
const n = {};
|
|
1753
|
+
return e.messages ? n.messages = e.messages.map((t) => t ? r.Any.toJSON(t) : void 0) : n.messages = [], e.memo !== void 0 && (n.memo = e.memo), e.timeoutHeight !== void 0 && (n.timeoutHeight = (e.timeoutHeight || BigInt(0)).toString()), e.extensionOptions ? n.extensionOptions = e.extensionOptions.map((t) => t ? r.Any.toJSON(t) : void 0) : n.extensionOptions = [], e.nonCriticalExtensionOptions ? n.nonCriticalExtensionOptions = e.nonCriticalExtensionOptions.map((t) => t ? r.Any.toJSON(t) : void 0) : n.nonCriticalExtensionOptions = [], n;
|
|
1754
|
+
},
|
|
1755
|
+
fromPartial(e) {
|
|
1756
|
+
var t, m, h;
|
|
1757
|
+
const n = l();
|
|
1758
|
+
return n.messages = ((t = e.messages) == null ? void 0 : t.map((B) => r.Any.fromPartial(B))) || [], n.memo = e.memo ?? "", e.timeoutHeight !== void 0 && e.timeoutHeight !== null && (n.timeoutHeight = BigInt(e.timeoutHeight.toString())), n.extensionOptions = ((m = e.extensionOptions) == null ? void 0 : m.map((B) => r.Any.fromPartial(B))) || [], n.nonCriticalExtensionOptions = ((h = e.nonCriticalExtensionOptions) == null ? void 0 : h.map((B) => r.Any.fromPartial(B))) || [], n;
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
function I() {
|
|
1762
|
+
return {
|
|
1763
|
+
signerInfos: [],
|
|
1764
|
+
fee: void 0,
|
|
1765
|
+
tip: void 0
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1768
|
+
i.AuthInfo = {
|
|
1769
|
+
typeUrl: "/cosmos.tx.v1beta1.AuthInfo",
|
|
1770
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1771
|
+
for (const t of e.signerInfos)
|
|
1772
|
+
i.SignerInfo.encode(t, n.uint32(10).fork()).ldelim();
|
|
1773
|
+
return e.fee !== void 0 && i.Fee.encode(e.fee, n.uint32(18).fork()).ldelim(), e.tip !== void 0 && i.Tip.encode(e.tip, n.uint32(26).fork()).ldelim(), n;
|
|
1774
|
+
},
|
|
1775
|
+
decode(e, n) {
|
|
1776
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1777
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1778
|
+
const h = I();
|
|
1779
|
+
for (; t.pos < m; ) {
|
|
1780
|
+
const B = t.uint32();
|
|
1781
|
+
switch (B >>> 3) {
|
|
1782
|
+
case 1:
|
|
1783
|
+
h.signerInfos.push(i.SignerInfo.decode(t, t.uint32()));
|
|
1784
|
+
break;
|
|
1785
|
+
case 2:
|
|
1786
|
+
h.fee = i.Fee.decode(t, t.uint32());
|
|
1787
|
+
break;
|
|
1788
|
+
case 3:
|
|
1789
|
+
h.tip = i.Tip.decode(t, t.uint32());
|
|
1790
|
+
break;
|
|
1791
|
+
default:
|
|
1792
|
+
t.skipType(B & 7);
|
|
1793
|
+
break;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return h;
|
|
1797
|
+
},
|
|
1798
|
+
fromJSON(e) {
|
|
1799
|
+
const n = I();
|
|
1800
|
+
return Array.isArray(e == null ? void 0 : e.signerInfos) && (n.signerInfos = e.signerInfos.map((t) => i.SignerInfo.fromJSON(t))), (0, a.isSet)(e.fee) && (n.fee = i.Fee.fromJSON(e.fee)), (0, a.isSet)(e.tip) && (n.tip = i.Tip.fromJSON(e.tip)), n;
|
|
1801
|
+
},
|
|
1802
|
+
toJSON(e) {
|
|
1803
|
+
const n = {};
|
|
1804
|
+
return e.signerInfos ? n.signerInfos = e.signerInfos.map((t) => t ? i.SignerInfo.toJSON(t) : void 0) : n.signerInfos = [], e.fee !== void 0 && (n.fee = e.fee ? i.Fee.toJSON(e.fee) : void 0), e.tip !== void 0 && (n.tip = e.tip ? i.Tip.toJSON(e.tip) : void 0), n;
|
|
1805
|
+
},
|
|
1806
|
+
fromPartial(e) {
|
|
1807
|
+
var t;
|
|
1808
|
+
const n = I();
|
|
1809
|
+
return n.signerInfos = ((t = e.signerInfos) == null ? void 0 : t.map((m) => i.SignerInfo.fromPartial(m))) || [], e.fee !== void 0 && e.fee !== null && (n.fee = i.Fee.fromPartial(e.fee)), e.tip !== void 0 && e.tip !== null && (n.tip = i.Tip.fromPartial(e.tip)), n;
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
function u() {
|
|
1813
|
+
return {
|
|
1814
|
+
publicKey: void 0,
|
|
1815
|
+
modeInfo: void 0,
|
|
1816
|
+
sequence: BigInt(0)
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
i.SignerInfo = {
|
|
1820
|
+
typeUrl: "/cosmos.tx.v1beta1.SignerInfo",
|
|
1821
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1822
|
+
return e.publicKey !== void 0 && r.Any.encode(e.publicKey, n.uint32(10).fork()).ldelim(), e.modeInfo !== void 0 && i.ModeInfo.encode(e.modeInfo, n.uint32(18).fork()).ldelim(), e.sequence !== BigInt(0) && n.uint32(24).uint64(e.sequence), n;
|
|
1823
|
+
},
|
|
1824
|
+
decode(e, n) {
|
|
1825
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1826
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1827
|
+
const h = u();
|
|
1828
|
+
for (; t.pos < m; ) {
|
|
1829
|
+
const B = t.uint32();
|
|
1830
|
+
switch (B >>> 3) {
|
|
1831
|
+
case 1:
|
|
1832
|
+
h.publicKey = r.Any.decode(t, t.uint32());
|
|
1833
|
+
break;
|
|
1834
|
+
case 2:
|
|
1835
|
+
h.modeInfo = i.ModeInfo.decode(t, t.uint32());
|
|
1836
|
+
break;
|
|
1837
|
+
case 3:
|
|
1838
|
+
h.sequence = t.uint64();
|
|
1839
|
+
break;
|
|
1840
|
+
default:
|
|
1841
|
+
t.skipType(B & 7);
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return h;
|
|
1846
|
+
},
|
|
1847
|
+
fromJSON(e) {
|
|
1848
|
+
const n = u();
|
|
1849
|
+
return (0, a.isSet)(e.publicKey) && (n.publicKey = r.Any.fromJSON(e.publicKey)), (0, a.isSet)(e.modeInfo) && (n.modeInfo = i.ModeInfo.fromJSON(e.modeInfo)), (0, a.isSet)(e.sequence) && (n.sequence = BigInt(e.sequence.toString())), n;
|
|
1850
|
+
},
|
|
1851
|
+
toJSON(e) {
|
|
1852
|
+
const n = {};
|
|
1853
|
+
return e.publicKey !== void 0 && (n.publicKey = e.publicKey ? r.Any.toJSON(e.publicKey) : void 0), e.modeInfo !== void 0 && (n.modeInfo = e.modeInfo ? i.ModeInfo.toJSON(e.modeInfo) : void 0), e.sequence !== void 0 && (n.sequence = (e.sequence || BigInt(0)).toString()), n;
|
|
1854
|
+
},
|
|
1855
|
+
fromPartial(e) {
|
|
1856
|
+
const n = u();
|
|
1857
|
+
return e.publicKey !== void 0 && e.publicKey !== null && (n.publicKey = r.Any.fromPartial(e.publicKey)), e.modeInfo !== void 0 && e.modeInfo !== null && (n.modeInfo = i.ModeInfo.fromPartial(e.modeInfo)), e.sequence !== void 0 && e.sequence !== null && (n.sequence = BigInt(e.sequence.toString())), n;
|
|
1858
|
+
}
|
|
1859
|
+
};
|
|
1860
|
+
function y() {
|
|
1861
|
+
return {
|
|
1862
|
+
single: void 0,
|
|
1863
|
+
multi: void 0
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
i.ModeInfo = {
|
|
1867
|
+
typeUrl: "/cosmos.tx.v1beta1.ModeInfo",
|
|
1868
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1869
|
+
return e.single !== void 0 && i.ModeInfo_Single.encode(e.single, n.uint32(10).fork()).ldelim(), e.multi !== void 0 && i.ModeInfo_Multi.encode(e.multi, n.uint32(18).fork()).ldelim(), n;
|
|
1870
|
+
},
|
|
1871
|
+
decode(e, n) {
|
|
1872
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1873
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1874
|
+
const h = y();
|
|
1875
|
+
for (; t.pos < m; ) {
|
|
1876
|
+
const B = t.uint32();
|
|
1877
|
+
switch (B >>> 3) {
|
|
1878
|
+
case 1:
|
|
1879
|
+
h.single = i.ModeInfo_Single.decode(t, t.uint32());
|
|
1880
|
+
break;
|
|
1881
|
+
case 2:
|
|
1882
|
+
h.multi = i.ModeInfo_Multi.decode(t, t.uint32());
|
|
1883
|
+
break;
|
|
1884
|
+
default:
|
|
1885
|
+
t.skipType(B & 7);
|
|
1886
|
+
break;
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
return h;
|
|
1890
|
+
},
|
|
1891
|
+
fromJSON(e) {
|
|
1892
|
+
const n = y();
|
|
1893
|
+
return (0, a.isSet)(e.single) && (n.single = i.ModeInfo_Single.fromJSON(e.single)), (0, a.isSet)(e.multi) && (n.multi = i.ModeInfo_Multi.fromJSON(e.multi)), n;
|
|
1894
|
+
},
|
|
1895
|
+
toJSON(e) {
|
|
1896
|
+
const n = {};
|
|
1897
|
+
return e.single !== void 0 && (n.single = e.single ? i.ModeInfo_Single.toJSON(e.single) : void 0), e.multi !== void 0 && (n.multi = e.multi ? i.ModeInfo_Multi.toJSON(e.multi) : void 0), n;
|
|
1898
|
+
},
|
|
1899
|
+
fromPartial(e) {
|
|
1900
|
+
const n = y();
|
|
1901
|
+
return e.single !== void 0 && e.single !== null && (n.single = i.ModeInfo_Single.fromPartial(e.single)), e.multi !== void 0 && e.multi !== null && (n.multi = i.ModeInfo_Multi.fromPartial(e.multi)), n;
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
function S() {
|
|
1905
|
+
return {
|
|
1906
|
+
mode: 0
|
|
1907
|
+
};
|
|
1908
|
+
}
|
|
1909
|
+
i.ModeInfo_Single = {
|
|
1910
|
+
typeUrl: "/cosmos.tx.v1beta1.Single",
|
|
1911
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1912
|
+
return e.mode !== 0 && n.uint32(8).int32(e.mode), n;
|
|
1913
|
+
},
|
|
1914
|
+
decode(e, n) {
|
|
1915
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1916
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1917
|
+
const h = S();
|
|
1918
|
+
for (; t.pos < m; ) {
|
|
1919
|
+
const B = t.uint32();
|
|
1920
|
+
switch (B >>> 3) {
|
|
1921
|
+
case 1:
|
|
1922
|
+
h.mode = t.int32();
|
|
1923
|
+
break;
|
|
1924
|
+
default:
|
|
1925
|
+
t.skipType(B & 7);
|
|
1926
|
+
break;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
return h;
|
|
1930
|
+
},
|
|
1931
|
+
fromJSON(e) {
|
|
1932
|
+
const n = S();
|
|
1933
|
+
return (0, a.isSet)(e.mode) && (n.mode = (0, c.signModeFromJSON)(e.mode)), n;
|
|
1934
|
+
},
|
|
1935
|
+
toJSON(e) {
|
|
1936
|
+
const n = {};
|
|
1937
|
+
return e.mode !== void 0 && (n.mode = (0, c.signModeToJSON)(e.mode)), n;
|
|
1938
|
+
},
|
|
1939
|
+
fromPartial(e) {
|
|
1940
|
+
const n = S();
|
|
1941
|
+
return n.mode = e.mode ?? 0, n;
|
|
1942
|
+
}
|
|
1943
|
+
};
|
|
1944
|
+
function p() {
|
|
1945
|
+
return {
|
|
1946
|
+
bitarray: void 0,
|
|
1947
|
+
modeInfos: []
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
i.ModeInfo_Multi = {
|
|
1951
|
+
typeUrl: "/cosmos.tx.v1beta1.Multi",
|
|
1952
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
1953
|
+
e.bitarray !== void 0 && d.CompactBitArray.encode(e.bitarray, n.uint32(10).fork()).ldelim();
|
|
1954
|
+
for (const t of e.modeInfos)
|
|
1955
|
+
i.ModeInfo.encode(t, n.uint32(18).fork()).ldelim();
|
|
1956
|
+
return n;
|
|
1957
|
+
},
|
|
1958
|
+
decode(e, n) {
|
|
1959
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
1960
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
1961
|
+
const h = p();
|
|
1962
|
+
for (; t.pos < m; ) {
|
|
1963
|
+
const B = t.uint32();
|
|
1964
|
+
switch (B >>> 3) {
|
|
1965
|
+
case 1:
|
|
1966
|
+
h.bitarray = d.CompactBitArray.decode(t, t.uint32());
|
|
1967
|
+
break;
|
|
1968
|
+
case 2:
|
|
1969
|
+
h.modeInfos.push(i.ModeInfo.decode(t, t.uint32()));
|
|
1970
|
+
break;
|
|
1971
|
+
default:
|
|
1972
|
+
t.skipType(B & 7);
|
|
1973
|
+
break;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
return h;
|
|
1977
|
+
},
|
|
1978
|
+
fromJSON(e) {
|
|
1979
|
+
const n = p();
|
|
1980
|
+
return (0, a.isSet)(e.bitarray) && (n.bitarray = d.CompactBitArray.fromJSON(e.bitarray)), Array.isArray(e == null ? void 0 : e.modeInfos) && (n.modeInfos = e.modeInfos.map((t) => i.ModeInfo.fromJSON(t))), n;
|
|
1981
|
+
},
|
|
1982
|
+
toJSON(e) {
|
|
1983
|
+
const n = {};
|
|
1984
|
+
return e.bitarray !== void 0 && (n.bitarray = e.bitarray ? d.CompactBitArray.toJSON(e.bitarray) : void 0), e.modeInfos ? n.modeInfos = e.modeInfos.map((t) => t ? i.ModeInfo.toJSON(t) : void 0) : n.modeInfos = [], n;
|
|
1985
|
+
},
|
|
1986
|
+
fromPartial(e) {
|
|
1987
|
+
var t;
|
|
1988
|
+
const n = p();
|
|
1989
|
+
return e.bitarray !== void 0 && e.bitarray !== null && (n.bitarray = d.CompactBitArray.fromPartial(e.bitarray)), n.modeInfos = ((t = e.modeInfos) == null ? void 0 : t.map((m) => i.ModeInfo.fromPartial(m))) || [], n;
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
function w() {
|
|
1993
|
+
return {
|
|
1994
|
+
amount: [],
|
|
1995
|
+
gasLimit: BigInt(0),
|
|
1996
|
+
payer: "",
|
|
1997
|
+
granter: ""
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
i.Fee = {
|
|
2001
|
+
typeUrl: "/cosmos.tx.v1beta1.Fee",
|
|
2002
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
2003
|
+
for (const t of e.amount)
|
|
2004
|
+
s.Coin.encode(t, n.uint32(10).fork()).ldelim();
|
|
2005
|
+
return e.gasLimit !== BigInt(0) && n.uint32(16).uint64(e.gasLimit), e.payer !== "" && n.uint32(26).string(e.payer), e.granter !== "" && n.uint32(34).string(e.granter), n;
|
|
2006
|
+
},
|
|
2007
|
+
decode(e, n) {
|
|
2008
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
2009
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
2010
|
+
const h = w();
|
|
2011
|
+
for (; t.pos < m; ) {
|
|
2012
|
+
const B = t.uint32();
|
|
2013
|
+
switch (B >>> 3) {
|
|
2014
|
+
case 1:
|
|
2015
|
+
h.amount.push(s.Coin.decode(t, t.uint32()));
|
|
2016
|
+
break;
|
|
2017
|
+
case 2:
|
|
2018
|
+
h.gasLimit = t.uint64();
|
|
2019
|
+
break;
|
|
2020
|
+
case 3:
|
|
2021
|
+
h.payer = t.string();
|
|
2022
|
+
break;
|
|
2023
|
+
case 4:
|
|
2024
|
+
h.granter = t.string();
|
|
2025
|
+
break;
|
|
2026
|
+
default:
|
|
2027
|
+
t.skipType(B & 7);
|
|
2028
|
+
break;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
return h;
|
|
2032
|
+
},
|
|
2033
|
+
fromJSON(e) {
|
|
2034
|
+
const n = w();
|
|
2035
|
+
return Array.isArray(e == null ? void 0 : e.amount) && (n.amount = e.amount.map((t) => s.Coin.fromJSON(t))), (0, a.isSet)(e.gasLimit) && (n.gasLimit = BigInt(e.gasLimit.toString())), (0, a.isSet)(e.payer) && (n.payer = String(e.payer)), (0, a.isSet)(e.granter) && (n.granter = String(e.granter)), n;
|
|
2036
|
+
},
|
|
2037
|
+
toJSON(e) {
|
|
2038
|
+
const n = {};
|
|
2039
|
+
return e.amount ? n.amount = e.amount.map((t) => t ? s.Coin.toJSON(t) : void 0) : n.amount = [], e.gasLimit !== void 0 && (n.gasLimit = (e.gasLimit || BigInt(0)).toString()), e.payer !== void 0 && (n.payer = e.payer), e.granter !== void 0 && (n.granter = e.granter), n;
|
|
2040
|
+
},
|
|
2041
|
+
fromPartial(e) {
|
|
2042
|
+
var t;
|
|
2043
|
+
const n = w();
|
|
2044
|
+
return n.amount = ((t = e.amount) == null ? void 0 : t.map((m) => s.Coin.fromPartial(m))) || [], e.gasLimit !== void 0 && e.gasLimit !== null && (n.gasLimit = BigInt(e.gasLimit.toString())), n.payer = e.payer ?? "", n.granter = e.granter ?? "", n;
|
|
2045
|
+
}
|
|
2046
|
+
};
|
|
2047
|
+
function O() {
|
|
2048
|
+
return {
|
|
2049
|
+
amount: [],
|
|
2050
|
+
tipper: ""
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
i.Tip = {
|
|
2054
|
+
typeUrl: "/cosmos.tx.v1beta1.Tip",
|
|
2055
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
2056
|
+
for (const t of e.amount)
|
|
2057
|
+
s.Coin.encode(t, n.uint32(10).fork()).ldelim();
|
|
2058
|
+
return e.tipper !== "" && n.uint32(18).string(e.tipper), n;
|
|
2059
|
+
},
|
|
2060
|
+
decode(e, n) {
|
|
2061
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
2062
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
2063
|
+
const h = O();
|
|
2064
|
+
for (; t.pos < m; ) {
|
|
2065
|
+
const B = t.uint32();
|
|
2066
|
+
switch (B >>> 3) {
|
|
2067
|
+
case 1:
|
|
2068
|
+
h.amount.push(s.Coin.decode(t, t.uint32()));
|
|
2069
|
+
break;
|
|
2070
|
+
case 2:
|
|
2071
|
+
h.tipper = t.string();
|
|
2072
|
+
break;
|
|
2073
|
+
default:
|
|
2074
|
+
t.skipType(B & 7);
|
|
2075
|
+
break;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
return h;
|
|
2079
|
+
},
|
|
2080
|
+
fromJSON(e) {
|
|
2081
|
+
const n = O();
|
|
2082
|
+
return Array.isArray(e == null ? void 0 : e.amount) && (n.amount = e.amount.map((t) => s.Coin.fromJSON(t))), (0, a.isSet)(e.tipper) && (n.tipper = String(e.tipper)), n;
|
|
2083
|
+
},
|
|
2084
|
+
toJSON(e) {
|
|
2085
|
+
const n = {};
|
|
2086
|
+
return e.amount ? n.amount = e.amount.map((t) => t ? s.Coin.toJSON(t) : void 0) : n.amount = [], e.tipper !== void 0 && (n.tipper = e.tipper), n;
|
|
2087
|
+
},
|
|
2088
|
+
fromPartial(e) {
|
|
2089
|
+
var t;
|
|
2090
|
+
const n = O();
|
|
2091
|
+
return n.amount = ((t = e.amount) == null ? void 0 : t.map((m) => s.Coin.fromPartial(m))) || [], n.tipper = e.tipper ?? "", n;
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
function D() {
|
|
2095
|
+
return {
|
|
2096
|
+
address: "",
|
|
2097
|
+
signDoc: void 0,
|
|
2098
|
+
mode: 0,
|
|
2099
|
+
sig: new Uint8Array()
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
i.AuxSignerData = {
|
|
2103
|
+
typeUrl: "/cosmos.tx.v1beta1.AuxSignerData",
|
|
2104
|
+
encode(e, n = o.BinaryWriter.create()) {
|
|
2105
|
+
return e.address !== "" && n.uint32(10).string(e.address), e.signDoc !== void 0 && i.SignDocDirectAux.encode(e.signDoc, n.uint32(18).fork()).ldelim(), e.mode !== 0 && n.uint32(24).int32(e.mode), e.sig.length !== 0 && n.uint32(34).bytes(e.sig), n;
|
|
2106
|
+
},
|
|
2107
|
+
decode(e, n) {
|
|
2108
|
+
const t = e instanceof o.BinaryReader ? e : new o.BinaryReader(e);
|
|
2109
|
+
let m = n === void 0 ? t.len : t.pos + n;
|
|
2110
|
+
const h = D();
|
|
2111
|
+
for (; t.pos < m; ) {
|
|
2112
|
+
const B = t.uint32();
|
|
2113
|
+
switch (B >>> 3) {
|
|
2114
|
+
case 1:
|
|
2115
|
+
h.address = t.string();
|
|
2116
|
+
break;
|
|
2117
|
+
case 2:
|
|
2118
|
+
h.signDoc = i.SignDocDirectAux.decode(t, t.uint32());
|
|
2119
|
+
break;
|
|
2120
|
+
case 3:
|
|
2121
|
+
h.mode = t.int32();
|
|
2122
|
+
break;
|
|
2123
|
+
case 4:
|
|
2124
|
+
h.sig = t.bytes();
|
|
2125
|
+
break;
|
|
2126
|
+
default:
|
|
2127
|
+
t.skipType(B & 7);
|
|
2128
|
+
break;
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
return h;
|
|
2132
|
+
},
|
|
2133
|
+
fromJSON(e) {
|
|
2134
|
+
const n = D();
|
|
2135
|
+
return (0, a.isSet)(e.address) && (n.address = String(e.address)), (0, a.isSet)(e.signDoc) && (n.signDoc = i.SignDocDirectAux.fromJSON(e.signDoc)), (0, a.isSet)(e.mode) && (n.mode = (0, c.signModeFromJSON)(e.mode)), (0, a.isSet)(e.sig) && (n.sig = (0, a.bytesFromBase64)(e.sig)), n;
|
|
2136
|
+
},
|
|
2137
|
+
toJSON(e) {
|
|
2138
|
+
const n = {};
|
|
2139
|
+
return e.address !== void 0 && (n.address = e.address), e.signDoc !== void 0 && (n.signDoc = e.signDoc ? i.SignDocDirectAux.toJSON(e.signDoc) : void 0), e.mode !== void 0 && (n.mode = (0, c.signModeToJSON)(e.mode)), e.sig !== void 0 && (n.sig = (0, a.base64FromBytes)(e.sig !== void 0 ? e.sig : new Uint8Array())), n;
|
|
2140
|
+
},
|
|
2141
|
+
fromPartial(e) {
|
|
2142
|
+
const n = D();
|
|
2143
|
+
return n.address = e.address ?? "", e.signDoc !== void 0 && e.signDoc !== null && (n.signDoc = i.SignDocDirectAux.fromPartial(e.signDoc)), n.mode = e.mode ?? 0, n.sig = e.sig ?? new Uint8Array(), n;
|
|
2144
|
+
}
|
|
2145
|
+
};
|
|
2146
|
+
}(X)), X;
|
|
2147
|
+
}
|
|
2148
|
+
var q = nn();
|
|
2149
|
+
const tn = async (i) => {
|
|
2150
|
+
var l, I, u, y, S, p, w, O, D, e, n, t, m;
|
|
2151
|
+
const r = Me.find((h) => h.chain_id === i);
|
|
2152
|
+
if (!r)
|
|
2153
|
+
throw new Error(`Chain info not found for chainId: ${i}`);
|
|
2154
|
+
const { bech32_prefix: c, chain_id: d } = r, s = (u = (I = (l = r.staking) == null ? void 0 : l.staking_tokens) == null ? void 0 : I[0]) == null ? void 0 : u.denom, o = (p = (S = (y = r.apis) == null ? void 0 : y.rpc) == null ? void 0 : S[0]) == null ? void 0 : p.address, a = (D = (O = (w = r.apis) == null ? void 0 : w.rest) == null ? void 0 : O[0]) == null ? void 0 : D.address, f = (t = (n = (e = r.fees) == null ? void 0 : e.fee_tokens) == null ? void 0 : n[0]) == null ? void 0 : t.average_gas_price;
|
|
2155
|
+
if (!c || !s || !o || !a || !d || f === void 0)
|
|
2156
|
+
throw new Error(
|
|
2157
|
+
`Missing required chain information for ${r.chain_name}`
|
|
2158
|
+
);
|
|
2159
|
+
const g = Je.find(
|
|
2160
|
+
(h) => h.chain_name === r.chain_name
|
|
2161
|
+
), _ = g == null ? void 0 : g.assets.find((h) => h.base === s), b = (m = _ == null ? void 0 : _.denom_units.find(
|
|
2162
|
+
(h) => h.denom === _.display
|
|
2163
|
+
)) == null ? void 0 : m.exponent;
|
|
2164
|
+
if (b === void 0)
|
|
2165
|
+
throw new Error(
|
|
2166
|
+
`Could not find decimals for ${s} on chain ${r.chain_name}`
|
|
2167
|
+
);
|
|
2168
|
+
return { prefix: c, denom: s, rpcUrl: o, restUrl: a, expectedChainId: d, gasPrice: f, decimals: b };
|
|
2169
|
+
};
|
|
2170
|
+
class rn extends Q {
|
|
2171
|
+
/**
|
|
2172
|
+
* Creates a new Cosmos chain instance
|
|
2173
|
+
* @param params - Configuration parameters
|
|
2174
|
+
* @param params.chainId - Chain id for the Cosmos network
|
|
2175
|
+
* @param params.contract - Instance of the chain signature contract for MPC operations
|
|
2176
|
+
* @param params.endpoints - Optional RPC and REST endpoints
|
|
2177
|
+
* @param params.endpoints.rpcUrl - Optional RPC endpoint URL
|
|
2178
|
+
* @param params.endpoints.restUrl - Optional REST endpoint URL
|
|
2179
|
+
*/
|
|
2180
|
+
constructor({
|
|
2181
|
+
chainId: r,
|
|
2182
|
+
contract: c,
|
|
2183
|
+
endpoints: d
|
|
2184
|
+
}) {
|
|
2185
|
+
super(), this.contract = c, this.registry = new De(), this.chainId = r, this.endpoints = d;
|
|
2186
|
+
}
|
|
2187
|
+
parseRSVSignature(r) {
|
|
2188
|
+
return new Uint8Array([
|
|
2189
|
+
...K(r.r),
|
|
2190
|
+
...K(r.s)
|
|
2191
|
+
]);
|
|
2192
|
+
}
|
|
2193
|
+
async getChainInfo() {
|
|
2194
|
+
return {
|
|
2195
|
+
...await tn(this.chainId),
|
|
2196
|
+
...this.endpoints
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
async getBalance(r) {
|
|
2200
|
+
try {
|
|
2201
|
+
const { restUrl: c, denom: d, decimals: s } = await this.getChainInfo(), o = await fetch(
|
|
2202
|
+
`${c}/cosmos/bank/v1beta1/balances/${r}`
|
|
2203
|
+
);
|
|
2204
|
+
if (!o.ok)
|
|
2205
|
+
throw new Error(`HTTP error! status: ${o.status}`);
|
|
2206
|
+
const f = (await o.json()).balances.find((b) => b.denom === d), g = (f == null ? void 0 : f.amount) ?? "0";
|
|
2207
|
+
return (parseInt(g) / Math.pow(10, s)).toString();
|
|
2208
|
+
} catch (c) {
|
|
2209
|
+
throw console.error("Failed to fetch Cosmos balance:", c), new Error("Failed to fetch Cosmos balance");
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
async deriveAddressAndPublicKey(r, c) {
|
|
2213
|
+
const { prefix: d } = await this.getChainInfo(), s = await this.contract.getDerivedPublicKey({
|
|
2214
|
+
path: c,
|
|
2215
|
+
predecessor: r
|
|
2216
|
+
});
|
|
2217
|
+
if (!s)
|
|
2218
|
+
throw new Error("Failed to get derived public key");
|
|
2219
|
+
const o = ge(s), a = ee(K(o)), f = Ae(a);
|
|
2220
|
+
return { address: te.encode(d, te.toWords(f)), publicKey: o };
|
|
2221
|
+
}
|
|
2222
|
+
setTransaction(r, c) {
|
|
2223
|
+
const d = q.TxRaw.encode(r).finish();
|
|
2224
|
+
window.localStorage.setItem(c, we(d));
|
|
2225
|
+
}
|
|
2226
|
+
getTransaction(r, c) {
|
|
2227
|
+
const d = window.localStorage.getItem(r);
|
|
2228
|
+
if (d)
|
|
2229
|
+
return c != null && c.remove && window.localStorage.removeItem(r), q.TxRaw.decode(_e(d));
|
|
2230
|
+
}
|
|
2231
|
+
async getMPCPayloadAndTransaction(r) {
|
|
2232
|
+
const { denom: c, rpcUrl: d, gasPrice: s } = await this.getChainInfo(), o = K(r.publicKey), a = r.gas || 2e5, f = Ce(
|
|
2233
|
+
a,
|
|
2234
|
+
xe.fromString(`${s}${c}`)
|
|
2235
|
+
), _ = await (await ne.connect(d)).getAccount(r.address);
|
|
2236
|
+
if (!_)
|
|
2237
|
+
throw new Error(
|
|
2238
|
+
`Account ${r.address} does not exist on chain`
|
|
2239
|
+
);
|
|
2240
|
+
const { accountNumber: b, sequence: l } = _, I = {
|
|
2241
|
+
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
2242
|
+
value: {
|
|
2243
|
+
messages: r.messages,
|
|
2244
|
+
memo: r.memo || ""
|
|
2245
|
+
}
|
|
2246
|
+
}, u = this.registry.encode(I), y = Te(Ne(o)), S = ve(
|
|
2247
|
+
[
|
|
2248
|
+
{
|
|
2249
|
+
pubkey: y,
|
|
2250
|
+
sequence: l
|
|
2251
|
+
}
|
|
2252
|
+
],
|
|
2253
|
+
f.amount,
|
|
2254
|
+
Number(f.gas),
|
|
2255
|
+
void 0,
|
|
2256
|
+
void 0,
|
|
2257
|
+
je.SignMode.SIGN_MODE_DIRECT
|
|
2258
|
+
), p = Pe(
|
|
2259
|
+
u,
|
|
2260
|
+
S,
|
|
2261
|
+
this.chainId,
|
|
2262
|
+
b
|
|
2263
|
+
), w = Ee(p), O = Array.from(ee(w));
|
|
2264
|
+
return {
|
|
2265
|
+
transaction: q.TxRaw.fromPartial({
|
|
2266
|
+
bodyBytes: u,
|
|
2267
|
+
authInfoBytes: S,
|
|
2268
|
+
signatures: []
|
|
2269
|
+
}),
|
|
2270
|
+
mpcPayloads: [
|
|
2271
|
+
{
|
|
2272
|
+
index: 0,
|
|
2273
|
+
payload: O
|
|
2274
|
+
}
|
|
2275
|
+
]
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
addSignature({
|
|
2279
|
+
transaction: r,
|
|
2280
|
+
mpcSignatures: c
|
|
2281
|
+
}) {
|
|
2282
|
+
r.signatures = c.map(
|
|
2283
|
+
(s) => this.parseRSVSignature(s)
|
|
2284
|
+
);
|
|
2285
|
+
const d = q.TxRaw.encode(r).finish();
|
|
2286
|
+
return Buffer.from(d).toString("hex");
|
|
2287
|
+
}
|
|
2288
|
+
async broadcastTx(r) {
|
|
2289
|
+
try {
|
|
2290
|
+
const { rpcUrl: c } = await this.getChainInfo(), d = await ne.connect(c), s = K(r), o = await d.broadcastTx(s);
|
|
2291
|
+
if (o.code !== 0)
|
|
2292
|
+
throw new Error(`Broadcast error: ${o.rawLog}`);
|
|
2293
|
+
return o.transactionHash;
|
|
2294
|
+
} catch (c) {
|
|
2295
|
+
throw console.error("Transaction broadcast failed:", c), new Error("Failed to broadcast transaction.");
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
var Z = {}, he;
|
|
2300
|
+
function an() {
|
|
2301
|
+
return he || (he = 1, function(i) {
|
|
2302
|
+
Object.defineProperty(i, "__esModule", { value: !0 }), i.base_decode = i.base_encode = i.deserialize = i.serialize = void 0;
|
|
2303
|
+
var r = Ge;
|
|
2304
|
+
Object.defineProperty(i, "serialize", { enumerable: !0, get: function() {
|
|
2305
|
+
return r.serialize;
|
|
2306
|
+
} }), Object.defineProperty(i, "deserialize", { enumerable: !0, get: function() {
|
|
2307
|
+
return r.deserialize;
|
|
2308
|
+
} });
|
|
2309
|
+
var c = He;
|
|
2310
|
+
Object.defineProperty(i, "base_encode", { enumerable: !0, get: function() {
|
|
2311
|
+
return c.baseEncode;
|
|
2312
|
+
} }), Object.defineProperty(i, "base_decode", { enumerable: !0, get: function() {
|
|
2313
|
+
return c.baseDecode;
|
|
2314
|
+
} });
|
|
2315
|
+
}(Z)), Z;
|
|
2316
|
+
}
|
|
2317
|
+
var on = an();
|
|
2318
|
+
const z = new $("300000000000000"), j = "dontcare", W = async ({
|
|
2319
|
+
networkId: i,
|
|
2320
|
+
accountId: r = j,
|
|
2321
|
+
keypair: c = me.fromRandom("ed25519")
|
|
2322
|
+
}) => {
|
|
2323
|
+
const d = new Le();
|
|
2324
|
+
await d.setKey(i, r, c);
|
|
2325
|
+
const s = Ue.fromConfig({
|
|
2326
|
+
networkId: i,
|
|
2327
|
+
provider: {
|
|
2328
|
+
type: "JsonRpcProvider",
|
|
2329
|
+
args: {
|
|
2330
|
+
url: {
|
|
2331
|
+
testnet: "https://rpc.testnet.near.org",
|
|
2332
|
+
mainnet: "https://rpc.mainnet.near.org"
|
|
2333
|
+
}[i]
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
signer: { type: "InMemorySigner", keyStore: d }
|
|
2337
|
+
});
|
|
2338
|
+
return new Re(s, r);
|
|
2339
|
+
};
|
|
2340
|
+
function sn(i) {
|
|
2341
|
+
return {
|
|
2342
|
+
delegate_action: {
|
|
2343
|
+
actions: i.delegateAction.actions.map((r) => {
|
|
2344
|
+
if (r.functionCall)
|
|
2345
|
+
return {
|
|
2346
|
+
FunctionCall: {
|
|
2347
|
+
method_name: r.functionCall.methodName,
|
|
2348
|
+
args: Buffer.from(r.functionCall.args).toString("base64"),
|
|
2349
|
+
gas: Number(r.functionCall.gas),
|
|
2350
|
+
deposit: r.functionCall.deposit.toString()
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}).flatMap((r) => r ? [r] : []),
|
|
2354
|
+
nonce: Number(i.delegateAction.nonce),
|
|
2355
|
+
max_block_height: Number(i.delegateAction.maxBlockHeight),
|
|
2356
|
+
public_key: i.delegateAction.publicKey.toString(),
|
|
2357
|
+
receiver_id: i.delegateAction.receiverId,
|
|
2358
|
+
sender_id: i.delegateAction.senderId
|
|
2359
|
+
},
|
|
2360
|
+
signature: `ed25519:${qe.encode(i.signature.data)}`
|
|
2361
|
+
};
|
|
2362
|
+
}
|
|
2363
|
+
const un = (i) => `04${Buffer.from(on.base_decode(i.split(":")[1])).toString("hex")}`, dn = (i) => {
|
|
2364
|
+
if (i === j)
|
|
2365
|
+
throw new Error(
|
|
2366
|
+
"A valid account ID and keypair are required for change methods. Please instantiate a new contract with valid credentials."
|
|
2367
|
+
);
|
|
2368
|
+
};
|
|
2369
|
+
class G extends ze {
|
|
2370
|
+
constructor({
|
|
2371
|
+
networkId: r,
|
|
2372
|
+
contractId: c,
|
|
2373
|
+
accountId: d = j,
|
|
2374
|
+
keypair: s = me.fromRandom("ed25519")
|
|
2375
|
+
}) {
|
|
2376
|
+
super(), this.networkId = r, this.contractId = c, this.accountId = d, this.keypair = s;
|
|
2377
|
+
}
|
|
2378
|
+
async getContract() {
|
|
2379
|
+
const r = await W({
|
|
2380
|
+
networkId: this.networkId,
|
|
2381
|
+
accountId: this.accountId,
|
|
2382
|
+
keypair: this.keypair
|
|
2383
|
+
});
|
|
2384
|
+
return new Fe(r, this.contractId, {
|
|
2385
|
+
viewMethods: [
|
|
2386
|
+
"public_key",
|
|
2387
|
+
"experimental_signature_deposit",
|
|
2388
|
+
"derived_public_key"
|
|
2389
|
+
],
|
|
2390
|
+
changeMethods: ["sign"],
|
|
2391
|
+
useLocalViewExecution: !1
|
|
2392
|
+
});
|
|
2393
|
+
}
|
|
2394
|
+
async getCurrentSignatureDeposit() {
|
|
2395
|
+
const r = await this.getContract();
|
|
2396
|
+
return new $(
|
|
2397
|
+
(await r.experimental_signature_deposit()).toLocaleString(
|
|
2398
|
+
"fullwide",
|
|
2399
|
+
{
|
|
2400
|
+
useGrouping: !1
|
|
2401
|
+
}
|
|
2402
|
+
)
|
|
2403
|
+
);
|
|
2404
|
+
}
|
|
2405
|
+
async getDerivedPublicKey(r) {
|
|
2406
|
+
const d = await (await this.getContract()).derived_public_key(r);
|
|
2407
|
+
return un(d);
|
|
2408
|
+
}
|
|
2409
|
+
async sign(r) {
|
|
2410
|
+
dn(this.accountId);
|
|
2411
|
+
const c = await this.getContract(), d = await this.getCurrentSignatureDeposit(), s = await c.sign({
|
|
2412
|
+
args: { request: r },
|
|
2413
|
+
gas: z,
|
|
2414
|
+
amount: d
|
|
2415
|
+
});
|
|
2416
|
+
return pe(s);
|
|
2417
|
+
}
|
|
2418
|
+
static async signWithRelayer({
|
|
2419
|
+
account: r,
|
|
2420
|
+
contract: c,
|
|
2421
|
+
signArgs: d,
|
|
2422
|
+
deposit: s,
|
|
2423
|
+
relayerUrl: o
|
|
2424
|
+
}) {
|
|
2425
|
+
const a = Ke.functionCall(
|
|
2426
|
+
"sign",
|
|
2427
|
+
{ request: d },
|
|
2428
|
+
BigInt(z.toString()),
|
|
2429
|
+
BigInt(s.toString())
|
|
2430
|
+
), f = await r.signedDelegate({
|
|
2431
|
+
receiverId: c,
|
|
2432
|
+
actions: [a],
|
|
2433
|
+
blockHeightTtl: 60
|
|
2434
|
+
});
|
|
2435
|
+
delete r.accessKeyByPublicKeyCache[
|
|
2436
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
2437
|
+
f.delegateAction.publicKey.toString()
|
|
2438
|
+
];
|
|
2439
|
+
const _ = await (await fetch(`${o}/send_meta_tx_async`, {
|
|
2440
|
+
method: "POST",
|
|
2441
|
+
mode: "cors",
|
|
2442
|
+
body: JSON.stringify(sn(f)),
|
|
2443
|
+
headers: new Headers({ "Content-Type": "application/json" })
|
|
2444
|
+
})).text(), b = await r.connection.provider.txStatus(
|
|
2445
|
+
_,
|
|
2446
|
+
r.accountId,
|
|
2447
|
+
"FINAL"
|
|
2448
|
+
), l = Be({
|
|
2449
|
+
response: b
|
|
2450
|
+
});
|
|
2451
|
+
if (!l)
|
|
2452
|
+
throw new Error("Signature error, please retry");
|
|
2453
|
+
return l;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
const cn = async ({
|
|
2457
|
+
networkId: i,
|
|
2458
|
+
contractId: r,
|
|
2459
|
+
mpcPayloads: c,
|
|
2460
|
+
path: d
|
|
2461
|
+
}) => {
|
|
2462
|
+
const o = await new G({
|
|
2463
|
+
networkId: i,
|
|
2464
|
+
contractId: r
|
|
2465
|
+
}).getCurrentSignatureDeposit();
|
|
2466
|
+
return {
|
|
2467
|
+
receiverId: r,
|
|
2468
|
+
actions: c.map(({ payload: a }) => ({
|
|
2469
|
+
type: "FunctionCall",
|
|
2470
|
+
params: {
|
|
2471
|
+
methodName: "sign",
|
|
2472
|
+
args: {
|
|
2473
|
+
request: {
|
|
2474
|
+
payload: Array.from(a),
|
|
2475
|
+
path: d,
|
|
2476
|
+
key_version: 0
|
|
2477
|
+
}
|
|
2478
|
+
},
|
|
2479
|
+
gas: z.div(new $(c.length)).toString(),
|
|
2480
|
+
deposit: (o == null ? void 0 : o.toString()) || "1"
|
|
2481
|
+
}
|
|
2482
|
+
}))
|
|
2483
|
+
};
|
|
2484
|
+
}, fn = async ({
|
|
2485
|
+
networkId: i,
|
|
2486
|
+
chainSigContract: r,
|
|
2487
|
+
nftKeysContract: c,
|
|
2488
|
+
mpcPayloads: d,
|
|
2489
|
+
path: s,
|
|
2490
|
+
tokenId: o
|
|
2491
|
+
}) => {
|
|
2492
|
+
const f = await new G({
|
|
2493
|
+
networkId: i,
|
|
2494
|
+
contractId: r
|
|
2495
|
+
}).getCurrentSignatureDeposit();
|
|
2496
|
+
return {
|
|
2497
|
+
receiverId: c,
|
|
2498
|
+
actions: d.map(({ payload: g }) => ({
|
|
2499
|
+
type: "FunctionCall",
|
|
2500
|
+
params: {
|
|
2501
|
+
methodName: "ckt_sign_hash",
|
|
2502
|
+
args: {
|
|
2503
|
+
token_id: o,
|
|
2504
|
+
path: s,
|
|
2505
|
+
payload: Array.from(g)
|
|
2506
|
+
},
|
|
2507
|
+
gas: z.div(new $(d.length)).toString(),
|
|
2508
|
+
deposit: (f == null ? void 0 : f.toString()) || "1"
|
|
2509
|
+
}
|
|
2510
|
+
}))
|
|
2511
|
+
};
|
|
2512
|
+
}, Be = ({
|
|
2513
|
+
response: i
|
|
2514
|
+
}) => {
|
|
2515
|
+
const r = i.receipts_outcome.reduce(
|
|
2516
|
+
(c, d) => {
|
|
2517
|
+
if (c)
|
|
2518
|
+
return c;
|
|
2519
|
+
const { status: s } = d.outcome;
|
|
2520
|
+
return typeof s == "object" && s.SuccessValue && s.SuccessValue !== "" && Buffer.from(s.SuccessValue, "base64").toString("utf-8") || "";
|
|
2521
|
+
},
|
|
2522
|
+
""
|
|
2523
|
+
);
|
|
2524
|
+
if (r) {
|
|
2525
|
+
const c = JSON.parse(r);
|
|
2526
|
+
return pe(c.Ok);
|
|
2527
|
+
} else
|
|
2528
|
+
return;
|
|
2529
|
+
}, ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2530
|
+
__proto__: null,
|
|
2531
|
+
mpcPayloadsToChainSigTransaction: cn,
|
|
2532
|
+
mpcPayloadsToNFTKeysTransaction: fn,
|
|
2533
|
+
responseToMpcSignature: Be
|
|
2534
|
+
}, Symbol.toStringTag, { value: "Module" })), yn = async (i, r) => {
|
|
2535
|
+
try {
|
|
2536
|
+
const c = await W({
|
|
2537
|
+
networkId: i.nearAuthentication.networkId,
|
|
2538
|
+
accountId: i.nearAuthentication.accountId,
|
|
2539
|
+
keypair: r
|
|
2540
|
+
}), d = new G({
|
|
2541
|
+
networkId: i.nearAuthentication.networkId,
|
|
2542
|
+
contractId: i.chainConfig.contract,
|
|
2543
|
+
accountId: c.accountId,
|
|
2544
|
+
keypair: r
|
|
2545
|
+
}), s = new We({
|
|
2546
|
+
rpcUrl: i.chainConfig.providerUrl,
|
|
2547
|
+
contract: d
|
|
2548
|
+
}), { transaction: o, mpcPayloads: a } = await s.getMPCPayloadAndTransaction(
|
|
2549
|
+
i.transaction
|
|
2550
|
+
), f = await d.sign({
|
|
2551
|
+
payload: a[0].payload,
|
|
2552
|
+
path: i.derivationPath,
|
|
2553
|
+
key_version: 0
|
|
2554
|
+
}), g = s.addSignature({
|
|
2555
|
+
transaction: o,
|
|
2556
|
+
mpcSignatures: [f]
|
|
2557
|
+
});
|
|
2558
|
+
return {
|
|
2559
|
+
transactionHash: await s.broadcastTx(g),
|
|
2560
|
+
success: !0
|
|
2561
|
+
};
|
|
2562
|
+
} catch (c) {
|
|
2563
|
+
return console.error(c), {
|
|
2564
|
+
success: !1,
|
|
2565
|
+
errorMessage: c instanceof Error ? c.message : String(c)
|
|
2566
|
+
};
|
|
2567
|
+
}
|
|
2568
|
+
}, hn = async (i, r) => {
|
|
2569
|
+
try {
|
|
2570
|
+
const c = await W({
|
|
2571
|
+
networkId: i.nearAuthentication.networkId,
|
|
2572
|
+
accountId: i.nearAuthentication.accountId,
|
|
2573
|
+
keypair: r
|
|
2574
|
+
}), d = new G({
|
|
2575
|
+
networkId: i.nearAuthentication.networkId,
|
|
2576
|
+
contractId: i.chainConfig.contract,
|
|
2577
|
+
accountId: c.accountId,
|
|
2578
|
+
keypair: r
|
|
2579
|
+
}), s = new Y({
|
|
2580
|
+
btcRpcAdapter: new Ze.Mempool(i.chainConfig.providerUrl),
|
|
2581
|
+
contract: d,
|
|
2582
|
+
network: i.chainConfig.network
|
|
2583
|
+
}), { transaction: o, mpcPayloads: a } = await s.getMPCPayloadAndTransaction(
|
|
2584
|
+
i.transaction
|
|
2585
|
+
), f = await Promise.all(
|
|
2586
|
+
a.map(
|
|
2587
|
+
async ({ payload: b }) => await d.sign({
|
|
2588
|
+
payload: b,
|
|
2589
|
+
path: i.derivationPath,
|
|
2590
|
+
key_version: 0
|
|
2591
|
+
})
|
|
2592
|
+
)
|
|
2593
|
+
), g = s.addSignature({
|
|
2594
|
+
transaction: o,
|
|
2595
|
+
mpcSignatures: f
|
|
2596
|
+
});
|
|
2597
|
+
return {
|
|
2598
|
+
transactionHash: await s.broadcastTx(g),
|
|
2599
|
+
success: !0
|
|
2600
|
+
};
|
|
2601
|
+
} catch (c) {
|
|
2602
|
+
return {
|
|
2603
|
+
success: !1,
|
|
2604
|
+
errorMessage: c instanceof Error ? c.message : String(c)
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
}, mn = async (i, r) => {
|
|
2608
|
+
try {
|
|
2609
|
+
const c = await W({
|
|
2610
|
+
networkId: i.nearAuthentication.networkId,
|
|
2611
|
+
accountId: i.nearAuthentication.accountId,
|
|
2612
|
+
keypair: r
|
|
2613
|
+
}), d = new G({
|
|
2614
|
+
networkId: i.nearAuthentication.networkId,
|
|
2615
|
+
contractId: i.chainConfig.contract,
|
|
2616
|
+
accountId: c.accountId,
|
|
2617
|
+
keypair: r
|
|
2618
|
+
}), s = new rn({
|
|
2619
|
+
contract: d,
|
|
2620
|
+
chainId: i.chainConfig.chainId
|
|
2621
|
+
}), { transaction: o, mpcPayloads: a } = await s.getMPCPayloadAndTransaction(i.transaction), f = await Promise.all(
|
|
2622
|
+
a.map(
|
|
2623
|
+
async ({ payload: b }) => await d.sign({
|
|
2624
|
+
payload: b,
|
|
2625
|
+
path: i.derivationPath,
|
|
2626
|
+
key_version: 0
|
|
2627
|
+
})
|
|
2628
|
+
)
|
|
2629
|
+
), g = s.addSignature({
|
|
2630
|
+
transaction: o,
|
|
2631
|
+
mpcSignatures: f
|
|
2632
|
+
});
|
|
2633
|
+
return {
|
|
2634
|
+
transactionHash: await s.broadcastTx(g),
|
|
2635
|
+
success: !0
|
|
2636
|
+
};
|
|
2637
|
+
} catch (c) {
|
|
2638
|
+
return console.error(c), {
|
|
2639
|
+
success: !1,
|
|
2640
|
+
errorMessage: c instanceof Error ? c.message : String(c)
|
|
2641
|
+
};
|
|
2642
|
+
}
|
|
2643
|
+
}, pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2644
|
+
__proto__: null,
|
|
2645
|
+
BTCTransaction: hn,
|
|
2646
|
+
CosmosTransaction: mn,
|
|
2647
|
+
EVMTransaction: yn
|
|
2648
|
+
}, Symbol.toStringTag, { value: "Module" })), gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2649
|
+
__proto__: null,
|
|
2650
|
+
keypair: pn
|
|
2651
|
+
}, Symbol.toStringTag, { value: "Module" })), Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2652
|
+
__proto__: null,
|
|
2653
|
+
ChainSignatureContract: G,
|
|
2654
|
+
signAndSend: gn,
|
|
2655
|
+
transactionBuilder: ln
|
|
2656
|
+
}, Symbol.toStringTag, { value: "Module" })), In = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2657
|
+
__proto__: null,
|
|
2658
|
+
near: Sn
|
|
2659
|
+
}, Symbol.toStringTag, { value: "Module" })), Rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2660
|
+
__proto__: null,
|
|
2661
|
+
chains: In
|
|
2662
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2663
|
+
export {
|
|
2664
|
+
Ve as BTCRpcAdapter,
|
|
2665
|
+
Ze as BTCRpcAdapters,
|
|
2666
|
+
Y as Bitcoin,
|
|
2667
|
+
Q as Chain,
|
|
2668
|
+
ze as ChainSignatureContract,
|
|
2669
|
+
rn as Cosmos,
|
|
2670
|
+
We as EVM,
|
|
2671
|
+
$e as fetchEVMFeeProperties,
|
|
2672
|
+
Rn as utils
|
|
2673
|
+
};
|
|
2674
|
+
//# sourceMappingURL=index.js.map
|