@meshsdk/common 1.9.0-beta.1 → 1.9.0-beta.100
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 +718 -902
- package/dist/index.d.cts +798 -244
- package/dist/index.d.ts +798 -244
- package/dist/index.js +699 -924
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -1,891 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
// ../../node_modules/blakejs/util.js
|
|
28
|
-
var require_util = __commonJS({
|
|
29
|
-
"../../node_modules/blakejs/util.js"(exports, module) {
|
|
30
|
-
"use strict";
|
|
31
|
-
var ERROR_MSG_INPUT = "Input must be an string, Buffer or Uint8Array";
|
|
32
|
-
function normalizeInput(input) {
|
|
33
|
-
let ret;
|
|
34
|
-
if (input instanceof Uint8Array) {
|
|
35
|
-
ret = input;
|
|
36
|
-
} else if (typeof input === "string") {
|
|
37
|
-
const encoder = new TextEncoder();
|
|
38
|
-
ret = encoder.encode(input);
|
|
39
|
-
} else {
|
|
40
|
-
throw new Error(ERROR_MSG_INPUT);
|
|
41
|
-
}
|
|
42
|
-
return ret;
|
|
43
|
-
}
|
|
44
|
-
function toHex(bytes) {
|
|
45
|
-
return Array.prototype.map.call(bytes, function(n) {
|
|
46
|
-
return (n < 16 ? "0" : "") + n.toString(16);
|
|
47
|
-
}).join("");
|
|
48
|
-
}
|
|
49
|
-
function uint32ToHex(val) {
|
|
50
|
-
return (4294967296 + val).toString(16).substring(1);
|
|
51
|
-
}
|
|
52
|
-
function debugPrint(label, arr, size) {
|
|
53
|
-
let msg = "\n" + label + " = ";
|
|
54
|
-
for (let i = 0; i < arr.length; i += 2) {
|
|
55
|
-
if (size === 32) {
|
|
56
|
-
msg += uint32ToHex(arr[i]).toUpperCase();
|
|
57
|
-
msg += " ";
|
|
58
|
-
msg += uint32ToHex(arr[i + 1]).toUpperCase();
|
|
59
|
-
} else if (size === 64) {
|
|
60
|
-
msg += uint32ToHex(arr[i + 1]).toUpperCase();
|
|
61
|
-
msg += uint32ToHex(arr[i]).toUpperCase();
|
|
62
|
-
} else throw new Error("Invalid size " + size);
|
|
63
|
-
if (i % 6 === 4) {
|
|
64
|
-
msg += "\n" + new Array(label.length + 4).join(" ");
|
|
65
|
-
} else if (i < arr.length - 2) {
|
|
66
|
-
msg += " ";
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
console.log(msg);
|
|
70
|
-
}
|
|
71
|
-
function testSpeed(hashFn, N, M) {
|
|
72
|
-
let startMs = (/* @__PURE__ */ new Date()).getTime();
|
|
73
|
-
const input = new Uint8Array(N);
|
|
74
|
-
for (let i = 0; i < N; i++) {
|
|
75
|
-
input[i] = i % 256;
|
|
76
|
-
}
|
|
77
|
-
const genMs = (/* @__PURE__ */ new Date()).getTime();
|
|
78
|
-
console.log("Generated random input in " + (genMs - startMs) + "ms");
|
|
79
|
-
startMs = genMs;
|
|
80
|
-
for (let i = 0; i < M; i++) {
|
|
81
|
-
const hashHex = hashFn(input);
|
|
82
|
-
const hashMs = (/* @__PURE__ */ new Date()).getTime();
|
|
83
|
-
const ms = hashMs - startMs;
|
|
84
|
-
startMs = hashMs;
|
|
85
|
-
console.log("Hashed in " + ms + "ms: " + hashHex.substring(0, 20) + "...");
|
|
86
|
-
console.log(
|
|
87
|
-
Math.round(N / (1 << 20) / (ms / 1e3) * 100) / 100 + " MB PER SECOND"
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
module.exports = {
|
|
92
|
-
normalizeInput,
|
|
93
|
-
toHex,
|
|
94
|
-
debugPrint,
|
|
95
|
-
testSpeed
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// ../../node_modules/blakejs/blake2b.js
|
|
101
|
-
var require_blake2b = __commonJS({
|
|
102
|
-
"../../node_modules/blakejs/blake2b.js"(exports, module) {
|
|
103
|
-
"use strict";
|
|
104
|
-
var util = require_util();
|
|
105
|
-
function ADD64AA(v2, a, b) {
|
|
106
|
-
const o0 = v2[a] + v2[b];
|
|
107
|
-
let o1 = v2[a + 1] + v2[b + 1];
|
|
108
|
-
if (o0 >= 4294967296) {
|
|
109
|
-
o1++;
|
|
110
|
-
}
|
|
111
|
-
v2[a] = o0;
|
|
112
|
-
v2[a + 1] = o1;
|
|
113
|
-
}
|
|
114
|
-
function ADD64AC(v2, a, b0, b1) {
|
|
115
|
-
let o0 = v2[a] + b0;
|
|
116
|
-
if (b0 < 0) {
|
|
117
|
-
o0 += 4294967296;
|
|
118
|
-
}
|
|
119
|
-
let o1 = v2[a + 1] + b1;
|
|
120
|
-
if (o0 >= 4294967296) {
|
|
121
|
-
o1++;
|
|
122
|
-
}
|
|
123
|
-
v2[a] = o0;
|
|
124
|
-
v2[a + 1] = o1;
|
|
125
|
-
}
|
|
126
|
-
function B2B_GET32(arr, i) {
|
|
127
|
-
return arr[i] ^ arr[i + 1] << 8 ^ arr[i + 2] << 16 ^ arr[i + 3] << 24;
|
|
128
|
-
}
|
|
129
|
-
function B2B_G(a, b, c, d, ix, iy) {
|
|
130
|
-
const x0 = m[ix];
|
|
131
|
-
const x1 = m[ix + 1];
|
|
132
|
-
const y0 = m[iy];
|
|
133
|
-
const y1 = m[iy + 1];
|
|
134
|
-
ADD64AA(v, a, b);
|
|
135
|
-
ADD64AC(v, a, x0, x1);
|
|
136
|
-
let xor0 = v[d] ^ v[a];
|
|
137
|
-
let xor1 = v[d + 1] ^ v[a + 1];
|
|
138
|
-
v[d] = xor1;
|
|
139
|
-
v[d + 1] = xor0;
|
|
140
|
-
ADD64AA(v, c, d);
|
|
141
|
-
xor0 = v[b] ^ v[c];
|
|
142
|
-
xor1 = v[b + 1] ^ v[c + 1];
|
|
143
|
-
v[b] = xor0 >>> 24 ^ xor1 << 8;
|
|
144
|
-
v[b + 1] = xor1 >>> 24 ^ xor0 << 8;
|
|
145
|
-
ADD64AA(v, a, b);
|
|
146
|
-
ADD64AC(v, a, y0, y1);
|
|
147
|
-
xor0 = v[d] ^ v[a];
|
|
148
|
-
xor1 = v[d + 1] ^ v[a + 1];
|
|
149
|
-
v[d] = xor0 >>> 16 ^ xor1 << 16;
|
|
150
|
-
v[d + 1] = xor1 >>> 16 ^ xor0 << 16;
|
|
151
|
-
ADD64AA(v, c, d);
|
|
152
|
-
xor0 = v[b] ^ v[c];
|
|
153
|
-
xor1 = v[b + 1] ^ v[c + 1];
|
|
154
|
-
v[b] = xor1 >>> 31 ^ xor0 << 1;
|
|
155
|
-
v[b + 1] = xor0 >>> 31 ^ xor1 << 1;
|
|
156
|
-
}
|
|
157
|
-
var BLAKE2B_IV32 = new Uint32Array([
|
|
158
|
-
4089235720,
|
|
159
|
-
1779033703,
|
|
160
|
-
2227873595,
|
|
161
|
-
3144134277,
|
|
162
|
-
4271175723,
|
|
163
|
-
1013904242,
|
|
164
|
-
1595750129,
|
|
165
|
-
2773480762,
|
|
166
|
-
2917565137,
|
|
167
|
-
1359893119,
|
|
168
|
-
725511199,
|
|
169
|
-
2600822924,
|
|
170
|
-
4215389547,
|
|
171
|
-
528734635,
|
|
172
|
-
327033209,
|
|
173
|
-
1541459225
|
|
174
|
-
]);
|
|
175
|
-
var SIGMA8 = [
|
|
176
|
-
0,
|
|
177
|
-
1,
|
|
178
|
-
2,
|
|
179
|
-
3,
|
|
180
|
-
4,
|
|
181
|
-
5,
|
|
182
|
-
6,
|
|
183
|
-
7,
|
|
184
|
-
8,
|
|
185
|
-
9,
|
|
186
|
-
10,
|
|
187
|
-
11,
|
|
188
|
-
12,
|
|
189
|
-
13,
|
|
190
|
-
14,
|
|
191
|
-
15,
|
|
192
|
-
14,
|
|
193
|
-
10,
|
|
194
|
-
4,
|
|
195
|
-
8,
|
|
196
|
-
9,
|
|
197
|
-
15,
|
|
198
|
-
13,
|
|
199
|
-
6,
|
|
200
|
-
1,
|
|
201
|
-
12,
|
|
202
|
-
0,
|
|
203
|
-
2,
|
|
204
|
-
11,
|
|
205
|
-
7,
|
|
206
|
-
5,
|
|
207
|
-
3,
|
|
208
|
-
11,
|
|
209
|
-
8,
|
|
210
|
-
12,
|
|
211
|
-
0,
|
|
212
|
-
5,
|
|
213
|
-
2,
|
|
214
|
-
15,
|
|
215
|
-
13,
|
|
216
|
-
10,
|
|
217
|
-
14,
|
|
218
|
-
3,
|
|
219
|
-
6,
|
|
220
|
-
7,
|
|
221
|
-
1,
|
|
222
|
-
9,
|
|
223
|
-
4,
|
|
224
|
-
7,
|
|
225
|
-
9,
|
|
226
|
-
3,
|
|
227
|
-
1,
|
|
228
|
-
13,
|
|
229
|
-
12,
|
|
230
|
-
11,
|
|
231
|
-
14,
|
|
232
|
-
2,
|
|
233
|
-
6,
|
|
234
|
-
5,
|
|
235
|
-
10,
|
|
236
|
-
4,
|
|
237
|
-
0,
|
|
238
|
-
15,
|
|
239
|
-
8,
|
|
240
|
-
9,
|
|
241
|
-
0,
|
|
242
|
-
5,
|
|
243
|
-
7,
|
|
244
|
-
2,
|
|
245
|
-
4,
|
|
246
|
-
10,
|
|
247
|
-
15,
|
|
248
|
-
14,
|
|
249
|
-
1,
|
|
250
|
-
11,
|
|
251
|
-
12,
|
|
252
|
-
6,
|
|
253
|
-
8,
|
|
254
|
-
3,
|
|
255
|
-
13,
|
|
256
|
-
2,
|
|
257
|
-
12,
|
|
258
|
-
6,
|
|
259
|
-
10,
|
|
260
|
-
0,
|
|
261
|
-
11,
|
|
262
|
-
8,
|
|
263
|
-
3,
|
|
264
|
-
4,
|
|
265
|
-
13,
|
|
266
|
-
7,
|
|
267
|
-
5,
|
|
268
|
-
15,
|
|
269
|
-
14,
|
|
270
|
-
1,
|
|
271
|
-
9,
|
|
272
|
-
12,
|
|
273
|
-
5,
|
|
274
|
-
1,
|
|
275
|
-
15,
|
|
276
|
-
14,
|
|
277
|
-
13,
|
|
278
|
-
4,
|
|
279
|
-
10,
|
|
280
|
-
0,
|
|
281
|
-
7,
|
|
282
|
-
6,
|
|
283
|
-
3,
|
|
284
|
-
9,
|
|
285
|
-
2,
|
|
286
|
-
8,
|
|
287
|
-
11,
|
|
288
|
-
13,
|
|
289
|
-
11,
|
|
290
|
-
7,
|
|
291
|
-
14,
|
|
292
|
-
12,
|
|
293
|
-
1,
|
|
294
|
-
3,
|
|
295
|
-
9,
|
|
296
|
-
5,
|
|
297
|
-
0,
|
|
298
|
-
15,
|
|
299
|
-
4,
|
|
300
|
-
8,
|
|
301
|
-
6,
|
|
302
|
-
2,
|
|
303
|
-
10,
|
|
304
|
-
6,
|
|
305
|
-
15,
|
|
306
|
-
14,
|
|
307
|
-
9,
|
|
308
|
-
11,
|
|
309
|
-
3,
|
|
310
|
-
0,
|
|
311
|
-
8,
|
|
312
|
-
12,
|
|
313
|
-
2,
|
|
314
|
-
13,
|
|
315
|
-
7,
|
|
316
|
-
1,
|
|
317
|
-
4,
|
|
318
|
-
10,
|
|
319
|
-
5,
|
|
320
|
-
10,
|
|
321
|
-
2,
|
|
322
|
-
8,
|
|
323
|
-
4,
|
|
324
|
-
7,
|
|
325
|
-
6,
|
|
326
|
-
1,
|
|
327
|
-
5,
|
|
328
|
-
15,
|
|
329
|
-
11,
|
|
330
|
-
9,
|
|
331
|
-
14,
|
|
332
|
-
3,
|
|
333
|
-
12,
|
|
334
|
-
13,
|
|
335
|
-
0,
|
|
336
|
-
0,
|
|
337
|
-
1,
|
|
338
|
-
2,
|
|
339
|
-
3,
|
|
340
|
-
4,
|
|
341
|
-
5,
|
|
342
|
-
6,
|
|
343
|
-
7,
|
|
344
|
-
8,
|
|
345
|
-
9,
|
|
346
|
-
10,
|
|
347
|
-
11,
|
|
348
|
-
12,
|
|
349
|
-
13,
|
|
350
|
-
14,
|
|
351
|
-
15,
|
|
352
|
-
14,
|
|
353
|
-
10,
|
|
354
|
-
4,
|
|
355
|
-
8,
|
|
356
|
-
9,
|
|
357
|
-
15,
|
|
358
|
-
13,
|
|
359
|
-
6,
|
|
360
|
-
1,
|
|
361
|
-
12,
|
|
362
|
-
0,
|
|
363
|
-
2,
|
|
364
|
-
11,
|
|
365
|
-
7,
|
|
366
|
-
5,
|
|
367
|
-
3
|
|
368
|
-
];
|
|
369
|
-
var SIGMA82 = new Uint8Array(
|
|
370
|
-
SIGMA8.map(function(x) {
|
|
371
|
-
return x * 2;
|
|
372
|
-
})
|
|
373
|
-
);
|
|
374
|
-
var v = new Uint32Array(32);
|
|
375
|
-
var m = new Uint32Array(32);
|
|
376
|
-
function blake2bCompress(ctx, last) {
|
|
377
|
-
let i = 0;
|
|
378
|
-
for (i = 0; i < 16; i++) {
|
|
379
|
-
v[i] = ctx.h[i];
|
|
380
|
-
v[i + 16] = BLAKE2B_IV32[i];
|
|
381
|
-
}
|
|
382
|
-
v[24] = v[24] ^ ctx.t;
|
|
383
|
-
v[25] = v[25] ^ ctx.t / 4294967296;
|
|
384
|
-
if (last) {
|
|
385
|
-
v[28] = ~v[28];
|
|
386
|
-
v[29] = ~v[29];
|
|
387
|
-
}
|
|
388
|
-
for (i = 0; i < 32; i++) {
|
|
389
|
-
m[i] = B2B_GET32(ctx.b, 4 * i);
|
|
390
|
-
}
|
|
391
|
-
for (i = 0; i < 12; i++) {
|
|
392
|
-
B2B_G(0, 8, 16, 24, SIGMA82[i * 16 + 0], SIGMA82[i * 16 + 1]);
|
|
393
|
-
B2B_G(2, 10, 18, 26, SIGMA82[i * 16 + 2], SIGMA82[i * 16 + 3]);
|
|
394
|
-
B2B_G(4, 12, 20, 28, SIGMA82[i * 16 + 4], SIGMA82[i * 16 + 5]);
|
|
395
|
-
B2B_G(6, 14, 22, 30, SIGMA82[i * 16 + 6], SIGMA82[i * 16 + 7]);
|
|
396
|
-
B2B_G(0, 10, 20, 30, SIGMA82[i * 16 + 8], SIGMA82[i * 16 + 9]);
|
|
397
|
-
B2B_G(2, 12, 22, 24, SIGMA82[i * 16 + 10], SIGMA82[i * 16 + 11]);
|
|
398
|
-
B2B_G(4, 14, 16, 26, SIGMA82[i * 16 + 12], SIGMA82[i * 16 + 13]);
|
|
399
|
-
B2B_G(6, 8, 18, 28, SIGMA82[i * 16 + 14], SIGMA82[i * 16 + 15]);
|
|
400
|
-
}
|
|
401
|
-
for (i = 0; i < 16; i++) {
|
|
402
|
-
ctx.h[i] = ctx.h[i] ^ v[i] ^ v[i + 16];
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
var parameterBlock = new Uint8Array([
|
|
406
|
-
0,
|
|
407
|
-
0,
|
|
408
|
-
0,
|
|
409
|
-
0,
|
|
410
|
-
// 0: outlen, keylen, fanout, depth
|
|
411
|
-
0,
|
|
412
|
-
0,
|
|
413
|
-
0,
|
|
414
|
-
0,
|
|
415
|
-
// 4: leaf length, sequential mode
|
|
416
|
-
0,
|
|
417
|
-
0,
|
|
418
|
-
0,
|
|
419
|
-
0,
|
|
420
|
-
// 8: node offset
|
|
421
|
-
0,
|
|
422
|
-
0,
|
|
423
|
-
0,
|
|
424
|
-
0,
|
|
425
|
-
// 12: node offset
|
|
426
|
-
0,
|
|
427
|
-
0,
|
|
428
|
-
0,
|
|
429
|
-
0,
|
|
430
|
-
// 16: node depth, inner length, rfu
|
|
431
|
-
0,
|
|
432
|
-
0,
|
|
433
|
-
0,
|
|
434
|
-
0,
|
|
435
|
-
// 20: rfu
|
|
436
|
-
0,
|
|
437
|
-
0,
|
|
438
|
-
0,
|
|
439
|
-
0,
|
|
440
|
-
// 24: rfu
|
|
441
|
-
0,
|
|
442
|
-
0,
|
|
443
|
-
0,
|
|
444
|
-
0,
|
|
445
|
-
// 28: rfu
|
|
446
|
-
0,
|
|
447
|
-
0,
|
|
448
|
-
0,
|
|
449
|
-
0,
|
|
450
|
-
// 32: salt
|
|
451
|
-
0,
|
|
452
|
-
0,
|
|
453
|
-
0,
|
|
454
|
-
0,
|
|
455
|
-
// 36: salt
|
|
456
|
-
0,
|
|
457
|
-
0,
|
|
458
|
-
0,
|
|
459
|
-
0,
|
|
460
|
-
// 40: salt
|
|
461
|
-
0,
|
|
462
|
-
0,
|
|
463
|
-
0,
|
|
464
|
-
0,
|
|
465
|
-
// 44: salt
|
|
466
|
-
0,
|
|
467
|
-
0,
|
|
468
|
-
0,
|
|
469
|
-
0,
|
|
470
|
-
// 48: personal
|
|
471
|
-
0,
|
|
472
|
-
0,
|
|
473
|
-
0,
|
|
474
|
-
0,
|
|
475
|
-
// 52: personal
|
|
476
|
-
0,
|
|
477
|
-
0,
|
|
478
|
-
0,
|
|
479
|
-
0,
|
|
480
|
-
// 56: personal
|
|
481
|
-
0,
|
|
482
|
-
0,
|
|
483
|
-
0,
|
|
484
|
-
0
|
|
485
|
-
// 60: personal
|
|
486
|
-
]);
|
|
487
|
-
function blake2bInit(outlen, key, salt, personal) {
|
|
488
|
-
if (outlen === 0 || outlen > 64) {
|
|
489
|
-
throw new Error("Illegal output length, expected 0 < length <= 64");
|
|
490
|
-
}
|
|
491
|
-
if (key && key.length > 64) {
|
|
492
|
-
throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");
|
|
493
|
-
}
|
|
494
|
-
if (salt && salt.length !== 16) {
|
|
495
|
-
throw new Error("Illegal salt, expected Uint8Array with length is 16");
|
|
496
|
-
}
|
|
497
|
-
if (personal && personal.length !== 16) {
|
|
498
|
-
throw new Error("Illegal personal, expected Uint8Array with length is 16");
|
|
499
|
-
}
|
|
500
|
-
const ctx = {
|
|
501
|
-
b: new Uint8Array(128),
|
|
502
|
-
h: new Uint32Array(16),
|
|
503
|
-
t: 0,
|
|
504
|
-
// input count
|
|
505
|
-
c: 0,
|
|
506
|
-
// pointer within buffer
|
|
507
|
-
outlen
|
|
508
|
-
// output length in bytes
|
|
509
|
-
};
|
|
510
|
-
parameterBlock.fill(0);
|
|
511
|
-
parameterBlock[0] = outlen;
|
|
512
|
-
if (key) parameterBlock[1] = key.length;
|
|
513
|
-
parameterBlock[2] = 1;
|
|
514
|
-
parameterBlock[3] = 1;
|
|
515
|
-
if (salt) parameterBlock.set(salt, 32);
|
|
516
|
-
if (personal) parameterBlock.set(personal, 48);
|
|
517
|
-
for (let i = 0; i < 16; i++) {
|
|
518
|
-
ctx.h[i] = BLAKE2B_IV32[i] ^ B2B_GET32(parameterBlock, i * 4);
|
|
519
|
-
}
|
|
520
|
-
if (key) {
|
|
521
|
-
blake2bUpdate(ctx, key);
|
|
522
|
-
ctx.c = 128;
|
|
523
|
-
}
|
|
524
|
-
return ctx;
|
|
525
|
-
}
|
|
526
|
-
function blake2bUpdate(ctx, input) {
|
|
527
|
-
for (let i = 0; i < input.length; i++) {
|
|
528
|
-
if (ctx.c === 128) {
|
|
529
|
-
ctx.t += ctx.c;
|
|
530
|
-
blake2bCompress(ctx, false);
|
|
531
|
-
ctx.c = 0;
|
|
532
|
-
}
|
|
533
|
-
ctx.b[ctx.c++] = input[i];
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
function blake2bFinal(ctx) {
|
|
537
|
-
ctx.t += ctx.c;
|
|
538
|
-
while (ctx.c < 128) {
|
|
539
|
-
ctx.b[ctx.c++] = 0;
|
|
540
|
-
}
|
|
541
|
-
blake2bCompress(ctx, true);
|
|
542
|
-
const out = new Uint8Array(ctx.outlen);
|
|
543
|
-
for (let i = 0; i < ctx.outlen; i++) {
|
|
544
|
-
out[i] = ctx.h[i >> 2] >> 8 * (i & 3);
|
|
545
|
-
}
|
|
546
|
-
return out;
|
|
547
|
-
}
|
|
548
|
-
function blake2b2(input, key, outlen, salt, personal) {
|
|
549
|
-
outlen = outlen || 64;
|
|
550
|
-
input = util.normalizeInput(input);
|
|
551
|
-
if (salt) {
|
|
552
|
-
salt = util.normalizeInput(salt);
|
|
553
|
-
}
|
|
554
|
-
if (personal) {
|
|
555
|
-
personal = util.normalizeInput(personal);
|
|
556
|
-
}
|
|
557
|
-
const ctx = blake2bInit(outlen, key, salt, personal);
|
|
558
|
-
blake2bUpdate(ctx, input);
|
|
559
|
-
return blake2bFinal(ctx);
|
|
560
|
-
}
|
|
561
|
-
function blake2bHex2(input, key, outlen, salt, personal) {
|
|
562
|
-
const output = blake2b2(input, key, outlen, salt, personal);
|
|
563
|
-
return util.toHex(output);
|
|
564
|
-
}
|
|
565
|
-
module.exports = {
|
|
566
|
-
blake2b: blake2b2,
|
|
567
|
-
blake2bHex: blake2bHex2,
|
|
568
|
-
blake2bInit,
|
|
569
|
-
blake2bUpdate,
|
|
570
|
-
blake2bFinal
|
|
571
|
-
};
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
// ../../node_modules/blakejs/blake2s.js
|
|
576
|
-
var require_blake2s = __commonJS({
|
|
577
|
-
"../../node_modules/blakejs/blake2s.js"(exports, module) {
|
|
578
|
-
"use strict";
|
|
579
|
-
var util = require_util();
|
|
580
|
-
function B2S_GET32(v2, i) {
|
|
581
|
-
return v2[i] ^ v2[i + 1] << 8 ^ v2[i + 2] << 16 ^ v2[i + 3] << 24;
|
|
582
|
-
}
|
|
583
|
-
function B2S_G(a, b, c, d, x, y) {
|
|
584
|
-
v[a] = v[a] + v[b] + x;
|
|
585
|
-
v[d] = ROTR32(v[d] ^ v[a], 16);
|
|
586
|
-
v[c] = v[c] + v[d];
|
|
587
|
-
v[b] = ROTR32(v[b] ^ v[c], 12);
|
|
588
|
-
v[a] = v[a] + v[b] + y;
|
|
589
|
-
v[d] = ROTR32(v[d] ^ v[a], 8);
|
|
590
|
-
v[c] = v[c] + v[d];
|
|
591
|
-
v[b] = ROTR32(v[b] ^ v[c], 7);
|
|
592
|
-
}
|
|
593
|
-
function ROTR32(x, y) {
|
|
594
|
-
return x >>> y ^ x << 32 - y;
|
|
595
|
-
}
|
|
596
|
-
var BLAKE2S_IV = new Uint32Array([
|
|
597
|
-
1779033703,
|
|
598
|
-
3144134277,
|
|
599
|
-
1013904242,
|
|
600
|
-
2773480762,
|
|
601
|
-
1359893119,
|
|
602
|
-
2600822924,
|
|
603
|
-
528734635,
|
|
604
|
-
1541459225
|
|
605
|
-
]);
|
|
606
|
-
var SIGMA = new Uint8Array([
|
|
607
|
-
0,
|
|
608
|
-
1,
|
|
609
|
-
2,
|
|
610
|
-
3,
|
|
611
|
-
4,
|
|
612
|
-
5,
|
|
613
|
-
6,
|
|
614
|
-
7,
|
|
615
|
-
8,
|
|
616
|
-
9,
|
|
617
|
-
10,
|
|
618
|
-
11,
|
|
619
|
-
12,
|
|
620
|
-
13,
|
|
621
|
-
14,
|
|
622
|
-
15,
|
|
623
|
-
14,
|
|
624
|
-
10,
|
|
625
|
-
4,
|
|
626
|
-
8,
|
|
627
|
-
9,
|
|
628
|
-
15,
|
|
629
|
-
13,
|
|
630
|
-
6,
|
|
631
|
-
1,
|
|
632
|
-
12,
|
|
633
|
-
0,
|
|
634
|
-
2,
|
|
635
|
-
11,
|
|
636
|
-
7,
|
|
637
|
-
5,
|
|
638
|
-
3,
|
|
639
|
-
11,
|
|
640
|
-
8,
|
|
641
|
-
12,
|
|
642
|
-
0,
|
|
643
|
-
5,
|
|
644
|
-
2,
|
|
645
|
-
15,
|
|
646
|
-
13,
|
|
647
|
-
10,
|
|
648
|
-
14,
|
|
649
|
-
3,
|
|
650
|
-
6,
|
|
651
|
-
7,
|
|
652
|
-
1,
|
|
653
|
-
9,
|
|
654
|
-
4,
|
|
655
|
-
7,
|
|
656
|
-
9,
|
|
657
|
-
3,
|
|
658
|
-
1,
|
|
659
|
-
13,
|
|
660
|
-
12,
|
|
661
|
-
11,
|
|
662
|
-
14,
|
|
663
|
-
2,
|
|
664
|
-
6,
|
|
665
|
-
5,
|
|
666
|
-
10,
|
|
667
|
-
4,
|
|
668
|
-
0,
|
|
669
|
-
15,
|
|
670
|
-
8,
|
|
671
|
-
9,
|
|
672
|
-
0,
|
|
673
|
-
5,
|
|
674
|
-
7,
|
|
675
|
-
2,
|
|
676
|
-
4,
|
|
677
|
-
10,
|
|
678
|
-
15,
|
|
679
|
-
14,
|
|
680
|
-
1,
|
|
681
|
-
11,
|
|
682
|
-
12,
|
|
683
|
-
6,
|
|
684
|
-
8,
|
|
685
|
-
3,
|
|
686
|
-
13,
|
|
687
|
-
2,
|
|
688
|
-
12,
|
|
689
|
-
6,
|
|
690
|
-
10,
|
|
691
|
-
0,
|
|
692
|
-
11,
|
|
693
|
-
8,
|
|
694
|
-
3,
|
|
695
|
-
4,
|
|
696
|
-
13,
|
|
697
|
-
7,
|
|
698
|
-
5,
|
|
699
|
-
15,
|
|
700
|
-
14,
|
|
701
|
-
1,
|
|
702
|
-
9,
|
|
703
|
-
12,
|
|
704
|
-
5,
|
|
705
|
-
1,
|
|
706
|
-
15,
|
|
707
|
-
14,
|
|
708
|
-
13,
|
|
709
|
-
4,
|
|
710
|
-
10,
|
|
711
|
-
0,
|
|
712
|
-
7,
|
|
713
|
-
6,
|
|
714
|
-
3,
|
|
715
|
-
9,
|
|
716
|
-
2,
|
|
717
|
-
8,
|
|
718
|
-
11,
|
|
719
|
-
13,
|
|
720
|
-
11,
|
|
721
|
-
7,
|
|
722
|
-
14,
|
|
723
|
-
12,
|
|
724
|
-
1,
|
|
725
|
-
3,
|
|
726
|
-
9,
|
|
727
|
-
5,
|
|
728
|
-
0,
|
|
729
|
-
15,
|
|
730
|
-
4,
|
|
731
|
-
8,
|
|
732
|
-
6,
|
|
733
|
-
2,
|
|
734
|
-
10,
|
|
735
|
-
6,
|
|
736
|
-
15,
|
|
737
|
-
14,
|
|
738
|
-
9,
|
|
739
|
-
11,
|
|
740
|
-
3,
|
|
741
|
-
0,
|
|
742
|
-
8,
|
|
743
|
-
12,
|
|
744
|
-
2,
|
|
745
|
-
13,
|
|
746
|
-
7,
|
|
747
|
-
1,
|
|
748
|
-
4,
|
|
749
|
-
10,
|
|
750
|
-
5,
|
|
751
|
-
10,
|
|
752
|
-
2,
|
|
753
|
-
8,
|
|
754
|
-
4,
|
|
755
|
-
7,
|
|
756
|
-
6,
|
|
757
|
-
1,
|
|
758
|
-
5,
|
|
759
|
-
15,
|
|
760
|
-
11,
|
|
761
|
-
9,
|
|
762
|
-
14,
|
|
763
|
-
3,
|
|
764
|
-
12,
|
|
765
|
-
13,
|
|
766
|
-
0
|
|
767
|
-
]);
|
|
768
|
-
var v = new Uint32Array(16);
|
|
769
|
-
var m = new Uint32Array(16);
|
|
770
|
-
function blake2sCompress(ctx, last) {
|
|
771
|
-
let i = 0;
|
|
772
|
-
for (i = 0; i < 8; i++) {
|
|
773
|
-
v[i] = ctx.h[i];
|
|
774
|
-
v[i + 8] = BLAKE2S_IV[i];
|
|
775
|
-
}
|
|
776
|
-
v[12] ^= ctx.t;
|
|
777
|
-
v[13] ^= ctx.t / 4294967296;
|
|
778
|
-
if (last) {
|
|
779
|
-
v[14] = ~v[14];
|
|
780
|
-
}
|
|
781
|
-
for (i = 0; i < 16; i++) {
|
|
782
|
-
m[i] = B2S_GET32(ctx.b, 4 * i);
|
|
783
|
-
}
|
|
784
|
-
for (i = 0; i < 10; i++) {
|
|
785
|
-
B2S_G(0, 4, 8, 12, m[SIGMA[i * 16 + 0]], m[SIGMA[i * 16 + 1]]);
|
|
786
|
-
B2S_G(1, 5, 9, 13, m[SIGMA[i * 16 + 2]], m[SIGMA[i * 16 + 3]]);
|
|
787
|
-
B2S_G(2, 6, 10, 14, m[SIGMA[i * 16 + 4]], m[SIGMA[i * 16 + 5]]);
|
|
788
|
-
B2S_G(3, 7, 11, 15, m[SIGMA[i * 16 + 6]], m[SIGMA[i * 16 + 7]]);
|
|
789
|
-
B2S_G(0, 5, 10, 15, m[SIGMA[i * 16 + 8]], m[SIGMA[i * 16 + 9]]);
|
|
790
|
-
B2S_G(1, 6, 11, 12, m[SIGMA[i * 16 + 10]], m[SIGMA[i * 16 + 11]]);
|
|
791
|
-
B2S_G(2, 7, 8, 13, m[SIGMA[i * 16 + 12]], m[SIGMA[i * 16 + 13]]);
|
|
792
|
-
B2S_G(3, 4, 9, 14, m[SIGMA[i * 16 + 14]], m[SIGMA[i * 16 + 15]]);
|
|
793
|
-
}
|
|
794
|
-
for (i = 0; i < 8; i++) {
|
|
795
|
-
ctx.h[i] ^= v[i] ^ v[i + 8];
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
function blake2sInit(outlen, key) {
|
|
799
|
-
if (!(outlen > 0 && outlen <= 32)) {
|
|
800
|
-
throw new Error("Incorrect output length, should be in [1, 32]");
|
|
801
|
-
}
|
|
802
|
-
const keylen = key ? key.length : 0;
|
|
803
|
-
if (key && !(keylen > 0 && keylen <= 32)) {
|
|
804
|
-
throw new Error("Incorrect key length, should be in [1, 32]");
|
|
805
|
-
}
|
|
806
|
-
const ctx = {
|
|
807
|
-
h: new Uint32Array(BLAKE2S_IV),
|
|
808
|
-
// hash state
|
|
809
|
-
b: new Uint8Array(64),
|
|
810
|
-
// input block
|
|
811
|
-
c: 0,
|
|
812
|
-
// pointer within block
|
|
813
|
-
t: 0,
|
|
814
|
-
// input count
|
|
815
|
-
outlen
|
|
816
|
-
// output length in bytes
|
|
817
|
-
};
|
|
818
|
-
ctx.h[0] ^= 16842752 ^ keylen << 8 ^ outlen;
|
|
819
|
-
if (keylen > 0) {
|
|
820
|
-
blake2sUpdate(ctx, key);
|
|
821
|
-
ctx.c = 64;
|
|
822
|
-
}
|
|
823
|
-
return ctx;
|
|
824
|
-
}
|
|
825
|
-
function blake2sUpdate(ctx, input) {
|
|
826
|
-
for (let i = 0; i < input.length; i++) {
|
|
827
|
-
if (ctx.c === 64) {
|
|
828
|
-
ctx.t += ctx.c;
|
|
829
|
-
blake2sCompress(ctx, false);
|
|
830
|
-
ctx.c = 0;
|
|
831
|
-
}
|
|
832
|
-
ctx.b[ctx.c++] = input[i];
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
function blake2sFinal(ctx) {
|
|
836
|
-
ctx.t += ctx.c;
|
|
837
|
-
while (ctx.c < 64) {
|
|
838
|
-
ctx.b[ctx.c++] = 0;
|
|
839
|
-
}
|
|
840
|
-
blake2sCompress(ctx, true);
|
|
841
|
-
const out = new Uint8Array(ctx.outlen);
|
|
842
|
-
for (let i = 0; i < ctx.outlen; i++) {
|
|
843
|
-
out[i] = ctx.h[i >> 2] >> 8 * (i & 3) & 255;
|
|
844
|
-
}
|
|
845
|
-
return out;
|
|
846
|
-
}
|
|
847
|
-
function blake2s(input, key, outlen) {
|
|
848
|
-
outlen = outlen || 32;
|
|
849
|
-
input = util.normalizeInput(input);
|
|
850
|
-
const ctx = blake2sInit(outlen, key);
|
|
851
|
-
blake2sUpdate(ctx, input);
|
|
852
|
-
return blake2sFinal(ctx);
|
|
853
|
-
}
|
|
854
|
-
function blake2sHex(input, key, outlen) {
|
|
855
|
-
const output = blake2s(input, key, outlen);
|
|
856
|
-
return util.toHex(output);
|
|
857
|
-
}
|
|
858
|
-
module.exports = {
|
|
859
|
-
blake2s,
|
|
860
|
-
blake2sHex,
|
|
861
|
-
blake2sInit,
|
|
862
|
-
blake2sUpdate,
|
|
863
|
-
blake2sFinal
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
});
|
|
867
|
-
|
|
868
|
-
// ../../node_modules/blakejs/index.js
|
|
869
|
-
var require_blakejs = __commonJS({
|
|
870
|
-
"../../node_modules/blakejs/index.js"(exports, module) {
|
|
871
|
-
"use strict";
|
|
872
|
-
var b2b = require_blake2b();
|
|
873
|
-
var b2s = require_blake2s();
|
|
874
|
-
module.exports = {
|
|
875
|
-
blake2b: b2b.blake2b,
|
|
876
|
-
blake2bHex: b2b.blake2bHex,
|
|
877
|
-
blake2bInit: b2b.blake2bInit,
|
|
878
|
-
blake2bUpdate: b2b.blake2bUpdate,
|
|
879
|
-
blake2bFinal: b2b.blake2bFinal,
|
|
880
|
-
blake2s: b2s.blake2s,
|
|
881
|
-
blake2sHex: b2s.blake2sHex,
|
|
882
|
-
blake2sInit: b2s.blake2sInit,
|
|
883
|
-
blake2sUpdate: b2s.blake2sUpdate,
|
|
884
|
-
blake2sFinal: b2s.blake2sFinal
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
|
|
889
1
|
// src/constants/protocol-parameters.ts
|
|
890
2
|
var DEFAULT_PROTOCOL_PARAMETERS = {
|
|
891
3
|
epoch: 0,
|
|
@@ -911,6 +23,7 @@ var DEFAULT_PROTOCOL_PARAMETERS = {
|
|
|
911
23
|
minFeeRefScriptCostPerByte: 15
|
|
912
24
|
};
|
|
913
25
|
var DREP_DEPOSIT = "500000000";
|
|
26
|
+
var VOTING_PROPOSAL_DEPOSIT = "100000000000";
|
|
914
27
|
var resolveTxFees = (txSize, minFeeA = DEFAULT_PROTOCOL_PARAMETERS.minFeeA, minFeeB = DEFAULT_PROTOCOL_PARAMETERS.minFeeB) => {
|
|
915
28
|
const fees = BigInt(minFeeA) * BigInt(txSize) + BigInt(minFeeB);
|
|
916
29
|
return fees.toString();
|
|
@@ -1655,6 +768,12 @@ var CIP68_222 = (tokenNameHex) => {
|
|
|
1655
768
|
return `000de140${tokenNameHex}`;
|
|
1656
769
|
};
|
|
1657
770
|
|
|
771
|
+
// src/interfaces/fetcher.ts
|
|
772
|
+
var DEFAULT_FETCHER_OPTIONS = {
|
|
773
|
+
maxPage: 20,
|
|
774
|
+
order: "desc"
|
|
775
|
+
};
|
|
776
|
+
|
|
1658
777
|
// src/types/asset.ts
|
|
1659
778
|
var mergeAssets = (assets) => {
|
|
1660
779
|
const merged = [];
|
|
@@ -1724,10 +843,25 @@ var castProtocol = (data) => {
|
|
|
1724
843
|
return result;
|
|
1725
844
|
};
|
|
1726
845
|
|
|
846
|
+
// src/types/transaction-builder/txin.ts
|
|
847
|
+
var txInToUtxo = (txIn) => {
|
|
848
|
+
return {
|
|
849
|
+
input: {
|
|
850
|
+
txHash: txIn.txHash,
|
|
851
|
+
outputIndex: txIn.txIndex
|
|
852
|
+
},
|
|
853
|
+
output: {
|
|
854
|
+
address: txIn.address || "",
|
|
855
|
+
amount: txIn.amount || []
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
|
|
1727
860
|
// src/types/transaction-builder/index.ts
|
|
1728
861
|
var emptyTxBuilderBody = () => ({
|
|
1729
862
|
inputs: [],
|
|
1730
863
|
outputs: [],
|
|
864
|
+
fee: "0",
|
|
1731
865
|
extraInputs: [],
|
|
1732
866
|
collaterals: [],
|
|
1733
867
|
requiredSignatures: [],
|
|
@@ -1735,24 +869,53 @@ var emptyTxBuilderBody = () => ({
|
|
|
1735
869
|
mints: [],
|
|
1736
870
|
changeAddress: "",
|
|
1737
871
|
metadata: /* @__PURE__ */ new Map(),
|
|
872
|
+
scriptMetadata: [],
|
|
1738
873
|
validityRange: {},
|
|
1739
874
|
certificates: [],
|
|
1740
875
|
withdrawals: [],
|
|
1741
876
|
votes: [],
|
|
877
|
+
proposals: [],
|
|
1742
878
|
signingKey: [],
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
network: "mainnet"
|
|
879
|
+
chainedTxs: [],
|
|
880
|
+
inputsForEvaluation: {},
|
|
881
|
+
network: "mainnet",
|
|
882
|
+
expectedNumberKeyWitnesses: 0,
|
|
883
|
+
expectedByronAddressWitnesses: []
|
|
1749
884
|
});
|
|
885
|
+
function cloneTxBuilderBody(body) {
|
|
886
|
+
const { extraInputs, ...otherProps } = body;
|
|
887
|
+
const cloned = structuredClone(otherProps);
|
|
888
|
+
cloned.extraInputs = extraInputs;
|
|
889
|
+
return cloned;
|
|
890
|
+
}
|
|
1750
891
|
var validityRangeToObj = (validityRange) => {
|
|
1751
892
|
return {
|
|
1752
893
|
invalidBefore: validityRange.invalidBefore ?? null,
|
|
1753
894
|
invalidHereafter: validityRange.invalidHereafter ?? null
|
|
1754
895
|
};
|
|
1755
896
|
};
|
|
897
|
+
var validityRangeFromObj = (obj) => {
|
|
898
|
+
const validityRange = {};
|
|
899
|
+
if (obj.invalidBefore !== null && obj.invalidBefore !== void 0) {
|
|
900
|
+
validityRange.invalidBefore = Number(obj.invalidBefore);
|
|
901
|
+
}
|
|
902
|
+
if (obj.invalidHereafter !== null && obj.invalidHereafter !== void 0) {
|
|
903
|
+
validityRange.invalidHereafter = Number(obj.invalidHereafter);
|
|
904
|
+
}
|
|
905
|
+
return validityRange;
|
|
906
|
+
};
|
|
907
|
+
|
|
908
|
+
// src/types/governance.ts
|
|
909
|
+
var GovernanceActionKind = /* @__PURE__ */ ((GovernanceActionKind2) => {
|
|
910
|
+
GovernanceActionKind2["ParameterChangeAction"] = "ParameterChangeAction";
|
|
911
|
+
GovernanceActionKind2["HardForkInitiationAction"] = "HardForkInitiationAction";
|
|
912
|
+
GovernanceActionKind2["TreasuryWithdrawalsAction"] = "TreasuryWithdrawalsAction";
|
|
913
|
+
GovernanceActionKind2["NoConfidenceAction"] = "NoConfidenceAction";
|
|
914
|
+
GovernanceActionKind2["UpdateCommitteeAction"] = "UpdateCommitteeAction";
|
|
915
|
+
GovernanceActionKind2["NewConstitutionAction"] = "NewConstitutionAction";
|
|
916
|
+
GovernanceActionKind2["InfoAction"] = "InfoAction";
|
|
917
|
+
return GovernanceActionKind2;
|
|
918
|
+
})(GovernanceActionKind || {});
|
|
1756
919
|
|
|
1757
920
|
// src/data/mesh/constructors.ts
|
|
1758
921
|
var mConStr = (alternative, fields) => ({
|
|
@@ -1802,7 +965,7 @@ var mTxOutRef = (txHash, index) => {
|
|
|
1802
965
|
}
|
|
1803
966
|
return mConStr0([mConStr0([txHash]), index]);
|
|
1804
967
|
};
|
|
1805
|
-
var mTuple = (
|
|
968
|
+
var mTuple = (...args) => args;
|
|
1806
969
|
var mOption = (value2) => {
|
|
1807
970
|
if (value2) {
|
|
1808
971
|
return mSome(value2);
|
|
@@ -1813,14 +976,16 @@ var mSome = (value2) => mConStr0([value2]);
|
|
|
1813
976
|
var mNone = () => mConStr1([]);
|
|
1814
977
|
|
|
1815
978
|
// src/data/mesh/credentials.ts
|
|
979
|
+
var mVerificationKey = (bytes) => mConStr0([bytes]);
|
|
980
|
+
var mScript = (bytes) => mConStr1([bytes]);
|
|
1816
981
|
var mMaybeStakingHash = (stakeCredential, isStakeScriptCredential = false) => {
|
|
1817
982
|
if (stakeCredential === "") {
|
|
1818
983
|
return mConStr1([]);
|
|
1819
984
|
}
|
|
1820
985
|
if (isStakeScriptCredential) {
|
|
1821
|
-
return mConStr0([mConStr0([
|
|
986
|
+
return mConStr0([mConStr0([mScript(stakeCredential)])]);
|
|
1822
987
|
}
|
|
1823
|
-
return mConStr0([mConStr0([
|
|
988
|
+
return mConStr0([mConStr0([mVerificationKey(stakeCredential)])]);
|
|
1824
989
|
};
|
|
1825
990
|
var mPubKeyAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => mConStr0([
|
|
1826
991
|
{ alternative: 0, fields: [bytes] },
|
|
@@ -1830,6 +995,7 @@ var mScriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) =
|
|
|
1830
995
|
{ alternative: 1, fields: [bytes] },
|
|
1831
996
|
mMaybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1832
997
|
]);
|
|
998
|
+
var mCredential = (hash, isScriptCredential = false) => isScriptCredential ? mScript(hash) : mVerificationKey(hash);
|
|
1833
999
|
|
|
1834
1000
|
// src/data/mesh/primitives.ts
|
|
1835
1001
|
var mBool = (b) => b ? mConStr1([]) : mConStr0([]);
|
|
@@ -1917,11 +1083,25 @@ var assocMap = (mapItems, validation = true) => ({
|
|
|
1917
1083
|
return { k, v };
|
|
1918
1084
|
})
|
|
1919
1085
|
});
|
|
1086
|
+
var pairs = (mapItems, validation = true) => ({
|
|
1087
|
+
map: mapItems.map(([k, v]) => {
|
|
1088
|
+
if (validation) {
|
|
1089
|
+
if (typeof k !== "object" || typeof v !== "object") {
|
|
1090
|
+
throw new Error(
|
|
1091
|
+
`Map item of JSON Cardano data type must be an object - ${k}, ${v}`
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return { k, v };
|
|
1096
|
+
})
|
|
1097
|
+
});
|
|
1920
1098
|
|
|
1921
1099
|
// src/data/json/aliases.ts
|
|
1922
1100
|
var hashByteString = (bytes) => {
|
|
1923
1101
|
if (bytes.length !== 56) {
|
|
1924
|
-
throw new Error(
|
|
1102
|
+
throw new Error(
|
|
1103
|
+
`Invalid hash for [${bytes}] - should be 28 bytes (56 hex length) long`
|
|
1104
|
+
);
|
|
1925
1105
|
}
|
|
1926
1106
|
return byteString(bytes);
|
|
1927
1107
|
};
|
|
@@ -1930,7 +1110,7 @@ var pubKeyHash = (bytes) => hashByteString(bytes);
|
|
|
1930
1110
|
var policyId = (bytes) => {
|
|
1931
1111
|
if (bytes.length !== POLICY_ID_LENGTH && bytes !== "") {
|
|
1932
1112
|
throw new Error(
|
|
1933
|
-
`Invalid policy id for [${bytes}] - should be ${POLICY_ID_LENGTH} bytes long or empty string for lovelace`
|
|
1113
|
+
`Invalid policy id for [${bytes}] - should be ${POLICY_ID_LENGTH / 2} bytes (${POLICY_ID_LENGTH} hex length) long or empty string for lovelace`
|
|
1934
1114
|
);
|
|
1935
1115
|
}
|
|
1936
1116
|
return byteString(bytes);
|
|
@@ -1962,7 +1142,9 @@ var posixTime = (int) => ({ int });
|
|
|
1962
1142
|
var dict = (itemsMap) => ({
|
|
1963
1143
|
map: itemsMap.map(([k, v]) => ({ k, v }))
|
|
1964
1144
|
});
|
|
1965
|
-
var tuple = (
|
|
1145
|
+
var tuple = (...args) => ({
|
|
1146
|
+
list: args
|
|
1147
|
+
});
|
|
1966
1148
|
var option = (value2) => {
|
|
1967
1149
|
if (!value2) {
|
|
1968
1150
|
return none();
|
|
@@ -1973,32 +1155,62 @@ var some = (value2) => conStr0([value2]);
|
|
|
1973
1155
|
var none = () => conStr1([]);
|
|
1974
1156
|
|
|
1975
1157
|
// src/data/json/credentials.ts
|
|
1158
|
+
var verificationKey = (bytes) => conStr0([pubKeyHash(bytes)]);
|
|
1159
|
+
var script = (bytes) => conStr1([scriptHash(bytes)]);
|
|
1976
1160
|
var maybeStakingHash = (stakeCredential, isStakeScriptCredential = false) => {
|
|
1977
1161
|
if (stakeCredential === "") {
|
|
1978
1162
|
return conStr1([]);
|
|
1979
1163
|
}
|
|
1980
1164
|
if (isStakeScriptCredential) {
|
|
1981
|
-
return conStr0([
|
|
1982
|
-
conStr0([conStr1([scriptHash(stakeCredential)])])
|
|
1983
|
-
]);
|
|
1165
|
+
return conStr0([conStr0([script(stakeCredential)])]);
|
|
1984
1166
|
}
|
|
1985
|
-
return conStr0([
|
|
1986
|
-
conStr0([conStr0([pubKeyHash(stakeCredential)])])
|
|
1987
|
-
]);
|
|
1167
|
+
return conStr0([conStr0([verificationKey(stakeCredential)])]);
|
|
1988
1168
|
};
|
|
1989
1169
|
var pubKeyAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => conStr0([
|
|
1990
1170
|
conStr0([pubKeyHash(bytes)]),
|
|
1991
1171
|
maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1992
1172
|
]);
|
|
1993
1173
|
var scriptAddress = (bytes, stakeCredential, isStakeScriptCredential = false) => conStr0([
|
|
1994
|
-
|
|
1174
|
+
script(bytes),
|
|
1995
1175
|
maybeStakingHash(stakeCredential || "", isStakeScriptCredential)
|
|
1996
1176
|
]);
|
|
1177
|
+
var credential = (hash, isScriptCredential = false) => isScriptCredential ? script(hash) : verificationKey(hash);
|
|
1178
|
+
|
|
1179
|
+
// src/data/json/mpf.ts
|
|
1180
|
+
var jsonProofToPlutusData = (proof) => {
|
|
1181
|
+
const proofSteps = [];
|
|
1182
|
+
const proofJson = proof;
|
|
1183
|
+
proofJson.forEach((proof2) => {
|
|
1184
|
+
const skip = integer(proof2.skip);
|
|
1185
|
+
switch (proof2.type) {
|
|
1186
|
+
case "branch":
|
|
1187
|
+
proofSteps.push(
|
|
1188
|
+
conStr0([skip, byteString(proof2.neighbors.toString("hex"))])
|
|
1189
|
+
);
|
|
1190
|
+
break;
|
|
1191
|
+
case "fork":
|
|
1192
|
+
const { prefix, nibble, root } = proof2.neighbor;
|
|
1193
|
+
const neighbor = conStr0([
|
|
1194
|
+
integer(nibble),
|
|
1195
|
+
byteString(prefix.toString("hex")),
|
|
1196
|
+
byteString(root.toString("hex"))
|
|
1197
|
+
]);
|
|
1198
|
+
proofSteps.push(conStr1([skip, neighbor]));
|
|
1199
|
+
break;
|
|
1200
|
+
case "leaf":
|
|
1201
|
+
const { key, value: value2 } = proof2.neighbor;
|
|
1202
|
+
proofSteps.push(conStr2([skip, byteString(key), byteString(value2)]));
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
return proofSteps;
|
|
1207
|
+
};
|
|
1997
1208
|
|
|
1998
1209
|
// src/data/parser.ts
|
|
1999
1210
|
var bytesToHex = (bytes) => Buffer.from(bytes).toString("hex");
|
|
2000
1211
|
var hexToBytes = (hex) => Buffer.from(hex, "hex");
|
|
2001
1212
|
var stringToHex = (str) => Buffer.from(str, "utf8").toString("hex");
|
|
1213
|
+
var isHexString = (hex) => /^[0-9A-F]*$/i.test(hex);
|
|
2002
1214
|
var hexToString = (hex) => Buffer.from(hex, "hex").toString("utf8");
|
|
2003
1215
|
var toBytes = (hex) => {
|
|
2004
1216
|
if (hex.length % 2 === 0 && /^[0-9A-F]*$/i.test(hex))
|
|
@@ -2177,10 +1389,10 @@ var BigNum = class _BigNum {
|
|
|
2177
1389
|
};
|
|
2178
1390
|
|
|
2179
1391
|
// src/utils/data-hash.ts
|
|
2180
|
-
|
|
1392
|
+
import { blake2b as blake2b2 } from "blakejs";
|
|
2181
1393
|
var hashDrepAnchor = (jsonLD) => {
|
|
2182
|
-
const jsonHash = (
|
|
2183
|
-
return jsonHash;
|
|
1394
|
+
const jsonHash = blake2b2(JSON.stringify(jsonLD, null, 2), void 0, 32);
|
|
1395
|
+
return Buffer.from(jsonHash).toString("hex");
|
|
2184
1396
|
};
|
|
2185
1397
|
|
|
2186
1398
|
// src/utils/file.ts
|
|
@@ -2192,6 +1404,7 @@ function getFile(url) {
|
|
|
2192
1404
|
}
|
|
2193
1405
|
|
|
2194
1406
|
// src/data/value.ts
|
|
1407
|
+
var compareByteOrder = (a, b) => a < b ? -1 : a > b ? 1 : 0;
|
|
2195
1408
|
var value = (assets) => {
|
|
2196
1409
|
return MeshValue.fromAssets(assets).toJSON();
|
|
2197
1410
|
};
|
|
@@ -2203,6 +1416,26 @@ var MeshValue = class _MeshValue {
|
|
|
2203
1416
|
constructor(value2 = {}) {
|
|
2204
1417
|
this.value = value2;
|
|
2205
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Sort a Value (JSON representation) by policy ID then token name
|
|
1421
|
+
* @param plutusValue The Value to sort
|
|
1422
|
+
* @returns Sorted Value
|
|
1423
|
+
*/
|
|
1424
|
+
static sortValue = (plutusValue) => {
|
|
1425
|
+
const sortedPolicies = [...plutusValue.map].sort(
|
|
1426
|
+
(a, b) => compareByteOrder(a.k.bytes, b.k.bytes)
|
|
1427
|
+
);
|
|
1428
|
+
const sortedMap = sortedPolicies.map((policyEntry) => {
|
|
1429
|
+
const sortedTokens = [...policyEntry.v.map].sort(
|
|
1430
|
+
(a, b) => compareByteOrder(a.k.bytes, b.k.bytes)
|
|
1431
|
+
);
|
|
1432
|
+
return {
|
|
1433
|
+
k: policyEntry.k,
|
|
1434
|
+
v: { map: sortedTokens }
|
|
1435
|
+
};
|
|
1436
|
+
});
|
|
1437
|
+
return { map: sortedMap };
|
|
1438
|
+
};
|
|
2206
1439
|
/**
|
|
2207
1440
|
* Converting assets into MeshValue
|
|
2208
1441
|
* @param assets The assets to convert
|
|
@@ -2293,6 +1526,23 @@ var MeshValue = class _MeshValue {
|
|
|
2293
1526
|
get = (unit) => {
|
|
2294
1527
|
return this.value[unit] ? BigInt(this.value[unit]) : BigInt(0);
|
|
2295
1528
|
};
|
|
1529
|
+
/**
|
|
1530
|
+
* Get all assets that belong to a specific policy ID
|
|
1531
|
+
* @param policyId The policy ID to filter by
|
|
1532
|
+
* @returns Array of assets that match the policy ID
|
|
1533
|
+
*/
|
|
1534
|
+
getPolicyAssets = (policyId2) => {
|
|
1535
|
+
const assets = [];
|
|
1536
|
+
Object.entries(this.value).forEach(([unit, quantity]) => {
|
|
1537
|
+
if (unit.startsWith(policyId2)) {
|
|
1538
|
+
assets.push({
|
|
1539
|
+
unit,
|
|
1540
|
+
quantity: quantity.toString()
|
|
1541
|
+
});
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
return assets;
|
|
1545
|
+
};
|
|
2296
1546
|
/**
|
|
2297
1547
|
* Get all asset units
|
|
2298
1548
|
* @returns The asset units
|
|
@@ -2340,6 +1590,26 @@ var MeshValue = class _MeshValue {
|
|
|
2340
1590
|
}
|
|
2341
1591
|
return BigInt(this.value[unit]) <= BigInt(other.value[unit]);
|
|
2342
1592
|
};
|
|
1593
|
+
/**
|
|
1594
|
+
* Check if the value is equal to another value
|
|
1595
|
+
* @param other - The value to compare against
|
|
1596
|
+
* @returns boolean
|
|
1597
|
+
*/
|
|
1598
|
+
eq = (other) => {
|
|
1599
|
+
return Object.keys(this.value).every((key) => this.eqUnit(key, other));
|
|
1600
|
+
};
|
|
1601
|
+
/**
|
|
1602
|
+
* Check if the specific unit of value is equal to that unit of another value
|
|
1603
|
+
* @param unit - The unit to compare
|
|
1604
|
+
* @param other - The value to compare against
|
|
1605
|
+
* @returns boolean
|
|
1606
|
+
*/
|
|
1607
|
+
eqUnit = (unit, other) => {
|
|
1608
|
+
if (this.value[unit] === void 0 || other.value[unit] === void 0) {
|
|
1609
|
+
return false;
|
|
1610
|
+
}
|
|
1611
|
+
return BigInt(this.value[unit]) === BigInt(other.value[unit]);
|
|
1612
|
+
};
|
|
2343
1613
|
/**
|
|
2344
1614
|
* Check if the value is empty
|
|
2345
1615
|
* @returns boolean
|
|
@@ -2374,17 +1644,18 @@ var MeshValue = class _MeshValue {
|
|
|
2374
1644
|
};
|
|
2375
1645
|
/**
|
|
2376
1646
|
* Convert the MeshValue object into Cardano data Value in Mesh Data type
|
|
1647
|
+
* Entries are sorted by byte ordering of policy ID, then token name
|
|
2377
1648
|
*/
|
|
2378
1649
|
toData = () => {
|
|
2379
|
-
const
|
|
1650
|
+
const unsortedMap = /* @__PURE__ */ new Map();
|
|
2380
1651
|
this.toAssets().forEach((asset) => {
|
|
2381
1652
|
const sanitizedName = asset.unit.replace("lovelace", "");
|
|
2382
1653
|
const policy = sanitizedName.slice(0, 56) || "";
|
|
2383
1654
|
const token = sanitizedName.slice(56) || "";
|
|
2384
|
-
if (!
|
|
2385
|
-
|
|
1655
|
+
if (!unsortedMap.has(policy)) {
|
|
1656
|
+
unsortedMap.set(policy, /* @__PURE__ */ new Map());
|
|
2386
1657
|
}
|
|
2387
|
-
const tokenMap =
|
|
1658
|
+
const tokenMap = unsortedMap.get(policy);
|
|
2388
1659
|
const quantity = tokenMap?.get(token);
|
|
2389
1660
|
if (!quantity) {
|
|
2390
1661
|
tokenMap.set(token, BigInt(asset.quantity));
|
|
@@ -2392,10 +1663,24 @@ var MeshValue = class _MeshValue {
|
|
|
2392
1663
|
tokenMap.set(token, quantity + BigInt(asset.quantity));
|
|
2393
1664
|
}
|
|
2394
1665
|
});
|
|
1666
|
+
const sortedPolicies = Array.from(unsortedMap.keys()).sort(compareByteOrder);
|
|
1667
|
+
const valueMap = /* @__PURE__ */ new Map();
|
|
1668
|
+
sortedPolicies.forEach((policy) => {
|
|
1669
|
+
const unsortedTokenMap = unsortedMap.get(policy);
|
|
1670
|
+
const sortedTokens = Array.from(unsortedTokenMap.keys()).sort(
|
|
1671
|
+
compareByteOrder
|
|
1672
|
+
);
|
|
1673
|
+
const sortedTokenMap = /* @__PURE__ */ new Map();
|
|
1674
|
+
sortedTokens.forEach((token) => {
|
|
1675
|
+
sortedTokenMap.set(token, unsortedTokenMap.get(token));
|
|
1676
|
+
});
|
|
1677
|
+
valueMap.set(policy, sortedTokenMap);
|
|
1678
|
+
});
|
|
2395
1679
|
return valueMap;
|
|
2396
1680
|
};
|
|
2397
1681
|
/**
|
|
2398
1682
|
* Convert the MeshValue object into a JSON representation of Cardano data Value
|
|
1683
|
+
* Entries are sorted by byte ordering of policy ID, then token name
|
|
2399
1684
|
* @returns Cardano data Value in JSON
|
|
2400
1685
|
*/
|
|
2401
1686
|
toJSON = () => {
|
|
@@ -2414,11 +1699,16 @@ var MeshValue = class _MeshValue {
|
|
|
2414
1699
|
valueMap[policy][token] += Number(asset.quantity);
|
|
2415
1700
|
}
|
|
2416
1701
|
});
|
|
2417
|
-
Object.keys(valueMap).
|
|
1702
|
+
const sortedPolicies = Object.keys(valueMap).sort(compareByteOrder);
|
|
1703
|
+
sortedPolicies.forEach((policy) => {
|
|
2418
1704
|
const policyByte = currencySymbol(policy);
|
|
2419
|
-
const
|
|
2420
|
-
|
|
1705
|
+
const sortedTokenNames = Object.keys(valueMap[policy]).sort(
|
|
1706
|
+
compareByteOrder
|
|
2421
1707
|
);
|
|
1708
|
+
const tokens = sortedTokenNames.map((name) => [
|
|
1709
|
+
tokenName(name),
|
|
1710
|
+
integer(valueMap[policy][name])
|
|
1711
|
+
]);
|
|
2422
1712
|
const policyMap = assocMap(tokens);
|
|
2423
1713
|
valueMapToParse.push([policyByte, policyMap]);
|
|
2424
1714
|
});
|
|
@@ -2442,7 +1732,7 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2442
1732
|
const selectedInputs = /* @__PURE__ */ new Set();
|
|
2443
1733
|
const onlyLovelace = /* @__PURE__ */ new Set();
|
|
2444
1734
|
const singletons = /* @__PURE__ */ new Set();
|
|
2445
|
-
const
|
|
1735
|
+
const pairs2 = /* @__PURE__ */ new Set();
|
|
2446
1736
|
const rest = /* @__PURE__ */ new Set();
|
|
2447
1737
|
const collaterals = /* @__PURE__ */ new Set();
|
|
2448
1738
|
for (let i = 0; i < inputs.length; i++) {
|
|
@@ -2461,7 +1751,7 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2461
1751
|
break;
|
|
2462
1752
|
}
|
|
2463
1753
|
case 3: {
|
|
2464
|
-
|
|
1754
|
+
pairs2.add(i);
|
|
2465
1755
|
break;
|
|
2466
1756
|
}
|
|
2467
1757
|
default: {
|
|
@@ -2494,10 +1784,10 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2494
1784
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2495
1785
|
addUtxoWithAssetAmount(inputIndex, assetUnit, singletons);
|
|
2496
1786
|
}
|
|
2497
|
-
for (const inputIndex of
|
|
1787
|
+
for (const inputIndex of pairs2) {
|
|
2498
1788
|
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
2499
1789
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2500
|
-
addUtxoWithAssetAmount(inputIndex, assetUnit,
|
|
1790
|
+
addUtxoWithAssetAmount(inputIndex, assetUnit, pairs2);
|
|
2501
1791
|
}
|
|
2502
1792
|
for (const inputIndex of rest) {
|
|
2503
1793
|
const assetRequired = totalRequiredAssets.get(assetUnit);
|
|
@@ -2515,10 +1805,10 @@ var experimentalSelectUtxos = (requiredAssets, inputs, threshold) => {
|
|
|
2515
1805
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2516
1806
|
addUtxoWithAssetAmount(inputIndex, "lovelace", singletons);
|
|
2517
1807
|
}
|
|
2518
|
-
for (const inputIndex of
|
|
1808
|
+
for (const inputIndex of pairs2) {
|
|
2519
1809
|
const assetRequired = totalRequiredAssets.get("lovelace");
|
|
2520
1810
|
if (!assetRequired || Number(assetRequired) <= 0) break;
|
|
2521
|
-
addUtxoWithAssetAmount(inputIndex, "lovelace",
|
|
1811
|
+
addUtxoWithAssetAmount(inputIndex, "lovelace", pairs2);
|
|
2522
1812
|
}
|
|
2523
1813
|
for (const inputIndex of rest) {
|
|
2524
1814
|
const assetRequired = totalRequiredAssets.get("lovelace");
|
|
@@ -2693,6 +1983,473 @@ var UtxoSelection = class {
|
|
|
2693
1983
|
}
|
|
2694
1984
|
};
|
|
2695
1985
|
|
|
1986
|
+
// src/tx-tester/index.ts
|
|
1987
|
+
var TxTester = class {
|
|
1988
|
+
txBody;
|
|
1989
|
+
inputsEvaluating;
|
|
1990
|
+
outputsEvaluating;
|
|
1991
|
+
traces;
|
|
1992
|
+
/**
|
|
1993
|
+
* Create a new TxTester instance
|
|
1994
|
+
* @param txBody The transaction builder body
|
|
1995
|
+
*/
|
|
1996
|
+
constructor(txBody) {
|
|
1997
|
+
this.txBody = { ...txBody };
|
|
1998
|
+
this.inputsEvaluating = [];
|
|
1999
|
+
this.outputsEvaluating = [];
|
|
2000
|
+
this.traces = [];
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Add a trace to the TxTester
|
|
2004
|
+
* @param funcName The function name where the error occurred
|
|
2005
|
+
* @param message The error message
|
|
2006
|
+
*/
|
|
2007
|
+
addTrace(funcName, message) {
|
|
2008
|
+
const msg = `[Error - ${funcName}]: ${message}`;
|
|
2009
|
+
this.traces.push(msg);
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Check if the transaction evaluation was successful
|
|
2013
|
+
* @returns true if there are no errors, false otherwise
|
|
2014
|
+
*/
|
|
2015
|
+
success() {
|
|
2016
|
+
return this.traces.length === 0;
|
|
2017
|
+
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Get the error messages if any
|
|
2020
|
+
* @returns A string representation of the errors or "No errors" if there are none
|
|
2021
|
+
*/
|
|
2022
|
+
errors() {
|
|
2023
|
+
if (this.traces.length > 0) {
|
|
2024
|
+
return `${this.traces}`;
|
|
2025
|
+
} else {
|
|
2026
|
+
return "No errors";
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
/**
|
|
2030
|
+
* Checks if the transaction is valid after a specified timestamp.
|
|
2031
|
+
* @param requiredTimestamp The timestamp after which the transaction should be valid
|
|
2032
|
+
* @returns The TxTester instance for chaining
|
|
2033
|
+
*/
|
|
2034
|
+
validAfter = (requiredTimestamp) => {
|
|
2035
|
+
const invalidBefore = this.txBody.validityRange?.invalidHereafter ? this.txBody.validityRange.invalidHereafter : 9999999999999;
|
|
2036
|
+
const isValidAfter = this.txBody.validityRange?.invalidBefore ? this.txBody.validityRange.invalidBefore < requiredTimestamp : true;
|
|
2037
|
+
if (!isValidAfter) {
|
|
2038
|
+
this.addTrace(
|
|
2039
|
+
"validAfter",
|
|
2040
|
+
`tx invalid before ${invalidBefore}, with requiredTimestamp ${requiredTimestamp}`
|
|
2041
|
+
);
|
|
2042
|
+
}
|
|
2043
|
+
return this;
|
|
2044
|
+
};
|
|
2045
|
+
/**
|
|
2046
|
+
* Checks if the transaction is valid before a specified timestamp.
|
|
2047
|
+
* @param requiredTimestamp The timestamp before which the transaction should be valid
|
|
2048
|
+
* @returns The TxTester instance for chaining
|
|
2049
|
+
*/
|
|
2050
|
+
validBefore = (requiredTimestamp) => {
|
|
2051
|
+
const invalidHereafter = this.txBody.validityRange?.invalidBefore ? this.txBody.validityRange.invalidBefore : 0;
|
|
2052
|
+
const isValidBefore = this.txBody.validityRange?.invalidHereafter ? this.txBody.validityRange.invalidHereafter > requiredTimestamp : true;
|
|
2053
|
+
if (!isValidBefore) {
|
|
2054
|
+
this.addTrace(
|
|
2055
|
+
"validBefore",
|
|
2056
|
+
`tx invalid after ${invalidHereafter}, with requiredTimestamp ${requiredTimestamp}`
|
|
2057
|
+
);
|
|
2058
|
+
}
|
|
2059
|
+
return this;
|
|
2060
|
+
};
|
|
2061
|
+
// Extra Signatories Methods
|
|
2062
|
+
/**
|
|
2063
|
+
* Checks if a specific key is signed in the transaction.
|
|
2064
|
+
* @param keyHash The key hash to check
|
|
2065
|
+
* @returns The TxTester instance for chaining
|
|
2066
|
+
*/
|
|
2067
|
+
keySigned = (keyHash) => {
|
|
2068
|
+
const isKeySigned = keySignedLogic(this.txBody.requiredSignatures, keyHash);
|
|
2069
|
+
if (!isKeySigned) {
|
|
2070
|
+
this.addTrace("keySigned", `tx does not have key ${keyHash} signed`);
|
|
2071
|
+
}
|
|
2072
|
+
return this;
|
|
2073
|
+
};
|
|
2074
|
+
/**
|
|
2075
|
+
* Checks if any one of the specified keys is signed in the transaction.
|
|
2076
|
+
* @param keyHashes The array of key hashes to check
|
|
2077
|
+
* @returns The TxTester instance for chaining
|
|
2078
|
+
*/
|
|
2079
|
+
oneOfKeysSigned = (keyHashes) => {
|
|
2080
|
+
const isOneOfKeysSigned = keyHashes.some(
|
|
2081
|
+
(keyHash) => keySignedLogic(this.txBody.requiredSignatures, keyHash)
|
|
2082
|
+
);
|
|
2083
|
+
if (!isOneOfKeysSigned) {
|
|
2084
|
+
this.addTrace(
|
|
2085
|
+
"oneOfKeysSigned",
|
|
2086
|
+
`tx does not have any of the keys signed: ${keyHashes.join(", ")}`
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
2089
|
+
return this;
|
|
2090
|
+
};
|
|
2091
|
+
/**
|
|
2092
|
+
* Checks if all specified keys are signed in the transaction.
|
|
2093
|
+
* @param keyHashes The array of key hashes to check
|
|
2094
|
+
* @returns The TxTester instance for chaining
|
|
2095
|
+
*/
|
|
2096
|
+
allKeysSigned = (keyHashes) => {
|
|
2097
|
+
const missingKeys = [];
|
|
2098
|
+
const isAllKeysSigned = keyHashes.every((keyHash) => {
|
|
2099
|
+
const isKeySigned = keySignedLogic(
|
|
2100
|
+
this.txBody.requiredSignatures,
|
|
2101
|
+
keyHash
|
|
2102
|
+
);
|
|
2103
|
+
if (!isKeySigned) {
|
|
2104
|
+
missingKeys.push(keyHash);
|
|
2105
|
+
}
|
|
2106
|
+
return isKeySigned;
|
|
2107
|
+
});
|
|
2108
|
+
if (!isAllKeysSigned) {
|
|
2109
|
+
this.addTrace(
|
|
2110
|
+
"allKeysSigned",
|
|
2111
|
+
`tx does not have all keys signed: ${missingKeys.join(", ")}`
|
|
2112
|
+
);
|
|
2113
|
+
}
|
|
2114
|
+
return this;
|
|
2115
|
+
};
|
|
2116
|
+
/**
|
|
2117
|
+
* Checks if a specific token is minted in the transaction.
|
|
2118
|
+
* @param policyId The policy ID of the token
|
|
2119
|
+
* @param assetName The asset name of the token
|
|
2120
|
+
* @param quantity The quantity of the token
|
|
2121
|
+
* @returns The TxTester instance for chaining
|
|
2122
|
+
*/
|
|
2123
|
+
tokenMinted = (policyId2, assetName2, quantity) => {
|
|
2124
|
+
const isTokenMinted = tokenMintedLogic(
|
|
2125
|
+
this.txBody.mints,
|
|
2126
|
+
policyId2,
|
|
2127
|
+
assetName2,
|
|
2128
|
+
quantity
|
|
2129
|
+
);
|
|
2130
|
+
if (!isTokenMinted) {
|
|
2131
|
+
this.addTrace(
|
|
2132
|
+
"tokenMinted",
|
|
2133
|
+
`Token with policy_id: ${policyId2}, asset_name: ${assetName2}, quantity: ${quantity} not found in mints.`
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
return this;
|
|
2137
|
+
};
|
|
2138
|
+
/**
|
|
2139
|
+
* Checks if a specific token is minted in the transaction and that it is the only mint.
|
|
2140
|
+
* @param policyId The policy ID of the token
|
|
2141
|
+
* @param assetName The asset name of the token
|
|
2142
|
+
* @param quantity The quantity of the token
|
|
2143
|
+
* @returns The TxTester instance for chaining
|
|
2144
|
+
*/
|
|
2145
|
+
onlyTokenMinted = (policyId2, assetName2, quantity) => {
|
|
2146
|
+
const isTokenMinted = tokenMintedLogic(
|
|
2147
|
+
this.txBody.mints,
|
|
2148
|
+
policyId2,
|
|
2149
|
+
assetName2,
|
|
2150
|
+
quantity
|
|
2151
|
+
);
|
|
2152
|
+
const isOnlyOneMint = this.txBody.mints?.length === 1;
|
|
2153
|
+
if (!isTokenMinted) {
|
|
2154
|
+
this.addTrace(
|
|
2155
|
+
"onlyTokenMinted",
|
|
2156
|
+
`Token with policy_id: ${policyId2}, asset_name: ${assetName2}, quantity: ${quantity} not found in mints`
|
|
2157
|
+
);
|
|
2158
|
+
}
|
|
2159
|
+
if (!isOnlyOneMint) {
|
|
2160
|
+
this.addTrace(
|
|
2161
|
+
"onlyTokenMinted",
|
|
2162
|
+
`Expected only one mint, but found ${this.txBody.mints?.length || 0} mints.`
|
|
2163
|
+
);
|
|
2164
|
+
}
|
|
2165
|
+
return this;
|
|
2166
|
+
};
|
|
2167
|
+
/**
|
|
2168
|
+
* Checks if a specific token is minted in the transaction, ensuring that it is the only mint for the given policy ID.
|
|
2169
|
+
* @param policyId The policy ID of the token
|
|
2170
|
+
* @param assetName The asset name of the token
|
|
2171
|
+
* @param quantity The quantity of the token
|
|
2172
|
+
* @returns The TxTester instance for chaining
|
|
2173
|
+
*/
|
|
2174
|
+
policyOnlyMintedToken = (policyId2, assetName2, quantity) => {
|
|
2175
|
+
const filteredMints = this.txBody.mints?.filter((token) => {
|
|
2176
|
+
return token.policyId === policyId2;
|
|
2177
|
+
}) || [];
|
|
2178
|
+
const isTokenMinted = tokenMintedLogic(
|
|
2179
|
+
this.txBody.mints,
|
|
2180
|
+
policyId2,
|
|
2181
|
+
assetName2,
|
|
2182
|
+
quantity
|
|
2183
|
+
);
|
|
2184
|
+
const isOnlyOneMint = filteredMints.length === 1;
|
|
2185
|
+
if (!isOnlyOneMint) {
|
|
2186
|
+
this.addTrace(
|
|
2187
|
+
"policyOnlyMintedToken",
|
|
2188
|
+
`Expected only one mint for policy_id: ${policyId2}, but found ${filteredMints.length} mints.`
|
|
2189
|
+
);
|
|
2190
|
+
}
|
|
2191
|
+
if (!isTokenMinted) {
|
|
2192
|
+
this.addTrace(
|
|
2193
|
+
"policyOnlyMintedToken",
|
|
2194
|
+
`Token with policy_id: ${policyId2}, asset_name: ${assetName2}, quantity: ${quantity} not found in mints.`
|
|
2195
|
+
);
|
|
2196
|
+
}
|
|
2197
|
+
return this;
|
|
2198
|
+
};
|
|
2199
|
+
/**
|
|
2200
|
+
* Checks if a specific policy ID is burned in the transaction, ensuring that it is the only minting (i.e. burning item).
|
|
2201
|
+
* @param policyId The policy ID to check
|
|
2202
|
+
* @returns true if the policy is the only burn, false otherwise
|
|
2203
|
+
*/
|
|
2204
|
+
checkPolicyOnlyBurn = (policyId2) => {
|
|
2205
|
+
const filteredMints = this.txBody.mints?.filter((token) => {
|
|
2206
|
+
return token.policyId === policyId2 && token.mintValue.findIndex((m) => BigInt(m.amount) > 0) >= 0;
|
|
2207
|
+
}) || [];
|
|
2208
|
+
return filteredMints.length === 0;
|
|
2209
|
+
};
|
|
2210
|
+
/**
|
|
2211
|
+
* Not apply filter to inputs
|
|
2212
|
+
* @returns The TxTester instance for chaining
|
|
2213
|
+
*/
|
|
2214
|
+
allInputs = () => {
|
|
2215
|
+
this.inputsEvaluating = this.txBody.inputs?.slice() || [];
|
|
2216
|
+
return this;
|
|
2217
|
+
};
|
|
2218
|
+
/**
|
|
2219
|
+
* Filter inputs by address
|
|
2220
|
+
* @param address The address to filter by
|
|
2221
|
+
* @returns The TxTester instance for chaining
|
|
2222
|
+
*/
|
|
2223
|
+
inputsAt = (address) => {
|
|
2224
|
+
this.inputsEvaluating = this.txBody.inputs?.filter(
|
|
2225
|
+
(input) => txInToUtxo(input.txIn).output.address === address
|
|
2226
|
+
) || [];
|
|
2227
|
+
return this;
|
|
2228
|
+
};
|
|
2229
|
+
/**
|
|
2230
|
+
* Filter inputs by unit
|
|
2231
|
+
* @param unit The unit to filter by
|
|
2232
|
+
* @returns The TxTester instance for chaining
|
|
2233
|
+
*/
|
|
2234
|
+
inputsWith = (unit) => {
|
|
2235
|
+
this.inputsEvaluating = this.txBody.inputs?.filter((input) => {
|
|
2236
|
+
const inputValue = MeshValue.fromAssets(
|
|
2237
|
+
txInToUtxo(input.txIn).output.amount
|
|
2238
|
+
);
|
|
2239
|
+
const quantity = inputValue.get(unit);
|
|
2240
|
+
return quantity > 0;
|
|
2241
|
+
}) || [];
|
|
2242
|
+
return this;
|
|
2243
|
+
};
|
|
2244
|
+
/**
|
|
2245
|
+
* Filter inputs by policy ID
|
|
2246
|
+
* @param policyId The policy ID to filter by
|
|
2247
|
+
* @returns The TxTester instance for chaining
|
|
2248
|
+
*/
|
|
2249
|
+
inputsWithPolicy = (policyId2) => {
|
|
2250
|
+
this.inputsEvaluating = this.txBody.inputs?.filter((input) => {
|
|
2251
|
+
const inputValue = MeshValue.fromAssets(
|
|
2252
|
+
txInToUtxo(input.txIn).output.amount
|
|
2253
|
+
);
|
|
2254
|
+
const assets = inputValue.getPolicyAssets(policyId2);
|
|
2255
|
+
return assets.length > 0;
|
|
2256
|
+
}) || [];
|
|
2257
|
+
return this;
|
|
2258
|
+
};
|
|
2259
|
+
/**
|
|
2260
|
+
* Filter inputs by address and policy ID
|
|
2261
|
+
* @param address The address to filter by
|
|
2262
|
+
* @param policyId The policy ID to filter by
|
|
2263
|
+
* @returns The TxTester instance for chaining
|
|
2264
|
+
*/
|
|
2265
|
+
inputsAtWithPolicy = (address, policyId2) => {
|
|
2266
|
+
this.inputsEvaluating = this.txBody.inputs?.filter((input) => {
|
|
2267
|
+
const utxo = txInToUtxo(input.txIn);
|
|
2268
|
+
const inputValue = MeshValue.fromAssets(utxo.output.amount);
|
|
2269
|
+
const assets = inputValue.getPolicyAssets(policyId2);
|
|
2270
|
+
return utxo.output.address === address && assets.length > 0;
|
|
2271
|
+
}) || [];
|
|
2272
|
+
return this;
|
|
2273
|
+
};
|
|
2274
|
+
/**
|
|
2275
|
+
* Filter inputs by address and unit
|
|
2276
|
+
* @param address The address to filter by
|
|
2277
|
+
* @param unit The unit to filter by
|
|
2278
|
+
* @returns The TxTester instance for chaining
|
|
2279
|
+
*/
|
|
2280
|
+
inputsAtWith = (address, unit) => {
|
|
2281
|
+
this.inputsEvaluating = this.txBody.inputs?.filter((input) => {
|
|
2282
|
+
const utxo = txInToUtxo(input.txIn);
|
|
2283
|
+
const inputValue = MeshValue.fromAssets(utxo.output.amount);
|
|
2284
|
+
const quantity = inputValue.get(unit);
|
|
2285
|
+
return utxo.output.address === address && quantity > 0;
|
|
2286
|
+
}) || [];
|
|
2287
|
+
return this;
|
|
2288
|
+
};
|
|
2289
|
+
/**
|
|
2290
|
+
* Check if inputs contain the expected value.
|
|
2291
|
+
* *Reminder - It must be called after filtering methods for inputs*
|
|
2292
|
+
* @param expectedValue The expected value
|
|
2293
|
+
* @returns The TxTester instance for chaining
|
|
2294
|
+
*/
|
|
2295
|
+
inputsValue = (expectedValue) => {
|
|
2296
|
+
let value2 = new MeshValue();
|
|
2297
|
+
this.inputsEvaluating.forEach((input) => {
|
|
2298
|
+
const utxo = txInToUtxo(input.txIn);
|
|
2299
|
+
value2.addAssets(utxo.output.amount);
|
|
2300
|
+
});
|
|
2301
|
+
const isValueCorrect = value2.eq(expectedValue);
|
|
2302
|
+
if (!isValueCorrect) {
|
|
2303
|
+
this.addTrace(
|
|
2304
|
+
"inputsValue",
|
|
2305
|
+
`inputs ${JSON.stringify(this.inputsEvaluating)} have value ${JSON.stringify(value2)}, expect ${JSON.stringify(expectedValue)}`
|
|
2306
|
+
);
|
|
2307
|
+
}
|
|
2308
|
+
return this;
|
|
2309
|
+
};
|
|
2310
|
+
// /**
|
|
2311
|
+
// * Check if inputs contain a specific inline datum.
|
|
2312
|
+
// * *Reminder - It must be called after filtering methods for inputs*
|
|
2313
|
+
// * @param datumCbor The datum CBOR to check
|
|
2314
|
+
// * @returns The TxTester instance for chaining
|
|
2315
|
+
// */
|
|
2316
|
+
// inputsInlineDatumExist = (datumCbor: string): this => {
|
|
2317
|
+
// const inputsWithInlineDatum = this.inputsEvaluating.filter((input) => {
|
|
2318
|
+
// const utxo = txInToUtxo(input.txIn);
|
|
2319
|
+
// return utxo.output.plutusData === datumCbor;
|
|
2320
|
+
// });
|
|
2321
|
+
// if (inputsWithInlineDatum.length === 0) {
|
|
2322
|
+
// this.addTrace(
|
|
2323
|
+
// "inputsInlineDatumExist",
|
|
2324
|
+
// `No inputs with inline datum matching: ${datumCbor}`,
|
|
2325
|
+
// );
|
|
2326
|
+
// }
|
|
2327
|
+
// return this;
|
|
2328
|
+
// };
|
|
2329
|
+
/**
|
|
2330
|
+
* Not apply filter to outputs
|
|
2331
|
+
* @returns The TxTester instance for chaining
|
|
2332
|
+
*/
|
|
2333
|
+
allOutputs = () => {
|
|
2334
|
+
this.outputsEvaluating = this.txBody.outputs?.slice() || [];
|
|
2335
|
+
return this;
|
|
2336
|
+
};
|
|
2337
|
+
/**
|
|
2338
|
+
* Filter outputs by address
|
|
2339
|
+
* @param address The address to filter by
|
|
2340
|
+
* @returns The TxTester instance for chaining
|
|
2341
|
+
*/
|
|
2342
|
+
outputsAt = (address) => {
|
|
2343
|
+
this.outputsEvaluating = this.txBody.outputs?.filter((output) => output.address === address) || [];
|
|
2344
|
+
return this;
|
|
2345
|
+
};
|
|
2346
|
+
/**
|
|
2347
|
+
* Filter outputs by unit
|
|
2348
|
+
* @param unit The unit to filter by
|
|
2349
|
+
* @returns The TxTester instance for chaining
|
|
2350
|
+
*/
|
|
2351
|
+
outputsWith = (unit) => {
|
|
2352
|
+
this.outputsEvaluating = this.txBody.outputs?.filter((output) => {
|
|
2353
|
+
const outputValue = MeshValue.fromAssets(output.amount);
|
|
2354
|
+
const quantity = outputValue.get(unit);
|
|
2355
|
+
return quantity > 0;
|
|
2356
|
+
}) || [];
|
|
2357
|
+
return this;
|
|
2358
|
+
};
|
|
2359
|
+
/**
|
|
2360
|
+
* Filter outputs by policy ID
|
|
2361
|
+
* @param policyId The policy ID to filter by
|
|
2362
|
+
* @returns The TxTester instance for chaining
|
|
2363
|
+
*/
|
|
2364
|
+
outputsWithPolicy = (policyId2) => {
|
|
2365
|
+
this.outputsEvaluating = this.txBody.outputs?.filter((output) => {
|
|
2366
|
+
const outputValue = MeshValue.fromAssets(output.amount);
|
|
2367
|
+
const assets = outputValue.getPolicyAssets(policyId2);
|
|
2368
|
+
return assets.length > 0;
|
|
2369
|
+
}) || [];
|
|
2370
|
+
return this;
|
|
2371
|
+
};
|
|
2372
|
+
/**
|
|
2373
|
+
* Filter outputs by address and policy ID
|
|
2374
|
+
* @param address The address to filter by
|
|
2375
|
+
* @param policyId The policy ID to filter by
|
|
2376
|
+
* @returns The TxTester instance for chaining
|
|
2377
|
+
*/
|
|
2378
|
+
outputsAtWithPolicy = (address, policyId2) => {
|
|
2379
|
+
this.outputsEvaluating = this.txBody.outputs?.filter((output) => {
|
|
2380
|
+
const outputValue = MeshValue.fromAssets(output.amount);
|
|
2381
|
+
const assets = outputValue.getPolicyAssets(policyId2);
|
|
2382
|
+
return output.address === address && assets.length > 0;
|
|
2383
|
+
}) || [];
|
|
2384
|
+
return this;
|
|
2385
|
+
};
|
|
2386
|
+
/**
|
|
2387
|
+
* Filter outputs by address and unit
|
|
2388
|
+
* @param address The address to filter by
|
|
2389
|
+
* @param unit The unit to filter by
|
|
2390
|
+
* @returns The TxTester instance for chaining
|
|
2391
|
+
*/
|
|
2392
|
+
outputsAtWith = (address, unit) => {
|
|
2393
|
+
this.outputsEvaluating = this.txBody.outputs?.filter((output) => {
|
|
2394
|
+
const outputValue = MeshValue.fromAssets(output.amount);
|
|
2395
|
+
const quantity = outputValue.get(unit);
|
|
2396
|
+
return output.address === address && quantity > 0;
|
|
2397
|
+
}) || [];
|
|
2398
|
+
return this;
|
|
2399
|
+
};
|
|
2400
|
+
/**
|
|
2401
|
+
* Check if outputs contain the expected value.
|
|
2402
|
+
* *Reminder - It must be called after filtering methods for outputs*
|
|
2403
|
+
* @param expectedValue The expected value
|
|
2404
|
+
* @returns The TxTester instance for chaining
|
|
2405
|
+
*/
|
|
2406
|
+
outputsValue = (expectedValue) => {
|
|
2407
|
+
let value2 = new MeshValue();
|
|
2408
|
+
this.outputsEvaluating.forEach((output) => {
|
|
2409
|
+
value2.addAssets(output.amount);
|
|
2410
|
+
});
|
|
2411
|
+
const isValueCorrect = value2.eq(expectedValue);
|
|
2412
|
+
if (!isValueCorrect) {
|
|
2413
|
+
this.addTrace(
|
|
2414
|
+
"outputsValue",
|
|
2415
|
+
`tx outputs ${JSON.stringify(this.outputsEvaluating)} have value ${JSON.stringify(value2)}, expected ${JSON.stringify(expectedValue)}`
|
|
2416
|
+
);
|
|
2417
|
+
}
|
|
2418
|
+
return this;
|
|
2419
|
+
};
|
|
2420
|
+
/**
|
|
2421
|
+
* Check if outputs contain a specific inline datum.
|
|
2422
|
+
* *Reminder - It must be called after filtering methods for outputs*
|
|
2423
|
+
* @param datumCbor The datum CBOR to check
|
|
2424
|
+
* @returns The TxTester instance for chaining
|
|
2425
|
+
*/
|
|
2426
|
+
outputsInlineDatumExist = (datumCbor) => {
|
|
2427
|
+
const outputsWithInlineDatum = this.outputsEvaluating.filter((output) => {
|
|
2428
|
+
if (output.datum && output.datum.type === "Inline") {
|
|
2429
|
+
return output.datum.data.content === datumCbor;
|
|
2430
|
+
}
|
|
2431
|
+
return false;
|
|
2432
|
+
});
|
|
2433
|
+
if (outputsWithInlineDatum.length === 0) {
|
|
2434
|
+
this.addTrace(
|
|
2435
|
+
"outputs_inline_datum_exist",
|
|
2436
|
+
`No outputs with inline datum matching: ${datumCbor}`
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
return this;
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
function keySignedLogic(requiredSignatures, keyHash) {
|
|
2443
|
+
return requiredSignatures?.some((signatory) => signatory === keyHash) || false;
|
|
2444
|
+
}
|
|
2445
|
+
function tokenMintedLogic(mints, policyId2, assetName2, quantity) {
|
|
2446
|
+
return mints?.some((token) => {
|
|
2447
|
+
return token.policyId === policyId2 && token.mintValue.findIndex(
|
|
2448
|
+
(m) => m.assetName === assetName2 && BigInt(m.amount) === BigInt(quantity)
|
|
2449
|
+
) >= 0;
|
|
2450
|
+
}) || false;
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2696
2453
|
// src/index.ts
|
|
2697
2454
|
import { generateMnemonic, mnemonicToEntropy } from "bip39";
|
|
2698
2455
|
export {
|
|
@@ -2700,12 +2457,14 @@ export {
|
|
|
2700
2457
|
BigNum,
|
|
2701
2458
|
CIP68_100,
|
|
2702
2459
|
CIP68_222,
|
|
2460
|
+
DEFAULT_FETCHER_OPTIONS,
|
|
2703
2461
|
DEFAULT_PROTOCOL_PARAMETERS,
|
|
2704
2462
|
DEFAULT_REDEEMER_BUDGET,
|
|
2705
2463
|
DEFAULT_V1_COST_MODEL_LIST,
|
|
2706
2464
|
DEFAULT_V2_COST_MODEL_LIST,
|
|
2707
2465
|
DEFAULT_V3_COST_MODEL_LIST,
|
|
2708
2466
|
DREP_DEPOSIT,
|
|
2467
|
+
GovernanceActionKind,
|
|
2709
2468
|
HARDENED_KEY_START,
|
|
2710
2469
|
LANGUAGE_VERSIONS,
|
|
2711
2470
|
MeshValue,
|
|
@@ -2717,7 +2476,9 @@ export {
|
|
|
2717
2476
|
SUPPORTED_OGMIOS_LINKS,
|
|
2718
2477
|
SUPPORTED_TOKENS,
|
|
2719
2478
|
SUPPORTED_WALLETS,
|
|
2479
|
+
TxTester,
|
|
2720
2480
|
UtxoSelection,
|
|
2481
|
+
VOTING_PROPOSAL_DEPOSIT,
|
|
2721
2482
|
assetClass,
|
|
2722
2483
|
assetName,
|
|
2723
2484
|
assocMap,
|
|
@@ -2726,11 +2487,13 @@ export {
|
|
|
2726
2487
|
byteString,
|
|
2727
2488
|
bytesToHex,
|
|
2728
2489
|
castProtocol,
|
|
2490
|
+
cloneTxBuilderBody,
|
|
2729
2491
|
conStr,
|
|
2730
2492
|
conStr0,
|
|
2731
2493
|
conStr1,
|
|
2732
2494
|
conStr2,
|
|
2733
2495
|
conStr3,
|
|
2496
|
+
credential,
|
|
2734
2497
|
currencySymbol,
|
|
2735
2498
|
dict,
|
|
2736
2499
|
emptyTxBuilderBody,
|
|
@@ -2744,8 +2507,11 @@ export {
|
|
|
2744
2507
|
hexToBytes,
|
|
2745
2508
|
hexToString,
|
|
2746
2509
|
integer,
|
|
2510
|
+
isHexString,
|
|
2747
2511
|
isNetwork,
|
|
2512
|
+
jsonProofToPlutusData,
|
|
2748
2513
|
keepRelevant,
|
|
2514
|
+
keySignedLogic,
|
|
2749
2515
|
largestFirst,
|
|
2750
2516
|
largestFirstMultiAsset,
|
|
2751
2517
|
list,
|
|
@@ -2756,18 +2522,21 @@ export {
|
|
|
2756
2522
|
mConStr1,
|
|
2757
2523
|
mConStr2,
|
|
2758
2524
|
mConStr3,
|
|
2525
|
+
mCredential,
|
|
2759
2526
|
mMaybeStakingHash,
|
|
2760
2527
|
mNone,
|
|
2761
2528
|
mOption,
|
|
2762
2529
|
mOutputReference,
|
|
2763
2530
|
mPlutusBSArrayToString,
|
|
2764
2531
|
mPubKeyAddress,
|
|
2532
|
+
mScript,
|
|
2765
2533
|
mScriptAddress,
|
|
2766
2534
|
mSome,
|
|
2767
2535
|
mStringToPlutusBSArray,
|
|
2768
2536
|
mTuple,
|
|
2769
2537
|
mTxOutRef,
|
|
2770
2538
|
mValue,
|
|
2539
|
+
mVerificationKey,
|
|
2771
2540
|
maybeStakingHash,
|
|
2772
2541
|
mergeAssets,
|
|
2773
2542
|
metadataStandardKeys,
|
|
@@ -2776,6 +2545,7 @@ export {
|
|
|
2776
2545
|
none,
|
|
2777
2546
|
option,
|
|
2778
2547
|
outputReference,
|
|
2548
|
+
pairs,
|
|
2779
2549
|
parseAssetUnit,
|
|
2780
2550
|
plutusBSArrayToString,
|
|
2781
2551
|
policyId,
|
|
@@ -2788,6 +2558,7 @@ export {
|
|
|
2788
2558
|
resolveSlotNo,
|
|
2789
2559
|
resolveTxFees,
|
|
2790
2560
|
royaltiesStandardKeys,
|
|
2561
|
+
script,
|
|
2791
2562
|
scriptAddress,
|
|
2792
2563
|
scriptHash,
|
|
2793
2564
|
slotToBeginUnixTime,
|
|
@@ -2796,10 +2567,14 @@ export {
|
|
|
2796
2567
|
stringToHex,
|
|
2797
2568
|
toBytes,
|
|
2798
2569
|
toUTF8,
|
|
2570
|
+
tokenMintedLogic,
|
|
2799
2571
|
tokenName,
|
|
2800
2572
|
tuple,
|
|
2573
|
+
txInToUtxo,
|
|
2801
2574
|
txOutRef,
|
|
2802
2575
|
unixTimeToEnclosingSlot,
|
|
2576
|
+
validityRangeFromObj,
|
|
2803
2577
|
validityRangeToObj,
|
|
2804
|
-
value
|
|
2578
|
+
value,
|
|
2579
|
+
verificationKey
|
|
2805
2580
|
};
|