@meshsdk/common 1.8.14 → 1.9.0-beta-39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +618 -1063
- package/dist/index.d.cts +194 -36
- package/dist/index.d.ts +194 -36
- package/dist/index.js +605 -1085
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,868 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// ../../node_modules/blakejs/util.js
|
|
34
|
-
var require_util = __commonJS({
|
|
35
|
-
"../../node_modules/blakejs/util.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var ERROR_MSG_INPUT = "Input must be an string, Buffer or Uint8Array";
|
|
38
|
-
function normalizeInput(input) {
|
|
39
|
-
let ret;
|
|
40
|
-
if (input instanceof Uint8Array) {
|
|
41
|
-
ret = input;
|
|
42
|
-
} else if (typeof input === "string") {
|
|
43
|
-
const encoder = new TextEncoder();
|
|
44
|
-
ret = encoder.encode(input);
|
|
45
|
-
} else {
|
|
46
|
-
throw new Error(ERROR_MSG_INPUT);
|
|
47
|
-
}
|
|
48
|
-
return ret;
|
|
49
|
-
}
|
|
50
|
-
function toHex(bytes) {
|
|
51
|
-
return Array.prototype.map.call(bytes, function(n) {
|
|
52
|
-
return (n < 16 ? "0" : "") + n.toString(16);
|
|
53
|
-
}).join("");
|
|
54
|
-
}
|
|
55
|
-
function uint32ToHex(val) {
|
|
56
|
-
return (4294967296 + val).toString(16).substring(1);
|
|
57
|
-
}
|
|
58
|
-
function debugPrint(label, arr, size) {
|
|
59
|
-
let msg = "\n" + label + " = ";
|
|
60
|
-
for (let i = 0; i < arr.length; i += 2) {
|
|
61
|
-
if (size === 32) {
|
|
62
|
-
msg += uint32ToHex(arr[i]).toUpperCase();
|
|
63
|
-
msg += " ";
|
|
64
|
-
msg += uint32ToHex(arr[i + 1]).toUpperCase();
|
|
65
|
-
} else if (size === 64) {
|
|
66
|
-
msg += uint32ToHex(arr[i + 1]).toUpperCase();
|
|
67
|
-
msg += uint32ToHex(arr[i]).toUpperCase();
|
|
68
|
-
} else throw new Error("Invalid size " + size);
|
|
69
|
-
if (i % 6 === 4) {
|
|
70
|
-
msg += "\n" + new Array(label.length + 4).join(" ");
|
|
71
|
-
} else if (i < arr.length - 2) {
|
|
72
|
-
msg += " ";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
console.log(msg);
|
|
76
|
-
}
|
|
77
|
-
function testSpeed(hashFn, N, M) {
|
|
78
|
-
let startMs = (/* @__PURE__ */ new Date()).getTime();
|
|
79
|
-
const input = new Uint8Array(N);
|
|
80
|
-
for (let i = 0; i < N; i++) {
|
|
81
|
-
input[i] = i % 256;
|
|
82
|
-
}
|
|
83
|
-
const genMs = (/* @__PURE__ */ new Date()).getTime();
|
|
84
|
-
console.log("Generated random input in " + (genMs - startMs) + "ms");
|
|
85
|
-
startMs = genMs;
|
|
86
|
-
for (let i = 0; i < M; i++) {
|
|
87
|
-
const hashHex = hashFn(input);
|
|
88
|
-
const hashMs = (/* @__PURE__ */ new Date()).getTime();
|
|
89
|
-
const ms = hashMs - startMs;
|
|
90
|
-
startMs = hashMs;
|
|
91
|
-
console.log("Hashed in " + ms + "ms: " + hashHex.substring(0, 20) + "...");
|
|
92
|
-
console.log(
|
|
93
|
-
Math.round(N / (1 << 20) / (ms / 1e3) * 100) / 100 + " MB PER SECOND"
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
module2.exports = {
|
|
98
|
-
normalizeInput,
|
|
99
|
-
toHex,
|
|
100
|
-
debugPrint,
|
|
101
|
-
testSpeed
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// ../../node_modules/blakejs/blake2b.js
|
|
107
|
-
var require_blake2b = __commonJS({
|
|
108
|
-
"../../node_modules/blakejs/blake2b.js"(exports2, module2) {
|
|
109
|
-
"use strict";
|
|
110
|
-
var util = require_util();
|
|
111
|
-
function ADD64AA(v2, a, b) {
|
|
112
|
-
const o0 = v2[a] + v2[b];
|
|
113
|
-
let o1 = v2[a + 1] + v2[b + 1];
|
|
114
|
-
if (o0 >= 4294967296) {
|
|
115
|
-
o1++;
|
|
116
|
-
}
|
|
117
|
-
v2[a] = o0;
|
|
118
|
-
v2[a + 1] = o1;
|
|
119
|
-
}
|
|
120
|
-
function ADD64AC(v2, a, b0, b1) {
|
|
121
|
-
let o0 = v2[a] + b0;
|
|
122
|
-
if (b0 < 0) {
|
|
123
|
-
o0 += 4294967296;
|
|
124
|
-
}
|
|
125
|
-
let o1 = v2[a + 1] + b1;
|
|
126
|
-
if (o0 >= 4294967296) {
|
|
127
|
-
o1++;
|
|
128
|
-
}
|
|
129
|
-
v2[a] = o0;
|
|
130
|
-
v2[a + 1] = o1;
|
|
131
|
-
}
|
|
132
|
-
function B2B_GET32(arr, i) {
|
|
133
|
-
return arr[i] ^ arr[i + 1] << 8 ^ arr[i + 2] << 16 ^ arr[i + 3] << 24;
|
|
134
|
-
}
|
|
135
|
-
function B2B_G(a, b, c, d, ix, iy) {
|
|
136
|
-
const x0 = m[ix];
|
|
137
|
-
const x1 = m[ix + 1];
|
|
138
|
-
const y0 = m[iy];
|
|
139
|
-
const y1 = m[iy + 1];
|
|
140
|
-
ADD64AA(v, a, b);
|
|
141
|
-
ADD64AC(v, a, x0, x1);
|
|
142
|
-
let xor0 = v[d] ^ v[a];
|
|
143
|
-
let xor1 = v[d + 1] ^ v[a + 1];
|
|
144
|
-
v[d] = xor1;
|
|
145
|
-
v[d + 1] = xor0;
|
|
146
|
-
ADD64AA(v, c, d);
|
|
147
|
-
xor0 = v[b] ^ v[c];
|
|
148
|
-
xor1 = v[b + 1] ^ v[c + 1];
|
|
149
|
-
v[b] = xor0 >>> 24 ^ xor1 << 8;
|
|
150
|
-
v[b + 1] = xor1 >>> 24 ^ xor0 << 8;
|
|
151
|
-
ADD64AA(v, a, b);
|
|
152
|
-
ADD64AC(v, a, y0, y1);
|
|
153
|
-
xor0 = v[d] ^ v[a];
|
|
154
|
-
xor1 = v[d + 1] ^ v[a + 1];
|
|
155
|
-
v[d] = xor0 >>> 16 ^ xor1 << 16;
|
|
156
|
-
v[d + 1] = xor1 >>> 16 ^ xor0 << 16;
|
|
157
|
-
ADD64AA(v, c, d);
|
|
158
|
-
xor0 = v[b] ^ v[c];
|
|
159
|
-
xor1 = v[b + 1] ^ v[c + 1];
|
|
160
|
-
v[b] = xor1 >>> 31 ^ xor0 << 1;
|
|
161
|
-
v[b + 1] = xor0 >>> 31 ^ xor1 << 1;
|
|
162
|
-
}
|
|
163
|
-
var BLAKE2B_IV32 = new Uint32Array([
|
|
164
|
-
4089235720,
|
|
165
|
-
1779033703,
|
|
166
|
-
2227873595,
|
|
167
|
-
3144134277,
|
|
168
|
-
4271175723,
|
|
169
|
-
1013904242,
|
|
170
|
-
1595750129,
|
|
171
|
-
2773480762,
|
|
172
|
-
2917565137,
|
|
173
|
-
1359893119,
|
|
174
|
-
725511199,
|
|
175
|
-
2600822924,
|
|
176
|
-
4215389547,
|
|
177
|
-
528734635,
|
|
178
|
-
327033209,
|
|
179
|
-
1541459225
|
|
180
|
-
]);
|
|
181
|
-
var SIGMA8 = [
|
|
182
|
-
0,
|
|
183
|
-
1,
|
|
184
|
-
2,
|
|
185
|
-
3,
|
|
186
|
-
4,
|
|
187
|
-
5,
|
|
188
|
-
6,
|
|
189
|
-
7,
|
|
190
|
-
8,
|
|
191
|
-
9,
|
|
192
|
-
10,
|
|
193
|
-
11,
|
|
194
|
-
12,
|
|
195
|
-
13,
|
|
196
|
-
14,
|
|
197
|
-
15,
|
|
198
|
-
14,
|
|
199
|
-
10,
|
|
200
|
-
4,
|
|
201
|
-
8,
|
|
202
|
-
9,
|
|
203
|
-
15,
|
|
204
|
-
13,
|
|
205
|
-
6,
|
|
206
|
-
1,
|
|
207
|
-
12,
|
|
208
|
-
0,
|
|
209
|
-
2,
|
|
210
|
-
11,
|
|
211
|
-
7,
|
|
212
|
-
5,
|
|
213
|
-
3,
|
|
214
|
-
11,
|
|
215
|
-
8,
|
|
216
|
-
12,
|
|
217
|
-
0,
|
|
218
|
-
5,
|
|
219
|
-
2,
|
|
220
|
-
15,
|
|
221
|
-
13,
|
|
222
|
-
10,
|
|
223
|
-
14,
|
|
224
|
-
3,
|
|
225
|
-
6,
|
|
226
|
-
7,
|
|
227
|
-
1,
|
|
228
|
-
9,
|
|
229
|
-
4,
|
|
230
|
-
7,
|
|
231
|
-
9,
|
|
232
|
-
3,
|
|
233
|
-
1,
|
|
234
|
-
13,
|
|
235
|
-
12,
|
|
236
|
-
11,
|
|
237
|
-
14,
|
|
238
|
-
2,
|
|
239
|
-
6,
|
|
240
|
-
5,
|
|
241
|
-
10,
|
|
242
|
-
4,
|
|
243
|
-
0,
|
|
244
|
-
15,
|
|
245
|
-
8,
|
|
246
|
-
9,
|
|
247
|
-
0,
|
|
248
|
-
5,
|
|
249
|
-
7,
|
|
250
|
-
2,
|
|
251
|
-
4,
|
|
252
|
-
10,
|
|
253
|
-
15,
|
|
254
|
-
14,
|
|
255
|
-
1,
|
|
256
|
-
11,
|
|
257
|
-
12,
|
|
258
|
-
6,
|
|
259
|
-
8,
|
|
260
|
-
3,
|
|
261
|
-
13,
|
|
262
|
-
2,
|
|
263
|
-
12,
|
|
264
|
-
6,
|
|
265
|
-
10,
|
|
266
|
-
0,
|
|
267
|
-
11,
|
|
268
|
-
8,
|
|
269
|
-
3,
|
|
270
|
-
4,
|
|
271
|
-
13,
|
|
272
|
-
7,
|
|
273
|
-
5,
|
|
274
|
-
15,
|
|
275
|
-
14,
|
|
276
|
-
1,
|
|
277
|
-
9,
|
|
278
|
-
12,
|
|
279
|
-
5,
|
|
280
|
-
1,
|
|
281
|
-
15,
|
|
282
|
-
14,
|
|
283
|
-
13,
|
|
284
|
-
4,
|
|
285
|
-
10,
|
|
286
|
-
0,
|
|
287
|
-
7,
|
|
288
|
-
6,
|
|
289
|
-
3,
|
|
290
|
-
9,
|
|
291
|
-
2,
|
|
292
|
-
8,
|
|
293
|
-
11,
|
|
294
|
-
13,
|
|
295
|
-
11,
|
|
296
|
-
7,
|
|
297
|
-
14,
|
|
298
|
-
12,
|
|
299
|
-
1,
|
|
300
|
-
3,
|
|
301
|
-
9,
|
|
302
|
-
5,
|
|
303
|
-
0,
|
|
304
|
-
15,
|
|
305
|
-
4,
|
|
306
|
-
8,
|
|
307
|
-
6,
|
|
308
|
-
2,
|
|
309
|
-
10,
|
|
310
|
-
6,
|
|
311
|
-
15,
|
|
312
|
-
14,
|
|
313
|
-
9,
|
|
314
|
-
11,
|
|
315
|
-
3,
|
|
316
|
-
0,
|
|
317
|
-
8,
|
|
318
|
-
12,
|
|
319
|
-
2,
|
|
320
|
-
13,
|
|
321
|
-
7,
|
|
322
|
-
1,
|
|
323
|
-
4,
|
|
324
|
-
10,
|
|
325
|
-
5,
|
|
326
|
-
10,
|
|
327
|
-
2,
|
|
328
|
-
8,
|
|
329
|
-
4,
|
|
330
|
-
7,
|
|
331
|
-
6,
|
|
332
|
-
1,
|
|
333
|
-
5,
|
|
334
|
-
15,
|
|
335
|
-
11,
|
|
336
|
-
9,
|
|
337
|
-
14,
|
|
338
|
-
3,
|
|
339
|
-
12,
|
|
340
|
-
13,
|
|
341
|
-
0,
|
|
342
|
-
0,
|
|
343
|
-
1,
|
|
344
|
-
2,
|
|
345
|
-
3,
|
|
346
|
-
4,
|
|
347
|
-
5,
|
|
348
|
-
6,
|
|
349
|
-
7,
|
|
350
|
-
8,
|
|
351
|
-
9,
|
|
352
|
-
10,
|
|
353
|
-
11,
|
|
354
|
-
12,
|
|
355
|
-
13,
|
|
356
|
-
14,
|
|
357
|
-
15,
|
|
358
|
-
14,
|
|
359
|
-
10,
|
|
360
|
-
4,
|
|
361
|
-
8,
|
|
362
|
-
9,
|
|
363
|
-
15,
|
|
364
|
-
13,
|
|
365
|
-
6,
|
|
366
|
-
1,
|
|
367
|
-
12,
|
|
368
|
-
0,
|
|
369
|
-
2,
|
|
370
|
-
11,
|
|
371
|
-
7,
|
|
372
|
-
5,
|
|
373
|
-
3
|
|
374
|
-
];
|
|
375
|
-
var SIGMA82 = new Uint8Array(
|
|
376
|
-
SIGMA8.map(function(x) {
|
|
377
|
-
return x * 2;
|
|
378
|
-
})
|
|
379
|
-
);
|
|
380
|
-
var v = new Uint32Array(32);
|
|
381
|
-
var m = new Uint32Array(32);
|
|
382
|
-
function blake2bCompress(ctx, last) {
|
|
383
|
-
let i = 0;
|
|
384
|
-
for (i = 0; i < 16; i++) {
|
|
385
|
-
v[i] = ctx.h[i];
|
|
386
|
-
v[i + 16] = BLAKE2B_IV32[i];
|
|
387
|
-
}
|
|
388
|
-
v[24] = v[24] ^ ctx.t;
|
|
389
|
-
v[25] = v[25] ^ ctx.t / 4294967296;
|
|
390
|
-
if (last) {
|
|
391
|
-
v[28] = ~v[28];
|
|
392
|
-
v[29] = ~v[29];
|
|
393
|
-
}
|
|
394
|
-
for (i = 0; i < 32; i++) {
|
|
395
|
-
m[i] = B2B_GET32(ctx.b, 4 * i);
|
|
396
|
-
}
|
|
397
|
-
for (i = 0; i < 12; i++) {
|
|
398
|
-
B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]);
|
|
399
|
-
B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]);
|
|
400
|
-
B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]);
|
|
401
|
-
B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]);
|
|
402
|
-
B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]);
|
|
403
|
-
B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]);
|
|
404
|
-
B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]);
|
|
405
|
-
B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]);
|
|
406
|
-
}
|
|
407
|
-
for (i = 0; i < 16; i++) {
|
|
408
|
-
ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16];
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
var parameterBlock = new Uint8Array([
|
|
412
|
-
0,
|
|
413
|
-
0,
|
|
414
|
-
0,
|
|
415
|
-
0,
|
|
416
|
-
// 0: outlen, keylen, fanout, depth
|
|
417
|
-
0,
|
|
418
|
-
0,
|
|
419
|
-
0,
|
|
420
|
-
0,
|
|
421
|
-
// 4: leaf length, sequential mode
|
|
422
|
-
0,
|
|
423
|
-
0,
|
|
424
|
-
0,
|
|
425
|
-
0,
|
|
426
|
-
// 8: node offset
|
|
427
|
-
0,
|
|
428
|
-
0,
|
|
429
|
-
0,
|
|
430
|
-
0,
|
|
431
|
-
// 12: node offset
|
|
432
|
-
0,
|
|
433
|
-
0,
|
|
434
|
-
0,
|
|
435
|
-
0,
|
|
436
|
-
// 16: node depth, inner length, rfu
|
|
437
|
-
0,
|
|
438
|
-
0,
|
|
439
|
-
0,
|
|
440
|
-
0,
|
|
441
|
-
// 20: rfu
|
|
442
|
-
0,
|
|
443
|
-
0,
|
|
444
|
-
0,
|
|
445
|
-
0,
|
|
446
|
-
// 24: rfu
|
|
447
|
-
0,
|
|
448
|
-
0,
|
|
449
|
-
0,
|
|
450
|
-
0,
|
|
451
|
-
// 28: rfu
|
|
452
|
-
0,
|
|
453
|
-
0,
|
|
454
|
-
0,
|
|
455
|
-
0,
|
|
456
|
-
// 32: salt
|
|
457
|
-
0,
|
|
458
|
-
0,
|
|
459
|
-
0,
|
|
460
|
-
0,
|
|
461
|
-
// 36: salt
|
|
462
|
-
0,
|
|
463
|
-
0,
|
|
464
|
-
0,
|
|
465
|
-
0,
|
|
466
|
-
// 40: salt
|
|
467
|
-
0,
|
|
468
|
-
0,
|
|
469
|
-
0,
|
|
470
|
-
0,
|
|
471
|
-
// 44: salt
|
|
472
|
-
0,
|
|
473
|
-
0,
|
|
474
|
-
0,
|
|
475
|
-
0,
|
|
476
|
-
// 48: personal
|
|
477
|
-
0,
|
|
478
|
-
0,
|
|
479
|
-
0,
|
|
480
|
-
0,
|
|
481
|
-
// 52: personal
|
|
482
|
-
0,
|
|
483
|
-
0,
|
|
484
|
-
0,
|
|
485
|
-
0,
|
|
486
|
-
// 56: personal
|
|
487
|
-
0,
|
|
488
|
-
0,
|
|
489
|
-
0,
|
|
490
|
-
0
|
|
491
|
-
// 60: personal
|
|
492
|
-
]);
|
|
493
|
-
function blake2bInit(outlen, key, salt, personal) {
|
|
494
|
-
if (outlen === 0 || outlen > 64) {
|
|
495
|
-
throw new Error("Illegal output length, expected 0 < length <= 64");
|
|
496
|
-
}
|
|
497
|
-
if (key && key.length > 64) {
|
|
498
|
-
throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");
|
|
499
|
-
}
|
|
500
|
-
if (salt && salt.length !== 16) {
|
|
501
|
-
throw new Error("Illegal salt, expected Uint8Array with length is 16");
|
|
502
|
-
}
|
|
503
|
-
if (personal && personal.length !== 16) {
|
|
504
|
-
throw new Error("Illegal personal, expected Uint8Array with length is 16");
|
|
505
|
-
}
|
|
506
|
-
const ctx = {
|
|
507
|
-
b: new Uint8Array(128),
|
|
508
|
-
h: new Uint32Array(16),
|
|
509
|
-
t: 0,
|
|
510
|
-
// input count
|
|
511
|
-
c: 0,
|
|
512
|
-
// pointer within buffer
|
|
513
|
-
outlen
|
|
514
|
-
// output length in bytes
|
|
515
|
-
};
|
|
516
|
-
parameterBlock.fill(0);
|
|
517
|
-
parameterBlock[0] = outlen;
|
|
518
|
-
if (key) parameterBlock[1] = key.length;
|
|
519
|
-
parameterBlock[2] = 1;
|
|
520
|
-
parameterBlock[3] = 1;
|
|
521
|
-
if (salt) parameterBlock.set(salt, 32);
|
|
522
|
-
if (personal) parameterBlock.set(personal, 48);
|
|
523
|
-
for (let i = 0; i < 16; i++) {
|
|
524
|
-
ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4);
|
|
525
|
-
}
|
|
526
|
-
if (key) {
|
|
527
|
-
blake2bUpdate(ctx, key);
|
|
528
|
-
ctx.c = 128;
|
|
529
|
-
}
|
|
530
|
-
return ctx;
|
|
531
|
-
}
|
|
532
|
-
function blake2bUpdate(ctx, input) {
|
|
533
|
-
for (let i = 0; i < input.length; i++) {
|
|
534
|
-
if (ctx.c === 128) {
|
|
535
|
-
ctx.t += ctx.c;
|
|
536
|
-
blake2bCompress(ctx, false);
|
|
537
|
-
ctx.c = 0;
|
|
538
|
-
}
|
|
539
|
-
ctx.b[ctx.c++] = input[i];
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
function blake2bFinal(ctx) {
|
|
543
|
-
ctx.t += ctx.c;
|
|
544
|
-
while (ctx.c < 128) {
|
|
545
|
-
ctx.b[ctx.c++] = 0;
|
|
546
|
-
}
|
|
547
|
-
blake2bCompress(ctx, true);
|
|
548
|
-
const out = new Uint8Array(ctx.outlen);
|
|
549
|
-
for (let i = 0; i < ctx.outlen; i++) {
|
|
550
|
-
out[i] = ctx.h[i >> 2] >> 8 * (i & 3);
|
|
551
|
-
}
|
|
552
|
-
return out;
|
|
553
|
-
}
|
|
554
|
-
function blake2b2(input, key, outlen, salt, personal) {
|
|
555
|
-
outlen = outlen || 64;
|
|
556
|
-
input = util.normalizeInput(input);
|
|
557
|
-
if (salt) {
|
|
558
|
-
salt = util.normalizeInput(salt);
|
|
559
|
-
}
|
|
560
|
-
if (personal) {
|
|
561
|
-
personal = util.normalizeInput(personal);
|
|
562
|
-
}
|
|
563
|
-
const ctx = blake2bInit(outlen, key, salt, personal);
|
|
564
|
-
blake2bUpdate(ctx, input);
|
|
565
|
-
return blake2bFinal(ctx);
|
|
566
|
-
}
|
|
567
|
-
function blake2bHex2(input, key, outlen, salt, personal) {
|
|
568
|
-
const output = blake2b2(input, key, outlen, salt, personal);
|
|
569
|
-
return util.toHex(output);
|
|
570
|
-
}
|
|
571
|
-
module2.exports = {
|
|
572
|
-
blake2b: blake2b2,
|
|
573
|
-
blake2bHex: blake2bHex2,
|
|
574
|
-
blake2bInit,
|
|
575
|
-
blake2bUpdate,
|
|
576
|
-
blake2bFinal
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
});
|
|
580
|
-
|
|
581
|
-
// ../../node_modules/blakejs/blake2s.js
|
|
582
|
-
var require_blake2s = __commonJS({
|
|
583
|
-
"../../node_modules/blakejs/blake2s.js"(exports2, module2) {
|
|
584
|
-
"use strict";
|
|
585
|
-
var util = require_util();
|
|
586
|
-
function B2S_GET32(v2, i) {
|
|
587
|
-
return v2[i] ^ v2[i + 1] << 8 ^ v2[i + 2] << 16 ^ v2[i + 3] << 24;
|
|
588
|
-
}
|
|
589
|
-
function B2S_G(a, b, c, d, x, y) {
|
|
590
|
-
v[a] = v[a] + v[b] + x;
|
|
591
|
-
v[d] = ROTR32(v[d] ^ v[a], 16);
|
|
592
|
-
v[c] = v[c] + v[d];
|
|
593
|
-
v[b] = ROTR32(v[b] ^ v[c], 12);
|
|
594
|
-
v[a] = v[a] + v[b] + y;
|
|
595
|
-
v[d] = ROTR32(v[d] ^ v[a], 8);
|
|
596
|
-
v[c] = v[c] + v[d];
|
|
597
|
-
v[b] = ROTR32(v[b] ^ v[c], 7);
|
|
598
|
-
}
|
|
599
|
-
function ROTR32(x, y) {
|
|
600
|
-
return x >>> y ^ x << 32 - y;
|
|
601
|
-
}
|
|
602
|
-
var BLAKE2S_IV = new Uint32Array([
|
|
603
|
-
1779033703,
|
|
604
|
-
3144134277,
|
|
605
|
-
1013904242,
|
|
606
|
-
2773480762,
|
|
607
|
-
1359893119,
|
|
608
|
-
2600822924,
|
|
609
|
-
528734635,
|
|
610
|
-
1541459225
|
|
611
|
-
]);
|
|
612
|
-
var SIGMA = new Uint8Array([
|
|
613
|
-
0,
|
|
614
|
-
1,
|
|
615
|
-
2,
|
|
616
|
-
3,
|
|
617
|
-
4,
|
|
618
|
-
5,
|
|
619
|
-
6,
|
|
620
|
-
7,
|
|
621
|
-
8,
|
|
622
|
-
9,
|
|
623
|
-
10,
|
|
624
|
-
11,
|
|
625
|
-
12,
|
|
626
|
-
13,
|
|
627
|
-
14,
|
|
628
|
-
15,
|
|
629
|
-
14,
|
|
630
|
-
10,
|
|
631
|
-
4,
|
|
632
|
-
8,
|
|
633
|
-
9,
|
|
634
|
-
15,
|
|
635
|
-
13,
|
|
636
|
-
6,
|
|
637
|
-
1,
|
|
638
|
-
12,
|
|
639
|
-
0,
|
|
640
|
-
2,
|
|
641
|
-
11,
|
|
642
|
-
7,
|
|
643
|
-
5,
|
|
644
|
-
3,
|
|
645
|
-
11,
|
|
646
|
-
8,
|
|
647
|
-
12,
|
|
648
|
-
0,
|
|
649
|
-
5,
|
|
650
|
-
2,
|
|
651
|
-
15,
|
|
652
|
-
13,
|
|
653
|
-
10,
|
|
654
|
-
14,
|
|
655
|
-
3,
|
|
656
|
-
6,
|
|
657
|
-
7,
|
|
658
|
-
1,
|
|
659
|
-
9,
|
|
660
|
-
4,
|
|
661
|
-
7,
|
|
662
|
-
9,
|
|
663
|
-
3,
|
|
664
|
-
1,
|
|
665
|
-
13,
|
|
666
|
-
12,
|
|
667
|
-
11,
|
|
668
|
-
14,
|
|
669
|
-
2,
|
|
670
|
-
6,
|
|
671
|
-
5,
|
|
672
|
-
10,
|
|
673
|
-
4,
|
|
674
|
-
0,
|
|
675
|
-
15,
|
|
676
|
-
8,
|
|
677
|
-
9,
|
|
678
|
-
0,
|
|
679
|
-
5,
|
|
680
|
-
7,
|
|
681
|
-
2,
|
|
682
|
-
4,
|
|
683
|
-
10,
|
|
684
|
-
15,
|
|
685
|
-
14,
|
|
686
|
-
1,
|
|
687
|
-
11,
|
|
688
|
-
12,
|
|
689
|
-
6,
|
|
690
|
-
8,
|
|
691
|
-
3,
|
|
692
|
-
13,
|
|
693
|
-
2,
|
|
694
|
-
12,
|
|
695
|
-
6,
|
|
696
|
-
10,
|
|
697
|
-
0,
|
|
698
|
-
11,
|
|
699
|
-
8,
|
|
700
|
-
3,
|
|
701
|
-
4,
|
|
702
|
-
13,
|
|
703
|
-
7,
|
|
704
|
-
5,
|
|
705
|
-
15,
|
|
706
|
-
14,
|
|
707
|
-
1,
|
|
708
|
-
9,
|
|
709
|
-
12,
|
|
710
|
-
5,
|
|
711
|
-
1,
|
|
712
|
-
15,
|
|
713
|
-
14,
|
|
714
|
-
13,
|
|
715
|
-
4,
|
|
716
|
-
10,
|
|
717
|
-
0,
|
|
718
|
-
7,
|
|
719
|
-
6,
|
|
720
|
-
3,
|
|
721
|
-
9,
|
|
722
|
-
2,
|
|
723
|
-
8,
|
|
724
|
-
11,
|
|
725
|
-
13,
|
|
726
|
-
11,
|
|
727
|
-
7,
|
|
728
|
-
14,
|
|
729
|
-
12,
|
|
730
|
-
1,
|
|
731
|
-
3,
|
|
732
|
-
9,
|
|
733
|
-
5,
|
|
734
|
-
0,
|
|
735
|
-
15,
|
|
736
|
-
4,
|
|
737
|
-
8,
|
|
738
|
-
6,
|
|
739
|
-
2,
|
|
740
|
-
10,
|
|
741
|
-
6,
|
|
742
|
-
15,
|
|
743
|
-
14,
|
|
744
|
-
9,
|
|
745
|
-
11,
|
|
746
|
-
3,
|
|
747
|
-
0,
|
|
748
|
-
8,
|
|
749
|
-
12,
|
|
750
|
-
2,
|
|
751
|
-
13,
|
|
752
|
-
7,
|
|
753
|
-
1,
|
|
754
|
-
4,
|
|
755
|
-
10,
|
|
756
|
-
5,
|
|
757
|
-
10,
|
|
758
|
-
2,
|
|
759
|
-
8,
|
|
760
|
-
4,
|
|
761
|
-
7,
|
|
762
|
-
6,
|
|
763
|
-
1,
|
|
764
|
-
5,
|
|
765
|
-
15,
|
|
766
|
-
11,
|
|
767
|
-
9,
|
|
768
|
-
14,
|
|
769
|
-
3,
|
|
770
|
-
12,
|
|
771
|
-
13,
|
|
772
|
-
0
|
|
773
|
-
]);
|
|
774
|
-
var v = new Uint32Array(16);
|
|
775
|
-
var m = new Uint32Array(16);
|
|
776
|
-
function blake2sCompress(ctx, last) {
|
|
777
|
-
let i = 0;
|
|
778
|
-
for (i = 0; i < 8; i++) {
|
|
779
|
-
v[i] = ctx.h[i];
|
|
780
|
-
v[i + 8] = BLAKE2S_IV[i];
|
|
781
|
-
}
|
|
782
|
-
v[12] ^= ctx.t;
|
|
783
|
-
v[13] ^= ctx.t / 4294967296;
|
|
784
|
-
if (last) {
|
|
785
|
-
v[14] = ~v[14];
|
|
786
|
-
}
|
|
787
|
-
for (i = 0; i < 16; i++) {
|
|
788
|
-
m[i] = B2S_GET32(ctx.b, 4 * i);
|
|
789
|
-
}
|
|
790
|
-
for (i = 0; i < 10; i++) {
|
|
791
|
-
B2S_G(0, 4, 8, 12, m[SIGMA[i * 16 + 0]], m[SIGMA[i * 16 + 1]]);
|
|
792
|
-
B2S_G(1, 5, 9, 13, m[SIGMA[i * 16 + 2]], m[SIGMA[i * 16 + 3]]);
|
|
793
|
-
B2S_G(2, 6, 10, 14, m[SIGMA[i * 16 + 4]], m[SIGMA[i * 16 + 5]]);
|
|
794
|
-
B2S_G(3, 7, 11, 15, m[SIGMA[i * 16 + 6]], m[SIGMA[i * 16 + 7]]);
|
|
795
|
-
B2S_G(0, 5, 10, 15, m[SIGMA[i * 16 + 8]], m[SIGMA[i * 16 + 9]]);
|
|
796
|
-
B2S_G(1, 6, 11, 12, m[SIGMA[i * 16 + 10]], m[SIGMA[i * 16 + 11]]);
|
|
797
|
-
B2S_G(2, 7, 8, 13, m[SIGMA[i * 16 + 12]], m[SIGMA[i * 16 + 13]]);
|
|
798
|
-
B2S_G(3, 4, 9, 14, m[SIGMA[i * 16 + 14]], m[SIGMA[i * 16 + 15]]);
|
|
799
|
-
}
|
|
800
|
-
for (i = 0; i < 8; i++) {
|
|
801
|
-
ctx.h[i] ^= v[i] ^ v[i + 8];
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
function blake2sInit(outlen, key) {
|
|
805
|
-
if (!(outlen > 0 && outlen <= 32)) {
|
|
806
|
-
throw new Error("Incorrect output length, should be in [1, 32]");
|
|
807
|
-
}
|
|
808
|
-
const keylen = key ? key.length : 0;
|
|
809
|
-
if (key && !(keylen > 0 && keylen <= 32)) {
|
|
810
|
-
throw new Error("Incorrect key length, should be in [1, 32]");
|
|
811
|
-
}
|
|
812
|
-
const ctx = {
|
|
813
|
-
h: new Uint32Array(BLAKE2S_IV),
|
|
814
|
-
// hash state
|
|
815
|
-
b: new Uint8Array(64),
|
|
816
|
-
// input block
|
|
817
|
-
c: 0,
|
|
818
|
-
// pointer within block
|
|
819
|
-
t: 0,
|
|
820
|
-
// input count
|
|
821
|
-
outlen
|
|
822
|
-
// output length in bytes
|
|
823
|
-
};
|
|
824
|
-
ctx.h[0] ^= 16842752 ^ keylen << 8 ^ outlen;
|
|
825
|
-
if (keylen > 0) {
|
|
826
|
-
blake2sUpdate(ctx, key);
|
|
827
|
-
ctx.c = 64;
|
|
828
|
-
}
|
|
829
|
-
return ctx;
|
|
830
|
-
}
|
|
831
|
-
function blake2sUpdate(ctx, input) {
|
|
832
|
-
for (let i = 0; i < input.length; i++) {
|
|
833
|
-
if (ctx.c === 64) {
|
|
834
|
-
ctx.t += ctx.c;
|
|
835
|
-
blake2sCompress(ctx, false);
|
|
836
|
-
ctx.c = 0;
|
|
837
|
-
}
|
|
838
|
-
ctx.b[ctx.c++] = input[i];
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
function blake2sFinal(ctx) {
|
|
842
|
-
ctx.t += ctx.c;
|
|
843
|
-
while (ctx.c < 64) {
|
|
844
|
-
ctx.b[ctx.c++] = 0;
|
|
845
|
-
}
|
|
846
|
-
blake2sCompress(ctx, true);
|
|
847
|
-
const out = new Uint8Array(ctx.outlen);
|
|
848
|
-
for (let i = 0; i < ctx.outlen; i++) {
|
|
849
|
-
out[i] = ctx.h[i >> 2] >> 8 * (i & 3) & 255;
|
|
850
|
-
}
|
|
851
|
-
return out;
|
|
852
|
-
}
|
|
853
|
-
function blake2s(input, key, outlen) {
|
|
854
|
-
outlen = outlen || 32;
|
|
855
|
-
input = util.normalizeInput(input);
|
|
856
|
-
const ctx = blake2sInit(outlen, key);
|
|
857
|
-
blake2sUpdate(ctx, input);
|
|
858
|
-
return blake2sFinal(ctx);
|
|
859
|
-
}
|
|
860
|
-
function blake2sHex(input, key, outlen) {
|
|
861
|
-
const output = blake2s(input, key, outlen);
|
|
862
|
-
return util.toHex(output);
|
|
863
|
-
}
|
|
864
|
-
module2.exports = {
|
|
865
|
-
blake2s,
|
|
866
|
-
blake2sHex,
|
|
867
|
-
blake2sInit,
|
|
868
|
-
blake2sUpdate,
|
|
869
|
-
blake2sFinal
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
// ../../node_modules/blakejs/index.js
|
|
875
|
-
var require_blakejs = __commonJS({
|
|
876
|
-
"../../node_modules/blakejs/index.js"(exports2, module2) {
|
|
877
|
-
"use strict";
|
|
878
|
-
var b2b = require_blake2b();
|
|
879
|
-
var b2s = require_blake2s();
|
|
880
|
-
module2.exports = {
|
|
881
|
-
blake2b: b2b.blake2b,
|
|
882
|
-
blake2bHex: b2b.blake2bHex,
|
|
883
|
-
blake2bInit: b2b.blake2bInit,
|
|
884
|
-
blake2bUpdate: b2b.blake2bUpdate,
|
|
885
|
-
blake2bFinal: b2b.blake2bFinal,
|
|
886
|
-
blake2s: b2s.blake2s,
|
|
887
|
-
blake2sHex: b2s.blake2sHex,
|
|
888
|
-
blake2sInit: b2s.blake2sInit,
|
|
889
|
-
blake2sUpdate: b2s.blake2sUpdate,
|
|
890
|
-
blake2sFinal: b2s.blake2sFinal
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
});
|
|
894
|
-
|
|
895
30
|
// src/index.ts
|
|
896
31
|
var index_exports = {};
|
|
897
32
|
__export(index_exports, {
|
|
@@ -899,10 +34,12 @@ __export(index_exports, {
|
|
|
899
34
|
BigNum: () => BigNum,
|
|
900
35
|
CIP68_100: () => CIP68_100,
|
|
901
36
|
CIP68_222: () => CIP68_222,
|
|
37
|
+
DEFAULT_FETCHER_OPTIONS: () => DEFAULT_FETCHER_OPTIONS,
|
|
902
38
|
DEFAULT_PROTOCOL_PARAMETERS: () => DEFAULT_PROTOCOL_PARAMETERS,
|
|
903
39
|
DEFAULT_REDEEMER_BUDGET: () => DEFAULT_REDEEMER_BUDGET,
|
|
904
40
|
DEFAULT_V1_COST_MODEL_LIST: () => DEFAULT_V1_COST_MODEL_LIST,
|
|
905
41
|
DEFAULT_V2_COST_MODEL_LIST: () => DEFAULT_V2_COST_MODEL_LIST,
|
|
42
|
+
DEFAULT_V3_COST_MODEL_LIST: () => DEFAULT_V3_COST_MODEL_LIST,
|
|
906
43
|
DREP_DEPOSIT: () => DREP_DEPOSIT,
|
|
907
44
|
HARDENED_KEY_START: () => HARDENED_KEY_START,
|
|
908
45
|
LANGUAGE_VERSIONS: () => LANGUAGE_VERSIONS,
|
|
@@ -924,11 +61,13 @@ __export(index_exports, {
|
|
|
924
61
|
byteString: () => byteString,
|
|
925
62
|
bytesToHex: () => bytesToHex,
|
|
926
63
|
castProtocol: () => castProtocol,
|
|
64
|
+
cloneTxBuilderBody: () => cloneTxBuilderBody,
|
|
927
65
|
conStr: () => conStr,
|
|
928
66
|
conStr0: () => conStr0,
|
|
929
67
|
conStr1: () => conStr1,
|
|
930
68
|
conStr2: () => conStr2,
|
|
931
69
|
conStr3: () => conStr3,
|
|
70
|
+
credential: () => credential,
|
|
932
71
|
currencySymbol: () => currencySymbol,
|
|
933
72
|
dict: () => dict,
|
|
934
73
|
emptyTxBuilderBody: () => emptyTxBuilderBody,
|
|
@@ -943,6 +82,7 @@ __export(index_exports, {
|
|
|
943
82
|
hexToString: () => hexToString,
|
|
944
83
|
integer: () => integer,
|
|
945
84
|
isNetwork: () => isNetwork,
|
|
85
|
+
jsonProofToPlutusData: () => jsonProofToPlutusData,
|
|
946
86
|
keepRelevant: () => keepRelevant,
|
|
947
87
|
largestFirst: () => largestFirst,
|
|
948
88
|
largestFirstMultiAsset: () => largestFirstMultiAsset,
|
|
@@ -954,18 +94,21 @@ __export(index_exports, {
|
|
|
954
94
|
mConStr1: () => mConStr1,
|
|
955
95
|
mConStr2: () => mConStr2,
|
|
956
96
|
mConStr3: () => mConStr3,
|
|
97
|
+
mCredential: () => mCredential,
|
|
957
98
|
mMaybeStakingHash: () => mMaybeStakingHash,
|
|
958
99
|
mNone: () => mNone,
|
|
959
100
|
mOption: () => mOption,
|
|
960
101
|
mOutputReference: () => mOutputReference,
|
|
961
102
|
mPlutusBSArrayToString: () => mPlutusBSArrayToString,
|
|
962
103
|
mPubKeyAddress: () => mPubKeyAddress,
|
|
104
|
+
mScript: () => mScript,
|
|
963
105
|
mScriptAddress: () => mScriptAddress,
|
|
964
106
|
mSome: () => mSome,
|
|
965
107
|
mStringToPlutusBSArray: () => mStringToPlutusBSArray,
|
|
966
108
|
mTuple: () => mTuple,
|
|
967
109
|
mTxOutRef: () => mTxOutRef,
|
|
968
110
|
mValue: () => mValue,
|
|
111
|
+
mVerificationKey: () => mVerificationKey,
|
|
969
112
|
maybeStakingHash: () => maybeStakingHash,
|
|
970
113
|
mergeAssets: () => mergeAssets,
|
|
971
114
|
metadataStandardKeys: () => metadataStandardKeys,
|
|
@@ -974,6 +117,7 @@ __export(index_exports, {
|
|
|
974
117
|
none: () => none,
|
|
975
118
|
option: () => option,
|
|
976
119
|
outputReference: () => outputReference,
|
|
120
|
+
pairs: () => pairs,
|
|
977
121
|
parseAssetUnit: () => parseAssetUnit,
|
|
978
122
|
plutusBSArrayToString: () => plutusBSArrayToString,
|
|
979
123
|
policyId: () => policyId,
|
|
@@ -986,6 +130,7 @@ __export(index_exports, {
|
|
|
986
130
|
resolveSlotNo: () => resolveSlotNo,
|
|
987
131
|
resolveTxFees: () => resolveTxFees,
|
|
988
132
|
royaltiesStandardKeys: () => royaltiesStandardKeys,
|
|
133
|
+
script: () => script,
|
|
989
134
|
scriptAddress: () => scriptAddress,
|
|
990
135
|
scriptHash: () => scriptHash,
|
|
991
136
|
slotToBeginUnixTime: () => slotToBeginUnixTime,
|
|
@@ -996,10 +141,12 @@ __export(index_exports, {
|
|
|
996
141
|
toUTF8: () => toUTF8,
|
|
997
142
|
tokenName: () => tokenName,
|
|
998
143
|
tuple: () => tuple,
|
|
144
|
+
txInToUtxo: () => txInToUtxo,
|
|
999
145
|
txOutRef: () => txOutRef,
|
|
1000
146
|
unixTimeToEnclosingSlot: () => unixTimeToEnclosingSlot,
|
|
1001
147
|
validityRangeToObj: () => validityRangeToObj,
|
|
1002
|
-
value: () => value
|
|
148
|
+
value: () => value,
|
|
149
|
+
verificationKey: () => verificationKey
|
|
1003
150
|
});
|
|
1004
151
|
module.exports = __toCommonJS(index_exports);
|
|
1005
152
|
|
|
@@ -1049,350 +196,649 @@ var SUPPORTED_WALLETS = [
|
|
|
1049
196
|
|
|
1050
197
|
// src/constants/cost-models.ts
|
|
1051
198
|
var DEFAULT_V1_COST_MODEL_LIST = [
|
|
1052
|
-
|
|
1053
|
-
|
|
199
|
+
100788,
|
|
200
|
+
420,
|
|
1054
201
|
1,
|
|
1055
202
|
1,
|
|
1056
203
|
1e3,
|
|
1057
|
-
|
|
204
|
+
173,
|
|
1058
205
|
0,
|
|
1059
206
|
1,
|
|
1060
207
|
1e3,
|
|
1061
|
-
|
|
208
|
+
59957,
|
|
1062
209
|
4,
|
|
1063
210
|
1,
|
|
1064
|
-
|
|
211
|
+
11183,
|
|
1065
212
|
32,
|
|
1066
|
-
|
|
1067
|
-
|
|
213
|
+
201305,
|
|
214
|
+
8356,
|
|
1068
215
|
4,
|
|
1069
|
-
|
|
216
|
+
16e3,
|
|
1070
217
|
100,
|
|
1071
|
-
|
|
218
|
+
16e3,
|
|
1072
219
|
100,
|
|
1073
|
-
|
|
220
|
+
16e3,
|
|
1074
221
|
100,
|
|
1075
|
-
|
|
222
|
+
16e3,
|
|
1076
223
|
100,
|
|
1077
|
-
|
|
224
|
+
16e3,
|
|
1078
225
|
100,
|
|
1079
|
-
|
|
226
|
+
16e3,
|
|
1080
227
|
100,
|
|
1081
228
|
100,
|
|
1082
229
|
100,
|
|
1083
|
-
|
|
230
|
+
16e3,
|
|
1084
231
|
100,
|
|
1085
|
-
|
|
232
|
+
94375,
|
|
1086
233
|
32,
|
|
1087
|
-
|
|
234
|
+
132994,
|
|
1088
235
|
32,
|
|
1089
|
-
|
|
236
|
+
61462,
|
|
1090
237
|
4,
|
|
1091
|
-
|
|
1092
|
-
|
|
238
|
+
72010,
|
|
239
|
+
178,
|
|
1093
240
|
0,
|
|
1094
241
|
1,
|
|
1095
|
-
|
|
242
|
+
22151,
|
|
1096
243
|
32,
|
|
1097
|
-
|
|
1098
|
-
|
|
244
|
+
91189,
|
|
245
|
+
769,
|
|
1099
246
|
4,
|
|
1100
247
|
2,
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
248
|
+
85848,
|
|
249
|
+
228465,
|
|
250
|
+
122,
|
|
1104
251
|
0,
|
|
1105
252
|
1,
|
|
1106
253
|
1,
|
|
1107
254
|
1e3,
|
|
1108
|
-
|
|
255
|
+
42921,
|
|
1109
256
|
4,
|
|
1110
257
|
2,
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
258
|
+
24548,
|
|
259
|
+
29498,
|
|
260
|
+
38,
|
|
1114
261
|
1,
|
|
1115
|
-
|
|
1116
|
-
|
|
262
|
+
898148,
|
|
263
|
+
27279,
|
|
1117
264
|
1,
|
|
1118
|
-
|
|
1119
|
-
|
|
265
|
+
51775,
|
|
266
|
+
558,
|
|
1120
267
|
1,
|
|
1121
|
-
|
|
268
|
+
39184,
|
|
1122
269
|
1e3,
|
|
1123
|
-
|
|
270
|
+
60594,
|
|
1124
271
|
1,
|
|
1125
|
-
|
|
272
|
+
141895,
|
|
1126
273
|
32,
|
|
1127
|
-
|
|
274
|
+
83150,
|
|
1128
275
|
32,
|
|
1129
|
-
|
|
276
|
+
15299,
|
|
1130
277
|
32,
|
|
1131
|
-
|
|
278
|
+
76049,
|
|
1132
279
|
1,
|
|
1133
|
-
|
|
280
|
+
13169,
|
|
1134
281
|
4,
|
|
1135
|
-
|
|
282
|
+
22100,
|
|
1136
283
|
10,
|
|
1137
|
-
|
|
1138
|
-
|
|
284
|
+
28999,
|
|
285
|
+
74,
|
|
1139
286
|
1,
|
|
1140
|
-
|
|
1141
|
-
|
|
287
|
+
28999,
|
|
288
|
+
74,
|
|
1142
289
|
1,
|
|
1143
|
-
|
|
1144
|
-
|
|
290
|
+
43285,
|
|
291
|
+
552,
|
|
1145
292
|
1,
|
|
1146
|
-
|
|
1147
|
-
|
|
293
|
+
44749,
|
|
294
|
+
541,
|
|
1148
295
|
1,
|
|
1149
|
-
|
|
296
|
+
33852,
|
|
1150
297
|
32,
|
|
1151
|
-
|
|
298
|
+
68246,
|
|
1152
299
|
32,
|
|
1153
|
-
|
|
300
|
+
72362,
|
|
1154
301
|
32,
|
|
1155
|
-
|
|
302
|
+
7243,
|
|
1156
303
|
32,
|
|
1157
|
-
|
|
304
|
+
7391,
|
|
1158
305
|
32,
|
|
1159
|
-
|
|
306
|
+
11546,
|
|
1160
307
|
32,
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
308
|
+
85848,
|
|
309
|
+
228465,
|
|
310
|
+
122,
|
|
1164
311
|
0,
|
|
1165
312
|
1,
|
|
1166
313
|
1,
|
|
1167
|
-
|
|
1168
|
-
|
|
314
|
+
90434,
|
|
315
|
+
519,
|
|
1169
316
|
0,
|
|
1170
317
|
1,
|
|
1171
|
-
|
|
318
|
+
74433,
|
|
1172
319
|
32,
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
320
|
+
85848,
|
|
321
|
+
228465,
|
|
322
|
+
122,
|
|
1176
323
|
0,
|
|
1177
324
|
1,
|
|
1178
325
|
1,
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
326
|
+
85848,
|
|
327
|
+
228465,
|
|
328
|
+
122,
|
|
1182
329
|
0,
|
|
1183
330
|
1,
|
|
1184
331
|
1,
|
|
1185
|
-
|
|
1186
|
-
|
|
332
|
+
270652,
|
|
333
|
+
22588,
|
|
1187
334
|
4,
|
|
1188
|
-
|
|
1189
|
-
|
|
335
|
+
1457325,
|
|
336
|
+
64566,
|
|
1190
337
|
4,
|
|
1191
|
-
|
|
1192
|
-
|
|
338
|
+
20467,
|
|
339
|
+
1,
|
|
1193
340
|
4,
|
|
1194
341
|
0,
|
|
1195
|
-
|
|
342
|
+
141992,
|
|
1196
343
|
32,
|
|
1197
|
-
|
|
1198
|
-
|
|
344
|
+
100788,
|
|
345
|
+
420,
|
|
1199
346
|
1,
|
|
1200
347
|
1,
|
|
1201
|
-
|
|
348
|
+
81663,
|
|
1202
349
|
32,
|
|
1203
|
-
|
|
350
|
+
59498,
|
|
1204
351
|
32,
|
|
1205
|
-
|
|
352
|
+
20142,
|
|
1206
353
|
32,
|
|
1207
|
-
|
|
354
|
+
24588,
|
|
1208
355
|
32,
|
|
1209
|
-
|
|
356
|
+
20744,
|
|
1210
357
|
32,
|
|
1211
|
-
|
|
358
|
+
25933,
|
|
1212
359
|
32,
|
|
1213
|
-
|
|
360
|
+
24623,
|
|
1214
361
|
32,
|
|
1215
|
-
|
|
1216
|
-
|
|
362
|
+
53384111,
|
|
363
|
+
14333,
|
|
1217
364
|
10
|
|
1218
365
|
];
|
|
1219
366
|
var DEFAULT_V2_COST_MODEL_LIST = [
|
|
1220
|
-
|
|
1221
|
-
|
|
367
|
+
100788,
|
|
368
|
+
420,
|
|
1222
369
|
1,
|
|
1223
370
|
1,
|
|
1224
371
|
1e3,
|
|
1225
|
-
|
|
372
|
+
173,
|
|
1226
373
|
0,
|
|
1227
374
|
1,
|
|
1228
375
|
1e3,
|
|
1229
|
-
|
|
376
|
+
59957,
|
|
1230
377
|
4,
|
|
1231
378
|
1,
|
|
1232
|
-
|
|
379
|
+
11183,
|
|
1233
380
|
32,
|
|
1234
|
-
|
|
1235
|
-
|
|
381
|
+
201305,
|
|
382
|
+
8356,
|
|
1236
383
|
4,
|
|
1237
|
-
|
|
384
|
+
16e3,
|
|
1238
385
|
100,
|
|
1239
|
-
|
|
386
|
+
16e3,
|
|
1240
387
|
100,
|
|
1241
|
-
|
|
388
|
+
16e3,
|
|
1242
389
|
100,
|
|
1243
|
-
|
|
390
|
+
16e3,
|
|
1244
391
|
100,
|
|
1245
|
-
|
|
392
|
+
16e3,
|
|
1246
393
|
100,
|
|
1247
|
-
|
|
394
|
+
16e3,
|
|
1248
395
|
100,
|
|
1249
396
|
100,
|
|
1250
397
|
100,
|
|
1251
|
-
|
|
398
|
+
16e3,
|
|
1252
399
|
100,
|
|
1253
|
-
|
|
400
|
+
94375,
|
|
1254
401
|
32,
|
|
1255
|
-
|
|
402
|
+
132994,
|
|
1256
403
|
32,
|
|
1257
|
-
|
|
404
|
+
61462,
|
|
1258
405
|
4,
|
|
1259
|
-
|
|
1260
|
-
|
|
406
|
+
72010,
|
|
407
|
+
178,
|
|
1261
408
|
0,
|
|
1262
409
|
1,
|
|
1263
|
-
|
|
410
|
+
22151,
|
|
1264
411
|
32,
|
|
1265
|
-
|
|
1266
|
-
|
|
412
|
+
91189,
|
|
413
|
+
769,
|
|
1267
414
|
4,
|
|
1268
415
|
2,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
416
|
+
85848,
|
|
417
|
+
228465,
|
|
418
|
+
122,
|
|
1272
419
|
0,
|
|
1273
420
|
1,
|
|
1274
421
|
1,
|
|
1275
422
|
1e3,
|
|
1276
|
-
|
|
423
|
+
42921,
|
|
1277
424
|
4,
|
|
1278
425
|
2,
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
426
|
+
24548,
|
|
427
|
+
29498,
|
|
428
|
+
38,
|
|
1282
429
|
1,
|
|
1283
|
-
|
|
1284
|
-
|
|
430
|
+
898148,
|
|
431
|
+
27279,
|
|
1285
432
|
1,
|
|
1286
|
-
|
|
1287
|
-
|
|
433
|
+
51775,
|
|
434
|
+
558,
|
|
1288
435
|
1,
|
|
1289
|
-
|
|
436
|
+
39184,
|
|
1290
437
|
1e3,
|
|
1291
|
-
|
|
438
|
+
60594,
|
|
1292
439
|
1,
|
|
1293
|
-
|
|
440
|
+
141895,
|
|
1294
441
|
32,
|
|
1295
|
-
|
|
442
|
+
83150,
|
|
1296
443
|
32,
|
|
1297
|
-
|
|
444
|
+
15299,
|
|
1298
445
|
32,
|
|
1299
|
-
|
|
446
|
+
76049,
|
|
1300
447
|
1,
|
|
1301
|
-
|
|
448
|
+
13169,
|
|
1302
449
|
4,
|
|
1303
|
-
|
|
450
|
+
22100,
|
|
1304
451
|
10,
|
|
1305
|
-
|
|
1306
|
-
|
|
452
|
+
28999,
|
|
453
|
+
74,
|
|
1307
454
|
1,
|
|
1308
|
-
|
|
1309
|
-
|
|
455
|
+
28999,
|
|
456
|
+
74,
|
|
1310
457
|
1,
|
|
1311
|
-
|
|
1312
|
-
|
|
458
|
+
43285,
|
|
459
|
+
552,
|
|
1313
460
|
1,
|
|
1314
|
-
|
|
1315
|
-
|
|
461
|
+
44749,
|
|
462
|
+
541,
|
|
1316
463
|
1,
|
|
1317
|
-
|
|
464
|
+
33852,
|
|
1318
465
|
32,
|
|
1319
|
-
|
|
466
|
+
68246,
|
|
1320
467
|
32,
|
|
1321
|
-
|
|
468
|
+
72362,
|
|
1322
469
|
32,
|
|
1323
|
-
|
|
470
|
+
7243,
|
|
1324
471
|
32,
|
|
1325
|
-
|
|
472
|
+
7391,
|
|
1326
473
|
32,
|
|
1327
|
-
|
|
474
|
+
11546,
|
|
1328
475
|
32,
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
476
|
+
85848,
|
|
477
|
+
228465,
|
|
478
|
+
122,
|
|
1332
479
|
0,
|
|
1333
480
|
1,
|
|
1334
481
|
1,
|
|
1335
|
-
|
|
1336
|
-
|
|
482
|
+
90434,
|
|
483
|
+
519,
|
|
1337
484
|
0,
|
|
1338
485
|
1,
|
|
1339
|
-
|
|
486
|
+
74433,
|
|
1340
487
|
32,
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
488
|
+
85848,
|
|
489
|
+
228465,
|
|
490
|
+
122,
|
|
1344
491
|
0,
|
|
1345
492
|
1,
|
|
1346
493
|
1,
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
494
|
+
85848,
|
|
495
|
+
228465,
|
|
496
|
+
122,
|
|
1350
497
|
0,
|
|
1351
498
|
1,
|
|
1352
499
|
1,
|
|
1353
|
-
|
|
1354
|
-
|
|
500
|
+
955506,
|
|
501
|
+
213312,
|
|
1355
502
|
0,
|
|
1356
503
|
2,
|
|
1357
|
-
|
|
1358
|
-
|
|
504
|
+
270652,
|
|
505
|
+
22588,
|
|
1359
506
|
4,
|
|
1360
|
-
|
|
1361
|
-
|
|
507
|
+
1457325,
|
|
508
|
+
64566,
|
|
1362
509
|
4,
|
|
1363
|
-
|
|
1364
|
-
|
|
510
|
+
20467,
|
|
511
|
+
1,
|
|
1365
512
|
4,
|
|
1366
513
|
0,
|
|
1367
|
-
|
|
514
|
+
141992,
|
|
1368
515
|
32,
|
|
1369
|
-
|
|
1370
|
-
|
|
516
|
+
100788,
|
|
517
|
+
420,
|
|
1371
518
|
1,
|
|
1372
519
|
1,
|
|
1373
|
-
|
|
520
|
+
81663,
|
|
1374
521
|
32,
|
|
1375
|
-
|
|
522
|
+
59498,
|
|
1376
523
|
32,
|
|
1377
|
-
|
|
524
|
+
20142,
|
|
1378
525
|
32,
|
|
1379
|
-
|
|
526
|
+
24588,
|
|
1380
527
|
32,
|
|
1381
|
-
|
|
528
|
+
20744,
|
|
1382
529
|
32,
|
|
1383
|
-
|
|
530
|
+
25933,
|
|
1384
531
|
32,
|
|
1385
|
-
|
|
532
|
+
24623,
|
|
1386
533
|
32,
|
|
1387
|
-
|
|
534
|
+
43053543,
|
|
1388
535
|
10,
|
|
1389
|
-
|
|
1390
|
-
|
|
536
|
+
53384111,
|
|
537
|
+
14333,
|
|
1391
538
|
10,
|
|
1392
|
-
|
|
1393
|
-
|
|
539
|
+
43574283,
|
|
540
|
+
26308,
|
|
1394
541
|
10
|
|
1395
542
|
];
|
|
543
|
+
var DEFAULT_V3_COST_MODEL_LIST = [
|
|
544
|
+
100788,
|
|
545
|
+
420,
|
|
546
|
+
1,
|
|
547
|
+
1,
|
|
548
|
+
1e3,
|
|
549
|
+
173,
|
|
550
|
+
0,
|
|
551
|
+
1,
|
|
552
|
+
1e3,
|
|
553
|
+
59957,
|
|
554
|
+
4,
|
|
555
|
+
1,
|
|
556
|
+
11183,
|
|
557
|
+
32,
|
|
558
|
+
201305,
|
|
559
|
+
8356,
|
|
560
|
+
4,
|
|
561
|
+
16e3,
|
|
562
|
+
100,
|
|
563
|
+
16e3,
|
|
564
|
+
100,
|
|
565
|
+
16e3,
|
|
566
|
+
100,
|
|
567
|
+
16e3,
|
|
568
|
+
100,
|
|
569
|
+
16e3,
|
|
570
|
+
100,
|
|
571
|
+
16e3,
|
|
572
|
+
100,
|
|
573
|
+
100,
|
|
574
|
+
100,
|
|
575
|
+
16e3,
|
|
576
|
+
100,
|
|
577
|
+
94375,
|
|
578
|
+
32,
|
|
579
|
+
132994,
|
|
580
|
+
32,
|
|
581
|
+
61462,
|
|
582
|
+
4,
|
|
583
|
+
72010,
|
|
584
|
+
178,
|
|
585
|
+
0,
|
|
586
|
+
1,
|
|
587
|
+
22151,
|
|
588
|
+
32,
|
|
589
|
+
91189,
|
|
590
|
+
769,
|
|
591
|
+
4,
|
|
592
|
+
2,
|
|
593
|
+
85848,
|
|
594
|
+
123203,
|
|
595
|
+
7305,
|
|
596
|
+
-900,
|
|
597
|
+
1716,
|
|
598
|
+
549,
|
|
599
|
+
57,
|
|
600
|
+
85848,
|
|
601
|
+
0,
|
|
602
|
+
1,
|
|
603
|
+
1,
|
|
604
|
+
1e3,
|
|
605
|
+
42921,
|
|
606
|
+
4,
|
|
607
|
+
2,
|
|
608
|
+
24548,
|
|
609
|
+
29498,
|
|
610
|
+
38,
|
|
611
|
+
1,
|
|
612
|
+
898148,
|
|
613
|
+
27279,
|
|
614
|
+
1,
|
|
615
|
+
51775,
|
|
616
|
+
558,
|
|
617
|
+
1,
|
|
618
|
+
39184,
|
|
619
|
+
1e3,
|
|
620
|
+
60594,
|
|
621
|
+
1,
|
|
622
|
+
141895,
|
|
623
|
+
32,
|
|
624
|
+
83150,
|
|
625
|
+
32,
|
|
626
|
+
15299,
|
|
627
|
+
32,
|
|
628
|
+
76049,
|
|
629
|
+
1,
|
|
630
|
+
13169,
|
|
631
|
+
4,
|
|
632
|
+
22100,
|
|
633
|
+
10,
|
|
634
|
+
28999,
|
|
635
|
+
74,
|
|
636
|
+
1,
|
|
637
|
+
28999,
|
|
638
|
+
74,
|
|
639
|
+
1,
|
|
640
|
+
43285,
|
|
641
|
+
552,
|
|
642
|
+
1,
|
|
643
|
+
44749,
|
|
644
|
+
541,
|
|
645
|
+
1,
|
|
646
|
+
33852,
|
|
647
|
+
32,
|
|
648
|
+
68246,
|
|
649
|
+
32,
|
|
650
|
+
72362,
|
|
651
|
+
32,
|
|
652
|
+
7243,
|
|
653
|
+
32,
|
|
654
|
+
7391,
|
|
655
|
+
32,
|
|
656
|
+
11546,
|
|
657
|
+
32,
|
|
658
|
+
85848,
|
|
659
|
+
123203,
|
|
660
|
+
7305,
|
|
661
|
+
-900,
|
|
662
|
+
1716,
|
|
663
|
+
549,
|
|
664
|
+
57,
|
|
665
|
+
85848,
|
|
666
|
+
0,
|
|
667
|
+
1,
|
|
668
|
+
90434,
|
|
669
|
+
519,
|
|
670
|
+
0,
|
|
671
|
+
1,
|
|
672
|
+
74433,
|
|
673
|
+
32,
|
|
674
|
+
85848,
|
|
675
|
+
123203,
|
|
676
|
+
7305,
|
|
677
|
+
-900,
|
|
678
|
+
1716,
|
|
679
|
+
549,
|
|
680
|
+
57,
|
|
681
|
+
85848,
|
|
682
|
+
0,
|
|
683
|
+
1,
|
|
684
|
+
1,
|
|
685
|
+
85848,
|
|
686
|
+
123203,
|
|
687
|
+
7305,
|
|
688
|
+
-900,
|
|
689
|
+
1716,
|
|
690
|
+
549,
|
|
691
|
+
57,
|
|
692
|
+
85848,
|
|
693
|
+
0,
|
|
694
|
+
1,
|
|
695
|
+
955506,
|
|
696
|
+
213312,
|
|
697
|
+
0,
|
|
698
|
+
2,
|
|
699
|
+
270652,
|
|
700
|
+
22588,
|
|
701
|
+
4,
|
|
702
|
+
1457325,
|
|
703
|
+
64566,
|
|
704
|
+
4,
|
|
705
|
+
20467,
|
|
706
|
+
1,
|
|
707
|
+
4,
|
|
708
|
+
0,
|
|
709
|
+
141992,
|
|
710
|
+
32,
|
|
711
|
+
100788,
|
|
712
|
+
420,
|
|
713
|
+
1,
|
|
714
|
+
1,
|
|
715
|
+
81663,
|
|
716
|
+
32,
|
|
717
|
+
59498,
|
|
718
|
+
32,
|
|
719
|
+
20142,
|
|
720
|
+
32,
|
|
721
|
+
24588,
|
|
722
|
+
32,
|
|
723
|
+
20744,
|
|
724
|
+
32,
|
|
725
|
+
25933,
|
|
726
|
+
32,
|
|
727
|
+
24623,
|
|
728
|
+
32,
|
|
729
|
+
43053543,
|
|
730
|
+
10,
|
|
731
|
+
53384111,
|
|
732
|
+
14333,
|
|
733
|
+
10,
|
|
734
|
+
43574283,
|
|
735
|
+
26308,
|
|
736
|
+
10,
|
|
737
|
+
16e3,
|
|
738
|
+
100,
|
|
739
|
+
16e3,
|
|
740
|
+
100,
|
|
741
|
+
962335,
|
|
742
|
+
18,
|
|
743
|
+
2780678,
|
|
744
|
+
6,
|
|
745
|
+
442008,
|
|
746
|
+
1,
|
|
747
|
+
52538055,
|
|
748
|
+
3756,
|
|
749
|
+
18,
|
|
750
|
+
267929,
|
|
751
|
+
18,
|
|
752
|
+
76433006,
|
|
753
|
+
8868,
|
|
754
|
+
18,
|
|
755
|
+
52948122,
|
|
756
|
+
18,
|
|
757
|
+
1995836,
|
|
758
|
+
36,
|
|
759
|
+
3227919,
|
|
760
|
+
12,
|
|
761
|
+
901022,
|
|
762
|
+
1,
|
|
763
|
+
166917843,
|
|
764
|
+
4307,
|
|
765
|
+
36,
|
|
766
|
+
284546,
|
|
767
|
+
36,
|
|
768
|
+
158221314,
|
|
769
|
+
26549,
|
|
770
|
+
36,
|
|
771
|
+
74698472,
|
|
772
|
+
36,
|
|
773
|
+
333849714,
|
|
774
|
+
1,
|
|
775
|
+
254006273,
|
|
776
|
+
72,
|
|
777
|
+
2174038,
|
|
778
|
+
72,
|
|
779
|
+
2261318,
|
|
780
|
+
64571,
|
|
781
|
+
4,
|
|
782
|
+
207616,
|
|
783
|
+
8310,
|
|
784
|
+
4,
|
|
785
|
+
1293828,
|
|
786
|
+
28716,
|
|
787
|
+
63,
|
|
788
|
+
0,
|
|
789
|
+
1,
|
|
790
|
+
1006041,
|
|
791
|
+
43623,
|
|
792
|
+
251,
|
|
793
|
+
0,
|
|
794
|
+
1,
|
|
795
|
+
100181,
|
|
796
|
+
726,
|
|
797
|
+
719,
|
|
798
|
+
0,
|
|
799
|
+
1,
|
|
800
|
+
100181,
|
|
801
|
+
726,
|
|
802
|
+
719,
|
|
803
|
+
0,
|
|
804
|
+
1,
|
|
805
|
+
100181,
|
|
806
|
+
726,
|
|
807
|
+
719,
|
|
808
|
+
0,
|
|
809
|
+
1,
|
|
810
|
+
107878,
|
|
811
|
+
680,
|
|
812
|
+
0,
|
|
813
|
+
1,
|
|
814
|
+
95336,
|
|
815
|
+
1,
|
|
816
|
+
281145,
|
|
817
|
+
18848,
|
|
818
|
+
0,
|
|
819
|
+
1,
|
|
820
|
+
180194,
|
|
821
|
+
159,
|
|
822
|
+
1,
|
|
823
|
+
1,
|
|
824
|
+
158519,
|
|
825
|
+
8942,
|
|
826
|
+
0,
|
|
827
|
+
1,
|
|
828
|
+
159378,
|
|
829
|
+
8813,
|
|
830
|
+
0,
|
|
831
|
+
1,
|
|
832
|
+
107490,
|
|
833
|
+
3298,
|
|
834
|
+
1,
|
|
835
|
+
106057,
|
|
836
|
+
655,
|
|
837
|
+
1,
|
|
838
|
+
1964219,
|
|
839
|
+
24520,
|
|
840
|
+
3
|
|
841
|
+
];
|
|
1396
842
|
|
|
1397
843
|
// src/constants/language-views.ts
|
|
1398
844
|
var SUPPORTED_LANGUAGE_VIEWS = {
|
|
@@ -1473,6 +919,12 @@ var CIP68_222 = (tokenNameHex) => {
|
|
|
1473
919
|
return `000de140${tokenNameHex}`;
|
|
1474
920
|
};
|
|
1475
921
|
|
|
922
|
+
// src/interfaces/fetcher.ts
|
|
923
|
+
var DEFAULT_FETCHER_OPTIONS = {
|
|
924
|
+
maxPage: 20,
|
|
925
|
+
order: "desc"
|
|
926
|
+
};
|
|
927
|
+
|
|
1476
928
|
// src/types/asset.ts
|
|
1477
929
|
var mergeAssets = (assets) => {
|
|
1478
930
|
const merged = [];
|
|
@@ -1542,10 +994,25 @@ var castProtocol = (data) => {
|
|
|
1542
994
|
return result;
|
|
1543
995
|
};
|
|
1544
996
|
|
|
997
|
+
// src/types/transaction-builder/txin.ts
|
|
998
|
+
var txInToUtxo = (txIn) => {
|
|
999
|
+
return {
|
|
1000
|
+
input: {
|
|
1001
|
+
txHash: txIn.txHash,
|
|
1002
|
+
outputIndex: txIn.txIndex
|
|
1003
|
+
},
|
|
1004
|
+
output: {
|
|
1005
|
+
address: txIn.address || "",
|
|
1006
|
+
amount: txIn.amount || []
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1545
1011
|
// src/types/transaction-builder/index.ts
|
|
1546
1012
|
var emptyTxBuilderBody = () => ({
|
|
1547
1013
|
inputs: [],
|
|
1548
1014
|
outputs: [],
|
|
1015
|
+
fee: "0",
|
|
1549
1016
|
extraInputs: [],
|
|
1550
1017
|
collaterals: [],
|
|
1551
1018
|
requiredSignatures: [],
|
|
@@ -1563,8 +1030,18 @@ var emptyTxBuilderBody = () => ({
|
|
|
1563
1030
|
strategy: "experimental",
|
|
1564
1031
|
includeTxFees: true
|
|
1565
1032
|
},
|
|
1566
|
-
|
|
1033
|
+
chainedTxs: [],
|
|
1034
|
+
inputsForEvaluation: {},
|
|
1035
|
+
network: "mainnet",
|
|
1036
|
+
expectedNumberKeyWitnesses: 0,
|
|
1037
|
+
expectedByronAddressWitnesses: []
|
|
1567
1038
|
});
|
|
1039
|
+
function cloneTxBuilderBody(body) {
|
|
1040
|
+
const { extraInputs, ...otherProps } = body;
|
|
1041
|
+
const cloned = structuredClone(otherProps);
|
|
1042
|
+
cloned.extraInputs = extraInputs;
|
|
1043
|
+
return cloned;
|
|
1044
|
+
}
|
|
1568
1045
|
var validityRangeToObj = (validityRange) => {
|
|
1569
1046
|
return {
|
|
1570
1047
|
invalidBefore: validityRange.invalidBefore ?? null,
|
|
@@ -1631,14 +1108,16 @@ var mSome = (value2) => mConStr0([value2]);
|
|
|
1631
1108
|
var mNone = () => mConStr1([]);
|
|
1632
1109
|
|
|
1633
1110
|
// src/data/mesh/credentials.ts
|
|
1111
|
+
var mVerificationKey = (bytes) => mConStr0([bytes]);
|
|
1112
|
+
var mScript = (bytes) => mConStr1([bytes]);
|
|
1634
1113
|
var mMaybeStakingHash = (stakeCredential, isStakeScriptCredential = false) => {
|
|
1635
1114
|
if (stakeCredential === "") {
|
|
1636
1115
|
return mConStr1([]);
|
|
1637
1116
|
}
|
|
1638
1117
|
if (isStakeScriptCredential) {
|
|
1639
|
-
return mConStr0([mConStr0([
|
|
1118
|
+
return mConStr0([mConStr0([mScript(stakeCredential)])]);
|
|
1640
1119
|
}
|
|
1641
|
-
return mConStr0([mConStr0([
|
|
1120
|
+
return mConStr0([mConStr0([mVerificationKey(stakeCredential)])]);
|
|
1642
1121
|
};
|
|
1643
1122
|
var mPubKeyAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => mConStr0([
|
|
1644
1123
|
{ alternative: 0, fields: [bytes] },
|
|
@@ -1648,6 +1127,7 @@ var mScriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =
|
|
|
1648
1127
|
{ alternative: 1, fields: [bytes] },
|
|
1649
1128
|
mMaybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1650
1129
|
]);
|
|
1130
|
+
var mCredential = (hash, isScriptCredential = false) => isScriptCredential ? mScript(hash) : mVerificationKey(hash);
|
|
1651
1131
|
|
|
1652
1132
|
// src/data/mesh/primitives.ts
|
|
1653
1133
|
var mBool = (b) => b ? mConStr1([]) : mConStr0([]);
|
|
@@ -1735,11 +1215,25 @@ var assocMap = (mapItems, validation = true) => ({
|
|
|
1735
1215
|
return { k, v };
|
|
1736
1216
|
})
|
|
1737
1217
|
});
|
|
1218
|
+
var pairs = (mapItems, validation = true) => ({
|
|
1219
|
+
map: mapItems.map(([k, v]) => {
|
|
1220
|
+
if (validation) {
|
|
1221
|
+
if (typeof k !== "object" || typeof v !== "object") {
|
|
1222
|
+
throw new Error(
|
|
1223
|
+
`Map item of JSON Cardano data type must be an object - ${k}, ${v}`
|
|
1224
|
+
);
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
return { k, v };
|
|
1228
|
+
})
|
|
1229
|
+
});
|
|
1738
1230
|
|
|
1739
1231
|
// src/data/json/aliases.ts
|
|
1740
1232
|
var hashByteString = (bytes) => {
|
|
1741
1233
|
if (bytes.length !== 56) {
|
|
1742
|
-
throw new Error(
|
|
1234
|
+
throw new Error(
|
|
1235
|
+
`Invalid hash for [${bytes}] - should be 28 bytes (56 hex length) long`
|
|
1236
|
+
);
|
|
1743
1237
|
}
|
|
1744
1238
|
return byteString(bytes);
|
|
1745
1239
|
};
|
|
@@ -1748,7 +1242,7 @@ var pubKeyHash = (bytes) => hashByteString(bytes);
|
|
|
1748
1242
|
var policyId = (bytes) => {
|
|
1749
1243
|
if (bytes.length !== POLICY_ID_LENGTH && bytes !== "") {
|
|
1750
1244
|
throw new Error(
|
|
1751
|
-
`Invalid policy id for [${bytes}] - should be ${POLICY_ID_LENGTH} bytes long or empty string for lovelace`
|
|
1245
|
+
`Invalid policy id for [${bytes}] - should be ${POLICY_ID_LENGTH / 2} bytes (${POLICY_ID_LENGTH} hex length) long or empty string for lovelace`
|
|
1752
1246
|
);
|
|
1753
1247
|
}
|
|
1754
1248
|
return byteString(bytes);
|
|
@@ -1791,27 +1285,56 @@ var some = (value2) => conStr0([value2]);
|
|
|
1791
1285
|
var none = () => conStr1([]);
|
|
1792
1286
|
|
|
1793
1287
|
// src/data/json/credentials.ts
|
|
1288
|
+
var verificationKey = (bytes) => conStr0([pubKeyHash(bytes)]);
|
|
1289
|
+
var script = (bytes) => conStr1([scriptHash(bytes)]);
|
|
1794
1290
|
var maybeStakingHash = (stakeCredential, isStakeScriptCredential = false) => {
|
|
1795
1291
|
if (stakeCredential === "") {
|
|
1796
1292
|
return conStr1([]);
|
|
1797
1293
|
}
|
|
1798
1294
|
if (isStakeScriptCredential) {
|
|
1799
|
-
return conStr0([
|
|
1800
|
-
conStr0([conStr1([scriptHash(stakeCredential)])])
|
|
1801
|
-
]);
|
|
1295
|
+
return conStr0([conStr0([script(stakeCredential)])]);
|
|
1802
1296
|
}
|
|
1803
|
-
return conStr0([
|
|
1804
|
-
conStr0([conStr0([pubKeyHash(stakeCredential)])])
|
|
1805
|
-
]);
|
|
1297
|
+
return conStr0([conStr0([verificationKey(stakeCredential)])]);
|
|
1806
1298
|
};
|
|
1807
1299
|
var pubKeyAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => conStr0([
|
|
1808
1300
|
conStr0([pubKeyHash(bytes)]),
|
|
1809
1301
|
maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1810
1302
|
]);
|
|
1811
1303
|
var scriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => conStr0([
|
|
1812
|
-
|
|
1304
|
+
script(bytes),
|
|
1813
1305
|
maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1814
1306
|
]);
|
|
1307
|
+
var credential = (hash, isScriptCredential = false) => isScriptCredential ? script(hash) : verificationKey(hash);
|
|
1308
|
+
|
|
1309
|
+
// src/data/json/mpf.ts
|
|
1310
|
+
var jsonProofToPlutusData = (proof) => {
|
|
1311
|
+
const proofSteps = [];
|
|
1312
|
+
const proofJson = proof;
|
|
1313
|
+
proofJson.forEach((proof2) => {
|
|
1314
|
+
const skip = integer(proof2.skip);
|
|
1315
|
+
switch (proof2.type) {
|
|
1316
|
+
case "branch":
|
|
1317
|
+
proofSteps.push(
|
|
1318
|
+
conStr0([skip, byteString(proof2.neighbors.toString("hex"))])
|
|
1319
|
+
);
|
|
1320
|
+
break;
|
|
1321
|
+
case "fork":
|
|
1322
|
+
const { prefix, nibble, root } = proof2.neighbor;
|
|
1323
|
+
const neighbor = conStr0([
|
|
1324
|
+
integer(nibble),
|
|
1325
|
+
byteString(prefix.toString("hex")),
|
|
1326
|
+
byteString(root.toString("hex"))
|
|
1327
|
+
]);
|
|
1328
|
+
proofSteps.push(conStr1([skip, neighbor]));
|
|
1329
|
+
break;
|
|
1330
|
+
case "leaf":
|
|
1331
|
+
const { key, value: value2 } = proof2.neighbor;
|
|
1332
|
+
proofSteps.push(conStr2([skip, byteString(key), byteString(value2)]));
|
|
1333
|
+
break;
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
return proofSteps;
|
|
1337
|
+
};
|
|
1815
1338
|
|
|
1816
1339
|
// src/data/parser.ts
|
|
1817
1340
|
var bytesToHex = (bytes) => Buffer.from(bytes).toString("hex");
|
|
@@ -1995,10 +1518,10 @@ var BigNum = class _BigNum {
|
|
|
1995
1518
|
};
|
|
1996
1519
|
|
|
1997
1520
|
// src/utils/data-hash.ts
|
|
1998
|
-
var import_blakejs =
|
|
1521
|
+
var import_blakejs = require("blakejs");
|
|
1999
1522
|
var hashDrepAnchor = (jsonLD) => {
|
|
2000
|
-
const jsonHash = (0, import_blakejs.
|
|
2001
|
-
return jsonHash;
|
|
1523
|
+
const jsonHash = (0, import_blakejs.blake2b)(JSON.stringify(jsonLD, null, 2), void 0, 32);
|
|
1524
|
+
return Buffer.from(jsonHash).toString("hex");
|
|
2002
1525
|
};
|
|
2003
1526
|
|
|
2004
1527
|
// src/utils/file.ts
|
|
@@ -2158,6 +1681,26 @@ var MeshValue = class _MeshValue {
|
|
|
2158
1681
|
}
|
|
2159
1682
|
return BigInt(this.value[unit]) <= BigInt(other.value[unit]);
|
|
2160
1683
|
};
|
|
1684
|
+
/**
|
|
1685
|
+
* Check if the value is equal to another value
|
|
1686
|
+
* @param other - The value to compare against
|
|
1687
|
+
* @returns boolean
|
|
1688
|
+
*/
|
|
1689
|
+
eq = (other) => {
|
|
1690
|
+
return Object.keys(this.value).every((key) => this.eqUnit(key, other));
|
|
1691
|
+
};
|
|
1692
|
+
/**
|
|
1693
|
+
* Check if the specific unit of value is equal to that unit of another value
|
|
1694
|
+
* @param unit - The unit to compare
|
|
1695
|
+
* @param other - The value to compare against
|
|
1696
|
+
* @returns boolean
|
|
1697
|
+
*/
|
|
1698
|
+
eqUnit = (unit, other) => {
|
|
1699
|
+
if (this.value[unit] === void 0 || other.value[unit] === void 0) {
|
|
1700
|
+
return false;
|
|
1701
|
+
}
|
|
1702
|
+
return BigInt(this.value[unit]) === BigInt(other.value[unit]);
|
|
1703
|
+
};
|
|
2161
1704
|
/**
|
|
2162
1705
|
* Check if the value is empty
|
|
2163
1706
|
* @returns boolean
|
|
@@ -2260,7 +1803,7 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2260
1803
|
const selectedInputs = /* @__PURE__ */ new Set();
|
|
2261
1804
|
const onlyLovelace = /* @__PURE__ */ new Set();
|
|
2262
1805
|
const singletons = /* @__PURE__ */ new Set();
|
|
2263
|
-
const
|
|
1806
|
+
const pairs2 = /* @__PURE__ */ new Set();
|
|
2264
1807
|
const rest = /* @__PURE__ */ new Set();
|
|
2265
1808
|
const collaterals = /* @__PURE__ */ new Set();
|
|
2266
1809
|
for (let i = 0; i < inputs.length; i++) {
|
|
@@ -2279,7 +1822,7 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2279
1822
|
break;
|
|
2280
1823
|
}
|
|
2281
1824
|
case 3: {
|
|
2282
|
-
|
|
1825
|
+
pairs2.add(i);
|
|
2283
1826
|
break;
|
|
2284
1827
|
}
|
|
2285
1828
|
default: {
|
|
@@ -2312,10 +1855,10 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2312
1855
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2313
1856
|
addUtxoWithAssetAmount(inputIndex, assetUnit, singletons);
|
|
2314
1857
|
}
|
|
2315
|
-
for (const inputIndex of
|
|
1858
|
+
for (const inputIndex of pairs2) {
|
|
2316
1859
|
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
2317
1860
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2318
|
-
addUtxoWithAssetAmount(inputIndex, assetUnit,
|
|
1861
|
+
addUtxoWithAssetAmount(inputIndex, assetUnit, pairs2);
|
|
2319
1862
|
}
|
|
2320
1863
|
for (const inputIndex of rest) {
|
|
2321
1864
|
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
@@ -2333,10 +1876,10 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2333
1876
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2334
1877
|
addUtxoWithAssetAmount(inputIndex, "lovelace", singletons);
|
|
2335
1878
|
}
|
|
2336
|
-
for (const inputIndex of
|
|
1879
|
+
for (const inputIndex of pairs2) {
|
|
2337
1880
|
const assetRequired = totalRequiredAssets.get("lovelace");
|
|
2338
1881
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2339
|
-
addUtxoWithAssetAmount(inputIndex, "lovelace",
|
|
1882
|
+
addUtxoWithAssetAmount(inputIndex, "lovelace", pairs2);
|
|
2340
1883
|
}
|
|
2341
1884
|
for (const inputIndex of rest) {
|
|
2342
1885
|
const assetRequired = totalRequiredAssets.get("lovelace");
|
|
@@ -2519,10 +2062,12 @@ var import_bip39 = require("bip39");
|
|
|
2519
2062
|
BigNum,
|
|
2520
2063
|
CIP68_100,
|
|
2521
2064
|
CIP68_222,
|
|
2065
|
+
DEFAULT_FETCHER_OPTIONS,
|
|
2522
2066
|
DEFAULT_PROTOCOL_PARAMETERS,
|
|
2523
2067
|
DEFAULT_REDEEMER_BUDGET,
|
|
2524
2068
|
DEFAULT_V1_COST_MODEL_LIST,
|
|
2525
2069
|
DEFAULT_V2_COST_MODEL_LIST,
|
|
2070
|
+
DEFAULT_V3_COST_MODEL_LIST,
|
|
2526
2071
|
DREP_DEPOSIT,
|
|
2527
2072
|
HARDENED_KEY_START,
|
|
2528
2073
|
LANGUAGE_VERSIONS,
|
|
@@ -2544,11 +2089,13 @@ var import_bip39 = require("bip39");
|
|
|
2544
2089
|
byteString,
|
|
2545
2090
|
bytesToHex,
|
|
2546
2091
|
castProtocol,
|
|
2092
|
+
cloneTxBuilderBody,
|
|
2547
2093
|
conStr,
|
|
2548
2094
|
conStr0,
|
|
2549
2095
|
conStr1,
|
|
2550
2096
|
conStr2,
|
|
2551
2097
|
conStr3,
|
|
2098
|
+
credential,
|
|
2552
2099
|
currencySymbol,
|
|
2553
2100
|
dict,
|
|
2554
2101
|
emptyTxBuilderBody,
|
|
@@ -2563,6 +2110,7 @@ var import_bip39 = require("bip39");
|
|
|
2563
2110
|
hexToString,
|
|
2564
2111
|
integer,
|
|
2565
2112
|
isNetwork,
|
|
2113
|
+
jsonProofToPlutusData,
|
|
2566
2114
|
keepRelevant,
|
|
2567
2115
|
largestFirst,
|
|
2568
2116
|
largestFirstMultiAsset,
|
|
@@ -2574,18 +2122,21 @@ var import_bip39 = require("bip39");
|
|
|
2574
2122
|
mConStr1,
|
|
2575
2123
|
mConStr2,
|
|
2576
2124
|
mConStr3,
|
|
2125
|
+
mCredential,
|
|
2577
2126
|
mMaybeStakingHash,
|
|
2578
2127
|
mNone,
|
|
2579
2128
|
mOption,
|
|
2580
2129
|
mOutputReference,
|
|
2581
2130
|
mPlutusBSArrayToString,
|
|
2582
2131
|
mPubKeyAddress,
|
|
2132
|
+
mScript,
|
|
2583
2133
|
mScriptAddress,
|
|
2584
2134
|
mSome,
|
|
2585
2135
|
mStringToPlutusBSArray,
|
|
2586
2136
|
mTuple,
|
|
2587
2137
|
mTxOutRef,
|
|
2588
2138
|
mValue,
|
|
2139
|
+
mVerificationKey,
|
|
2589
2140
|
maybeStakingHash,
|
|
2590
2141
|
mergeAssets,
|
|
2591
2142
|
metadataStandardKeys,
|
|
@@ -2594,6 +2145,7 @@ var import_bip39 = require("bip39");
|
|
|
2594
2145
|
none,
|
|
2595
2146
|
option,
|
|
2596
2147
|
outputReference,
|
|
2148
|
+
pairs,
|
|
2597
2149
|
parseAssetUnit,
|
|
2598
2150
|
plutusBSArrayToString,
|
|
2599
2151
|
policyId,
|
|
@@ -2606,6 +2158,7 @@ var import_bip39 = require("bip39");
|
|
|
2606
2158
|
resolveSlotNo,
|
|
2607
2159
|
resolveTxFees,
|
|
2608
2160
|
royaltiesStandardKeys,
|
|
2161
|
+
script,
|
|
2609
2162
|
scriptAddress,
|
|
2610
2163
|
scriptHash,
|
|
2611
2164
|
slotToBeginUnixTime,
|
|
@@ -2616,8 +2169,10 @@ var import_bip39 = require("bip39");
|
|
|
2616
2169
|
toUTF8,
|
|
2617
2170
|
tokenName,
|
|
2618
2171
|
tuple,
|
|
2172
|
+
txInToUtxo,
|
|
2619
2173
|
txOutRef,
|
|
2620
2174
|
unixTimeToEnclosingSlot,
|
|
2621
2175
|
validityRangeToObj,
|
|
2622
|
-
value
|
|
2176
|
+
value,
|
|
2177
|
+
verificationKey
|
|
2623
2178
|
});
|