@meshsdk/core 1.5.21 → 1.5.23
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/common/utils/resolver.d.ts +1 -0
- package/dist/core.cjs +4 -4
- package/dist/core.js +622 -590
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +1 -0
- package/dist/transaction/meshTxBuilder/type.d.ts +19 -1
- package/dist/transaction/transaction.service.d.ts +8 -1
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -9,10 +9,10 @@ const on = (s) => {
|
|
|
9
9
|
const r = e.find((n) => n.unit === t.unit);
|
|
10
10
|
r ? r.quantity = (parseInt(r.quantity) + parseInt(t.quantity)).toString() : e.push(t);
|
|
11
11
|
}), e;
|
|
12
|
-
}, Xr = ["testnet", "preview", "preprod", "mainnet"], Zr = (s) => Xr.includes(s),
|
|
12
|
+
}, Xr = ["testnet", "preview", "preprod", "mainnet"], Zr = (s) => Xr.includes(s), Yt = {
|
|
13
13
|
mem: 7e6,
|
|
14
14
|
steps: 3e9
|
|
15
|
-
},
|
|
15
|
+
}, mt = {
|
|
16
16
|
epoch: 0,
|
|
17
17
|
coinsPerUTxOSize: "4310",
|
|
18
18
|
priceMem: 0.0577,
|
|
@@ -33,7 +33,7 @@ const on = (s) => {
|
|
|
33
33
|
maxTxExSteps: "10000000000",
|
|
34
34
|
maxBlockExMem: "80000000",
|
|
35
35
|
maxBlockExSteps: "40000000000"
|
|
36
|
-
}, be = 2147483648,
|
|
36
|
+
}, be = 2147483648, vt = {
|
|
37
37
|
V1: a.Language.new_plutus_v1(),
|
|
38
38
|
V2: a.Language.new_plutus_v2()
|
|
39
39
|
}, lt = 56, ts = {
|
|
@@ -454,19 +454,19 @@ const on = (s) => {
|
|
|
454
454
|
"vespr",
|
|
455
455
|
"yoroi"
|
|
456
456
|
], ns = (s, e, t = "5000000") => {
|
|
457
|
-
const r = a.BigNum.from_str(s.get("lovelace") ?? "0").checked_add(a.BigNum.from_str(t)), n = e.filter((l) => l.output.amount.filter((
|
|
457
|
+
const r = a.BigNum.from_str(s.get("lovelace") ?? "0").checked_add(a.BigNum.from_str(t)), n = e.filter((l) => l.output.amount.filter((A) => A.unit !== "lovelace").some((A) => s.has(A.unit))), i = cs(n);
|
|
458
458
|
return [
|
|
459
|
-
...i.less_than(r) ? us(r.clamped_sub(i).to_str(), e.filter((l) => !n.some((
|
|
459
|
+
...i.less_than(r) ? us(r.clamped_sub(i).to_str(), e.filter((l) => !n.some((A) => A.input.txHash === l.input.txHash && A.input.outputIndex === l.input.outputIndex))) : [],
|
|
460
460
|
...n
|
|
461
461
|
];
|
|
462
|
-
}, cn = (s, e, t = !1, { maxTxSize: r, minFeeA: n, minFeeB: i } =
|
|
463
|
-
const c = e.filter((b) => Cr(b) === !1).sort(Fe), l = a.BigNum.from_str(qr(r, n, i)),
|
|
464
|
-
return
|
|
465
|
-
["lovelace",
|
|
462
|
+
}, cn = (s, e, t = !1, { maxTxSize: r, minFeeA: n, minFeeB: i } = mt) => {
|
|
463
|
+
const c = e.filter((b) => Cr(b) === !1).sort(Fe), l = a.BigNum.from_str(qr(r, n, i)), A = t ? a.BigNum.from_str(s).checked_add(l).to_str() : s;
|
|
464
|
+
return ie(c, /* @__PURE__ */ new Map([
|
|
465
|
+
["lovelace", A]
|
|
466
466
|
]));
|
|
467
|
-
}, is = (s, e, t = !1, r =
|
|
467
|
+
}, is = (s, e, t = !1, r = mt) => {
|
|
468
468
|
const n = e.filter(Cr).sort(Fe), i = os(r), c = s.get("lovelace") ?? "0", l = t ? a.BigNum.from_str(c).checked_add(i).to_str() : c;
|
|
469
|
-
return s.set("lovelace", l),
|
|
469
|
+
return s.set("lovelace", l), ie(n, s);
|
|
470
470
|
}, as = (s, e) => Array.from(e, (t) => ({ unit: t[0], quantity: a.BigNum.from_str(t[1]) })).every((t) => s.filter((r) => r.output.amount.find((n) => n.unit === t.unit) !== void 0).reduce((r, n) => {
|
|
471
471
|
const i = n.output.amount.reduce((c, l) => c.checked_add(a.BigNum.from_str(t.unit === l.unit ? l.quantity : "0")), a.BigNum.from_str("0"));
|
|
472
472
|
return r.checked_add(i);
|
|
@@ -483,10 +483,10 @@ const on = (s) => {
|
|
|
483
483
|
return e.checked_add(a.BigNum.from_str(r));
|
|
484
484
|
}, a.BigNum.from_str("0")), us = (s, e) => {
|
|
485
485
|
const t = e.sort(Fe);
|
|
486
|
-
return
|
|
486
|
+
return ie(t, /* @__PURE__ */ new Map([
|
|
487
487
|
["lovelace", s]
|
|
488
488
|
]));
|
|
489
|
-
},
|
|
489
|
+
}, ie = (s, e, t = []) => s.length === 0 || as(t, e) ? t : ls(s[0], e) ? ie(s.slice(1), e, [...t, s[0]]) : ie(s.slice(1), e, t), ls = (s, e) => Array.from(e.keys()).some((t) => s.output.amount.find((r) => r.unit === t) !== void 0), hs = (s, e) => {
|
|
490
490
|
const t = fs(e), r = gs(s, e);
|
|
491
491
|
return {
|
|
492
492
|
coseKey: ut(t.to_bytes()),
|
|
@@ -496,8 +496,8 @@ const on = (s) => {
|
|
|
496
496
|
var c, l;
|
|
497
497
|
const n = xr.from_bytes(G(t)), i = $r.from_bytes(G(r));
|
|
498
498
|
if ((s == null ? void 0 : s.length) > 0) {
|
|
499
|
-
const
|
|
500
|
-
if (ht(s) !==
|
|
499
|
+
const A = ut(i.payload() ?? new Uint8Array());
|
|
500
|
+
if (ht(s) !== A)
|
|
501
501
|
return !1;
|
|
502
502
|
}
|
|
503
503
|
if ((e == null ? void 0 : e.length) > 0) {
|
|
@@ -507,7 +507,7 @@ const on = (s) => {
|
|
|
507
507
|
const B = (l = n.header(Pt.new_int(ge.new_negative(De.from_str("2"))))) == null ? void 0 : l.as_bytes();
|
|
508
508
|
if (B === void 0)
|
|
509
509
|
throw new Error("Couldn't find a signer key in signature");
|
|
510
|
-
const b =
|
|
510
|
+
const b = Gt(ut(y)), w = Fs(ut(B));
|
|
511
511
|
if (ds(e, b, w) === !1)
|
|
512
512
|
throw new Error("Couldn't check signature because of address mismatch");
|
|
513
513
|
const v = Hs(ut(i.signature())), U = i.signed_data().to_bytes();
|
|
@@ -518,7 +518,7 @@ const on = (s) => {
|
|
|
518
518
|
if (s !== e.to_bech32())
|
|
519
519
|
return !1;
|
|
520
520
|
try {
|
|
521
|
-
return
|
|
521
|
+
return se(s) === t.hash().to_hex();
|
|
522
522
|
} catch {
|
|
523
523
|
return !1;
|
|
524
524
|
}
|
|
@@ -534,18 +534,18 @@ const on = (s) => {
|
|
|
534
534
|
return i.build(l.to_bytes());
|
|
535
535
|
};
|
|
536
536
|
var Te = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Br = {}, ot = { exports: {} };
|
|
537
|
-
Dt.notEqual =
|
|
538
|
-
Dt.notOk =
|
|
537
|
+
Dt.notEqual = ps;
|
|
538
|
+
Dt.notOk = As;
|
|
539
539
|
Dt.equal = ms;
|
|
540
540
|
Dt.ok = Dt;
|
|
541
|
-
var
|
|
541
|
+
var Sr = Dt;
|
|
542
542
|
function ms(s, e, t) {
|
|
543
543
|
Dt(s == e, t);
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ps(s, e, t) {
|
|
546
546
|
Dt(s != e, t);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function As(s, e) {
|
|
549
549
|
Dt(!s, e);
|
|
550
550
|
}
|
|
551
551
|
function Dt(s, e) {
|
|
@@ -570,14 +570,14 @@ function Re(s) {
|
|
|
570
570
|
};
|
|
571
571
|
return c(function() {
|
|
572
572
|
}), n;
|
|
573
|
-
function i(
|
|
574
|
-
n.exports.memory.grow(Math.ceil(Math.abs(
|
|
573
|
+
function i(A) {
|
|
574
|
+
n.exports.memory.grow(Math.ceil(Math.abs(A - n.memory.length) / 65536)), n.memory = new Uint8Array(n.exports.memory.buffer);
|
|
575
575
|
}
|
|
576
|
-
function c(
|
|
576
|
+
function c(A) {
|
|
577
577
|
if (n.exports)
|
|
578
|
-
return
|
|
578
|
+
return A();
|
|
579
579
|
if (r) {
|
|
580
|
-
r.then(
|
|
580
|
+
r.then(A.bind(null, null)).catch(A);
|
|
581
581
|
return;
|
|
582
582
|
}
|
|
583
583
|
try {
|
|
@@ -587,10 +587,10 @@ function Re(s) {
|
|
|
587
587
|
} catch {
|
|
588
588
|
r = WebAssembly.instantiate(t, e).then(l);
|
|
589
589
|
}
|
|
590
|
-
c(
|
|
590
|
+
c(A);
|
|
591
591
|
}
|
|
592
|
-
function l(
|
|
593
|
-
n.exports =
|
|
592
|
+
function l(A) {
|
|
593
|
+
n.exports = A.instance.exports, n.memory = n.exports.memory && n.exports.memory.buffer && new Uint8Array(n.exports.memory.buffer);
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
function ys(s) {
|
|
@@ -599,24 +599,24 @@ function ys(s) {
|
|
|
599
599
|
function xs(s) {
|
|
600
600
|
return s.charCodeAt(0);
|
|
601
601
|
}
|
|
602
|
-
var wt =
|
|
603
|
-
Et.exports =
|
|
602
|
+
var wt = Sr, W = _s(), Qt = 64, me = [];
|
|
603
|
+
Et.exports = pt;
|
|
604
604
|
var Xe = Et.exports.BYTES_MIN = 16, Ze = Et.exports.BYTES_MAX = 64;
|
|
605
605
|
Et.exports.BYTES = 32;
|
|
606
606
|
var tr = Et.exports.KEYBYTES_MIN = 16, er = Et.exports.KEYBYTES_MAX = 64;
|
|
607
607
|
Et.exports.KEYBYTES = 32;
|
|
608
608
|
var rr = Et.exports.SALTBYTES = 16, sr = Et.exports.PERSONALBYTES = 16;
|
|
609
|
-
function
|
|
610
|
-
if (!(this instanceof
|
|
611
|
-
return new
|
|
609
|
+
function pt(s, e, t, r, n) {
|
|
610
|
+
if (!(this instanceof pt))
|
|
611
|
+
return new pt(s, e, t, r, n);
|
|
612
612
|
if (!(W && W.exports))
|
|
613
613
|
throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");
|
|
614
|
-
s || (s = 32), n !== !0 && (wt(s >= Xe, "digestLength must be at least " + Xe + ", was given " + s), wt(s <= Ze, "digestLength must be at most " + Ze + ", was given " + s), e != null && wt(e.length >= tr, "key must be at least " + tr + ", was given " + e.length), e != null && wt(e.length <= er, "key must be at least " + er + ", was given " + e.length), t != null && wt(t.length === rr, "salt must be exactly " + rr + ", was given " + t.length), r != null && wt(r.length === sr, "personal must be exactly " + sr + ", was given " + r.length)), me.length || (me.push(
|
|
614
|
+
s || (s = 32), n !== !0 && (wt(s >= Xe, "digestLength must be at least " + Xe + ", was given " + s), wt(s <= Ze, "digestLength must be at most " + Ze + ", was given " + s), e != null && wt(e.length >= tr, "key must be at least " + tr + ", was given " + e.length), e != null && wt(e.length <= er, "key must be at least " + er + ", was given " + e.length), t != null && wt(t.length === rr, "salt must be exactly " + rr + ", was given " + t.length), r != null && wt(r.length === sr, "personal must be exactly " + sr + ", was given " + r.length)), me.length || (me.push(Qt), Qt += 216), this.digestLength = s, this.finalized = !1, this.pointer = me.pop(), W.memory.fill(0, 0, 64), W.memory[0] = this.digestLength, W.memory[1] = e ? e.length : 0, W.memory[2] = 1, W.memory[3] = 1, t && W.memory.set(t, 32), r && W.memory.set(r, 48), this.pointer + 216 > W.memory.length && W.realloc(this.pointer + 216), W.exports.blake2b_init(this.pointer, this.digestLength), e && (this.update(e), W.memory.fill(0, Qt, Qt + e.length), W.memory[this.pointer + 200] = 128);
|
|
615
615
|
}
|
|
616
|
-
|
|
617
|
-
return wt(this.finalized === !1, "Hash instance finalized"), wt(s, "input must be TypedArray or Buffer"),
|
|
616
|
+
pt.prototype.update = function(s) {
|
|
617
|
+
return wt(this.finalized === !1, "Hash instance finalized"), wt(s, "input must be TypedArray or Buffer"), Qt + s.length > W.memory.length && W.realloc(Qt + s.length), W.memory.set(s, Qt), W.exports.blake2b_update(this.pointer, Qt, Qt + s.length), this;
|
|
618
618
|
};
|
|
619
|
-
|
|
619
|
+
pt.prototype.digest = function(s) {
|
|
620
620
|
if (wt(this.finalized === !1, "Hash instance finalized"), this.finalized = !0, me.push(this.pointer), W.exports.blake2b_final(this.pointer), !s || s === "binary")
|
|
621
621
|
return W.memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength);
|
|
622
622
|
if (s === "hex")
|
|
@@ -626,10 +626,10 @@ mt.prototype.digest = function(s) {
|
|
|
626
626
|
s[e] = W.memory[this.pointer + 128 + e];
|
|
627
627
|
return s;
|
|
628
628
|
};
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
629
|
+
pt.prototype.final = pt.prototype.digest;
|
|
630
|
+
pt.WASM = W && W.buffer;
|
|
631
|
+
pt.SUPPORTED = typeof WebAssembly < "u";
|
|
632
|
+
pt.ready = function(s) {
|
|
633
633
|
if (s || (s = ws), !W)
|
|
634
634
|
return s(new Error("WebAssembly not supported"));
|
|
635
635
|
var e = new Promise(function(t, r) {
|
|
@@ -639,7 +639,7 @@ mt.ready = function(s) {
|
|
|
639
639
|
});
|
|
640
640
|
return e;
|
|
641
641
|
};
|
|
642
|
-
|
|
642
|
+
pt.prototype.ready = pt.ready;
|
|
643
643
|
function ws() {
|
|
644
644
|
}
|
|
645
645
|
function Cs(s, e, t) {
|
|
@@ -650,7 +650,7 @@ function Cs(s, e, t) {
|
|
|
650
650
|
function Bs(s) {
|
|
651
651
|
return s < 16 ? "0" + s.toString(16) : s.toString(16);
|
|
652
652
|
}
|
|
653
|
-
var Ut =
|
|
653
|
+
var Ut = Sr, ae = Et.exports;
|
|
654
654
|
function ue(s, e, t) {
|
|
655
655
|
var r = s[e] + s[t], n = s[e + 1] + s[t + 1];
|
|
656
656
|
r >= 4294967296 && n++, s[e] = r, s[e + 1] = n;
|
|
@@ -661,14 +661,14 @@ function nr(s, e, t, r) {
|
|
|
661
661
|
var i = s[e + 1] + r;
|
|
662
662
|
n >= 4294967296 && i++, s[e] = n, s[e + 1] = i;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function Er(s, e) {
|
|
665
665
|
return s[e] ^ s[e + 1] << 8 ^ s[e + 2] << 16 ^ s[e + 3] << 24;
|
|
666
666
|
}
|
|
667
667
|
function Tt(s, e, t, r, n, i) {
|
|
668
|
-
var c =
|
|
668
|
+
var c = re[n], l = re[n + 1], A = re[i], y = re[i + 1];
|
|
669
669
|
ue(H, s, e), nr(H, s, c, l);
|
|
670
670
|
var B = H[r] ^ H[s], b = H[r + 1] ^ H[s + 1];
|
|
671
|
-
H[r] = b, H[r + 1] = B, ue(H, t, r), B = H[e] ^ H[t], b = H[e + 1] ^ H[t + 1], H[e] = B >>> 24 ^ b << 8, H[e + 1] = b >>> 24 ^ B << 8, ue(H, s, e), nr(H, s,
|
|
671
|
+
H[r] = b, H[r + 1] = B, ue(H, t, r), B = H[e] ^ H[t], b = H[e + 1] ^ H[t + 1], H[e] = B >>> 24 ^ b << 8, H[e + 1] = b >>> 24 ^ B << 8, ue(H, s, e), nr(H, s, A, y), B = H[r] ^ H[s], b = H[r + 1] ^ H[s + 1], H[r] = B >>> 16 ^ b << 16, H[r + 1] = b >>> 16 ^ B << 16, ue(H, t, r), B = H[e] ^ H[t], b = H[e + 1] ^ H[t + 1], H[e] = b >>> 31 ^ B << 1, H[e + 1] = B >>> 31 ^ b << 1;
|
|
672
672
|
}
|
|
673
673
|
var br = new Uint32Array([
|
|
674
674
|
4089235720,
|
|
@@ -687,7 +687,7 @@ var br = new Uint32Array([
|
|
|
687
687
|
528734635,
|
|
688
688
|
327033209,
|
|
689
689
|
1541459225
|
|
690
|
-
]),
|
|
690
|
+
]), Ss = [
|
|
691
691
|
0,
|
|
692
692
|
1,
|
|
693
693
|
2,
|
|
@@ -880,15 +880,15 @@ var br = new Uint32Array([
|
|
|
880
880
|
7,
|
|
881
881
|
5,
|
|
882
882
|
3
|
|
883
|
-
], it = new Uint8Array(
|
|
883
|
+
], it = new Uint8Array(Ss.map(function(s) {
|
|
884
884
|
return s * 2;
|
|
885
|
-
})), H = new Uint32Array(32),
|
|
885
|
+
})), H = new Uint32Array(32), re = new Uint32Array(32);
|
|
886
886
|
function vr(s, e) {
|
|
887
887
|
var t = 0;
|
|
888
888
|
for (t = 0; t < 16; t++)
|
|
889
889
|
H[t] = s.h[t], H[t + 16] = br[t];
|
|
890
890
|
for (H[24] = H[24] ^ s.t, H[25] = H[25] ^ s.t / 4294967296, e && (H[28] = ~H[28], H[29] = ~H[29]), t = 0; t < 32; t++)
|
|
891
|
-
|
|
891
|
+
re[t] = Er(s.b, 4 * t);
|
|
892
892
|
for (t = 0; t < 12; t++)
|
|
893
893
|
Tt(0, 8, 16, 24, it[t * 16 + 0], it[t * 16 + 1]), Tt(2, 10, 18, 26, it[t * 16 + 2], it[t * 16 + 3]), Tt(4, 12, 20, 28, it[t * 16 + 4], it[t * 16 + 5]), Tt(6, 14, 22, 30, it[t * 16 + 6], it[t * 16 + 7]), Tt(0, 10, 20, 30, it[t * 16 + 8], it[t * 16 + 9]), Tt(2, 12, 22, 24, it[t * 16 + 10], it[t * 16 + 11]), Tt(4, 14, 16, 26, it[t * 16 + 12], it[t * 16 + 13]), Tt(6, 8, 18, 28, it[t * 16 + 14], it[t * 16 + 15]);
|
|
894
894
|
for (t = 0; t < 16; t++)
|
|
@@ -960,22 +960,22 @@ var Nt = new Uint8Array([
|
|
|
960
960
|
0,
|
|
961
961
|
0
|
|
962
962
|
]);
|
|
963
|
-
function
|
|
963
|
+
function Jt(s, e, t, r) {
|
|
964
964
|
Nt.fill(0), this.b = new Uint8Array(128), this.h = new Uint32Array(16), this.t = 0, this.c = 0, this.outlen = s, Nt[0] = s, e && (Nt[1] = e.length), Nt[2] = 1, Nt[3] = 1, t && Nt.set(t, 32), r && Nt.set(r, 48);
|
|
965
965
|
for (var n = 0; n < 16; n++)
|
|
966
|
-
this.h[n] = br[n] ^
|
|
966
|
+
this.h[n] = br[n] ^ Er(Nt, n * 4);
|
|
967
967
|
e && (Qr(this, e), this.c = 128);
|
|
968
968
|
}
|
|
969
|
-
|
|
969
|
+
Jt.prototype.update = function(s) {
|
|
970
970
|
return Ut(s != null, "input must be Uint8Array or Buffer"), Qr(this, s), this;
|
|
971
971
|
};
|
|
972
|
-
|
|
972
|
+
Jt.prototype.digest = function(s) {
|
|
973
973
|
var e = !s || s === "binary" || s === "hex" ? new Uint8Array(this.outlen) : s;
|
|
974
|
-
return Ut(e.length >= this.outlen, "out must have at least outlen bytes of space"),
|
|
974
|
+
return Ut(e.length >= this.outlen, "out must have at least outlen bytes of space"), Es(this, e), s === "hex" ? bs(e) : e;
|
|
975
975
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
976
|
+
Jt.prototype.final = Jt.prototype.digest;
|
|
977
|
+
Jt.ready = function(s) {
|
|
978
|
+
ae.ready(function() {
|
|
979
979
|
s();
|
|
980
980
|
});
|
|
981
981
|
};
|
|
@@ -983,7 +983,7 @@ function Qr(s, e) {
|
|
|
983
983
|
for (var t = 0; t < e.length; t++)
|
|
984
984
|
s.c === 128 && (s.t += s.c, vr(s, !1), s.c = 0), s.b[s.c++] = e[t];
|
|
985
985
|
}
|
|
986
|
-
function
|
|
986
|
+
function Es(s, e) {
|
|
987
987
|
for (s.t += s.c; s.c < 128; )
|
|
988
988
|
s.b[s.c++] = 0;
|
|
989
989
|
vr(s, !0);
|
|
@@ -999,34 +999,34 @@ function bs(s) {
|
|
|
999
999
|
function vs(s) {
|
|
1000
1000
|
return s < 16 ? "0" + s.toString(16) : s.toString(16);
|
|
1001
1001
|
}
|
|
1002
|
-
var Dr =
|
|
1002
|
+
var Dr = Jt;
|
|
1003
1003
|
ot.exports = function(e, t, r, n, i) {
|
|
1004
1004
|
return i !== !0 && (Ut(e >= ir, "outlen must be at least " + ir + ", was given " + e), Ut(e <= ar, "outlen must be at most " + ar + ", was given " + e), t != null && Ut(t.length >= or, "key must be at least " + or + ", was given " + t.length), t != null && Ut(t.length <= cr, "key must be at most " + cr + ", was given " + t.length), r != null && Ut(r.length === ur, "salt must be exactly " + ur + ", was given " + r.length), n != null && Ut(n.length === lr, "personal must be exactly " + lr + ", was given " + n.length)), new Dr(e, t, r, n);
|
|
1005
1005
|
};
|
|
1006
1006
|
ot.exports.ready = function(s) {
|
|
1007
|
-
|
|
1007
|
+
ae.ready(function() {
|
|
1008
1008
|
s();
|
|
1009
1009
|
});
|
|
1010
1010
|
};
|
|
1011
|
-
ot.exports.WASM_SUPPORTED =
|
|
1011
|
+
ot.exports.WASM_SUPPORTED = ae.SUPPORTED;
|
|
1012
1012
|
ot.exports.WASM_LOADED = !1;
|
|
1013
1013
|
var ir = ot.exports.BYTES_MIN = 16, ar = ot.exports.BYTES_MAX = 64;
|
|
1014
1014
|
ot.exports.BYTES = 32;
|
|
1015
1015
|
var or = ot.exports.KEYBYTES_MIN = 16, cr = ot.exports.KEYBYTES_MAX = 64;
|
|
1016
1016
|
ot.exports.KEYBYTES = 32;
|
|
1017
1017
|
var ur = ot.exports.SALTBYTES = 16, lr = ot.exports.PERSONALBYTES = 16;
|
|
1018
|
-
|
|
1019
|
-
s || (ot.exports.WASM_LOADED = !0, Dr =
|
|
1018
|
+
ae.ready(function(s) {
|
|
1019
|
+
s || (ot.exports.WASM_LOADED = !0, Dr = ae);
|
|
1020
1020
|
});
|
|
1021
|
-
var
|
|
1022
|
-
Object.defineProperty(
|
|
1023
|
-
|
|
1021
|
+
var jt = {};
|
|
1022
|
+
Object.defineProperty(jt, "__esModule", { value: !0 });
|
|
1023
|
+
jt.bech32m = jt.bech32 = void 0;
|
|
1024
1024
|
const _e = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", kr = {};
|
|
1025
1025
|
for (let s = 0; s < _e.length; s++) {
|
|
1026
1026
|
const e = _e.charAt(s);
|
|
1027
1027
|
kr[e] = s;
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1029
|
+
function zt(s) {
|
|
1030
1030
|
const e = s >> 25;
|
|
1031
1031
|
return (s & 33554431) << 5 ^ -(e >> 0 & 1) & 996825010 ^ -(e >> 1 & 1) & 642813549 ^ -(e >> 2 & 1) & 513874426 ^ -(e >> 3 & 1) & 1027748829 ^ -(e >> 4 & 1) & 705979059;
|
|
1032
1032
|
}
|
|
@@ -1036,20 +1036,20 @@ function hr(s) {
|
|
|
1036
1036
|
const r = s.charCodeAt(t);
|
|
1037
1037
|
if (r < 33 || r > 126)
|
|
1038
1038
|
return "Invalid prefix (" + s + ")";
|
|
1039
|
-
e =
|
|
1039
|
+
e = zt(e) ^ r >> 5;
|
|
1040
1040
|
}
|
|
1041
|
-
e =
|
|
1041
|
+
e = zt(e);
|
|
1042
1042
|
for (let t = 0; t < s.length; ++t) {
|
|
1043
1043
|
const r = s.charCodeAt(t);
|
|
1044
|
-
e =
|
|
1044
|
+
e = zt(e) ^ r & 31;
|
|
1045
1045
|
}
|
|
1046
1046
|
return e;
|
|
1047
1047
|
}
|
|
1048
1048
|
function qe(s, e, t, r) {
|
|
1049
1049
|
let n = 0, i = 0;
|
|
1050
1050
|
const c = (1 << t) - 1, l = [];
|
|
1051
|
-
for (let
|
|
1052
|
-
for (n = n << e | s[
|
|
1051
|
+
for (let A = 0; A < s.length; ++A)
|
|
1052
|
+
for (n = n << e | s[A], i += e; i >= t; )
|
|
1053
1053
|
i -= t, l.push(n >> i & c);
|
|
1054
1054
|
if (r)
|
|
1055
1055
|
i > 0 && l.push(n << t - i & c);
|
|
@@ -1078,8 +1078,8 @@ function ks(s) {
|
|
|
1078
1078
|
function Tr(s) {
|
|
1079
1079
|
let e;
|
|
1080
1080
|
s === "bech32" ? e = 1 : e = 734539939;
|
|
1081
|
-
function t(c, l,
|
|
1082
|
-
if (
|
|
1081
|
+
function t(c, l, A) {
|
|
1082
|
+
if (A = A || 90, c.length + 7 + l.length > A)
|
|
1083
1083
|
throw new TypeError("Exceeds length limit");
|
|
1084
1084
|
c = c.toLowerCase();
|
|
1085
1085
|
let y = hr(c);
|
|
@@ -1090,10 +1090,10 @@ function Tr(s) {
|
|
|
1090
1090
|
const w = l[b];
|
|
1091
1091
|
if (w >> 5 !== 0)
|
|
1092
1092
|
throw new Error("Non 5-bit word");
|
|
1093
|
-
y =
|
|
1093
|
+
y = zt(y) ^ w, B += _e.charAt(w);
|
|
1094
1094
|
}
|
|
1095
1095
|
for (let b = 0; b < 6; ++b)
|
|
1096
|
-
y =
|
|
1096
|
+
y = zt(y);
|
|
1097
1097
|
y ^= e;
|
|
1098
1098
|
for (let b = 0; b < 6; ++b) {
|
|
1099
1099
|
const w = y >> (5 - b) * 5 & 31;
|
|
@@ -1106,10 +1106,10 @@ function Tr(s) {
|
|
|
1106
1106
|
return c + " too short";
|
|
1107
1107
|
if (c.length > l)
|
|
1108
1108
|
return "Exceeds length limit";
|
|
1109
|
-
const
|
|
1110
|
-
if (c !==
|
|
1109
|
+
const A = c.toLowerCase(), y = c.toUpperCase();
|
|
1110
|
+
if (c !== A && c !== y)
|
|
1111
1111
|
return "Mixed-case string " + c;
|
|
1112
|
-
c =
|
|
1112
|
+
c = A;
|
|
1113
1113
|
const B = c.lastIndexOf("1");
|
|
1114
1114
|
if (B === -1)
|
|
1115
1115
|
return "No separator character for " + c;
|
|
@@ -1126,20 +1126,20 @@ function Tr(s) {
|
|
|
1126
1126
|
const N = w.charAt(k), T = kr[N];
|
|
1127
1127
|
if (T === void 0)
|
|
1128
1128
|
return "Unknown character " + N;
|
|
1129
|
-
v =
|
|
1129
|
+
v = zt(v) ^ T, !(k + 6 >= w.length) && U.push(T);
|
|
1130
1130
|
}
|
|
1131
1131
|
return v !== e ? "Invalid checksum for " + c : { prefix: b, words: U };
|
|
1132
1132
|
}
|
|
1133
1133
|
function n(c, l) {
|
|
1134
|
-
const
|
|
1135
|
-
if (typeof
|
|
1136
|
-
return
|
|
1134
|
+
const A = r(c, l);
|
|
1135
|
+
if (typeof A == "object")
|
|
1136
|
+
return A;
|
|
1137
1137
|
}
|
|
1138
1138
|
function i(c, l) {
|
|
1139
|
-
const
|
|
1140
|
-
if (typeof
|
|
1141
|
-
return
|
|
1142
|
-
throw new Error(
|
|
1139
|
+
const A = r(c, l);
|
|
1140
|
+
if (typeof A == "object")
|
|
1141
|
+
return A;
|
|
1142
|
+
throw new Error(A);
|
|
1143
1143
|
}
|
|
1144
1144
|
return {
|
|
1145
1145
|
decodeUnsafe: n,
|
|
@@ -1150,30 +1150,30 @@ function Tr(s) {
|
|
|
1150
1150
|
fromWords: ks
|
|
1151
1151
|
};
|
|
1152
1152
|
}
|
|
1153
|
-
|
|
1154
|
-
|
|
1153
|
+
jt.bech32 = Tr("bech32");
|
|
1154
|
+
jt.bech32m = Tr("bech32m");
|
|
1155
1155
|
var Ts = Te && Te.__importDefault || function(s) {
|
|
1156
1156
|
return s && s.__esModule ? s : { default: s };
|
|
1157
1157
|
};
|
|
1158
1158
|
Object.defineProperty(Br, "__esModule", { value: !0 });
|
|
1159
|
-
const Ns = Ts(ot.exports), le =
|
|
1160
|
-
class
|
|
1159
|
+
const Ns = Ts(ot.exports), le = jt, ve = "asset";
|
|
1160
|
+
class ne {
|
|
1161
1161
|
constructor(e) {
|
|
1162
1162
|
this.hashBuf = e;
|
|
1163
1163
|
}
|
|
1164
1164
|
static fromHash(e) {
|
|
1165
|
-
return new
|
|
1165
|
+
return new ne(e);
|
|
1166
1166
|
}
|
|
1167
1167
|
static fromParts(e, t) {
|
|
1168
1168
|
const r = (0, Ns.default)(20).update(new Uint8Array([...e, ...t])).digest("binary");
|
|
1169
|
-
return
|
|
1169
|
+
return ne.fromHash(r);
|
|
1170
1170
|
}
|
|
1171
1171
|
static fromBech32(e) {
|
|
1172
1172
|
const { prefix: t, words: r } = le.bech32.decode(e);
|
|
1173
1173
|
if (t !== ve)
|
|
1174
1174
|
throw new Error("Invalid asset fingerprint");
|
|
1175
1175
|
const n = Buffer.from(le.bech32.fromWords(r));
|
|
1176
|
-
return
|
|
1176
|
+
return ne.fromHash(n);
|
|
1177
1177
|
}
|
|
1178
1178
|
fingerprint() {
|
|
1179
1179
|
const e = le.bech32.toWords(this.hashBuf);
|
|
@@ -1189,11 +1189,11 @@ class se {
|
|
|
1189
1189
|
return this.fingerprint().slice(-6);
|
|
1190
1190
|
}
|
|
1191
1191
|
}
|
|
1192
|
-
var Us = Br.default =
|
|
1192
|
+
var Us = Br.default = ne;
|
|
1193
1193
|
const Ps = Us, Os = (s, e) => {
|
|
1194
1194
|
const t = Ms(s), r = t.derive(be + 1852).derive(be + 1815).derive(be + e), n = r.derive(0).derive(0).to_raw_key(), i = r.derive(2).derive(0).to_raw_key();
|
|
1195
1195
|
return r.free(), t.free(), { paymentKey: n, stakeKey: i };
|
|
1196
|
-
},
|
|
1196
|
+
}, Gt = (s) => a.Address.from_bytes(G(s)), Ms = (s) => a.Bip32PrivateKey.from_bytes(G(s)), Ks = (s) => a.DataHash.from_bytes(G(s)), Ct = (s) => a.Ed25519KeyHash.from_bytes(G(s)), Hs = (s) => a.Ed25519Signature.from_bytes(G(s)), Ve = (s) => a.NativeScript.from_bytes(G(s)), Fs = (s) => a.PublicKey.from_bytes(G(s)), Nr = (s) => a.PlutusData.from_bytes(G(s)), Xt = (s, e) => a.PlutusScript.from_bytes_with_version(G(s), vt[e]), Rs = (s) => a.ScriptRef.from_bytes(G(s)), qs = (s) => a.ScriptHash.from_bytes(G(s)), _t = (s) => a.Transaction.from_bytes(G(s)), Ur = (s) => a.TransactionHash.from_bytes(G(s)), dr = (s) => a.TransactionUnspentOutput.from_bytes(G(s)), fr = (s) => a.TransactionWitnessSet.from_bytes(G(s)), Vs = (s) => a.Value.from_bytes(G(s)), yt = (s) => a.Address.from_bech32(s), Le = (s) => a.BaseAddress.from_address(yt(s)), Pr = (s) => a.EnterpriseAddress.from_address(yt(s)), Or = (s) => a.RewardAddress.from_address(yt(s)), ut = (s) => Buffer.from(s).toString("hex"), G = (s) => s.length % 2 === 0 && /^[0-9A-F]*$/i.test(s) ? Buffer.from(s, "hex") : Buffer.from(s, "utf-8"), Ge = (s) => {
|
|
1197
1197
|
const e = (t) => {
|
|
1198
1198
|
const r = new Array();
|
|
1199
1199
|
for (let n = 0; n < t.len(); n += 1)
|
|
@@ -1241,11 +1241,11 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1241
1241
|
default:
|
|
1242
1242
|
throw new Error(`Script Kind: ${s.kind()}, is not supported`);
|
|
1243
1243
|
}
|
|
1244
|
-
},
|
|
1244
|
+
}, Vt = (s) => {
|
|
1245
1245
|
const e = (t) => {
|
|
1246
1246
|
const r = a.NativeScripts.new();
|
|
1247
1247
|
return t.forEach((n) => {
|
|
1248
|
-
r.add(
|
|
1248
|
+
r.add(Vt(n));
|
|
1249
1249
|
}), r;
|
|
1250
1250
|
};
|
|
1251
1251
|
switch (s.type) {
|
|
@@ -1262,18 +1262,18 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1262
1262
|
case "sig":
|
|
1263
1263
|
return a.NativeScript.new_script_pubkey(a.ScriptPubkey.new(Ct(s.keyHash)));
|
|
1264
1264
|
}
|
|
1265
|
-
},
|
|
1265
|
+
}, pe = (s) => {
|
|
1266
1266
|
var r, n, i;
|
|
1267
1267
|
const e = (c) => {
|
|
1268
1268
|
const l = [];
|
|
1269
|
-
for (let
|
|
1270
|
-
l.push(
|
|
1269
|
+
for (let A = 0; A < c.len(); A += 1)
|
|
1270
|
+
l.push(pe(c.get(A)));
|
|
1271
1271
|
return l;
|
|
1272
1272
|
}, t = (c) => {
|
|
1273
1273
|
const l = /* @__PURE__ */ new Map();
|
|
1274
|
-
for (let
|
|
1275
|
-
const y = c.keys().get(
|
|
1276
|
-
l.set(
|
|
1274
|
+
for (let A = 0; A < c.len(); A += 1) {
|
|
1275
|
+
const y = c.keys().get(A), B = c.get(y) ?? a.PlutusData.from_hex(ht("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));
|
|
1276
|
+
l.set(pe(y), pe(B));
|
|
1277
1277
|
}
|
|
1278
1278
|
return l;
|
|
1279
1279
|
};
|
|
@@ -1344,18 +1344,18 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1344
1344
|
const t = s.plutus_script();
|
|
1345
1345
|
return {
|
|
1346
1346
|
code: t.to_hex(),
|
|
1347
|
-
version: Object.keys(
|
|
1347
|
+
version: Object.keys(vt).find((r) => vt[r].to_hex() === t.language_version().to_hex())
|
|
1348
1348
|
};
|
|
1349
1349
|
}
|
|
1350
1350
|
const e = s.native_script();
|
|
1351
1351
|
return Ge(e);
|
|
1352
|
-
},
|
|
1352
|
+
}, Zt = (s) => {
|
|
1353
1353
|
if ("code" in s) {
|
|
1354
|
-
const e =
|
|
1354
|
+
const e = Xt(s.code, s.version);
|
|
1355
1355
|
return a.ScriptRef.new_plutus_script(e);
|
|
1356
1356
|
}
|
|
1357
|
-
return a.ScriptRef.new_native_script(
|
|
1358
|
-
},
|
|
1357
|
+
return a.ScriptRef.new_native_script(Vt(s));
|
|
1358
|
+
}, oe = (s) => {
|
|
1359
1359
|
var n, i, c;
|
|
1360
1360
|
const e = s.output().has_data_hash() ? (n = s.output().data_hash()) == null ? void 0 : n.to_hex() : void 0, t = s.output().has_plutus_data() ? (i = s.output().plutus_data()) == null ? void 0 : i.to_hex() : void 0, r = s.output().has_script_ref() ? (c = s.output().script_ref()) == null ? void 0 : c.to_hex() : void 0;
|
|
1361
1361
|
return {
|
|
@@ -1371,8 +1371,8 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1371
1371
|
scriptRef: r
|
|
1372
1372
|
}
|
|
1373
1373
|
};
|
|
1374
|
-
},
|
|
1375
|
-
const e = a.TransactionInput.new(Ur(s.input.txHash), s.input.outputIndex), t = a.TransactionOutput.new(yt(s.output.address),
|
|
1374
|
+
}, gt = (s) => {
|
|
1375
|
+
const e = a.TransactionInput.new(Ur(s.input.txHash), s.input.outputIndex), t = a.TransactionOutput.new(yt(s.output.address), Bt(s.output.amount));
|
|
1376
1376
|
return s.output.dataHash !== void 0 && t.set_data_hash(Ks(s.output.dataHash)), s.output.plutusData !== void 0 && t.set_plutus_data(Nr(s.output.plutusData)), s.output.scriptRef !== void 0 && t.set_script_ref(Rs(s.output.scriptRef)), a.TransactionUnspentOutput.new(e, t);
|
|
1377
1377
|
}, gr = (s) => {
|
|
1378
1378
|
const e = s.split(".")[1] ?? "0", t = `${parseInt(e, 10)}`, r = "1" + "0".repeat(e.length);
|
|
@@ -1387,15 +1387,15 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1387
1387
|
const i = r.get(n), c = t.get(i);
|
|
1388
1388
|
if (c !== void 0) {
|
|
1389
1389
|
const l = c.keys();
|
|
1390
|
-
for (let
|
|
1391
|
-
const y = l.get(
|
|
1390
|
+
for (let A = 0; A < l.len(); A += 1) {
|
|
1391
|
+
const y = l.get(A), B = c.get(y) ?? a.BigNum.from_str("0"), b = i.to_hex() + ut(y.name());
|
|
1392
1392
|
e.push({ unit: b, quantity: B.to_str() });
|
|
1393
1393
|
}
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
1397
1397
|
return e;
|
|
1398
|
-
},
|
|
1398
|
+
}, Bt = (s) => {
|
|
1399
1399
|
const e = s.find((i) => i.unit === "lovelace"), t = Array.from(new Set(s.filter((i) => i.unit !== "lovelace").map((i) => i.unit.slice(0, lt)))), r = a.MultiAsset.new();
|
|
1400
1400
|
t.forEach((i) => {
|
|
1401
1401
|
const c = a.Assets.new();
|
|
@@ -1408,11 +1408,11 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1408
1408
|
}, mr = (s, e, t) => a.BaseAddress.new(s, a.StakeCredential.from_keyhash(e), a.StakeCredential.from_keyhash(t)), Fr = (s, e = "") => a.Bip32PrivateKey.from_bip39_entropy(G(s), G(ht(e))), Ue = (s) => a.DataCost.new_coins_per_byte(a.BigNum.from_str(s)), Gs = (s) => {
|
|
1409
1409
|
if (typeof s != "object" || !("input" in s))
|
|
1410
1410
|
return a.DatumSource.new(Ot(s));
|
|
1411
|
-
const e =
|
|
1411
|
+
const e = gt(s);
|
|
1412
1412
|
if (e.output().has_plutus_data())
|
|
1413
1413
|
return a.DatumSource.new_ref_input(e.input());
|
|
1414
1414
|
throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1415
|
-
},
|
|
1415
|
+
}, pr = (s, e) => a.EnterpriseAddress.new(s, a.StakeCredential.from_keyhash(e)), Ar = (s, e) => {
|
|
1416
1416
|
if (typeof s == "string")
|
|
1417
1417
|
return a.MintWitness.new_native_script(Ve(s));
|
|
1418
1418
|
if (e === void 0)
|
|
@@ -1422,7 +1422,7 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1422
1422
|
return a.MintWitness.new_plutus_script(Oe(s), Ne({
|
|
1423
1423
|
tag: "MINT",
|
|
1424
1424
|
index: 0,
|
|
1425
|
-
budget:
|
|
1425
|
+
budget: Yt,
|
|
1426
1426
|
data: {
|
|
1427
1427
|
alternative: 0,
|
|
1428
1428
|
fields: []
|
|
@@ -1431,25 +1431,25 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1431
1431
|
}));
|
|
1432
1432
|
}, Pe = (s, e) => a.RewardAddress.new(s, a.StakeCredential.from_keyhash(e)), Oe = (s) => {
|
|
1433
1433
|
if ("code" in s)
|
|
1434
|
-
return a.PlutusScriptSource.new(
|
|
1435
|
-
const e =
|
|
1434
|
+
return a.PlutusScriptSource.new(Xt(s.code, s.version));
|
|
1435
|
+
const e = gt(s);
|
|
1436
1436
|
if (e.output().has_script_ref()) {
|
|
1437
1437
|
const t = e.output().script_ref();
|
|
1438
1438
|
if (t.is_plutus_script()) {
|
|
1439
|
-
const r = Kr(t), n =
|
|
1440
|
-
return a.PlutusScriptSource.new_ref_input_with_lang_ver(n, e.input(),
|
|
1439
|
+
const r = Kr(t), n = Xt(r.code, r.version).hash();
|
|
1440
|
+
return a.PlutusScriptSource.new_ref_input_with_lang_ver(n, e.input(), vt[r.version]);
|
|
1441
1441
|
}
|
|
1442
1442
|
}
|
|
1443
1443
|
throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1444
1444
|
}, he = (s) => {
|
|
1445
1445
|
const e = a.ScriptPubkey.new(s);
|
|
1446
1446
|
return a.NativeScript.new_script_pubkey(e);
|
|
1447
|
-
},
|
|
1447
|
+
}, Ae = (s = mt) => {
|
|
1448
1448
|
const e = a.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(a.BigNum.from_str(s.coinsPerUTxOSize)).ex_unit_prices(a.ExUnitPrices.new(gr(s.priceMem.toString()), gr(s.priceStep.toString()))).fee_algo(a.LinearFee.new(a.BigNum.from_str(s.minFeeA.toString()), a.BigNum.from_str(s.minFeeB.toString()))).key_deposit(a.BigNum.from_str(s.keyDeposit)).max_tx_size(s.maxTxSize).max_value_size(parseInt(s.maxValSize, 10)).pool_deposit(a.BigNum.from_str(s.poolDeposit)).build();
|
|
1449
1449
|
return a.TransactionBuilder.new(e);
|
|
1450
1450
|
}, Ir = (s) => {
|
|
1451
1451
|
const e = a.TxInputsBuilder.new();
|
|
1452
|
-
return s.map((t) => t instanceof a.TransactionUnspentOutput ? t :
|
|
1452
|
+
return s.map((t) => t instanceof a.TransactionUnspentOutput ? t : gt(t)).forEach((t) => {
|
|
1453
1453
|
e.add_input(t.output().address(), t.input(), t.output().amount());
|
|
1454
1454
|
}), e;
|
|
1455
1455
|
}, de = (s) => {
|
|
@@ -1461,14 +1461,14 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1461
1461
|
e = e.with_data_hash(a.hash_plutus_data(n)), r && (e = e.with_plutus_data(n));
|
|
1462
1462
|
}
|
|
1463
1463
|
if (s.script) {
|
|
1464
|
-
const t =
|
|
1464
|
+
const t = Zt(s.script);
|
|
1465
1465
|
e = e.with_script_ref(t);
|
|
1466
1466
|
}
|
|
1467
1467
|
return e;
|
|
1468
1468
|
}, Kt = (s) => {
|
|
1469
1469
|
const e = s.slice(0, lt), t = s.includes(".") ? ht(s.split(".")[1]) : s.slice(lt);
|
|
1470
1470
|
return { policyId: e, assetName: t };
|
|
1471
|
-
},
|
|
1471
|
+
}, S = (s) => Mt.isAxiosError(s) ? s.response ? JSON.stringify({
|
|
1472
1472
|
data: s.response.data,
|
|
1473
1473
|
headers: s.response.headers,
|
|
1474
1474
|
status: s.response.status
|
|
@@ -1482,9 +1482,9 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1482
1482
|
}
|
|
1483
1483
|
throw new Error(`Couldn't resolve EpochNo for network: ${s}`);
|
|
1484
1484
|
}, Rr = (s, e) => Ps.fromParts(G(s), G(e)).fingerprint(), dn = (s, e) => es[s][e], fn = (s, e = 0) => {
|
|
1485
|
-
const t =
|
|
1485
|
+
const t = Vt(s);
|
|
1486
1486
|
return a.EnterpriseAddress.new(e, a.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32();
|
|
1487
|
-
}, gn = (s) =>
|
|
1487
|
+
}, gn = (s) => Vt(s).hash().to_hex(), mn = (s) => Vt(s).to_hex(), $t = (s) => {
|
|
1488
1488
|
var e, t;
|
|
1489
1489
|
try {
|
|
1490
1490
|
const r = [
|
|
@@ -1497,8 +1497,8 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1497
1497
|
} catch (r) {
|
|
1498
1498
|
throw new Error(`An error occurred during resolvePaymentKeyHash: ${r}.`);
|
|
1499
1499
|
}
|
|
1500
|
-
},
|
|
1501
|
-
const t =
|
|
1500
|
+
}, pn = (s, e = 0) => {
|
|
1501
|
+
const t = Xt(s.code, s.version);
|
|
1502
1502
|
return a.EnterpriseAddress.new(e, a.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32();
|
|
1503
1503
|
}, An = (s) => {
|
|
1504
1504
|
try {
|
|
@@ -1509,10 +1509,10 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1509
1509
|
} catch (e) {
|
|
1510
1510
|
throw new Error(`An error occurred during resolveScriptHash: ${e}.`);
|
|
1511
1511
|
}
|
|
1512
|
-
},
|
|
1512
|
+
}, In = (s) => a.Ed25519KeyHash.from_hex(s).to_bech32("pool1"), Ys = (s) => {
|
|
1513
1513
|
const e = yr(s.join(" ")), t = Fr(e), r = t.to_bech32();
|
|
1514
1514
|
return t.free(), r;
|
|
1515
|
-
},
|
|
1515
|
+
}, _n = (s) => Zt(s).to_hex(), yn = (s, e = Date.now()) => {
|
|
1516
1516
|
if (Ie[s]) {
|
|
1517
1517
|
const [t, r, n] = Ie[s];
|
|
1518
1518
|
return a.BigNum.from_str(e.toString()).div_floor(a.BigNum.from_str("1000")).checked_sub(a.BigNum.from_str(n)).checked_add(a.BigNum.from_str(r)).to_str();
|
|
@@ -1527,7 +1527,7 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1527
1527
|
} catch (e) {
|
|
1528
1528
|
throw new Error(`An error occurred during resolveRewardAddress: ${e}.`);
|
|
1529
1529
|
}
|
|
1530
|
-
},
|
|
1530
|
+
}, se = (s) => {
|
|
1531
1531
|
var e, t;
|
|
1532
1532
|
try {
|
|
1533
1533
|
const r = [
|
|
@@ -1540,10 +1540,10 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1540
1540
|
} catch (r) {
|
|
1541
1541
|
throw new Error(`An error occurred during resolveStakeKeyHash: ${r}.`);
|
|
1542
1542
|
}
|
|
1543
|
-
}, qr = (s, e =
|
|
1543
|
+
}, qr = (s, e = mt.minFeeA, t = mt.minFeeB) => (BigInt(e) * BigInt(s) + BigInt(t)).toString(), $s = (s) => {
|
|
1544
1544
|
const e = _t(s).body();
|
|
1545
1545
|
return a.hash_transaction(e).to_hex();
|
|
1546
|
-
},
|
|
1546
|
+
}, xn = (s = "", e = 32) => {
|
|
1547
1547
|
if (e <= 0 || e > 2048)
|
|
1548
1548
|
throw new Error("Length must be bewteen 1 and 2048");
|
|
1549
1549
|
const r = _r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);
|
|
@@ -1562,8 +1562,8 @@ const Ps = Us, Os = (s, e) => {
|
|
|
1562
1562
|
}), n;
|
|
1563
1563
|
}
|
|
1564
1564
|
return e;
|
|
1565
|
-
},
|
|
1566
|
-
class
|
|
1565
|
+
}, wn = (s) => pe(Nr(s)), Cn = (s) => _t(s).to_js_value();
|
|
1566
|
+
class Bn {
|
|
1567
1567
|
_axiosInstance;
|
|
1568
1568
|
constructor(...e) {
|
|
1569
1569
|
if (typeof e[0] == "string" && e[0].startsWith("http"))
|
|
@@ -1588,9 +1588,9 @@ class Cn {
|
|
|
1588
1588
|
rewards: r.withdrawable_amount,
|
|
1589
1589
|
withdrawals: r.withdrawals_sum
|
|
1590
1590
|
};
|
|
1591
|
-
throw
|
|
1591
|
+
throw S(r);
|
|
1592
1592
|
} catch (r) {
|
|
1593
|
-
throw
|
|
1593
|
+
throw S(r);
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
1596
|
resolveScriptRef = async (e) => {
|
|
@@ -1601,9 +1601,9 @@ class Cn {
|
|
|
1601
1601
|
code: await this.fetchPlutusScriptCBOR(e),
|
|
1602
1602
|
version: t.type.replace("plutus", "")
|
|
1603
1603
|
} : await this.fetchNativeScriptJSON(e);
|
|
1604
|
-
return
|
|
1604
|
+
return Zt(n).to_hex();
|
|
1605
1605
|
}
|
|
1606
|
-
throw
|
|
1606
|
+
throw S(t);
|
|
1607
1607
|
}
|
|
1608
1608
|
};
|
|
1609
1609
|
toUTxO = async (e, t) => ({
|
|
@@ -1622,13 +1622,13 @@ class Cn {
|
|
|
1622
1622
|
});
|
|
1623
1623
|
async fetchAddressUTxOs(e, t) {
|
|
1624
1624
|
const r = t !== void 0 ? `/${t}` : "", n = `addresses/${e}/utxos` + r, i = async (c = 1, l = []) => {
|
|
1625
|
-
const { data:
|
|
1625
|
+
const { data: A, status: y } = await this._axiosInstance.get(`${n}?page=${c}`);
|
|
1626
1626
|
if (y === 200)
|
|
1627
|
-
return
|
|
1627
|
+
return A.length > 0 ? i(c + 1, [
|
|
1628
1628
|
...l,
|
|
1629
|
-
...await Promise.all(
|
|
1629
|
+
...await Promise.all(A.map((B) => this.toUTxO(B, B.tx_hash)))
|
|
1630
1630
|
]) : l;
|
|
1631
|
-
throw
|
|
1631
|
+
throw S(A);
|
|
1632
1632
|
};
|
|
1633
1633
|
try {
|
|
1634
1634
|
return await i();
|
|
@@ -1638,10 +1638,10 @@ class Cn {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
async fetchAssetAddresses(e) {
|
|
1640
1640
|
const t = async (r = 1, n = []) => {
|
|
1641
|
-
const { policyId: i, assetName: c } = Kt(e), { data: l, status:
|
|
1642
|
-
if (
|
|
1641
|
+
const { policyId: i, assetName: c } = Kt(e), { data: l, status: A } = await this._axiosInstance.get(`assets/${i}${c}/addresses?page=${r}`);
|
|
1642
|
+
if (A === 200)
|
|
1643
1643
|
return l.length > 0 ? t(r + 1, [...n, ...l]) : n;
|
|
1644
|
-
throw
|
|
1644
|
+
throw S(l);
|
|
1645
1645
|
};
|
|
1646
1646
|
try {
|
|
1647
1647
|
return await t();
|
|
@@ -1656,9 +1656,9 @@ class Cn {
|
|
|
1656
1656
|
return {
|
|
1657
1657
|
...n.onchain_metadata
|
|
1658
1658
|
};
|
|
1659
|
-
throw
|
|
1659
|
+
throw S(n);
|
|
1660
1660
|
} catch (t) {
|
|
1661
|
-
throw
|
|
1661
|
+
throw S(t);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
async fetchBlockInfo(e) {
|
|
@@ -1682,9 +1682,9 @@ class Cn {
|
|
|
1682
1682
|
txCount: t.tx_count,
|
|
1683
1683
|
VRFKey: t.block_vrf
|
|
1684
1684
|
};
|
|
1685
|
-
throw
|
|
1685
|
+
throw S(t);
|
|
1686
1686
|
} catch (t) {
|
|
1687
|
-
throw
|
|
1687
|
+
throw S(t);
|
|
1688
1688
|
}
|
|
1689
1689
|
}
|
|
1690
1690
|
async fetchCollectionAssets(e, t = 1) {
|
|
@@ -1698,7 +1698,7 @@ class Cn {
|
|
|
1698
1698
|
})),
|
|
1699
1699
|
next: r.length === 100 ? t + 1 : null
|
|
1700
1700
|
};
|
|
1701
|
-
throw
|
|
1701
|
+
throw S(r);
|
|
1702
1702
|
} catch {
|
|
1703
1703
|
return { assets: [], next: null };
|
|
1704
1704
|
}
|
|
@@ -1708,9 +1708,9 @@ class Cn {
|
|
|
1708
1708
|
const t = ht(e.replace("$", "")), { data: r, status: n } = await this._axiosInstance.get(`assets/${He[1]}${t}/addresses`);
|
|
1709
1709
|
if (n === 200)
|
|
1710
1710
|
return r[0].address;
|
|
1711
|
-
throw
|
|
1711
|
+
throw S(r);
|
|
1712
1712
|
} catch (t) {
|
|
1713
|
-
throw
|
|
1713
|
+
throw S(t);
|
|
1714
1714
|
}
|
|
1715
1715
|
}
|
|
1716
1716
|
async fetchProtocolParameters(e = Number.NaN) {
|
|
@@ -1739,9 +1739,9 @@ class Cn {
|
|
|
1739
1739
|
priceMem: t.price_mem,
|
|
1740
1740
|
priceStep: t.price_step
|
|
1741
1741
|
};
|
|
1742
|
-
throw
|
|
1742
|
+
throw S(t);
|
|
1743
1743
|
} catch (t) {
|
|
1744
|
-
throw
|
|
1744
|
+
throw S(t);
|
|
1745
1745
|
}
|
|
1746
1746
|
}
|
|
1747
1747
|
async fetchTxInfo(e) {
|
|
@@ -1759,9 +1759,9 @@ class Cn {
|
|
|
1759
1759
|
slot: t.slot.toString(),
|
|
1760
1760
|
size: t.size
|
|
1761
1761
|
};
|
|
1762
|
-
throw
|
|
1762
|
+
throw S(t);
|
|
1763
1763
|
} catch (t) {
|
|
1764
|
-
throw
|
|
1764
|
+
throw S(t);
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
1767
|
async fetchUTxOs(e) {
|
|
@@ -1773,9 +1773,9 @@ class Cn {
|
|
|
1773
1773
|
i.push(this.toUTxO(l, e));
|
|
1774
1774
|
}), await Promise.all(i);
|
|
1775
1775
|
}
|
|
1776
|
-
throw
|
|
1776
|
+
throw S(t);
|
|
1777
1777
|
} catch (t) {
|
|
1778
|
-
throw
|
|
1778
|
+
throw S(t);
|
|
1779
1779
|
}
|
|
1780
1780
|
}
|
|
1781
1781
|
onTxConfirmed(e, t, r = 100) {
|
|
@@ -1797,25 +1797,25 @@ class Cn {
|
|
|
1797
1797
|
const t = { "Content-Type": "application/cbor" }, { data: r, status: n } = await this._axiosInstance.post("tx/submit", G(e), { headers: t });
|
|
1798
1798
|
if (n === 200)
|
|
1799
1799
|
return r;
|
|
1800
|
-
throw
|
|
1800
|
+
throw S(r);
|
|
1801
1801
|
} catch (t) {
|
|
1802
|
-
throw
|
|
1802
|
+
throw S(t);
|
|
1803
1803
|
}
|
|
1804
1804
|
}
|
|
1805
1805
|
async fetchPlutusScriptCBOR(e) {
|
|
1806
1806
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/cbor`);
|
|
1807
1807
|
if (r === 200)
|
|
1808
1808
|
return t.cbor;
|
|
1809
|
-
throw
|
|
1809
|
+
throw S(t);
|
|
1810
1810
|
}
|
|
1811
1811
|
async fetchNativeScriptJSON(e) {
|
|
1812
1812
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/json`);
|
|
1813
1813
|
if (r === 200)
|
|
1814
1814
|
return t.json;
|
|
1815
|
-
throw
|
|
1815
|
+
throw S(t);
|
|
1816
1816
|
}
|
|
1817
1817
|
}
|
|
1818
|
-
class
|
|
1818
|
+
class Sn {
|
|
1819
1819
|
_axiosInstance;
|
|
1820
1820
|
constructor(e, t, r) {
|
|
1821
1821
|
const n = r.host ?? "ipfs.infura.io", i = r.port ?? 5001, c = r.version ?? 0;
|
|
@@ -1829,9 +1829,9 @@ class Bn {
|
|
|
1829
1829
|
const r = { "Content-Type": "multipart/form-data" }, { data: n, status: i } = await this._axiosInstance.post(`add?recursive=${t}`, e, { headers: r });
|
|
1830
1830
|
if (i === 200)
|
|
1831
1831
|
return n;
|
|
1832
|
-
throw
|
|
1832
|
+
throw S(n);
|
|
1833
1833
|
} catch (r) {
|
|
1834
|
-
throw
|
|
1834
|
+
throw S(r);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
}
|
|
@@ -1869,9 +1869,9 @@ class En {
|
|
|
1869
1869
|
rewards: r[0].rewards_available,
|
|
1870
1870
|
withdrawals: r[0].withdrawals
|
|
1871
1871
|
};
|
|
1872
|
-
throw
|
|
1872
|
+
throw S(r);
|
|
1873
1873
|
} catch (t) {
|
|
1874
|
-
throw
|
|
1874
|
+
throw S(t);
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
async fetchAddressUTxOs(e, t) {
|
|
@@ -1883,7 +1883,7 @@ class En {
|
|
|
1883
1883
|
const i = r.flatMap((c) => c.utxo_set).map((c) => this.toUTxO(c, e));
|
|
1884
1884
|
return t !== void 0 ? i.filter((c) => c.output.amount.find((l) => l.unit === t) !== void 0) : i;
|
|
1885
1885
|
}
|
|
1886
|
-
throw
|
|
1886
|
+
throw S(r);
|
|
1887
1887
|
} catch {
|
|
1888
1888
|
return [];
|
|
1889
1889
|
}
|
|
@@ -1896,9 +1896,9 @@ class En {
|
|
|
1896
1896
|
address: c.payment_address,
|
|
1897
1897
|
quantity: c.quantity
|
|
1898
1898
|
}));
|
|
1899
|
-
throw
|
|
1899
|
+
throw S(n);
|
|
1900
1900
|
} catch (t) {
|
|
1901
|
-
throw
|
|
1901
|
+
throw S(t);
|
|
1902
1902
|
}
|
|
1903
1903
|
}
|
|
1904
1904
|
async fetchAssetMetadata(e) {
|
|
@@ -1908,9 +1908,9 @@ class En {
|
|
|
1908
1908
|
return {
|
|
1909
1909
|
...n[0].minting_tx_metadata[721][t][Ye(r)]
|
|
1910
1910
|
};
|
|
1911
|
-
throw
|
|
1911
|
+
throw S(n);
|
|
1912
1912
|
} catch (t) {
|
|
1913
|
-
throw
|
|
1913
|
+
throw S(t);
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
1916
|
async fetchBlockInfo(e) {
|
|
@@ -1936,9 +1936,9 @@ class En {
|
|
|
1936
1936
|
txCount: t[0].tx_count,
|
|
1937
1937
|
VRFKey: t[0].vrf_key
|
|
1938
1938
|
};
|
|
1939
|
-
throw
|
|
1939
|
+
throw S(t);
|
|
1940
1940
|
} catch (t) {
|
|
1941
|
-
throw
|
|
1941
|
+
throw S(t);
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
1944
1944
|
async fetchCollectionAssets(e, t = 0) {
|
|
@@ -1952,9 +1952,9 @@ class En {
|
|
|
1952
1952
|
})),
|
|
1953
1953
|
next: r.length === 100 ? t + 100 : null
|
|
1954
1954
|
};
|
|
1955
|
-
throw
|
|
1955
|
+
throw S(r);
|
|
1956
1956
|
} catch (r) {
|
|
1957
|
-
throw
|
|
1957
|
+
throw S(r);
|
|
1958
1958
|
}
|
|
1959
1959
|
}
|
|
1960
1960
|
async fetchHandleAddress(e) {
|
|
@@ -1962,9 +1962,9 @@ class En {
|
|
|
1962
1962
|
const t = ht(e.replace("$", "")), { data: r, status: n } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${He[1]}&_asset_name=${t}`);
|
|
1963
1963
|
if (n === 200)
|
|
1964
1964
|
return r[0].payment_address;
|
|
1965
|
-
throw
|
|
1965
|
+
throw S(r);
|
|
1966
1966
|
} catch (t) {
|
|
1967
|
-
throw
|
|
1967
|
+
throw S(t);
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
async fetchProtocolParameters(e) {
|
|
@@ -1993,9 +1993,9 @@ class En {
|
|
|
1993
1993
|
priceMem: t[0].price_mem,
|
|
1994
1994
|
priceStep: t[0].price_step
|
|
1995
1995
|
};
|
|
1996
|
-
throw
|
|
1996
|
+
throw S(t);
|
|
1997
1997
|
} catch (t) {
|
|
1998
|
-
throw
|
|
1998
|
+
throw S(t);
|
|
1999
1999
|
}
|
|
2000
2000
|
}
|
|
2001
2001
|
async fetchTxInfo(e) {
|
|
@@ -2016,9 +2016,9 @@ class En {
|
|
|
2016
2016
|
slot: n[0].absolute_slot.toString(),
|
|
2017
2017
|
size: n[0].tx_size
|
|
2018
2018
|
};
|
|
2019
|
-
throw
|
|
2019
|
+
throw S(n);
|
|
2020
2020
|
} catch (n) {
|
|
2021
|
-
throw
|
|
2021
|
+
throw S(n);
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
async fetchUTxOs(e) {
|
|
@@ -2028,9 +2028,9 @@ class En {
|
|
|
2028
2028
|
});
|
|
2029
2029
|
if (r === 200)
|
|
2030
2030
|
return t[0].outputs.map((i) => this.toUTxO(i, i.payment_addr.bech32));
|
|
2031
|
-
throw
|
|
2031
|
+
throw S(t);
|
|
2032
2032
|
} catch (t) {
|
|
2033
|
-
throw
|
|
2033
|
+
throw S(t);
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
2036
|
onTxConfirmed(e, t, r = 100) {
|
|
@@ -2052,9 +2052,9 @@ class En {
|
|
|
2052
2052
|
const t = { "Content-Type": "application/cbor" }, { data: r, status: n } = await this._axiosInstance.post("submittx", G(e), { headers: t });
|
|
2053
2053
|
if (n === 202)
|
|
2054
2054
|
return r;
|
|
2055
|
-
throw
|
|
2055
|
+
throw S(r);
|
|
2056
2056
|
} catch (t) {
|
|
2057
|
-
throw
|
|
2057
|
+
throw S(t);
|
|
2058
2058
|
}
|
|
2059
2059
|
}
|
|
2060
2060
|
toUTxO(e, t) {
|
|
@@ -2086,11 +2086,11 @@ class En {
|
|
|
2086
2086
|
code: e.bytes,
|
|
2087
2087
|
version: e.type.replace("plutus", "")
|
|
2088
2088
|
} : Ge(Ve(e.bytes));
|
|
2089
|
-
return
|
|
2089
|
+
return Zt(t).to_hex();
|
|
2090
2090
|
}
|
|
2091
2091
|
};
|
|
2092
2092
|
}
|
|
2093
|
-
class
|
|
2093
|
+
class bn {
|
|
2094
2094
|
_baseUrl;
|
|
2095
2095
|
constructor(...e) {
|
|
2096
2096
|
this._baseUrl = Zr(e[0]) ? rs[e[0]] : e[0];
|
|
@@ -2157,7 +2157,7 @@ class Sn {
|
|
|
2157
2157
|
}));
|
|
2158
2158
|
}
|
|
2159
2159
|
}
|
|
2160
|
-
class
|
|
2160
|
+
class vn {
|
|
2161
2161
|
_axiosInstance;
|
|
2162
2162
|
_amountsAsStrings = {
|
|
2163
2163
|
headers: {
|
|
@@ -2182,13 +2182,13 @@ class bn {
|
|
|
2182
2182
|
wdrl: "REWARD"
|
|
2183
2183
|
};
|
|
2184
2184
|
return t.map((c) => {
|
|
2185
|
-
const l = c.ex_units,
|
|
2186
|
-
return { budget: l, index:
|
|
2185
|
+
const l = c.ex_units, A = c.redeemer_index, y = n[c.redeemer_tag];
|
|
2186
|
+
return { budget: l, index: A, tag: y };
|
|
2187
2187
|
});
|
|
2188
2188
|
}
|
|
2189
|
-
throw
|
|
2189
|
+
throw S(t);
|
|
2190
2190
|
} catch (t) {
|
|
2191
|
-
throw
|
|
2191
|
+
throw S(t);
|
|
2192
2192
|
}
|
|
2193
2193
|
}
|
|
2194
2194
|
async fetchAccountInfo(e) {
|
|
@@ -2205,19 +2205,19 @@ class bn {
|
|
|
2205
2205
|
withdrawals: i.total_withdrawn
|
|
2206
2206
|
};
|
|
2207
2207
|
}
|
|
2208
|
-
throw
|
|
2208
|
+
throw S(r);
|
|
2209
2209
|
} catch (r) {
|
|
2210
|
-
throw
|
|
2210
|
+
throw S(r);
|
|
2211
2211
|
}
|
|
2212
2212
|
}
|
|
2213
2213
|
async fetchAddressUTxOs(e, t) {
|
|
2214
2214
|
const r = (() => e.startsWith("addr_vkh") || e.startsWith("addr_shared_vkh") ? `addresses/cred/${e}` : `addresses/${e}`)(), n = t ? `&asset=${t}` : "", i = async (c = null, l = []) => {
|
|
2215
|
-
const
|
|
2215
|
+
const A = c === null ? "" : `&cursor=${c}`, { data: y, status: B } = await this._axiosInstance.get(`${r}/utxos?count=100${n}${A}`, this._amountsAsStrings);
|
|
2216
2216
|
if (B === 200) {
|
|
2217
2217
|
const w = y.data.map(this.toUTxO), v = [...l, ...w], U = y.next_cursor;
|
|
2218
2218
|
return U == null ? v : i(U, v);
|
|
2219
2219
|
}
|
|
2220
|
-
throw
|
|
2220
|
+
throw S(y);
|
|
2221
2221
|
};
|
|
2222
2222
|
try {
|
|
2223
2223
|
return await i();
|
|
@@ -2227,15 +2227,15 @@ class bn {
|
|
|
2227
2227
|
}
|
|
2228
2228
|
async fetchAssetAddresses(e) {
|
|
2229
2229
|
const { policyId: t, assetName: r } = Kt(e), n = async (i = null, c = []) => {
|
|
2230
|
-
const l = i === null ? "" : `&cursor=${i}`, { data:
|
|
2230
|
+
const l = i === null ? "" : `&cursor=${i}`, { data: A, status: y } = await this._axiosInstance.get(`assets/${t}${r}/addresses?count=100${l}`, this._amountsAsStrings);
|
|
2231
2231
|
if (y === 200) {
|
|
2232
|
-
const b =
|
|
2232
|
+
const b = A.data.map((U) => ({ address: U.address, quantity: U.amount })), w = A.next_cursor, v = [
|
|
2233
2233
|
...c,
|
|
2234
2234
|
...b
|
|
2235
2235
|
];
|
|
2236
2236
|
return w == null ? v : n(w, v);
|
|
2237
2237
|
}
|
|
2238
|
-
throw
|
|
2238
|
+
throw S(A);
|
|
2239
2239
|
};
|
|
2240
2240
|
try {
|
|
2241
2241
|
return await n();
|
|
@@ -2253,9 +2253,9 @@ class bn {
|
|
|
2253
2253
|
...c.asset_standards.cip68_metadata
|
|
2254
2254
|
};
|
|
2255
2255
|
}
|
|
2256
|
-
throw
|
|
2256
|
+
throw S(n);
|
|
2257
2257
|
} catch (t) {
|
|
2258
|
-
throw
|
|
2258
|
+
throw S(t);
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
async fetchBlockInfo(e) {
|
|
@@ -2282,9 +2282,9 @@ class bn {
|
|
|
2282
2282
|
VRFKey: a.VRFVKey.from_hex(i.vrf_key).to_bech32("vrf_vk")
|
|
2283
2283
|
};
|
|
2284
2284
|
}
|
|
2285
|
-
throw
|
|
2285
|
+
throw S(r);
|
|
2286
2286
|
} catch (r) {
|
|
2287
|
-
throw
|
|
2287
|
+
throw S(r);
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
2290
|
async fetchCollectionAssets(e, t) {
|
|
@@ -2298,7 +2298,7 @@ class bn {
|
|
|
2298
2298
|
})),
|
|
2299
2299
|
next: r.next_cursor
|
|
2300
2300
|
};
|
|
2301
|
-
throw
|
|
2301
|
+
throw S(r);
|
|
2302
2302
|
} catch {
|
|
2303
2303
|
return { assets: [], next: null };
|
|
2304
2304
|
}
|
|
@@ -2308,9 +2308,9 @@ class bn {
|
|
|
2308
2308
|
const t = e.charAt(0) === "$" ? e.substring(1) : e, { data: r, status: n } = await this._axiosInstance.get(`ecosystem/adahandle/${t}`);
|
|
2309
2309
|
if (n === 200)
|
|
2310
2310
|
return r.data;
|
|
2311
|
-
throw
|
|
2311
|
+
throw S(r);
|
|
2312
2312
|
} catch (t) {
|
|
2313
|
-
throw
|
|
2313
|
+
throw S(t);
|
|
2314
2314
|
}
|
|
2315
2315
|
}
|
|
2316
2316
|
async fetchProtocolParameters(e = Number.NaN) {
|
|
@@ -2327,12 +2327,12 @@ class bn {
|
|
|
2327
2327
|
try {
|
|
2328
2328
|
const { data: c, status: l } = await this._axiosInstance.get("epochs/current");
|
|
2329
2329
|
if (l === 200) {
|
|
2330
|
-
const
|
|
2330
|
+
const A = c.data;
|
|
2331
2331
|
return {
|
|
2332
2332
|
coinsPerUTxOSize: i.coins_per_utxo_byte.toString(),
|
|
2333
2333
|
collateralPercent: parseInt(i.collateral_percentage),
|
|
2334
2334
|
decentralisation: 0,
|
|
2335
|
-
epoch: parseInt(
|
|
2335
|
+
epoch: parseInt(A.epoch_no),
|
|
2336
2336
|
keyDeposit: i.stake_key_deposit.toString(),
|
|
2337
2337
|
maxBlockExMem: i.max_execution_units_per_block.memory.toString(),
|
|
2338
2338
|
maxBlockExSteps: i.max_execution_units_per_block.steps.toString(),
|
|
@@ -2351,14 +2351,14 @@ class bn {
|
|
|
2351
2351
|
priceStep: t(i.prices.steps)
|
|
2352
2352
|
};
|
|
2353
2353
|
}
|
|
2354
|
-
throw
|
|
2354
|
+
throw S(c);
|
|
2355
2355
|
} catch (c) {
|
|
2356
|
-
throw
|
|
2356
|
+
throw S(c);
|
|
2357
2357
|
}
|
|
2358
2358
|
}
|
|
2359
|
-
throw
|
|
2359
|
+
throw S(r);
|
|
2360
2360
|
} catch (r) {
|
|
2361
|
-
throw
|
|
2361
|
+
throw S(r);
|
|
2362
2362
|
}
|
|
2363
2363
|
}
|
|
2364
2364
|
async fetchTxInfo(e) {
|
|
@@ -2378,9 +2378,9 @@ class bn {
|
|
|
2378
2378
|
size: n.size - 1
|
|
2379
2379
|
};
|
|
2380
2380
|
}
|
|
2381
|
-
throw
|
|
2381
|
+
throw S(t);
|
|
2382
2382
|
} catch (t) {
|
|
2383
|
-
throw
|
|
2383
|
+
throw S(t);
|
|
2384
2384
|
}
|
|
2385
2385
|
}
|
|
2386
2386
|
async fetchUTxOs(e) {
|
|
@@ -2388,9 +2388,9 @@ class bn {
|
|
|
2388
2388
|
const { data: t, status: r } = await this._axiosInstance.get(`transactions/${e}`, this._amountsAsStrings);
|
|
2389
2389
|
if (r === 200)
|
|
2390
2390
|
return t.data.outputs.map(this.toUTxO);
|
|
2391
|
-
throw
|
|
2391
|
+
throw S(t);
|
|
2392
2392
|
} catch (t) {
|
|
2393
|
-
throw
|
|
2393
|
+
throw S(t);
|
|
2394
2394
|
}
|
|
2395
2395
|
}
|
|
2396
2396
|
onTxConfirmed(e, t, r = 100) {
|
|
@@ -2412,9 +2412,9 @@ class bn {
|
|
|
2412
2412
|
const t = { "Content-Type": "application/cbor" }, { data: r, status: n } = await this._axiosInstance.post(this.submitUrl, G(e), { headers: t });
|
|
2413
2413
|
if (n === 202)
|
|
2414
2414
|
return r;
|
|
2415
|
-
throw
|
|
2415
|
+
throw S(r);
|
|
2416
2416
|
} catch (t) {
|
|
2417
|
-
throw
|
|
2417
|
+
throw S(t);
|
|
2418
2418
|
}
|
|
2419
2419
|
}
|
|
2420
2420
|
toUTxO = (e) => {
|
|
@@ -2443,12 +2443,12 @@ class bn {
|
|
|
2443
2443
|
code: e.reference_script.bytes,
|
|
2444
2444
|
version: e.reference_script.type.replace("plutusv", "V")
|
|
2445
2445
|
};
|
|
2446
|
-
return
|
|
2446
|
+
return Zt(t).to_hex();
|
|
2447
2447
|
} else
|
|
2448
2448
|
return;
|
|
2449
2449
|
};
|
|
2450
2450
|
}
|
|
2451
|
-
class
|
|
2451
|
+
class Qn {
|
|
2452
2452
|
_axiosInstance;
|
|
2453
2453
|
constructor(e = "http://localhost:8080/api/v1") {
|
|
2454
2454
|
this._axiosInstance = Mt.create({
|
|
@@ -2467,9 +2467,9 @@ class vn {
|
|
|
2467
2467
|
rewards: r.withdrawable_amount,
|
|
2468
2468
|
withdrawals: r.withdrawals_sum
|
|
2469
2469
|
};
|
|
2470
|
-
throw
|
|
2470
|
+
throw S(r);
|
|
2471
2471
|
} catch (r) {
|
|
2472
|
-
throw
|
|
2472
|
+
throw S(r);
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
2475
2475
|
resolveScriptRef = async (e) => {
|
|
@@ -2480,9 +2480,9 @@ class vn {
|
|
|
2480
2480
|
code: await this.fetchPlutusScriptCBOR(e),
|
|
2481
2481
|
version: t.type.replace("plutus", "")
|
|
2482
2482
|
} : await this.fetchNativeScriptJSON(e);
|
|
2483
|
-
return
|
|
2483
|
+
return Zt(n).to_hex();
|
|
2484
2484
|
}
|
|
2485
|
-
throw
|
|
2485
|
+
throw S(t);
|
|
2486
2486
|
}
|
|
2487
2487
|
};
|
|
2488
2488
|
toUTxO = async (e, t) => ({
|
|
@@ -2501,13 +2501,13 @@ class vn {
|
|
|
2501
2501
|
});
|
|
2502
2502
|
async fetchAddressUTxOs(e, t) {
|
|
2503
2503
|
const r = t !== void 0 ? `/${t}` : "", n = `addresses/${e}/utxos` + r, i = async (c = 1, l = []) => {
|
|
2504
|
-
const { data:
|
|
2504
|
+
const { data: A, status: y } = await this._axiosInstance.get(`${n}?page=${c}`);
|
|
2505
2505
|
if (y === 200)
|
|
2506
|
-
return
|
|
2506
|
+
return A.length > 0 ? i(c + 1, [
|
|
2507
2507
|
...l,
|
|
2508
|
-
...await Promise.all(
|
|
2508
|
+
...await Promise.all(A.map((B) => this.toUTxO(B, B.tx_hash)))
|
|
2509
2509
|
]) : l;
|
|
2510
|
-
throw
|
|
2510
|
+
throw S(A);
|
|
2511
2511
|
};
|
|
2512
2512
|
try {
|
|
2513
2513
|
return await i();
|
|
@@ -2517,10 +2517,10 @@ class vn {
|
|
|
2517
2517
|
}
|
|
2518
2518
|
async fetchAssetAddresses(e) {
|
|
2519
2519
|
const t = async (r = 1, n = []) => {
|
|
2520
|
-
const { policyId: i, assetName: c } = Kt(e), { data: l, status:
|
|
2521
|
-
if (
|
|
2520
|
+
const { policyId: i, assetName: c } = Kt(e), { data: l, status: A } = await this._axiosInstance.get(`assets/${i}${c}/addresses?page=${r}`);
|
|
2521
|
+
if (A === 200)
|
|
2522
2522
|
return l.length > 0 ? t(r + 1, [...n, ...l]) : n;
|
|
2523
|
-
throw
|
|
2523
|
+
throw S(l);
|
|
2524
2524
|
};
|
|
2525
2525
|
try {
|
|
2526
2526
|
return await t();
|
|
@@ -2535,9 +2535,9 @@ class vn {
|
|
|
2535
2535
|
return {
|
|
2536
2536
|
...n.onchain_metadata
|
|
2537
2537
|
};
|
|
2538
|
-
throw
|
|
2538
|
+
throw S(n);
|
|
2539
2539
|
} catch (t) {
|
|
2540
|
-
throw
|
|
2540
|
+
throw S(t);
|
|
2541
2541
|
}
|
|
2542
2542
|
}
|
|
2543
2543
|
async fetchBlockInfo(e) {
|
|
@@ -2561,9 +2561,9 @@ class vn {
|
|
|
2561
2561
|
txCount: t.tx_count,
|
|
2562
2562
|
VRFKey: t.block_vrf
|
|
2563
2563
|
};
|
|
2564
|
-
throw
|
|
2564
|
+
throw S(t);
|
|
2565
2565
|
} catch (t) {
|
|
2566
|
-
throw
|
|
2566
|
+
throw S(t);
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
2569
|
async fetchCollectionAssets(e, t = 1) {
|
|
@@ -2577,7 +2577,7 @@ class vn {
|
|
|
2577
2577
|
})),
|
|
2578
2578
|
next: r.length === 100 ? t + 1 : null
|
|
2579
2579
|
};
|
|
2580
|
-
throw
|
|
2580
|
+
throw S(r);
|
|
2581
2581
|
} catch {
|
|
2582
2582
|
return { assets: [], next: null };
|
|
2583
2583
|
}
|
|
@@ -2587,9 +2587,9 @@ class vn {
|
|
|
2587
2587
|
const t = ht(e.replace("$", "")), { data: r, status: n } = await this._axiosInstance.get(`assets/${He[1]}${t}/addresses`);
|
|
2588
2588
|
if (n === 200)
|
|
2589
2589
|
return r[0].address;
|
|
2590
|
-
throw
|
|
2590
|
+
throw S(r);
|
|
2591
2591
|
} catch (t) {
|
|
2592
|
-
throw
|
|
2592
|
+
throw S(t);
|
|
2593
2593
|
}
|
|
2594
2594
|
}
|
|
2595
2595
|
async fetchProtocolParameters(e = Number.NaN) {
|
|
@@ -2618,9 +2618,9 @@ class vn {
|
|
|
2618
2618
|
priceMem: t.price_mem,
|
|
2619
2619
|
priceStep: t.price_step
|
|
2620
2620
|
};
|
|
2621
|
-
throw
|
|
2621
|
+
throw S(t);
|
|
2622
2622
|
} catch (t) {
|
|
2623
|
-
throw
|
|
2623
|
+
throw S(t);
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
async fetchTxInfo(e) {
|
|
@@ -2638,9 +2638,9 @@ class vn {
|
|
|
2638
2638
|
slot: t.slot.toString(),
|
|
2639
2639
|
size: t.size
|
|
2640
2640
|
};
|
|
2641
|
-
throw
|
|
2641
|
+
throw S(t);
|
|
2642
2642
|
} catch (t) {
|
|
2643
|
-
throw
|
|
2643
|
+
throw S(t);
|
|
2644
2644
|
}
|
|
2645
2645
|
}
|
|
2646
2646
|
async fetchUTxOs(e) {
|
|
@@ -2652,9 +2652,9 @@ class vn {
|
|
|
2652
2652
|
i.push(this.toUTxO(l, e));
|
|
2653
2653
|
}), await Promise.all(i);
|
|
2654
2654
|
}
|
|
2655
|
-
throw
|
|
2655
|
+
throw S(t);
|
|
2656
2656
|
} catch (t) {
|
|
2657
|
-
throw
|
|
2657
|
+
throw S(t);
|
|
2658
2658
|
}
|
|
2659
2659
|
}
|
|
2660
2660
|
onTxConfirmed(e, t, r = 100) {
|
|
@@ -2678,33 +2678,33 @@ class vn {
|
|
|
2678
2678
|
});
|
|
2679
2679
|
if (r === 202)
|
|
2680
2680
|
return n;
|
|
2681
|
-
throw
|
|
2681
|
+
throw S(n);
|
|
2682
2682
|
} catch (t) {
|
|
2683
|
-
throw console.log("error", t),
|
|
2683
|
+
throw console.log("error", t), S(t);
|
|
2684
2684
|
}
|
|
2685
2685
|
}
|
|
2686
2686
|
async fetchPlutusScriptCBOR(e) {
|
|
2687
2687
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/cbor`);
|
|
2688
2688
|
if (r === 200)
|
|
2689
2689
|
return t.cbor;
|
|
2690
|
-
throw
|
|
2690
|
+
throw S(t);
|
|
2691
2691
|
}
|
|
2692
2692
|
async fetchNativeScriptJSON(e) {
|
|
2693
2693
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/json`);
|
|
2694
2694
|
if (r === 200)
|
|
2695
2695
|
return t.json;
|
|
2696
|
-
throw
|
|
2696
|
+
throw S(t);
|
|
2697
2697
|
}
|
|
2698
2698
|
}
|
|
2699
|
-
class
|
|
2699
|
+
class Dn {
|
|
2700
2700
|
static withOneSignature(e) {
|
|
2701
|
-
const t = Ct(
|
|
2701
|
+
const t = Ct($t(e));
|
|
2702
2702
|
return he(t).to_hex();
|
|
2703
2703
|
}
|
|
2704
2704
|
static withAtLeastNSignatures(e, t) {
|
|
2705
2705
|
const r = a.NativeScripts.new();
|
|
2706
2706
|
e.forEach((i) => {
|
|
2707
|
-
const c = Ct(
|
|
2707
|
+
const c = Ct($t(i));
|
|
2708
2708
|
r.add(he(c));
|
|
2709
2709
|
});
|
|
2710
2710
|
const n = a.ScriptNOfK.new(t, r);
|
|
@@ -2713,7 +2713,7 @@ class Qn {
|
|
|
2713
2713
|
static withAnySignature(e) {
|
|
2714
2714
|
const t = a.NativeScripts.new();
|
|
2715
2715
|
e.forEach((n) => {
|
|
2716
|
-
const i = Ct(
|
|
2716
|
+
const i = Ct($t(n));
|
|
2717
2717
|
t.add(he(i));
|
|
2718
2718
|
});
|
|
2719
2719
|
const r = a.ScriptAny.new(t);
|
|
@@ -2722,14 +2722,14 @@ class Qn {
|
|
|
2722
2722
|
static withAllSignatures(e) {
|
|
2723
2723
|
const t = a.NativeScripts.new();
|
|
2724
2724
|
e.forEach((n) => {
|
|
2725
|
-
const i = Ct(
|
|
2725
|
+
const i = Ct($t(n));
|
|
2726
2726
|
t.add(he(i));
|
|
2727
2727
|
});
|
|
2728
2728
|
const r = a.ScriptAll.new(t);
|
|
2729
2729
|
return a.NativeScript.new_script_any(r).to_hex();
|
|
2730
2730
|
}
|
|
2731
2731
|
static fromNativeScript(e) {
|
|
2732
|
-
return
|
|
2732
|
+
return Vt(e).to_hex();
|
|
2733
2733
|
}
|
|
2734
2734
|
}
|
|
2735
2735
|
function Ht(s, e, t, r) {
|
|
@@ -2743,14 +2743,14 @@ function Ht(s, e, t, r) {
|
|
|
2743
2743
|
}
|
|
2744
2744
|
const zs = (s) => class extends s {
|
|
2745
2745
|
__visits = [];
|
|
2746
|
-
},
|
|
2746
|
+
}, Lt = () => function(s, e, t) {
|
|
2747
2747
|
const r = t.value;
|
|
2748
2748
|
t.value = function(...n) {
|
|
2749
2749
|
const i = r.call(this, ...n);
|
|
2750
2750
|
return this.__visits && this.__visits.push(e), i;
|
|
2751
2751
|
};
|
|
2752
2752
|
};
|
|
2753
|
-
let
|
|
2753
|
+
let St = class {
|
|
2754
2754
|
_changeAddress;
|
|
2755
2755
|
_txOutputs = /* @__PURE__ */ new Map();
|
|
2756
2756
|
_recipients = /* @__PURE__ */ new Map();
|
|
@@ -2765,7 +2765,7 @@ let Bt = class {
|
|
|
2765
2765
|
_txInputsBuilder;
|
|
2766
2766
|
_txWithdrawals;
|
|
2767
2767
|
constructor(e = {}) {
|
|
2768
|
-
this._era = e.era, this._initiator = e.initiator, this._mintBuilder = a.MintBuilder.new(), this._protocolParameters = e.parameters ??
|
|
2768
|
+
this._era = e.era, this._initiator = e.initiator, this._mintBuilder = a.MintBuilder.new(), this._protocolParameters = e.parameters ?? mt, this._txBuilder = Ae(e.parameters), this._txCertificates = a.Certificates.new(), this._txInputsBuilder = a.TxInputsBuilder.new(), this._txWithdrawals = a.Withdrawals.new();
|
|
2769
2769
|
}
|
|
2770
2770
|
static attachMetadata(e, t, r = "BABBAGE") {
|
|
2771
2771
|
var c;
|
|
@@ -2783,8 +2783,8 @@ let Bt = class {
|
|
|
2783
2783
|
const r = _t(e), n = (i = r.auxiliary_data()) == null ? void 0 : i.metadata();
|
|
2784
2784
|
if (n !== void 0) {
|
|
2785
2785
|
const c = a.GeneralTransactionMetadata.new();
|
|
2786
|
-
for (let
|
|
2787
|
-
const y = n.keys().get(
|
|
2786
|
+
for (let A = 0; A < n.len(); A += 1) {
|
|
2787
|
+
const y = n.keys().get(A), B = n.get(y);
|
|
2788
2788
|
c.insert(y, a.TransactionMetadatum.from_hex("0".repeat(((B == null ? void 0 : B.to_hex()) ?? "").length)));
|
|
2789
2789
|
}
|
|
2790
2790
|
const l = r.auxiliary_data();
|
|
@@ -2812,14 +2812,14 @@ let Bt = class {
|
|
|
2812
2812
|
}
|
|
2813
2813
|
burnAsset(e, t, r) {
|
|
2814
2814
|
const n = this._totalBurns.has(t.unit) ? a.BigNum.from_str(this._totalBurns.get(t.unit) ?? "0").checked_add(a.BigNum.from_str(t.quantity)).to_str() : t.quantity;
|
|
2815
|
-
return this._mintBuilder.add_asset(
|
|
2815
|
+
return this._mintBuilder.add_asset(Ar(e, r), a.AssetName.new(G(t.unit.slice(lt))), a.Int.new_negative(a.BigNum.from_str(t.quantity))), this._totalBurns.set(t.unit, n), this;
|
|
2816
2816
|
}
|
|
2817
2817
|
delegateStake(e, t) {
|
|
2818
|
-
const r = a.Certificate.new_stake_delegation(a.StakeDelegation.new(a.StakeCredential.from_keyhash(Ct(
|
|
2818
|
+
const r = a.Certificate.new_stake_delegation(a.StakeDelegation.new(a.StakeCredential.from_keyhash(Ct(se(e))), a.Ed25519KeyHash.from_bech32(t)));
|
|
2819
2819
|
return this._txCertificates.add(r), this;
|
|
2820
2820
|
}
|
|
2821
2821
|
deregisterStake(e) {
|
|
2822
|
-
const t = a.Certificate.new_stake_deregistration(a.StakeDeregistration.new(a.StakeCredential.from_keyhash(Ct(
|
|
2822
|
+
const t = a.Certificate.new_stake_deregistration(a.StakeDeregistration.new(a.StakeCredential.from_keyhash(Ct(se(e)))));
|
|
2823
2823
|
return this._txCertificates.add(t), this;
|
|
2824
2824
|
}
|
|
2825
2825
|
mintAsset(e, t, r) {
|
|
@@ -2832,37 +2832,37 @@ let Bt = class {
|
|
|
2832
2832
|
};
|
|
2833
2833
|
}, i = (b) => {
|
|
2834
2834
|
if ("code" in b)
|
|
2835
|
-
return
|
|
2836
|
-
const w =
|
|
2835
|
+
return Xt(b.code, b.version);
|
|
2836
|
+
const w = gt(b);
|
|
2837
2837
|
if (w.output().has_script_ref()) {
|
|
2838
2838
|
const v = w.output().script_ref();
|
|
2839
2839
|
if (v.is_plutus_script()) {
|
|
2840
2840
|
const U = Kr(v);
|
|
2841
|
-
return
|
|
2841
|
+
return Xt(U.code, U.version);
|
|
2842
2842
|
}
|
|
2843
2843
|
}
|
|
2844
2844
|
throw new Error(`[Transaction] No plutus script reference found in UTxO: ${w.input().transaction_id().to_hex()}`);
|
|
2845
|
-
}, c = n(e, t),
|
|
2846
|
-
return this._mintBuilder.add_asset(
|
|
2845
|
+
}, c = n(e, t), A = a.BigNum.from_str(((y = this._totalMints.get(c.unit)) == null ? void 0 : y.assetQuantity) ?? "0").checked_add(a.BigNum.from_str(c.quantity));
|
|
2846
|
+
return this._mintBuilder.add_asset(Ar(e, r), a.AssetName.new(G(ht(t.assetName))), a.Int.new(a.BigNum.from_str(c.quantity))), this._recipients.has(t.recipient) ? (B = this._recipients.get(t.recipient)) == null || B.push(c) : this._recipients.set(t.recipient, [c]), this._totalMints.set(c.unit, {
|
|
2847
2847
|
...t,
|
|
2848
|
-
assetQuantity:
|
|
2848
|
+
assetQuantity: A.to_str()
|
|
2849
2849
|
}), this;
|
|
2850
2850
|
}
|
|
2851
2851
|
redeemValue(e) {
|
|
2852
2852
|
const t = {
|
|
2853
2853
|
tag: "SPEND",
|
|
2854
|
-
budget:
|
|
2854
|
+
budget: Yt,
|
|
2855
2855
|
index: this._txInputsBuilder.inputs().len(),
|
|
2856
2856
|
data: {
|
|
2857
2857
|
alternative: 0,
|
|
2858
2858
|
fields: []
|
|
2859
2859
|
},
|
|
2860
2860
|
...e.redeemer
|
|
2861
|
-
}, r =
|
|
2861
|
+
}, r = gt(e.value), n = e.datum ? a.PlutusWitness.new_with_ref(Oe(e.script), Gs(e.datum), Ne(t)) : a.PlutusWitness.new_with_ref_without_datum(Oe(e.script), Ne(t));
|
|
2862
2862
|
return this._txInputsBuilder.add_plutus_script_input(n, r.input(), r.output().amount()), this;
|
|
2863
2863
|
}
|
|
2864
2864
|
registerStake(e) {
|
|
2865
|
-
const t = a.Certificate.new_stake_registration(a.StakeRegistration.new(a.StakeCredential.from_keyhash(Ct(
|
|
2865
|
+
const t = a.Certificate.new_stake_registration(a.StakeRegistration.new(a.StakeCredential.from_keyhash(Ct(se(e)))));
|
|
2866
2866
|
return this._txCertificates.add(t), this;
|
|
2867
2867
|
}
|
|
2868
2868
|
registerPool(e) {
|
|
@@ -2874,7 +2874,7 @@ let Bt = class {
|
|
|
2874
2874
|
return this._txCertificates.add(r), this;
|
|
2875
2875
|
}
|
|
2876
2876
|
sendAssets(e, t) {
|
|
2877
|
-
const r =
|
|
2877
|
+
const r = Bt(t), n = r.multiasset();
|
|
2878
2878
|
if (r.is_zero() || n === void 0)
|
|
2879
2879
|
return this;
|
|
2880
2880
|
const i = de(e).next(), c = r.coin().is_zero() ? i.with_asset_and_min_required_coin_by_utxo_cost(n, Ue(this._protocolParameters.coinsPerUTxOSize)).build() : i.with_coin_and_asset(r.coin(), n).build();
|
|
@@ -2890,13 +2890,15 @@ let Bt = class {
|
|
|
2890
2890
|
}), this._txBuilder.add_output(n), this;
|
|
2891
2891
|
}
|
|
2892
2892
|
sendToken(e, t, r) {
|
|
2893
|
-
return this.sendAssets(e, [
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2893
|
+
return this.sendAssets(e, [
|
|
2894
|
+
{
|
|
2895
|
+
quantity: r,
|
|
2896
|
+
unit: ss[t]
|
|
2897
|
+
}
|
|
2898
|
+
]), this;
|
|
2897
2899
|
}
|
|
2898
2900
|
sendValue(e, t) {
|
|
2899
|
-
const r =
|
|
2901
|
+
const r = Bt(t.output.amount), i = de(e).next().with_value(r).build();
|
|
2900
2902
|
return t.output.amount.forEach((c) => {
|
|
2901
2903
|
this.setTxOutput(c);
|
|
2902
2904
|
}), this._txBuilder.add_output(i), this;
|
|
@@ -2912,10 +2914,14 @@ let Bt = class {
|
|
|
2912
2914
|
return this._txBuilder.add_json_metadatum_with_schema(a.BigNum.from_str(e.toString()), JSON.stringify(t), a.MetadataJsonSchema.NoConversions), this;
|
|
2913
2915
|
}
|
|
2914
2916
|
setRequiredSigners(e) {
|
|
2915
|
-
return Array.from(new Set(e.map((r) => r.startsWith("addr") ?
|
|
2917
|
+
return Array.from(new Set(e.map((r) => r.startsWith("addr") ? $t(r) : se(r)).map((r) => Ct(r)))).forEach((r) => {
|
|
2916
2918
|
this._txBuilder.add_required_signer(r);
|
|
2917
2919
|
}), this;
|
|
2918
2920
|
}
|
|
2921
|
+
setNativeScriptInput(e, t) {
|
|
2922
|
+
const r = gt(t);
|
|
2923
|
+
return this._txBuilder.add_native_script_input(Vt(e), r.input(), r.output().amount()), this;
|
|
2924
|
+
}
|
|
2919
2925
|
setTimeToStart(e) {
|
|
2920
2926
|
return this._txBuilder.set_validity_start_interval_bignum(a.BigNum.from_str(e)), this;
|
|
2921
2927
|
}
|
|
@@ -2923,12 +2929,12 @@ let Bt = class {
|
|
|
2923
2929
|
return this._txBuilder.set_ttl_bignum(a.BigNum.from_str(e)), this;
|
|
2924
2930
|
}
|
|
2925
2931
|
setTxInputs(e) {
|
|
2926
|
-
return e.map((t) =>
|
|
2932
|
+
return e.map((t) => gt(t)).forEach((t) => {
|
|
2927
2933
|
this._txInputsBuilder.add_input(t.output().address(), t.input(), t.output().amount());
|
|
2928
2934
|
}), this;
|
|
2929
2935
|
}
|
|
2930
2936
|
setTxRefInputs(e) {
|
|
2931
|
-
return e.map((t) =>
|
|
2937
|
+
return e.map((t) => gt(t)).forEach((t) => {
|
|
2932
2938
|
this._txBuilder.add_reference_input(t.input());
|
|
2933
2939
|
}), this;
|
|
2934
2940
|
}
|
|
@@ -2939,7 +2945,7 @@ let Bt = class {
|
|
|
2939
2945
|
async addBurnInputsIfNeeded() {
|
|
2940
2946
|
if (this._initiator && this._totalBurns.size > 0 && this.notVisited("setTxInputs")) {
|
|
2941
2947
|
const e = await this._initiator.getUsedUTxOs();
|
|
2942
|
-
is(this._totalBurns, e.map((r) =>
|
|
2948
|
+
is(this._totalBurns, e.map((r) => oe(r))).map((r) => gt(r)).forEach((r) => {
|
|
2943
2949
|
this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
|
|
2944
2950
|
});
|
|
2945
2951
|
}
|
|
@@ -2959,14 +2965,14 @@ let Bt = class {
|
|
|
2959
2965
|
}
|
|
2960
2966
|
async addRequiredSignersIfNeeded() {
|
|
2961
2967
|
if (this._initiator && this.notVisited("setRequiredSigners")) {
|
|
2962
|
-
const e = await this._initiator.getUsedAddress(), t =
|
|
2968
|
+
const e = await this._initiator.getUsedAddress(), t = $t(e.to_bech32());
|
|
2963
2969
|
this._txBuilder.add_required_signer(Ct(t));
|
|
2964
2970
|
}
|
|
2965
2971
|
}
|
|
2966
2972
|
async addTxInputsAsNeeded() {
|
|
2967
2973
|
if (this.notVisited("setTxInputs")) {
|
|
2968
2974
|
const e = await this.filterAvailableUTxOs();
|
|
2969
|
-
ns(this._txOutputs, e.map((r) =>
|
|
2975
|
+
ns(this._txOutputs, e.map((r) => oe(r))).map((r) => gt(r)).forEach((r) => {
|
|
2970
2976
|
this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
|
|
2971
2977
|
});
|
|
2972
2978
|
}
|
|
@@ -2981,7 +2987,7 @@ let Bt = class {
|
|
|
2981
2987
|
if (t.data.label === "777")
|
|
2982
2988
|
return i;
|
|
2983
2989
|
if (r && r[c]) {
|
|
2984
|
-
const { [c]: l, ...
|
|
2990
|
+
const { [c]: l, ...A } = r, y = {
|
|
2985
2991
|
[n]: i,
|
|
2986
2992
|
...l
|
|
2987
2993
|
};
|
|
@@ -2989,7 +2995,7 @@ let Bt = class {
|
|
|
2989
2995
|
[c]: {
|
|
2990
2996
|
...y
|
|
2991
2997
|
},
|
|
2992
|
-
...
|
|
2998
|
+
...A
|
|
2993
2999
|
};
|
|
2994
3000
|
}
|
|
2995
3001
|
return r !== void 0 ? {
|
|
@@ -3013,7 +3019,7 @@ let Bt = class {
|
|
|
3013
3019
|
}
|
|
3014
3020
|
addMintOutputs() {
|
|
3015
3021
|
this._recipients.forEach((e, t) => {
|
|
3016
|
-
const n =
|
|
3022
|
+
const n = Bt(e).multiasset();
|
|
3017
3023
|
if (n !== void 0) {
|
|
3018
3024
|
const c = de(t).next().with_asset_and_min_required_coin_by_utxo_cost(n, Ue(this._protocolParameters.coinsPerUTxOSize)).build();
|
|
3019
3025
|
this._txBuilder.add_output(c);
|
|
@@ -3029,36 +3035,36 @@ let Bt = class {
|
|
|
3029
3035
|
}
|
|
3030
3036
|
};
|
|
3031
3037
|
Ht([
|
|
3032
|
-
|
|
3033
|
-
],
|
|
3038
|
+
Lt()
|
|
3039
|
+
], St.prototype, "mintAsset", null);
|
|
3034
3040
|
Ht([
|
|
3035
|
-
|
|
3036
|
-
],
|
|
3041
|
+
Lt()
|
|
3042
|
+
], St.prototype, "redeemValue", null);
|
|
3037
3043
|
Ht([
|
|
3038
|
-
|
|
3039
|
-
],
|
|
3044
|
+
Lt()
|
|
3045
|
+
], St.prototype, "sendAssets", null);
|
|
3040
3046
|
Ht([
|
|
3041
|
-
|
|
3042
|
-
],
|
|
3047
|
+
Lt()
|
|
3048
|
+
], St.prototype, "sendValue", null);
|
|
3043
3049
|
Ht([
|
|
3044
|
-
|
|
3045
|
-
],
|
|
3050
|
+
Lt()
|
|
3051
|
+
], St.prototype, "setCollateral", null);
|
|
3046
3052
|
Ht([
|
|
3047
|
-
|
|
3048
|
-
],
|
|
3053
|
+
Lt()
|
|
3054
|
+
], St.prototype, "setRequiredSigners", null);
|
|
3049
3055
|
Ht([
|
|
3050
|
-
|
|
3051
|
-
],
|
|
3052
|
-
|
|
3056
|
+
Lt()
|
|
3057
|
+
], St.prototype, "setTxInputs", null);
|
|
3058
|
+
St = Ht([
|
|
3053
3059
|
zs
|
|
3054
|
-
],
|
|
3060
|
+
], St);
|
|
3055
3061
|
const Ws = (s, e, t) => {
|
|
3056
3062
|
const r = new Map(e);
|
|
3057
3063
|
r.set("lovelace", String(Number(r.get("lovelace")) + Number(t)));
|
|
3058
3064
|
const n = /* @__PURE__ */ new Map();
|
|
3059
3065
|
for (let w = 0; w < s.length; w++)
|
|
3060
3066
|
n.set(w, s[w]);
|
|
3061
|
-
const i = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(),
|
|
3067
|
+
const i = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
|
|
3062
3068
|
for (let w = 0; w < s.length; w++)
|
|
3063
3069
|
switch (s[w].output.amount.length) {
|
|
3064
3070
|
case 1: {
|
|
@@ -3070,7 +3076,7 @@ const Ws = (s, e, t) => {
|
|
|
3070
3076
|
break;
|
|
3071
3077
|
}
|
|
3072
3078
|
case 3: {
|
|
3073
|
-
|
|
3079
|
+
A.add(w);
|
|
3074
3080
|
break;
|
|
3075
3081
|
}
|
|
3076
3082
|
default: {
|
|
@@ -3097,11 +3103,11 @@ const Ws = (s, e, t) => {
|
|
|
3097
3103
|
break;
|
|
3098
3104
|
B(v, w, l);
|
|
3099
3105
|
}
|
|
3100
|
-
for (const v of
|
|
3106
|
+
for (const v of A) {
|
|
3101
3107
|
const U = r.get(w);
|
|
3102
3108
|
if (!U || Number(U) <= 0)
|
|
3103
3109
|
break;
|
|
3104
|
-
B(v, w,
|
|
3110
|
+
B(v, w, A);
|
|
3105
3111
|
}
|
|
3106
3112
|
for (const v of y) {
|
|
3107
3113
|
const U = r.get(w);
|
|
@@ -3122,11 +3128,11 @@ const Ws = (s, e, t) => {
|
|
|
3122
3128
|
break;
|
|
3123
3129
|
B(w, "lovelace", l);
|
|
3124
3130
|
}
|
|
3125
|
-
for (const w of
|
|
3131
|
+
for (const w of A) {
|
|
3126
3132
|
const v = r.get("lovelace");
|
|
3127
3133
|
if (!v || Number(v) <= 0)
|
|
3128
3134
|
break;
|
|
3129
|
-
B(w, "lovelace",
|
|
3135
|
+
B(w, "lovelace", A);
|
|
3130
3136
|
}
|
|
3131
3137
|
for (const w of y) {
|
|
3132
3138
|
const v = r.get("lovelace");
|
|
@@ -3149,12 +3155,12 @@ const Ws = (s, e, t) => {
|
|
|
3149
3155
|
return t.quantity;
|
|
3150
3156
|
return "0";
|
|
3151
3157
|
};
|
|
3152
|
-
var
|
|
3158
|
+
var Wt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
3153
3159
|
(function(s) {
|
|
3154
3160
|
(function(e) {
|
|
3155
|
-
var t, r = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, n = Math.ceil, i = Math.floor, c = "[BigNumber Error] ", l = c + "Number primitive has more than 15 significant digits: ",
|
|
3161
|
+
var t, r = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, n = Math.ceil, i = Math.floor, c = "[BigNumber Error] ", l = c + "Number primitive has more than 15 significant digits: ", A = 1e14, y = 14, B = 9007199254740991, b = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], w = 1e7, v = 1e9;
|
|
3156
3162
|
function U(O) {
|
|
3157
|
-
var M, z, X, D =
|
|
3163
|
+
var M, z, X, D = E.prototype = { constructor: E, toString: null, valueOf: null }, F = new E(1), q = 20, J = 4, st = -7, ct = 21, Ft = -1e7, At = 1e7, Rt = !1, te = 1, kt = 0, xe = {
|
|
3158
3164
|
prefix: "",
|
|
3159
3165
|
groupSize: 3,
|
|
3160
3166
|
secondaryGroupSize: 0,
|
|
@@ -3164,39 +3170,39 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3164
3170
|
fractionGroupSeparator: "\xA0",
|
|
3165
3171
|
suffix: ""
|
|
3166
3172
|
}, qt = "0123456789abcdefghijklmnopqrstuvwxyz", we = !0;
|
|
3167
|
-
function
|
|
3168
|
-
var h, I, f, m, x, d, g, _,
|
|
3169
|
-
if (!(
|
|
3170
|
-
return new
|
|
3173
|
+
function E(o, u) {
|
|
3174
|
+
var h, I, f, m, x, d, g, _, p = this;
|
|
3175
|
+
if (!(p instanceof E))
|
|
3176
|
+
return new E(o, u);
|
|
3171
3177
|
if (u == null) {
|
|
3172
3178
|
if (o && o._isBigNumber === !0) {
|
|
3173
|
-
|
|
3179
|
+
p.s = o.s, !o.c || o.e > At ? p.c = p.e = null : o.e < Ft ? p.c = [p.e = 0] : (p.e = o.e, p.c = o.c.slice());
|
|
3174
3180
|
return;
|
|
3175
3181
|
}
|
|
3176
3182
|
if ((d = typeof o == "number") && o * 0 == 0) {
|
|
3177
|
-
if (
|
|
3183
|
+
if (p.s = 1 / o < 0 ? (o = -o, -1) : 1, o === ~~o) {
|
|
3178
3184
|
for (m = 0, x = o; x >= 10; x /= 10, m++)
|
|
3179
3185
|
;
|
|
3180
|
-
m > At ?
|
|
3186
|
+
m > At ? p.c = p.e = null : (p.e = m, p.c = [o]);
|
|
3181
3187
|
return;
|
|
3182
3188
|
}
|
|
3183
3189
|
_ = String(o);
|
|
3184
3190
|
} else {
|
|
3185
3191
|
if (!r.test(_ = String(o)))
|
|
3186
|
-
return X(
|
|
3187
|
-
|
|
3192
|
+
return X(p, _, d);
|
|
3193
|
+
p.s = _.charCodeAt(0) == 45 ? (_ = _.slice(1), -1) : 1;
|
|
3188
3194
|
}
|
|
3189
3195
|
(m = _.indexOf(".")) > -1 && (_ = _.replace(".", "")), (x = _.search(/e/i)) > 0 ? (m < 0 && (m = x), m += +_.slice(x + 1), _ = _.substring(0, x)) : m < 0 && (m = _.length);
|
|
3190
3196
|
} else {
|
|
3191
3197
|
if (Q(u, 2, qt.length, "Base"), u == 10 && we)
|
|
3192
|
-
return
|
|
3198
|
+
return p = new E(o), dt(p, q + p.e + 1, J);
|
|
3193
3199
|
if (_ = String(o), d = typeof o == "number") {
|
|
3194
3200
|
if (o * 0 != 0)
|
|
3195
|
-
return X(
|
|
3196
|
-
if (
|
|
3201
|
+
return X(p, _, d, u);
|
|
3202
|
+
if (p.s = 1 / o < 0 ? (_ = _.slice(1), -1) : 1, E.DEBUG && _.replace(/^0\.0*|\./, "").length > 15)
|
|
3197
3203
|
throw Error(l + o);
|
|
3198
3204
|
} else
|
|
3199
|
-
|
|
3205
|
+
p.s = _.charCodeAt(0) === 45 ? (_ = _.slice(1), -1) : 1;
|
|
3200
3206
|
for (h = qt.slice(0, u), m = x = 0, g = _.length; x < g; x++)
|
|
3201
3207
|
if (h.indexOf(I = _.charAt(x)) < 0) {
|
|
3202
3208
|
if (I == ".") {
|
|
@@ -3208,36 +3214,36 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3208
3214
|
f = !0, x = -1, m = 0;
|
|
3209
3215
|
continue;
|
|
3210
3216
|
}
|
|
3211
|
-
return X(
|
|
3217
|
+
return X(p, String(o), d, u);
|
|
3212
3218
|
}
|
|
3213
|
-
d = !1, _ = z(_, u, 10,
|
|
3219
|
+
d = !1, _ = z(_, u, 10, p.s), (m = _.indexOf(".")) > -1 ? _ = _.replace(".", "") : m = _.length;
|
|
3214
3220
|
}
|
|
3215
3221
|
for (x = 0; _.charCodeAt(x) === 48; x++)
|
|
3216
3222
|
;
|
|
3217
3223
|
for (g = _.length; _.charCodeAt(--g) === 48; )
|
|
3218
3224
|
;
|
|
3219
3225
|
if (_ = _.slice(x, ++g)) {
|
|
3220
|
-
if (g -= x, d &&
|
|
3221
|
-
throw Error(l +
|
|
3226
|
+
if (g -= x, d && E.DEBUG && g > 15 && (o > B || o !== i(o)))
|
|
3227
|
+
throw Error(l + p.s * o);
|
|
3222
3228
|
if ((m = m - x - 1) > At)
|
|
3223
|
-
|
|
3229
|
+
p.c = p.e = null;
|
|
3224
3230
|
else if (m < Ft)
|
|
3225
|
-
|
|
3231
|
+
p.c = [p.e = 0];
|
|
3226
3232
|
else {
|
|
3227
|
-
if (
|
|
3228
|
-
for (x &&
|
|
3229
|
-
|
|
3233
|
+
if (p.e = m, p.c = [], x = (m + 1) % y, m < 0 && (x += y), x < g) {
|
|
3234
|
+
for (x && p.c.push(+_.slice(0, x)), g -= y; x < g; )
|
|
3235
|
+
p.c.push(+_.slice(x, x += y));
|
|
3230
3236
|
x = y - (_ = _.slice(x)).length;
|
|
3231
3237
|
} else
|
|
3232
3238
|
x -= g;
|
|
3233
3239
|
for (; x--; _ += "0")
|
|
3234
3240
|
;
|
|
3235
|
-
|
|
3241
|
+
p.c.push(+_);
|
|
3236
3242
|
}
|
|
3237
3243
|
} else
|
|
3238
|
-
|
|
3244
|
+
p.c = [p.e = 0];
|
|
3239
3245
|
}
|
|
3240
|
-
|
|
3246
|
+
E.clone = U, E.ROUND_UP = 0, E.ROUND_DOWN = 1, E.ROUND_CEIL = 2, E.ROUND_FLOOR = 3, E.ROUND_HALF_UP = 4, E.ROUND_HALF_DOWN = 5, E.ROUND_HALF_EVEN = 6, E.ROUND_HALF_CEIL = 7, E.ROUND_HALF_FLOOR = 8, E.EUCLID = 9, E.config = E.set = function(o) {
|
|
3241
3247
|
var u, h;
|
|
3242
3248
|
if (o != null)
|
|
3243
3249
|
if (typeof o == "object") {
|
|
@@ -3259,7 +3265,7 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3259
3265
|
Rt = h;
|
|
3260
3266
|
else
|
|
3261
3267
|
throw Error(c + u + " not true or false: " + h);
|
|
3262
|
-
if (o.hasOwnProperty(u = "MODULO_MODE") && (h = o[u], Q(h, 0, 9, u),
|
|
3268
|
+
if (o.hasOwnProperty(u = "MODULO_MODE") && (h = o[u], Q(h, 0, 9, u), te = h), o.hasOwnProperty(u = "POW_PRECISION") && (h = o[u], Q(h, 0, v, u), kt = h), o.hasOwnProperty(u = "FORMAT"))
|
|
3263
3269
|
if (h = o[u], typeof h == "object")
|
|
3264
3270
|
xe = h;
|
|
3265
3271
|
else
|
|
@@ -3277,15 +3283,15 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3277
3283
|
EXPONENTIAL_AT: [st, ct],
|
|
3278
3284
|
RANGE: [Ft, At],
|
|
3279
3285
|
CRYPTO: Rt,
|
|
3280
|
-
MODULO_MODE:
|
|
3286
|
+
MODULO_MODE: te,
|
|
3281
3287
|
POW_PRECISION: kt,
|
|
3282
3288
|
FORMAT: xe,
|
|
3283
3289
|
ALPHABET: qt
|
|
3284
3290
|
};
|
|
3285
|
-
},
|
|
3291
|
+
}, E.isBigNumber = function(o) {
|
|
3286
3292
|
if (!o || o._isBigNumber !== !0)
|
|
3287
3293
|
return !1;
|
|
3288
|
-
if (!
|
|
3294
|
+
if (!E.DEBUG)
|
|
3289
3295
|
return !0;
|
|
3290
3296
|
var u, h, I = o.c, f = o.e, m = o.s;
|
|
3291
3297
|
t:
|
|
@@ -3298,7 +3304,7 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3298
3304
|
}
|
|
3299
3305
|
if (u = (f + 1) % y, u < 1 && (u += y), String(I[0]).length == u) {
|
|
3300
3306
|
for (u = 0; u < I.length; u++)
|
|
3301
|
-
if (h = I[u], h < 0 || h >=
|
|
3307
|
+
if (h = I[u], h < 0 || h >= A || h !== i(h))
|
|
3302
3308
|
break t;
|
|
3303
3309
|
if (h !== 0)
|
|
3304
3310
|
return !0;
|
|
@@ -3307,18 +3313,18 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3307
3313
|
} else if (I === null && f === null && (m === null || m === 1 || m === -1))
|
|
3308
3314
|
return !0;
|
|
3309
3315
|
throw Error(c + "Invalid BigNumber: " + o);
|
|
3310
|
-
},
|
|
3316
|
+
}, E.maximum = E.max = function() {
|
|
3311
3317
|
return ze(arguments, -1);
|
|
3312
|
-
},
|
|
3318
|
+
}, E.minimum = E.min = function() {
|
|
3313
3319
|
return ze(arguments, 1);
|
|
3314
|
-
},
|
|
3320
|
+
}, E.random = function() {
|
|
3315
3321
|
var o = 9007199254740992, u = Math.random() * o & 2097151 ? function() {
|
|
3316
3322
|
return i(Math.random() * o);
|
|
3317
3323
|
} : function() {
|
|
3318
3324
|
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
3319
3325
|
};
|
|
3320
3326
|
return function(h) {
|
|
3321
|
-
var I, f, m, x, d, g = 0, _ = [],
|
|
3327
|
+
var I, f, m, x, d, g = 0, _ = [], p = new E(F);
|
|
3322
3328
|
if (h == null ? h = q : Q(h, 0, v), x = n(h / y), Rt)
|
|
3323
3329
|
if (crypto.getRandomValues) {
|
|
3324
3330
|
for (I = crypto.getRandomValues(new Uint32Array(x *= 2)); g < x; )
|
|
@@ -3344,16 +3350,16 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3344
3350
|
;
|
|
3345
3351
|
g < y && (m -= y - g);
|
|
3346
3352
|
}
|
|
3347
|
-
return
|
|
3353
|
+
return p.e = m, p.c = _, p;
|
|
3348
3354
|
};
|
|
3349
|
-
}(),
|
|
3350
|
-
for (var o = 1, u = arguments, h = new
|
|
3355
|
+
}(), E.sum = function() {
|
|
3356
|
+
for (var o = 1, u = arguments, h = new E(u[0]); o < u.length; )
|
|
3351
3357
|
h = h.plus(u[o++]);
|
|
3352
3358
|
return h;
|
|
3353
3359
|
}, z = function() {
|
|
3354
3360
|
var o = "0123456789";
|
|
3355
3361
|
function u(h, I, f, m) {
|
|
3356
|
-
for (var x, d = [0], g, _ = 0,
|
|
3362
|
+
for (var x, d = [0], g, _ = 0, p = h.length; _ < p; ) {
|
|
3357
3363
|
for (g = d.length; g--; d[g] *= I)
|
|
3358
3364
|
;
|
|
3359
3365
|
for (d[0] += m.indexOf(h.charAt(_++)), x = 0; x < d.length; x++)
|
|
@@ -3362,25 +3368,25 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3362
3368
|
return d.reverse();
|
|
3363
3369
|
}
|
|
3364
3370
|
return function(h, I, f, m, x) {
|
|
3365
|
-
var d, g, _,
|
|
3366
|
-
for (Z >= 0 && (
|
|
3371
|
+
var d, g, _, p, C, P, K, L, Z = h.indexOf("."), et = q, V = J;
|
|
3372
|
+
for (Z >= 0 && (p = kt, kt = 0, h = h.replace(".", ""), L = new E(I), P = L.pow(h.length - Z), kt = p, L.c = u(
|
|
3367
3373
|
Y(N(P.c), P.e, "0"),
|
|
3368
3374
|
10,
|
|
3369
3375
|
f,
|
|
3370
3376
|
o
|
|
3371
|
-
), L.e = L.c.length), K = u(h, I, f, x ? (d = qt, o) : (d = o, qt)), _ =
|
|
3377
|
+
), L.e = L.c.length), K = u(h, I, f, x ? (d = qt, o) : (d = o, qt)), _ = p = K.length; K[--p] == 0; K.pop())
|
|
3372
3378
|
;
|
|
3373
3379
|
if (!K[0])
|
|
3374
3380
|
return d.charAt(0);
|
|
3375
|
-
if (Z < 0 ? --_ : (P.c = K, P.e = _, P.s = m, P = M(P, L, et, V, f), K = P.c, C = P.r, _ = P.e), g = _ + et + 1, Z = K[g],
|
|
3381
|
+
if (Z < 0 ? --_ : (P.c = K, P.e = _, P.s = m, P = M(P, L, et, V, f), K = P.c, C = P.r, _ = P.e), g = _ + et + 1, Z = K[g], p = f / 2, C = C || g < 0 || K[g + 1] != null, C = V < 4 ? (Z != null || C) && (V == 0 || V == (P.s < 0 ? 3 : 2)) : Z > p || Z == p && (V == 4 || C || V == 6 && K[g - 1] & 1 || V == (P.s < 0 ? 8 : 7)), g < 1 || !K[0])
|
|
3376
3382
|
h = C ? Y(d.charAt(1), -et, d.charAt(0)) : d.charAt(0);
|
|
3377
3383
|
else {
|
|
3378
3384
|
if (K.length = g, C)
|
|
3379
3385
|
for (--f; ++K[--g] > f; )
|
|
3380
3386
|
K[g] = 0, g || (++_, K = [1].concat(K));
|
|
3381
|
-
for (
|
|
3387
|
+
for (p = K.length; !K[--p]; )
|
|
3382
3388
|
;
|
|
3383
|
-
for (Z = 0, h = ""; Z <=
|
|
3389
|
+
for (Z = 0, h = ""; Z <= p; h += d.charAt(K[Z++]))
|
|
3384
3390
|
;
|
|
3385
3391
|
h = Y(h, _, d.charAt(0));
|
|
3386
3392
|
}
|
|
@@ -3388,10 +3394,10 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3388
3394
|
};
|
|
3389
3395
|
}(), M = function() {
|
|
3390
3396
|
function o(I, f, m) {
|
|
3391
|
-
var x, d, g, _,
|
|
3397
|
+
var x, d, g, _, p = 0, C = I.length, P = f % w, K = f / w | 0;
|
|
3392
3398
|
for (I = I.slice(); C--; )
|
|
3393
|
-
g = I[C] % w, _ = I[C] / w | 0, x = K * g + _ * P, d = P * g + x % w * w +
|
|
3394
|
-
return
|
|
3399
|
+
g = I[C] % w, _ = I[C] / w | 0, x = K * g + _ * P, d = P * g + x % w * w + p, p = (d / m | 0) + (x / w | 0) + K * _, I[C] = d % m;
|
|
3400
|
+
return p && (I = [p].concat(I)), I;
|
|
3395
3401
|
}
|
|
3396
3402
|
function u(I, f, m, x) {
|
|
3397
3403
|
var d, g;
|
|
@@ -3412,39 +3418,39 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3412
3418
|
;
|
|
3413
3419
|
}
|
|
3414
3420
|
return function(I, f, m, x, d) {
|
|
3415
|
-
var g, _,
|
|
3421
|
+
var g, _, p, C, P, K, L, Z, et, V, $, nt, ce, Se, Ee, xt, ee, ft = I.s == f.s ? 1 : -1, at = I.c, tt = f.c;
|
|
3416
3422
|
if (!at || !at[0] || !tt || !tt[0])
|
|
3417
|
-
return new
|
|
3423
|
+
return new E(
|
|
3418
3424
|
!I.s || !f.s || (at ? tt && at[0] == tt[0] : !tt) ? NaN : at && at[0] == 0 || !tt ? ft * 0 : ft / 0
|
|
3419
3425
|
);
|
|
3420
|
-
for (Z = new
|
|
3426
|
+
for (Z = new E(ft), et = Z.c = [], _ = I.e - f.e, ft = m + _ + 1, d || (d = A, _ = k(I.e / y) - k(f.e / y), ft = ft / y | 0), p = 0; tt[p] == (at[p] || 0); p++)
|
|
3421
3427
|
;
|
|
3422
|
-
if (tt[
|
|
3428
|
+
if (tt[p] > (at[p] || 0) && _--, ft < 0)
|
|
3423
3429
|
et.push(1), C = !0;
|
|
3424
3430
|
else {
|
|
3425
|
-
for (
|
|
3431
|
+
for (Se = at.length, xt = tt.length, p = 0, ft += 2, P = i(d / (tt[0] + 1)), P > 1 && (tt = o(tt, P, d), at = o(at, P, d), xt = tt.length, Se = at.length), ce = xt, V = at.slice(0, xt), $ = V.length; $ < xt; V[$++] = 0)
|
|
3426
3432
|
;
|
|
3427
|
-
|
|
3433
|
+
ee = tt.slice(), ee = [0].concat(ee), Ee = tt[0], tt[1] >= d / 2 && Ee++;
|
|
3428
3434
|
do {
|
|
3429
3435
|
if (P = 0, g = u(tt, V, xt, $), g < 0) {
|
|
3430
|
-
if (nt = V[0], xt != $ && (nt = nt * d + (V[1] || 0)), P = i(nt /
|
|
3436
|
+
if (nt = V[0], xt != $ && (nt = nt * d + (V[1] || 0)), P = i(nt / Ee), P > 1)
|
|
3431
3437
|
for (P >= d && (P = d - 1), K = o(tt, P, d), L = K.length, $ = V.length; u(K, V, L, $) == 1; )
|
|
3432
|
-
P--, h(K, xt < L ?
|
|
3438
|
+
P--, h(K, xt < L ? ee : tt, L, d), L = K.length, g = 1;
|
|
3433
3439
|
else
|
|
3434
3440
|
P == 0 && (g = P = 1), K = tt.slice(), L = K.length;
|
|
3435
3441
|
if (L < $ && (K = [0].concat(K)), h(V, K, $, d), $ = V.length, g == -1)
|
|
3436
3442
|
for (; u(tt, V, xt, $) < 1; )
|
|
3437
|
-
P++, h(V, xt < $ ?
|
|
3443
|
+
P++, h(V, xt < $ ? ee : tt, $, d), $ = V.length;
|
|
3438
3444
|
} else
|
|
3439
3445
|
g === 0 && (P++, V = [0]);
|
|
3440
|
-
et[
|
|
3441
|
-
} while ((ce++ <
|
|
3446
|
+
et[p++] = P, V[0] ? V[$++] = at[ce] || 0 : (V = [at[ce]], $ = 1);
|
|
3447
|
+
} while ((ce++ < Se || V[0] != null) && ft--);
|
|
3442
3448
|
C = V[0] != null, et[0] || et.splice(0, 1);
|
|
3443
3449
|
}
|
|
3444
|
-
if (d ==
|
|
3445
|
-
for (
|
|
3450
|
+
if (d == A) {
|
|
3451
|
+
for (p = 1, ft = et[0]; ft >= 10; ft /= 10, p++)
|
|
3446
3452
|
;
|
|
3447
|
-
dt(Z, m + (Z.e =
|
|
3453
|
+
dt(Z, m + (Z.e = p + _ * y - 1) + 1, x, C);
|
|
3448
3454
|
} else
|
|
3449
3455
|
Z.e = _, Z.r = +C;
|
|
3450
3456
|
return Z;
|
|
@@ -3456,7 +3462,7 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3456
3462
|
return o.toString();
|
|
3457
3463
|
if (f = o.c[0], x = o.e, u == null)
|
|
3458
3464
|
g = N(o.c), g = I == 1 || I == 2 && (x <= st || x >= ct) ? j(g, x) : Y(g, x, "0");
|
|
3459
|
-
else if (o = dt(new
|
|
3465
|
+
else if (o = dt(new E(o), u, h), m = o.e, g = N(o.c), d = g.length, I == 1 || I == 2 && (u <= m || m <= st)) {
|
|
3460
3466
|
for (; d < u; g += "0", d++)
|
|
3461
3467
|
;
|
|
3462
3468
|
g = j(g, m);
|
|
@@ -3470,8 +3476,8 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3470
3476
|
return o.s < 0 && f ? "-" + g : g;
|
|
3471
3477
|
}
|
|
3472
3478
|
function ze(o, u) {
|
|
3473
|
-
for (var h, I, f = 1, m = new
|
|
3474
|
-
I = new
|
|
3479
|
+
for (var h, I, f = 1, m = new E(o[0]); f < o.length; f++)
|
|
3480
|
+
I = new E(o[f]), (!I.s || (h = T(m, I)) === u || h === 0 && m.s === u) && (m = I);
|
|
3475
3481
|
return m;
|
|
3476
3482
|
}
|
|
3477
3483
|
function Be(o, u, h) {
|
|
@@ -3484,15 +3490,15 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3484
3490
|
X = function() {
|
|
3485
3491
|
var o = /^(-?)0([xbo])(?=\w[\w.]*$)/i, u = /^([^.]+)\.$/, h = /^\.([^.]+)$/, I = /^-?(Infinity|NaN)$/, f = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
3486
3492
|
return function(m, x, d, g) {
|
|
3487
|
-
var _,
|
|
3488
|
-
if (I.test(
|
|
3489
|
-
m.s = isNaN(
|
|
3493
|
+
var _, p = d ? x : x.replace(f, "");
|
|
3494
|
+
if (I.test(p))
|
|
3495
|
+
m.s = isNaN(p) ? null : p < 0 ? -1 : 1;
|
|
3490
3496
|
else {
|
|
3491
|
-
if (!d && (
|
|
3497
|
+
if (!d && (p = p.replace(o, function(C, P, K) {
|
|
3492
3498
|
return _ = (K = K.toLowerCase()) == "x" ? 16 : K == "b" ? 2 : 8, !g || g == _ ? P : C;
|
|
3493
|
-
}), g && (_ = g,
|
|
3494
|
-
return new
|
|
3495
|
-
if (
|
|
3499
|
+
}), g && (_ = g, p = p.replace(u, "$1").replace(h, "0.$1")), x != p))
|
|
3500
|
+
return new E(p, _);
|
|
3501
|
+
if (E.DEBUG)
|
|
3496
3502
|
throw Error(c + "Not a" + (g ? " base " + g : "") + " number: " + x);
|
|
3497
3503
|
m.s = null;
|
|
3498
3504
|
}
|
|
@@ -3500,26 +3506,26 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3500
3506
|
};
|
|
3501
3507
|
}();
|
|
3502
3508
|
function dt(o, u, h, I) {
|
|
3503
|
-
var f, m, x, d, g, _,
|
|
3509
|
+
var f, m, x, d, g, _, p, C = o.c, P = b;
|
|
3504
3510
|
if (C) {
|
|
3505
3511
|
t: {
|
|
3506
3512
|
for (f = 1, d = C[0]; d >= 10; d /= 10, f++)
|
|
3507
3513
|
;
|
|
3508
3514
|
if (m = u - f, m < 0)
|
|
3509
|
-
m += y, x = u, g = C[_ = 0],
|
|
3515
|
+
m += y, x = u, g = C[_ = 0], p = i(g / P[f - x - 1] % 10);
|
|
3510
3516
|
else if (_ = n((m + 1) / y), _ >= C.length)
|
|
3511
3517
|
if (I) {
|
|
3512
3518
|
for (; C.length <= _; C.push(0))
|
|
3513
3519
|
;
|
|
3514
|
-
g =
|
|
3520
|
+
g = p = 0, f = 1, m %= y, x = m - y + 1;
|
|
3515
3521
|
} else
|
|
3516
3522
|
break t;
|
|
3517
3523
|
else {
|
|
3518
3524
|
for (g = d = C[_], f = 1; d >= 10; d /= 10, f++)
|
|
3519
3525
|
;
|
|
3520
|
-
m %= y, x = m - y + f,
|
|
3526
|
+
m %= y, x = m - y + f, p = x < 0 ? 0 : i(g / P[f - x - 1] % 10);
|
|
3521
3527
|
}
|
|
3522
|
-
if (I = I || u < 0 || C[_ + 1] != null || (x < 0 ? g : g % P[f - x - 1]), I = h < 4 ? (
|
|
3528
|
+
if (I = I || u < 0 || C[_ + 1] != null || (x < 0 ? g : g % P[f - x - 1]), I = h < 4 ? (p || I) && (h == 0 || h == (o.s < 0 ? 3 : 2)) : p > 5 || p == 5 && (h == 4 || I || h == 6 && (m > 0 ? x > 0 ? g / P[f - x] : 0 : C[_ - 1]) % 10 & 1 || h == (o.s < 0 ? 8 : 7)), u < 1 || !C[0])
|
|
3523
3529
|
return C.length = 0, I ? (u -= o.e + 1, C[0] = P[(y - u % y) % y], o.e = -u || 0) : C[0] = o.e = 0, o;
|
|
3524
3530
|
if (m == 0 ? (C.length = _, d = 1, _--) : (C.length = _ + 1, d = P[y - m], C[_] = x > 0 ? i(g / P[f - x] % P[x]) * d : 0), I)
|
|
3525
3531
|
for (; ; )
|
|
@@ -3528,10 +3534,10 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3528
3534
|
;
|
|
3529
3535
|
for (x = C[0] += d, d = 1; x >= 10; x /= 10, d++)
|
|
3530
3536
|
;
|
|
3531
|
-
m != d && (o.e++, C[0] ==
|
|
3537
|
+
m != d && (o.e++, C[0] == A && (C[0] = 1));
|
|
3532
3538
|
break;
|
|
3533
3539
|
} else {
|
|
3534
|
-
if (C[_] += d, C[_] !=
|
|
3540
|
+
if (C[_] += d, C[_] != A)
|
|
3535
3541
|
break;
|
|
3536
3542
|
C[_--] = 0, d = 1;
|
|
3537
3543
|
}
|
|
@@ -3542,19 +3548,19 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3542
3548
|
}
|
|
3543
3549
|
return o;
|
|
3544
3550
|
}
|
|
3545
|
-
function
|
|
3551
|
+
function bt(o) {
|
|
3546
3552
|
var u, h = o.e;
|
|
3547
3553
|
return h === null ? o.toString() : (u = N(o.c), u = h <= st || h >= ct ? j(u, h) : Y(u, h, "0"), o.s < 0 ? "-" + u : u);
|
|
3548
3554
|
}
|
|
3549
3555
|
return D.absoluteValue = D.abs = function() {
|
|
3550
|
-
var o = new
|
|
3556
|
+
var o = new E(this);
|
|
3551
3557
|
return o.s < 0 && (o.s = 1), o;
|
|
3552
3558
|
}, D.comparedTo = function(o, u) {
|
|
3553
|
-
return T(this, new
|
|
3559
|
+
return T(this, new E(o, u));
|
|
3554
3560
|
}, D.decimalPlaces = D.dp = function(o, u) {
|
|
3555
3561
|
var h, I, f, m = this;
|
|
3556
3562
|
if (o != null)
|
|
3557
|
-
return Q(o, 0, v), u == null ? u = J : Q(u, 0, 8), dt(new
|
|
3563
|
+
return Q(o, 0, v), u == null ? u = J : Q(u, 0, 8), dt(new E(m), o + m.e + 1, u);
|
|
3558
3564
|
if (!(h = m.c))
|
|
3559
3565
|
return null;
|
|
3560
3566
|
if (I = ((f = h.length - 1) - k(this.e / y)) * y, f = h[f])
|
|
@@ -3562,29 +3568,29 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3562
3568
|
;
|
|
3563
3569
|
return I < 0 && (I = 0), I;
|
|
3564
3570
|
}, D.dividedBy = D.div = function(o, u) {
|
|
3565
|
-
return M(this, new
|
|
3571
|
+
return M(this, new E(o, u), q, J);
|
|
3566
3572
|
}, D.dividedToIntegerBy = D.idiv = function(o, u) {
|
|
3567
|
-
return M(this, new
|
|
3573
|
+
return M(this, new E(o, u), 0, 1);
|
|
3568
3574
|
}, D.exponentiatedBy = D.pow = function(o, u) {
|
|
3569
|
-
var h, I, f, m, x, d, g, _,
|
|
3570
|
-
if (o = new
|
|
3571
|
-
throw Error(c + "Exponent not an integer: " +
|
|
3572
|
-
if (u != null && (u = new
|
|
3573
|
-
return
|
|
3575
|
+
var h, I, f, m, x, d, g, _, p, C = this;
|
|
3576
|
+
if (o = new E(o), o.c && !o.isInteger())
|
|
3577
|
+
throw Error(c + "Exponent not an integer: " + bt(o));
|
|
3578
|
+
if (u != null && (u = new E(u)), d = o.e > 14, !C.c || !C.c[0] || C.c[0] == 1 && !C.e && C.c.length == 1 || !o.c || !o.c[0])
|
|
3579
|
+
return p = new E(Math.pow(+bt(C), d ? o.s * (2 - R(o)) : +bt(o))), u ? p.mod(u) : p;
|
|
3574
3580
|
if (g = o.s < 0, u) {
|
|
3575
3581
|
if (u.c ? !u.c[0] : !u.s)
|
|
3576
|
-
return new
|
|
3582
|
+
return new E(NaN);
|
|
3577
3583
|
I = !g && C.isInteger() && u.isInteger(), I && (C = C.mod(u));
|
|
3578
3584
|
} else {
|
|
3579
3585
|
if (o.e > 9 && (C.e > 0 || C.e < -1 || (C.e == 0 ? C.c[0] > 1 || d && C.c[1] >= 24e7 : C.c[0] < 8e13 || d && C.c[0] <= 9999975e7)))
|
|
3580
|
-
return m = C.s < 0 && R(o) ? -0 : 0, C.e > -1 && (m = 1 / m), new
|
|
3586
|
+
return m = C.s < 0 && R(o) ? -0 : 0, C.e > -1 && (m = 1 / m), new E(g ? 1 / m : m);
|
|
3581
3587
|
kt && (m = n(kt / y + 2));
|
|
3582
3588
|
}
|
|
3583
|
-
for (d ? (h = new
|
|
3589
|
+
for (d ? (h = new E(0.5), g && (o.s = 1), _ = R(o)) : (f = Math.abs(+bt(o)), _ = f % 2), p = new E(F); ; ) {
|
|
3584
3590
|
if (_) {
|
|
3585
|
-
if (
|
|
3591
|
+
if (p = p.times(C), !p.c)
|
|
3586
3592
|
break;
|
|
3587
|
-
m ?
|
|
3593
|
+
m ? p.c.length > m && (p.c.length = m) : I && (p = p.mod(u));
|
|
3588
3594
|
}
|
|
3589
3595
|
if (f) {
|
|
3590
3596
|
if (f = i(f / 2), f === 0)
|
|
@@ -3593,30 +3599,30 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3593
3599
|
} else if (o = o.times(h), dt(o, o.e + 1, 1), o.e > 14)
|
|
3594
3600
|
_ = R(o);
|
|
3595
3601
|
else {
|
|
3596
|
-
if (f = +
|
|
3602
|
+
if (f = +bt(o), f === 0)
|
|
3597
3603
|
break;
|
|
3598
3604
|
_ = f % 2;
|
|
3599
3605
|
}
|
|
3600
3606
|
C = C.times(C), m ? C.c && C.c.length > m && (C.c.length = m) : I && (C = C.mod(u));
|
|
3601
3607
|
}
|
|
3602
|
-
return I ?
|
|
3608
|
+
return I ? p : (g && (p = F.div(p)), u ? p.mod(u) : m ? dt(p, kt, J, x) : p);
|
|
3603
3609
|
}, D.integerValue = function(o) {
|
|
3604
|
-
var u = new
|
|
3610
|
+
var u = new E(this);
|
|
3605
3611
|
return o == null ? o = J : Q(o, 0, 8), dt(u, u.e + 1, o);
|
|
3606
3612
|
}, D.isEqualTo = D.eq = function(o, u) {
|
|
3607
|
-
return T(this, new
|
|
3613
|
+
return T(this, new E(o, u)) === 0;
|
|
3608
3614
|
}, D.isFinite = function() {
|
|
3609
3615
|
return !!this.c;
|
|
3610
3616
|
}, D.isGreaterThan = D.gt = function(o, u) {
|
|
3611
|
-
return T(this, new
|
|
3617
|
+
return T(this, new E(o, u)) > 0;
|
|
3612
3618
|
}, D.isGreaterThanOrEqualTo = D.gte = function(o, u) {
|
|
3613
|
-
return (u = T(this, new
|
|
3619
|
+
return (u = T(this, new E(o, u))) === 1 || u === 0;
|
|
3614
3620
|
}, D.isInteger = function() {
|
|
3615
3621
|
return !!this.c && k(this.e / y) > this.c.length - 2;
|
|
3616
3622
|
}, D.isLessThan = D.lt = function(o, u) {
|
|
3617
|
-
return T(this, new
|
|
3623
|
+
return T(this, new E(o, u)) < 0;
|
|
3618
3624
|
}, D.isLessThanOrEqualTo = D.lte = function(o, u) {
|
|
3619
|
-
return (u = T(this, new
|
|
3625
|
+
return (u = T(this, new E(o, u))) === -1 || u === 0;
|
|
3620
3626
|
}, D.isNaN = function() {
|
|
3621
3627
|
return !this.s;
|
|
3622
3628
|
}, D.isNegative = function() {
|
|
@@ -3627,71 +3633,71 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3627
3633
|
return !!this.c && this.c[0] == 0;
|
|
3628
3634
|
}, D.minus = function(o, u) {
|
|
3629
3635
|
var h, I, f, m, x = this, d = x.s;
|
|
3630
|
-
if (o = new
|
|
3631
|
-
return new
|
|
3636
|
+
if (o = new E(o, u), u = o.s, !d || !u)
|
|
3637
|
+
return new E(NaN);
|
|
3632
3638
|
if (d != u)
|
|
3633
3639
|
return o.s = -u, x.plus(o);
|
|
3634
|
-
var g = x.e / y, _ = o.e / y,
|
|
3640
|
+
var g = x.e / y, _ = o.e / y, p = x.c, C = o.c;
|
|
3635
3641
|
if (!g || !_) {
|
|
3636
|
-
if (!
|
|
3637
|
-
return
|
|
3638
|
-
if (!
|
|
3639
|
-
return C[0] ? (o.s = -u, o) : new
|
|
3642
|
+
if (!p || !C)
|
|
3643
|
+
return p ? (o.s = -u, o) : new E(C ? x : NaN);
|
|
3644
|
+
if (!p[0] || !C[0])
|
|
3645
|
+
return C[0] ? (o.s = -u, o) : new E(p[0] ? x : J == 3 ? -0 : 0);
|
|
3640
3646
|
}
|
|
3641
|
-
if (g = k(g), _ = k(_),
|
|
3642
|
-
for ((m = d < 0) ? (d = -d, f =
|
|
3647
|
+
if (g = k(g), _ = k(_), p = p.slice(), d = g - _) {
|
|
3648
|
+
for ((m = d < 0) ? (d = -d, f = p) : (_ = g, f = C), f.reverse(), u = d; u--; f.push(0))
|
|
3643
3649
|
;
|
|
3644
3650
|
f.reverse();
|
|
3645
3651
|
} else
|
|
3646
|
-
for (I = (m = (d =
|
|
3647
|
-
if (
|
|
3648
|
-
m =
|
|
3652
|
+
for (I = (m = (d = p.length) < (u = C.length)) ? d : u, d = u = 0; u < I; u++)
|
|
3653
|
+
if (p[u] != C[u]) {
|
|
3654
|
+
m = p[u] < C[u];
|
|
3649
3655
|
break;
|
|
3650
3656
|
}
|
|
3651
|
-
if (m && (f =
|
|
3652
|
-
for (; u--;
|
|
3657
|
+
if (m && (f = p, p = C, C = f, o.s = -o.s), u = (I = C.length) - (h = p.length), u > 0)
|
|
3658
|
+
for (; u--; p[h++] = 0)
|
|
3653
3659
|
;
|
|
3654
|
-
for (u =
|
|
3655
|
-
if (
|
|
3656
|
-
for (h = I; h && !
|
|
3660
|
+
for (u = A - 1; I > d; ) {
|
|
3661
|
+
if (p[--I] < C[I]) {
|
|
3662
|
+
for (h = I; h && !p[--h]; p[h] = u)
|
|
3657
3663
|
;
|
|
3658
|
-
--
|
|
3664
|
+
--p[h], p[I] += A;
|
|
3659
3665
|
}
|
|
3660
|
-
|
|
3666
|
+
p[I] -= C[I];
|
|
3661
3667
|
}
|
|
3662
|
-
for (;
|
|
3668
|
+
for (; p[0] == 0; p.splice(0, 1), --_)
|
|
3663
3669
|
;
|
|
3664
|
-
return
|
|
3670
|
+
return p[0] ? Be(o, p, _) : (o.s = J == 3 ? -1 : 1, o.c = [o.e = 0], o);
|
|
3665
3671
|
}, D.modulo = D.mod = function(o, u) {
|
|
3666
3672
|
var h, I, f = this;
|
|
3667
|
-
return o = new
|
|
3673
|
+
return o = new E(o, u), !f.c || !o.s || o.c && !o.c[0] ? new E(NaN) : !o.c || f.c && !f.c[0] ? new E(f) : (te == 9 ? (I = o.s, o.s = 1, h = M(f, o, 0, 3), o.s = I, h.s *= I) : h = M(f, o, 0, te), o = f.minus(h.times(o)), !o.c[0] && te == 1 && (o.s = f.s), o);
|
|
3668
3674
|
}, D.multipliedBy = D.times = function(o, u) {
|
|
3669
|
-
var h, I, f, m, x, d, g, _,
|
|
3675
|
+
var h, I, f, m, x, d, g, _, p, C, P, K, L, Z, et, V = this, $ = V.c, nt = (o = new E(o, u)).c;
|
|
3670
3676
|
if (!$ || !nt || !$[0] || !nt[0])
|
|
3671
3677
|
return !V.s || !o.s || $ && !$[0] && !nt || nt && !nt[0] && !$ ? o.c = o.e = o.s = null : (o.s *= V.s, !$ || !nt ? o.c = o.e = null : (o.c = [0], o.e = 0)), o;
|
|
3672
3678
|
for (I = k(V.e / y) + k(o.e / y), o.s *= V.s, g = $.length, C = nt.length, g < C && (L = $, $ = nt, nt = L, f = g, g = C, C = f), f = g + C, L = []; f--; L.push(0))
|
|
3673
3679
|
;
|
|
3674
|
-
for (Z =
|
|
3680
|
+
for (Z = A, et = w, f = C; --f >= 0; ) {
|
|
3675
3681
|
for (h = 0, P = nt[f] % et, K = nt[f] / et | 0, x = g, m = f + x; m > f; )
|
|
3676
|
-
_ = $[--x] % et,
|
|
3682
|
+
_ = $[--x] % et, p = $[x] / et | 0, d = K * _ + p * P, _ = P * _ + d % et * et + L[m] + h, h = (_ / Z | 0) + (d / et | 0) + K * p, L[m--] = _ % Z;
|
|
3677
3683
|
L[m] = h;
|
|
3678
3684
|
}
|
|
3679
3685
|
return h ? ++I : L.splice(0, 1), Be(o, L, I);
|
|
3680
3686
|
}, D.negated = function() {
|
|
3681
|
-
var o = new
|
|
3687
|
+
var o = new E(this);
|
|
3682
3688
|
return o.s = -o.s || null, o;
|
|
3683
3689
|
}, D.plus = function(o, u) {
|
|
3684
3690
|
var h, I = this, f = I.s;
|
|
3685
|
-
if (o = new
|
|
3686
|
-
return new
|
|
3691
|
+
if (o = new E(o, u), u = o.s, !f || !u)
|
|
3692
|
+
return new E(NaN);
|
|
3687
3693
|
if (f != u)
|
|
3688
3694
|
return o.s = -u, I.minus(o);
|
|
3689
3695
|
var m = I.e / y, x = o.e / y, d = I.c, g = o.c;
|
|
3690
3696
|
if (!m || !x) {
|
|
3691
3697
|
if (!d || !g)
|
|
3692
|
-
return new
|
|
3698
|
+
return new E(f / 0);
|
|
3693
3699
|
if (!d[0] || !g[0])
|
|
3694
|
-
return g[0] ? o : new
|
|
3700
|
+
return g[0] ? o : new E(d[0] ? I : f * 0);
|
|
3695
3701
|
}
|
|
3696
3702
|
if (m = k(m), x = k(x), d = d.slice(), f = m - x) {
|
|
3697
3703
|
for (f > 0 ? (x = m, h = g) : (f = -f, h = d), h.reverse(); f--; h.push(0))
|
|
@@ -3699,12 +3705,12 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3699
3705
|
h.reverse();
|
|
3700
3706
|
}
|
|
3701
3707
|
for (f = d.length, u = g.length, f - u < 0 && (h = g, g = d, d = h, u = f), f = 0; u; )
|
|
3702
|
-
f = (d[--u] = d[u] + g[u] + f) /
|
|
3708
|
+
f = (d[--u] = d[u] + g[u] + f) / A | 0, d[u] = A === d[u] ? 0 : d[u] % A;
|
|
3703
3709
|
return f && (d = [f].concat(d), ++x), Be(o, d, x);
|
|
3704
3710
|
}, D.precision = D.sd = function(o, u) {
|
|
3705
3711
|
var h, I, f, m = this;
|
|
3706
3712
|
if (o != null && o !== !!o)
|
|
3707
|
-
return Q(o, 1, v), u == null ? u = J : Q(u, 0, 8), dt(new
|
|
3713
|
+
return Q(o, 1, v), u == null ? u = J : Q(u, 0, 8), dt(new E(m), o, u);
|
|
3708
3714
|
if (!(h = m.c))
|
|
3709
3715
|
return null;
|
|
3710
3716
|
if (f = h.length - 1, I = f * y + 1, f = h[f]) {
|
|
@@ -3717,12 +3723,12 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3717
3723
|
}, D.shiftedBy = function(o) {
|
|
3718
3724
|
return Q(o, -B, B), this.times("1e" + o);
|
|
3719
3725
|
}, D.squareRoot = D.sqrt = function() {
|
|
3720
|
-
var o, u, h, I, f, m = this, x = m.c, d = m.s, g = m.e, _ = q + 4,
|
|
3726
|
+
var o, u, h, I, f, m = this, x = m.c, d = m.s, g = m.e, _ = q + 4, p = new E("0.5");
|
|
3721
3727
|
if (d !== 1 || !x || !x[0])
|
|
3722
|
-
return new
|
|
3723
|
-
if (d = Math.sqrt(+
|
|
3728
|
+
return new E(!d || d < 0 && (!x || x[0]) ? NaN : x ? m : 1 / 0);
|
|
3729
|
+
if (d = Math.sqrt(+bt(m)), d == 0 || d == 1 / 0 ? (u = N(x), (u.length + g) % 2 == 0 && (u += "0"), d = Math.sqrt(+u), g = k((g + 1) / 2) - (g < 0 || g % 2), d == 1 / 0 ? u = "5e" + g : (u = d.toExponential(), u = u.slice(0, u.indexOf("e") + 1) + g), h = new E(u)) : h = new E(d + ""), h.c[0]) {
|
|
3724
3730
|
for (g = h.e, d = g + _, d < 3 && (d = 0); ; )
|
|
3725
|
-
if (f = h, h =
|
|
3731
|
+
if (f = h, h = p.times(f.plus(M(m, f, _, 1))), N(f.c).slice(0, d) === (u = N(h.c)).slice(0, d))
|
|
3726
3732
|
if (h.e < g && --d, u = u.slice(d - 3, d + 1), u == "9999" || !I && u == "4999") {
|
|
3727
3733
|
if (!I && (dt(f, f.e + q + 2, 0), f.times(f).eq(m))) {
|
|
3728
3734
|
h = f;
|
|
@@ -3746,39 +3752,39 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3746
3752
|
else if (typeof h != "object")
|
|
3747
3753
|
throw Error(c + "Argument not an object: " + h);
|
|
3748
3754
|
if (I = f.toFixed(o, u), f.c) {
|
|
3749
|
-
var m, x = I.split("."), d = +h.groupSize, g = +h.secondaryGroupSize, _ = h.groupSeparator || "",
|
|
3755
|
+
var m, x = I.split("."), d = +h.groupSize, g = +h.secondaryGroupSize, _ = h.groupSeparator || "", p = x[0], C = x[1], P = f.s < 0, K = P ? p.slice(1) : p, L = K.length;
|
|
3750
3756
|
if (g && (m = d, d = g, g = m, L -= m), d > 0 && L > 0) {
|
|
3751
|
-
for (m = L % d || d,
|
|
3752
|
-
|
|
3753
|
-
g > 0 && (
|
|
3757
|
+
for (m = L % d || d, p = K.substr(0, m); m < L; m += d)
|
|
3758
|
+
p += _ + K.substr(m, d);
|
|
3759
|
+
g > 0 && (p += _ + K.slice(m)), P && (p = "-" + p);
|
|
3754
3760
|
}
|
|
3755
|
-
I = C ?
|
|
3761
|
+
I = C ? p + (h.decimalSeparator || "") + ((g = +h.fractionGroupSize) ? C.replace(
|
|
3756
3762
|
new RegExp("\\d{" + g + "}\\B", "g"),
|
|
3757
3763
|
"$&" + (h.fractionGroupSeparator || "")
|
|
3758
|
-
) : C) :
|
|
3764
|
+
) : C) : p;
|
|
3759
3765
|
}
|
|
3760
3766
|
return (h.prefix || "") + I + (h.suffix || "");
|
|
3761
3767
|
}, D.toFraction = function(o) {
|
|
3762
|
-
var u, h, I, f, m, x, d, g, _,
|
|
3763
|
-
if (o != null && (d = new
|
|
3764
|
-
throw Error(c + "Argument " + (d.isInteger() ? "out of range: " : "not an integer: ") +
|
|
3768
|
+
var u, h, I, f, m, x, d, g, _, p, C, P, K = this, L = K.c;
|
|
3769
|
+
if (o != null && (d = new E(o), !d.isInteger() && (d.c || d.s !== 1) || d.lt(F)))
|
|
3770
|
+
throw Error(c + "Argument " + (d.isInteger() ? "out of range: " : "not an integer: ") + bt(d));
|
|
3765
3771
|
if (!L)
|
|
3766
|
-
return new
|
|
3767
|
-
for (u = new
|
|
3768
|
-
h = I, I = f, _ = g.plus(
|
|
3772
|
+
return new E(K);
|
|
3773
|
+
for (u = new E(F), _ = h = new E(F), I = g = new E(F), P = N(L), m = u.e = P.length - K.e - 1, u.c[0] = b[(x = m % y) < 0 ? y + x : x], o = !o || d.comparedTo(u) > 0 ? m > 0 ? u : _ : d, x = At, At = 1 / 0, d = new E(P), g.c[0] = 0; p = M(d, u, 0, 1), f = h.plus(p.times(I)), f.comparedTo(o) != 1; )
|
|
3774
|
+
h = I, I = f, _ = g.plus(p.times(f = _)), g = f, u = d.minus(p.times(f = u)), d = f;
|
|
3769
3775
|
return f = M(o.minus(h), I, 0, 1), g = g.plus(f.times(_)), h = h.plus(f.times(I)), g.s = _.s = K.s, m = m * 2, C = M(_, I, m, J).minus(K).abs().comparedTo(
|
|
3770
3776
|
M(g, h, m, J).minus(K).abs()
|
|
3771
3777
|
) < 1 ? [_, I] : [g, h], At = x, C;
|
|
3772
3778
|
}, D.toNumber = function() {
|
|
3773
|
-
return +
|
|
3779
|
+
return +bt(this);
|
|
3774
3780
|
}, D.toPrecision = function(o, u) {
|
|
3775
3781
|
return o != null && Q(o, 1, v), Ce(this, o, u, 2);
|
|
3776
3782
|
}, D.toString = function(o) {
|
|
3777
3783
|
var u, h = this, I = h.s, f = h.e;
|
|
3778
|
-
return f === null ? I ? (u = "Infinity", I < 0 && (u = "-" + u)) : u = "NaN" : (o == null ? u = f <= st || f >= ct ? j(N(h.c), f) : Y(N(h.c), f, "0") : o === 10 && we ? (h = dt(new
|
|
3784
|
+
return f === null ? I ? (u = "Infinity", I < 0 && (u = "-" + u)) : u = "NaN" : (o == null ? u = f <= st || f >= ct ? j(N(h.c), f) : Y(N(h.c), f, "0") : o === 10 && we ? (h = dt(new E(h), q + f + 1, J), u = Y(N(h.c), h.e, "0")) : (Q(o, 2, qt.length, "Base"), u = z(Y(N(h.c), f, "0"), 10, o, I, !0)), I < 0 && h.c[0] && (u = "-" + u)), u;
|
|
3779
3785
|
}, D.valueOf = D.toJSON = function() {
|
|
3780
|
-
return
|
|
3781
|
-
}, D._isBigNumber = !0, O != null &&
|
|
3786
|
+
return bt(this);
|
|
3787
|
+
}, D._isBigNumber = !0, O != null && E.set(O), E;
|
|
3782
3788
|
}
|
|
3783
3789
|
function k(O) {
|
|
3784
3790
|
var M = O | 0;
|
|
@@ -3851,7 +3857,7 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3851
3857
|
'"': '\\"',
|
|
3852
3858
|
"\\": "\\\\"
|
|
3853
3859
|
}, l;
|
|
3854
|
-
function
|
|
3860
|
+
function A(B) {
|
|
3855
3861
|
return r.lastIndex = 0, r.test(B) ? '"' + B.replace(r, function(b) {
|
|
3856
3862
|
var w = c[b];
|
|
3857
3863
|
return typeof w == "string" ? w : "\\u" + ("0000" + b.charCodeAt(0).toString(16)).slice(-4);
|
|
@@ -3861,7 +3867,7 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3861
3867
|
var w, v, U, k, N = n, T, Q = b[B], R = Q != null && (Q instanceof e || e.isBigNumber(Q));
|
|
3862
3868
|
switch (Q && typeof Q == "object" && typeof Q.toJSON == "function" && (Q = Q.toJSON(B)), typeof l == "function" && (Q = l.call(b, B, Q)), typeof Q) {
|
|
3863
3869
|
case "string":
|
|
3864
|
-
return R ? Q :
|
|
3870
|
+
return R ? Q : A(Q);
|
|
3865
3871
|
case "number":
|
|
3866
3872
|
return isFinite(Q) ? String(Q) : "null";
|
|
3867
3873
|
case "boolean":
|
|
@@ -3881,11 +3887,11 @@ var zt = { exports: {} }, Vr = { exports: {} }, $e = { exports: {} };
|
|
|
3881
3887
|
}
|
|
3882
3888
|
if (l && typeof l == "object")
|
|
3883
3889
|
for (k = l.length, w = 0; w < k; w += 1)
|
|
3884
|
-
typeof l[w] == "string" && (v = l[w], U = y(v, Q), U && T.push(
|
|
3890
|
+
typeof l[w] == "string" && (v = l[w], U = y(v, Q), U && T.push(A(v) + (n ? ": " : ":") + U));
|
|
3885
3891
|
else
|
|
3886
3892
|
Object.keys(Q).forEach(function(j) {
|
|
3887
3893
|
var Y = y(j, Q);
|
|
3888
|
-
Y && T.push(
|
|
3894
|
+
Y && T.push(A(j) + (n ? ": " : ":") + Y);
|
|
3889
3895
|
});
|
|
3890
3896
|
return U = T.length === 0 ? "{}" : n ? `{
|
|
3891
3897
|
` + n + T.join(`,
|
|
@@ -3952,7 +3958,7 @@ var Zs = function(s) {
|
|
|
3952
3958
|
};
|
|
3953
3959
|
}, l = function(k) {
|
|
3954
3960
|
return k && k !== r && c("Expected '" + k + "' instead of '" + r + "'"), r = i.charAt(t), t += 1, r;
|
|
3955
|
-
},
|
|
3961
|
+
}, A = function() {
|
|
3956
3962
|
var k, N = "";
|
|
3957
3963
|
for (r === "-" && (N = "-", l("-")); r >= "0" && r <= "9"; )
|
|
3958
3964
|
N += r, l();
|
|
@@ -4032,9 +4038,9 @@ var Zs = function(s) {
|
|
|
4032
4038
|
case '"':
|
|
4033
4039
|
return y();
|
|
4034
4040
|
case "-":
|
|
4035
|
-
return
|
|
4041
|
+
return A();
|
|
4036
4042
|
default:
|
|
4037
|
-
return r >= "0" && r <= "9" ?
|
|
4043
|
+
return r >= "0" && r <= "9" ? A() : b();
|
|
4038
4044
|
}
|
|
4039
4045
|
}, function(k, N) {
|
|
4040
4046
|
var T;
|
|
@@ -4046,19 +4052,19 @@ var Zs = function(s) {
|
|
|
4046
4052
|
}({ "": T }, "") : T;
|
|
4047
4053
|
};
|
|
4048
4054
|
}, tn = Zs, Lr = Vr.exports.stringify, Gr = tn;
|
|
4049
|
-
|
|
4055
|
+
Wt.exports = function(s) {
|
|
4050
4056
|
return {
|
|
4051
4057
|
parse: Gr(s),
|
|
4052
4058
|
stringify: Lr
|
|
4053
4059
|
};
|
|
4054
4060
|
};
|
|
4055
|
-
|
|
4056
|
-
|
|
4061
|
+
Wt.exports.parse = Gr();
|
|
4062
|
+
Wt.exports.stringify = Lr;
|
|
4057
4063
|
class en {
|
|
4058
4064
|
txHex = "";
|
|
4059
|
-
txBuilder =
|
|
4065
|
+
txBuilder = Ae();
|
|
4060
4066
|
txEvaluationMultiplier = 1.1;
|
|
4061
|
-
_protocolParams =
|
|
4067
|
+
_protocolParams = mt;
|
|
4062
4068
|
txOutput;
|
|
4063
4069
|
addingScriptInput = !1;
|
|
4064
4070
|
addingPlutusMint = !1;
|
|
@@ -4068,7 +4074,7 @@ class en {
|
|
|
4068
4074
|
txInQueueItem;
|
|
4069
4075
|
collateralQueueItem;
|
|
4070
4076
|
refScriptTxInQueueItem;
|
|
4071
|
-
reset = () => (this.txHex = "", this.txBuilder =
|
|
4077
|
+
reset = () => (this.txHex = "", this.txBuilder = Ae(), this.txEvaluationMultiplier = 1.1, this._protocolParams = mt, this.txOutput = void 0, this.addingScriptInput = !1, this.addingPlutusMint = !1, this.mintItem = void 0, this.txInQueueItem = void 0, this.collateralQueueItem = void 0, this.refScriptTxInQueueItem = void 0, this.meshTxBuilderBody = this.emptyTxBuilderBody(), this);
|
|
4072
4078
|
emptyTxBuilderBody = () => ({
|
|
4073
4079
|
inputs: [],
|
|
4074
4080
|
outputs: [],
|
|
@@ -4093,7 +4099,7 @@ class en {
|
|
|
4093
4099
|
return e.length > 0 && this.addAllSigningKeys(e), this.txHex;
|
|
4094
4100
|
};
|
|
4095
4101
|
serializeTxBody = (e) => {
|
|
4096
|
-
const { inputs: t, outputs: r, extraInputs: n, selectionThreshold: i, collaterals: c, referenceInputs: l, mints:
|
|
4102
|
+
const { inputs: t, outputs: r, extraInputs: n, selectionThreshold: i, collaterals: c, referenceInputs: l, mints: A, changeAddress: y, certificates: B, validityRange: b, requiredSignatures: w, metadata: v } = e;
|
|
4097
4103
|
if (this.isHydra ? this.protocolParams({
|
|
4098
4104
|
minFeeA: 0,
|
|
4099
4105
|
minFeeB: 0,
|
|
@@ -4101,7 +4107,7 @@ class en {
|
|
|
4101
4107
|
priceStep: 0,
|
|
4102
4108
|
collateralPercent: 0,
|
|
4103
4109
|
coinsPerUTxOSize: "0"
|
|
4104
|
-
}) : this.protocolParams({}), n.length > 0 && this.addUtxosFrom(n, String(i)), this.removeDuplicateInputs(), this.meshTxBuilderBody.mints.sort((U, k) => U.policyId.localeCompare(k.policyId)), this.meshTxBuilderBody.inputs.sort((U, k) => U.txIn.txHash === k.txIn.txHash ? U.txIn.txIndex - k.txIn.txIndex : U.txIn.txHash.localeCompare(k.txIn.txHash)), this.addAllInputs(t), this.addAllOutputs(r), this.addAllCollaterals(c), this.addAllReferenceInputs(l), this.addAllMints(
|
|
4110
|
+
}) : this.protocolParams({}), n.length > 0 && this.addUtxosFrom(n, String(i)), this.removeDuplicateInputs(), this.meshTxBuilderBody.mints.sort((U, k) => U.policyId.localeCompare(k.policyId)), this.meshTxBuilderBody.inputs.sort((U, k) => U.txIn.txHash === k.txIn.txHash ? U.txIn.txIndex - k.txIn.txIndex : U.txIn.txHash.localeCompare(k.txIn.txHash)), this.addAllInputs(t), this.addAllOutputs(r), this.addAllCollaterals(c), this.addAllReferenceInputs(l), this.addAllMints(A), this.addAllCertificates(B), this.addValidityRange(b), this.addAllRequiredSignatures(w), this.addAllMetadata(v), this.addCostModels(), y) {
|
|
4105
4111
|
const U = this.meshTxBuilderBody.collaterals.map((T) => {
|
|
4106
4112
|
var Q, R;
|
|
4107
4113
|
return ((R = (Q = T.txIn.amount) == null ? void 0 : Q.find((j) => j.unit === "lovelace")) == null ? void 0 : R.quantity) || "0";
|
|
@@ -4133,24 +4139,37 @@ class en {
|
|
|
4133
4139
|
address: n
|
|
4134
4140
|
}
|
|
4135
4141
|
}, this.addingScriptInput = !1, this);
|
|
4136
|
-
txInScript = (e, t
|
|
4142
|
+
txInScript = (e, t) => {
|
|
4137
4143
|
if (!this.txInQueueItem)
|
|
4138
4144
|
throw Error("Undefined input");
|
|
4139
|
-
if (this.txInQueueItem.type === "PubKey"
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4145
|
+
if (this.txInQueueItem.type === "PubKey" && (this.txInQueueItem = {
|
|
4146
|
+
type: "SimpleScript",
|
|
4147
|
+
txIn: this.txInQueueItem.txIn,
|
|
4148
|
+
simpleScriptTxIn: {
|
|
4149
|
+
scriptSource: {
|
|
4150
|
+
type: "Provided",
|
|
4151
|
+
script: e
|
|
4152
|
+
}
|
|
4146
4153
|
}
|
|
4147
|
-
}, this
|
|
4154
|
+
}), this.txInQueueItem.type === "Script") {
|
|
4155
|
+
const r = t || "V2";
|
|
4156
|
+
this.txInQueueItem.scriptTxIn.scriptSource = {
|
|
4157
|
+
type: "Provided",
|
|
4158
|
+
script: {
|
|
4159
|
+
code: e,
|
|
4160
|
+
version: r
|
|
4161
|
+
}
|
|
4162
|
+
};
|
|
4163
|
+
}
|
|
4164
|
+
return this;
|
|
4148
4165
|
};
|
|
4149
4166
|
txInDatumValue = (e, t = "Mesh") => {
|
|
4150
4167
|
if (!this.txInQueueItem)
|
|
4151
4168
|
throw Error("Undefined input");
|
|
4152
4169
|
if (this.txInQueueItem.type === "PubKey")
|
|
4153
4170
|
throw Error("Datum value attempted to be called a non script input");
|
|
4171
|
+
if (this.txInQueueItem.type === "SimpleScript")
|
|
4172
|
+
throw Error("Datum value attempted to be called on a simple script input");
|
|
4154
4173
|
let r = e;
|
|
4155
4174
|
return t === "JSON" && (r = this.castRawDataToJsonString(e)), t === "Mesh" ? (this.txInQueueItem.scriptTxIn.datumSource = {
|
|
4156
4175
|
type: "Provided",
|
|
@@ -4171,6 +4190,8 @@ class en {
|
|
|
4171
4190
|
throw Error("Undefined input");
|
|
4172
4191
|
if (this.txInQueueItem.type === "PubKey")
|
|
4173
4192
|
throw Error("Inline datum present attempted to be called a non script input");
|
|
4193
|
+
if (this.txInQueueItem.type === "SimpleScript")
|
|
4194
|
+
throw Error("Inline datum present attempted to be called on a simple script input");
|
|
4174
4195
|
const { txHash: e, txIndex: t } = this.txInQueueItem.txIn;
|
|
4175
4196
|
return e && t.toString() && (this.txInQueueItem.scriptTxIn.datumSource = {
|
|
4176
4197
|
type: "Inline",
|
|
@@ -4178,11 +4199,13 @@ class en {
|
|
|
4178
4199
|
txIndex: t
|
|
4179
4200
|
}), this;
|
|
4180
4201
|
};
|
|
4181
|
-
txInRedeemerValue = (e, t = { ...
|
|
4202
|
+
txInRedeemerValue = (e, t = { ...Yt }, r = "Mesh") => {
|
|
4182
4203
|
if (!this.txInQueueItem)
|
|
4183
4204
|
throw Error("Undefined input");
|
|
4184
4205
|
if (this.txInQueueItem.type === "PubKey")
|
|
4185
4206
|
throw Error("Spending tx in reference redeemer attempted to be called a non script input");
|
|
4207
|
+
if (this.txInQueueItem.type === "SimpleScript")
|
|
4208
|
+
throw Error("Spending tx in reference redeemer attempted to be called on a simple script input");
|
|
4186
4209
|
let n = e;
|
|
4187
4210
|
return r === "Mesh" ? (this.txInQueueItem.scriptTxIn.redeemer = {
|
|
4188
4211
|
data: {
|
|
@@ -4251,6 +4274,8 @@ class en {
|
|
|
4251
4274
|
throw Error("Undefined input");
|
|
4252
4275
|
if (this.txInQueueItem.type === "PubKey")
|
|
4253
4276
|
throw Error("Spending tx in reference attempted to be called a non script input");
|
|
4277
|
+
if (this.txInQueueItem.type === "SimpleScript")
|
|
4278
|
+
throw Error("Spending tx in reference attempted to be called on a simple script input");
|
|
4254
4279
|
return this.txInQueueItem.scriptTxIn.scriptSource = {
|
|
4255
4280
|
type: "Inline",
|
|
4256
4281
|
txInInfo: {
|
|
@@ -4262,7 +4287,7 @@ class en {
|
|
|
4262
4287
|
}, this;
|
|
4263
4288
|
};
|
|
4264
4289
|
spendingReferenceTxInInlineDatumPresent = () => (this.txInInlineDatumPresent(), this);
|
|
4265
|
-
spendingReferenceTxInRedeemerValue = (e, t = { ...
|
|
4290
|
+
spendingReferenceTxInRedeemerValue = (e, t = { ...Yt }, r = "Mesh") => (this.txInRedeemerValue(e, t, r), this);
|
|
4266
4291
|
readOnlyTxInReference = (e, t) => (this.meshTxBuilderBody.referenceInputs.push({ txHash: e, txIndex: t }), this);
|
|
4267
4292
|
mintPlutusScriptV2 = () => (this.addingPlutusMint = !0, this);
|
|
4268
4293
|
mint = (e, t, r) => (this.mintItem && this.queueMint(), this.mintItem = {
|
|
@@ -4297,7 +4322,7 @@ class en {
|
|
|
4297
4322
|
version: r
|
|
4298
4323
|
}, this;
|
|
4299
4324
|
};
|
|
4300
|
-
mintReferenceTxInRedeemerValue = (e, t = { ...
|
|
4325
|
+
mintReferenceTxInRedeemerValue = (e, t = { ...Yt }, r = "Mesh") => {
|
|
4301
4326
|
if (!this.mintItem)
|
|
4302
4327
|
throw Error("Undefined mint");
|
|
4303
4328
|
if (this.mintItem.type == "Native")
|
|
@@ -4324,7 +4349,7 @@ class en {
|
|
|
4324
4349
|
}
|
|
4325
4350
|
return this;
|
|
4326
4351
|
};
|
|
4327
|
-
mintRedeemerValue = (e, t = { ...
|
|
4352
|
+
mintRedeemerValue = (e, t = { ...Yt }, r = "Mesh") => (this.mintReferenceTxInRedeemerValue(e, t, r), this);
|
|
4328
4353
|
requiredSignerHash = (e) => (this.meshTxBuilderBody.requiredSignatures.push(e), this);
|
|
4329
4354
|
txInCollateral = (e, t, r, n) => (this.collateralQueueItem && this.meshTxBuilderBody.collaterals.push(this.collateralQueueItem), this.collateralQueueItem = {
|
|
4330
4355
|
type: "PubKey",
|
|
@@ -4362,28 +4387,28 @@ class en {
|
|
|
4362
4387
|
invalidHereafter = (e) => (this.meshTxBuilderBody.validityRange.invalidHereafter = e, this);
|
|
4363
4388
|
metadataValue = (e, t) => (this.meshTxBuilderBody.metadata.push({ tag: e, metadata: t }), this);
|
|
4364
4389
|
protocolParams = (e) => {
|
|
4365
|
-
const t = { ...
|
|
4366
|
-
return this._protocolParams = t, this.txBuilder =
|
|
4390
|
+
const t = { ...mt, ...e };
|
|
4391
|
+
return this._protocolParams = t, this.txBuilder = Ae(t), this;
|
|
4367
4392
|
};
|
|
4368
4393
|
signingKey = (e) => (this.meshTxBuilderBody.signingKey.push(e), this);
|
|
4369
4394
|
selectUtxosFrom = (e, t = 5e6) => (this.meshTxBuilderBody.extraInputs = e, this.meshTxBuilderBody.selectionThreshold = t, this);
|
|
4370
4395
|
addUtxosFrom = (e, t) => {
|
|
4371
|
-
const r = this.meshTxBuilderBody.outputs.reduce((i, c) => (c.amount.forEach((
|
|
4372
|
-
const { unit: y, quantity: B } =
|
|
4396
|
+
const r = this.meshTxBuilderBody.outputs.reduce((i, c) => (c.amount.forEach((A) => {
|
|
4397
|
+
const { unit: y, quantity: B } = A, b = Number(i.get(y)) || 0;
|
|
4373
4398
|
i.set(y, String(b + Number(B)));
|
|
4374
4399
|
}), i), /* @__PURE__ */ new Map());
|
|
4375
4400
|
this.meshTxBuilderBody.inputs.reduce((i, c) => {
|
|
4376
4401
|
const l = c.txIn.amount;
|
|
4377
|
-
return l == null || l.forEach((
|
|
4378
|
-
const { unit: y, quantity: B } =
|
|
4402
|
+
return l == null || l.forEach((A) => {
|
|
4403
|
+
const { unit: y, quantity: B } = A, b = Number(i.get(y)) || 0;
|
|
4379
4404
|
i.set(y, String(b - Number(B)));
|
|
4380
4405
|
}), i;
|
|
4381
4406
|
}, r), this.meshTxBuilderBody.mints.reduce((i, c) => {
|
|
4382
4407
|
const l = {
|
|
4383
4408
|
unit: c.policyId + c.assetName,
|
|
4384
4409
|
quantity: String(c.amount)
|
|
4385
|
-
},
|
|
4386
|
-
return i.set(l.unit, String(
|
|
4410
|
+
}, A = Number(i.get(l.unit)) || 0;
|
|
4411
|
+
return i.set(l.unit, String(A - Number(l.quantity))), i;
|
|
4387
4412
|
}, r), Ws(e, r, t).forEach((i) => {
|
|
4388
4413
|
const c = {
|
|
4389
4414
|
type: "PubKey",
|
|
@@ -4401,7 +4426,7 @@ class en {
|
|
|
4401
4426
|
if (e.length > 0) {
|
|
4402
4427
|
const t = a.Vkeywitnesses.new(), r = a.Transaction.from_hex(this.txHex), n = r.body();
|
|
4403
4428
|
e.forEach((l) => {
|
|
4404
|
-
const
|
|
4429
|
+
const A = l.slice(0, 4) === "5820" ? l.slice(4) : l, y = a.PrivateKey.from_hex(A), B = a.make_vkey_witness(a.hash_transaction(n), y);
|
|
4405
4430
|
t.add(B);
|
|
4406
4431
|
});
|
|
4407
4432
|
const i = r.witness_set();
|
|
@@ -4438,7 +4463,7 @@ class en {
|
|
|
4438
4463
|
};
|
|
4439
4464
|
makePlutusScriptSource = (e) => {
|
|
4440
4465
|
const t = a.ScriptHash.from_hex(e.spendingScriptHash), r = a.TransactionInput.new(a.TransactionHash.from_hex(e.txHash), e.txIndex);
|
|
4441
|
-
return a.PlutusScriptSource.new_ref_input_with_lang_ver(t, r,
|
|
4466
|
+
return a.PlutusScriptSource.new_ref_input_with_lang_ver(t, r, vt[e.version]);
|
|
4442
4467
|
};
|
|
4443
4468
|
removeDuplicateInputs = () => {
|
|
4444
4469
|
const e = this.meshTxBuilderBody.inputs, t = (n) => `${n.txHash}#${n.txIndex}`, r = [];
|
|
@@ -4454,6 +4479,9 @@ class en {
|
|
|
4454
4479
|
case "PubKey":
|
|
4455
4480
|
this.addTxIn(r);
|
|
4456
4481
|
break;
|
|
4482
|
+
case "SimpleScript":
|
|
4483
|
+
this.addNativeScriptTxIn(r);
|
|
4484
|
+
break;
|
|
4457
4485
|
case "Script":
|
|
4458
4486
|
this.addScriptTxIn(r);
|
|
4459
4487
|
break;
|
|
@@ -4461,7 +4489,10 @@ class en {
|
|
|
4461
4489
|
}
|
|
4462
4490
|
};
|
|
4463
4491
|
addTxIn = (e) => {
|
|
4464
|
-
this.txBuilder.add_input(a.Address.from_bech32(e.txIn.address), a.TransactionInput.new(a.TransactionHash.from_hex(e.txIn.txHash), e.txIn.txIndex),
|
|
4492
|
+
this.txBuilder.add_input(a.Address.from_bech32(e.txIn.address), a.TransactionInput.new(a.TransactionHash.from_hex(e.txIn.txHash), e.txIn.txIndex), Bt(e.txIn.amount));
|
|
4493
|
+
};
|
|
4494
|
+
addNativeScriptTxIn = ({ txIn: e, simpleScriptTxIn: t }) => {
|
|
4495
|
+
t.scriptSource.type === "Provided" && this.txBuilder.add_native_script_input(a.NativeScript.from_hex(t.scriptSource.script), a.TransactionInput.new(a.TransactionHash.from_hex(e.txHash), e.txIndex), Bt(e.amount));
|
|
4465
4496
|
};
|
|
4466
4497
|
addScriptTxIn = ({ scriptTxIn: e, txIn: t }) => {
|
|
4467
4498
|
let r;
|
|
@@ -4473,9 +4504,9 @@ class en {
|
|
|
4473
4504
|
r = a.DatumSource.new_ref_input(y);
|
|
4474
4505
|
}
|
|
4475
4506
|
let l;
|
|
4476
|
-
i.type == "Inline" ? l = this.makePlutusScriptSource(i.txInInfo) : l = a.PlutusScriptSource.new(a.PlutusScript.from_hex_with_version(i.script.code,
|
|
4477
|
-
const
|
|
4478
|
-
this.txBuilder.add_plutus_script_input(a.PlutusWitness.new_with_ref(l, r,
|
|
4507
|
+
i.type == "Inline" ? l = this.makePlutusScriptSource(i.txInInfo) : l = a.PlutusScriptSource.new(a.PlutusScript.from_hex_with_version(i.script.code, vt[i.script.version]));
|
|
4508
|
+
const A = a.Redeemer.new(a.RedeemerTag.new_spend(), a.BigNum.from_str("0"), this.castDataToPlutusData(c.data), a.ExUnits.new(a.BigNum.from_str(String(c.exUnits.mem)), a.BigNum.from_str(String(c.exUnits.steps))));
|
|
4509
|
+
this.txBuilder.add_plutus_script_input(a.PlutusWitness.new_with_ref(l, r, A), a.TransactionInput.new(a.TransactionHash.from_hex(t.txHash), t.txIndex), Bt(t.amount));
|
|
4479
4510
|
};
|
|
4480
4511
|
addAllOutputs = (e) => {
|
|
4481
4512
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -4484,17 +4515,17 @@ class en {
|
|
|
4484
4515
|
}
|
|
4485
4516
|
};
|
|
4486
4517
|
addOutput = ({ amount: e, address: t, datum: r, referenceScript: n }) => {
|
|
4487
|
-
const i =
|
|
4518
|
+
const i = Bt(e), c = i.multiasset();
|
|
4488
4519
|
if (i.is_zero() && c === void 0)
|
|
4489
4520
|
throw Error("Invalid output amount");
|
|
4490
4521
|
let l = a.TransactionOutputBuilder.new().with_address(yt(t));
|
|
4491
|
-
r && r.type === "Hash" && (l = l.with_data_hash(a.hash_plutus_data(this.castDataToPlutusData(r.data)))), r && r.type === "Inline" && (l = l.with_plutus_data(this.castDataToPlutusData(r.data))), n && (l = l.with_script_ref(a.ScriptRef.new_plutus_script(a.PlutusScript.from_hex_with_version(n.code,
|
|
4492
|
-
const
|
|
4522
|
+
r && r.type === "Hash" && (l = l.with_data_hash(a.hash_plutus_data(this.castDataToPlutusData(r.data)))), r && r.type === "Inline" && (l = l.with_plutus_data(this.castDataToPlutusData(r.data))), n && (l = l.with_script_ref(a.ScriptRef.new_plutus_script(a.PlutusScript.from_hex_with_version(n.code, vt[n.version]))));
|
|
4523
|
+
const A = l.next();
|
|
4493
4524
|
if (c) {
|
|
4494
|
-
const y = i.coin().is_zero() ?
|
|
4525
|
+
const y = i.coin().is_zero() ? A.with_asset_and_min_required_coin_by_utxo_cost(c, Ue(this._protocolParams.coinsPerUTxOSize)).build() : A.with_coin_and_asset(i.coin(), c).build();
|
|
4495
4526
|
this.txBuilder.add_output(y);
|
|
4496
4527
|
} else {
|
|
4497
|
-
const y =
|
|
4528
|
+
const y = A.with_coin(i.coin()).build();
|
|
4498
4529
|
this.txBuilder.add_output(y);
|
|
4499
4530
|
}
|
|
4500
4531
|
};
|
|
@@ -4507,7 +4538,7 @@ class en {
|
|
|
4507
4538
|
this.txBuilder.set_collateral(t);
|
|
4508
4539
|
};
|
|
4509
4540
|
addCollateral = (e, t) => {
|
|
4510
|
-
e.add_input(a.Address.from_bech32(t.txIn.address), a.TransactionInput.new(a.TransactionHash.from_hex(t.txIn.txHash), t.txIn.txIndex),
|
|
4541
|
+
e.add_input(a.Address.from_bech32(t.txIn.address), a.TransactionInput.new(a.TransactionHash.from_hex(t.txIn.txHash), t.txIn.txIndex), Bt(t.txIn.amount));
|
|
4511
4542
|
};
|
|
4512
4543
|
addCollateralReturn = (e) => {
|
|
4513
4544
|
var r;
|
|
@@ -4543,8 +4574,8 @@ class en {
|
|
|
4543
4574
|
this.txBuilder.set_mint_builder(t);
|
|
4544
4575
|
};
|
|
4545
4576
|
addPlutusMint = (e, { redeemer: t, policyId: r, scriptSource: n, assetName: i, amount: c }, l) => {
|
|
4546
|
-
const
|
|
4547
|
-
e.add_asset(a.MintWitness.new_plutus_script(y,
|
|
4577
|
+
const A = a.Redeemer.new(a.RedeemerTag.new_mint(), a.BigNum.from_str(String(l)), this.castDataToPlutusData(t.data), a.ExUnits.new(a.BigNum.from_str(String(t.exUnits.mem)), a.BigNum.from_str(String(t.exUnits.steps)))), y = n.type === "Reference Script" ? a.PlutusScriptSource.new_ref_input_with_lang_ver(a.ScriptHash.from_hex(r), a.TransactionInput.new(a.TransactionHash.from_hex(n.txHash), n.txIndex), vt[n.version]) : a.PlutusScriptSource.new(a.PlutusScript.from_hex_with_version(n.script.code, vt[n.script.version]));
|
|
4578
|
+
e.add_asset(a.MintWitness.new_plutus_script(y, A), a.AssetName.new(Buffer.from(i, "hex")), a.Int.from_str(c));
|
|
4548
4579
|
};
|
|
4549
4580
|
addNativeMint = (e, { scriptSource: t, assetName: r, amount: n }) => {
|
|
4550
4581
|
if (t.type === "Reference Script")
|
|
@@ -4566,7 +4597,7 @@ class en {
|
|
|
4566
4597
|
const i = a.Ed25519KeyHashes.new();
|
|
4567
4598
|
return e.owners.forEach((c) => {
|
|
4568
4599
|
i.add(a.Ed25519KeyHash.from_hex(c));
|
|
4569
|
-
}), a.PoolParams.new(a.Ed25519KeyHash.from_hex(e.operator), a.VRFKeyHash.from_hex(e.VRFKeyHash), a.BigNum.from_str(e.pledge), a.BigNum.from_str(e.cost), a.UnitInterval.new(a.BigNum.from_str(t[0].toString()), a.BigNum.from_str(t[1].toString())), n, i, r, e.metadata ? a.PoolMetadata.from_json(
|
|
4600
|
+
}), a.PoolParams.new(a.Ed25519KeyHash.from_hex(e.operator), a.VRFKeyHash.from_hex(e.VRFKeyHash), a.BigNum.from_str(e.pledge), a.BigNum.from_str(e.cost), a.UnitInterval.new(a.BigNum.from_str(t[0].toString()), a.BigNum.from_str(t[1].toString())), n, i, r, e.metadata ? a.PoolMetadata.from_json(Wt.exports.stringify(e.metadata)) : void 0);
|
|
4570
4601
|
};
|
|
4571
4602
|
addCertificate = (e, t) => {
|
|
4572
4603
|
switch (t.type) {
|
|
@@ -4611,7 +4642,7 @@ class en {
|
|
|
4611
4642
|
};
|
|
4612
4643
|
addAllMetadata = (e) => {
|
|
4613
4644
|
e.forEach(({ tag: t, metadata: r }) => {
|
|
4614
|
-
this.txBuilder.add_json_metadatum(a.BigNum.from_str(t),
|
|
4645
|
+
this.txBuilder.add_json_metadatum(a.BigNum.from_str(t), Wt.exports.stringify(r));
|
|
4615
4646
|
});
|
|
4616
4647
|
};
|
|
4617
4648
|
updateRedeemer = (e, t) => {
|
|
@@ -4630,10 +4661,10 @@ class en {
|
|
|
4630
4661
|
}
|
|
4631
4662
|
});
|
|
4632
4663
|
};
|
|
4633
|
-
castRawDataToJsonString = (e) => typeof e == "object" ?
|
|
4664
|
+
castRawDataToJsonString = (e) => typeof e == "object" ? Wt.exports.stringify(e) : e;
|
|
4634
4665
|
castDataToPlutusData = ({ type: e, content: t }) => e === "Mesh" ? Ot(t) : e === "CBOR" ? a.PlutusData.from_hex(t) : a.PlutusData.from_json(t, a.PlutusDatumSchema.DetailedSchema);
|
|
4635
4666
|
}
|
|
4636
|
-
class
|
|
4667
|
+
class Tn extends en {
|
|
4637
4668
|
_fetcher;
|
|
4638
4669
|
_submitter;
|
|
4639
4670
|
_evaluator;
|
|
@@ -4711,7 +4742,7 @@ class rt {
|
|
|
4711
4742
|
}
|
|
4712
4743
|
getAccount(e, t) {
|
|
4713
4744
|
return this.accountContext(e, t, (r, n) => {
|
|
4714
|
-
const i = mr(this._networkId, r.to_public().hash(), n.to_public().hash()).to_address().to_bech32(), c =
|
|
4745
|
+
const i = mr(this._networkId, r.to_public().hash(), n.to_public().hash()).to_address().to_bech32(), c = pr(this._networkId, r.to_public().hash()).to_address().to_bech32(), l = Pe(this._networkId, n.to_public().hash()).to_address().to_bech32();
|
|
4715
4746
|
return {
|
|
4716
4747
|
baseAddress: i,
|
|
4717
4748
|
enterpriseAddress: c,
|
|
@@ -4722,10 +4753,10 @@ class rt {
|
|
|
4722
4753
|
signData(e, t, r, n) {
|
|
4723
4754
|
try {
|
|
4724
4755
|
return this.accountContext(e, t, (i, c) => {
|
|
4725
|
-
const l = { payload: n },
|
|
4756
|
+
const l = { payload: n }, A = {
|
|
4726
4757
|
address: rt.resolveAddress(this._networkId, r, i, c),
|
|
4727
4758
|
key: r.startsWith("stake") ? c : i
|
|
4728
|
-
}, { coseSign1: y, coseKey: B } = hs(l,
|
|
4759
|
+
}, { coseSign1: y, coseKey: B } = hs(l, A);
|
|
4729
4760
|
return { signature: y, key: B };
|
|
4730
4761
|
});
|
|
4731
4762
|
} catch (i) {
|
|
@@ -4735,13 +4766,13 @@ class rt {
|
|
|
4735
4766
|
signTx(e, t, r, n, i) {
|
|
4736
4767
|
try {
|
|
4737
4768
|
const c = Ur($s(n));
|
|
4738
|
-
return this.accountContext(e, t, (l,
|
|
4769
|
+
return this.accountContext(e, t, (l, A) => {
|
|
4739
4770
|
const y = a.Vkeywitnesses.new();
|
|
4740
4771
|
return rt.resolveSigners(n, r, l.to_public().hash().to_hex()).forEach((b) => {
|
|
4741
4772
|
if (b === l.to_public().hash().to_hex())
|
|
4742
4773
|
y.add(a.make_vkey_witness(c, l));
|
|
4743
|
-
else if (b ===
|
|
4744
|
-
y.add(a.make_vkey_witness(c,
|
|
4774
|
+
else if (b === A.to_public().hash().to_hex())
|
|
4775
|
+
y.add(a.make_vkey_witness(c, A));
|
|
4745
4776
|
else if (i === !1)
|
|
4746
4777
|
throw new Error(`Missing key witness for: ${b}`);
|
|
4747
4778
|
}), y;
|
|
@@ -4783,7 +4814,7 @@ class rt {
|
|
|
4783
4814
|
static resolveAddress(e, t, r, n) {
|
|
4784
4815
|
const i = [
|
|
4785
4816
|
mr(e, r.to_public().hash(), n.to_public().hash()),
|
|
4786
|
-
|
|
4817
|
+
pr(e, r.to_public().hash()),
|
|
4787
4818
|
Pe(e, n.to_public().hash())
|
|
4788
4819
|
].find((c) => c.to_address().to_bech32() === t);
|
|
4789
4820
|
if (i !== void 0)
|
|
@@ -4803,7 +4834,7 @@ class rt {
|
|
|
4803
4834
|
}
|
|
4804
4835
|
static resolveSigners(e, t, r) {
|
|
4805
4836
|
const n = (l) => {
|
|
4806
|
-
const
|
|
4837
|
+
const A = (T, Q = [], R = 0) => {
|
|
4807
4838
|
var O, M, z, X, D;
|
|
4808
4839
|
if (T === void 0 || R >= T.len())
|
|
4809
4840
|
return Q;
|
|
@@ -4839,7 +4870,7 @@ class rt {
|
|
|
4839
4870
|
break;
|
|
4840
4871
|
}
|
|
4841
4872
|
}
|
|
4842
|
-
return
|
|
4873
|
+
return A(T, [...Q, ...Y], R + 1);
|
|
4843
4874
|
}, y = (T, Q = [], R = 0) => {
|
|
4844
4875
|
if (T === void 0 || R >= T.len())
|
|
4845
4876
|
return Q;
|
|
@@ -4852,14 +4883,14 @@ class rt {
|
|
|
4852
4883
|
return b(T, Y ? [...Q, Y.to_hex()] : Q, R + 1);
|
|
4853
4884
|
}, w = l.certs(), v = l.collateral(), U = l.inputs(), k = l.required_signers(), N = l.withdrawals();
|
|
4854
4885
|
return [
|
|
4855
|
-
...
|
|
4886
|
+
...A(w),
|
|
4856
4887
|
...y(v),
|
|
4857
4888
|
...y(U),
|
|
4858
4889
|
...B(k),
|
|
4859
4890
|
...b(N)
|
|
4860
4891
|
];
|
|
4861
4892
|
}, i = (l) => {
|
|
4862
|
-
const
|
|
4893
|
+
const A = (B, b = []) => {
|
|
4863
4894
|
var w, v, U, k;
|
|
4864
4895
|
if (B)
|
|
4865
4896
|
for (let N = 0; N < B.len(); N += 1) {
|
|
@@ -4870,17 +4901,17 @@ class rt {
|
|
|
4870
4901
|
return Q ? [...b, Q] : b;
|
|
4871
4902
|
}
|
|
4872
4903
|
case a.NativeScriptKind.ScriptAll:
|
|
4873
|
-
return
|
|
4904
|
+
return A((v = T.as_script_all()) == null ? void 0 : v.native_scripts(), b);
|
|
4874
4905
|
case a.NativeScriptKind.ScriptAny:
|
|
4875
|
-
return
|
|
4906
|
+
return A((U = T.as_script_any()) == null ? void 0 : U.native_scripts(), b);
|
|
4876
4907
|
case a.NativeScriptKind.ScriptNOfK:
|
|
4877
|
-
return
|
|
4908
|
+
return A((k = T.as_script_n_of_k()) == null ? void 0 : k.native_scripts(), b);
|
|
4878
4909
|
}
|
|
4879
4910
|
}
|
|
4880
4911
|
return b;
|
|
4881
4912
|
}, y = l.native_scripts();
|
|
4882
4913
|
return [
|
|
4883
|
-
...
|
|
4914
|
+
...A(y)
|
|
4884
4915
|
];
|
|
4885
4916
|
}, c = _t(e);
|
|
4886
4917
|
return /* @__PURE__ */ new Set([
|
|
@@ -4889,7 +4920,7 @@ class rt {
|
|
|
4889
4920
|
]);
|
|
4890
4921
|
}
|
|
4891
4922
|
}
|
|
4892
|
-
const
|
|
4923
|
+
const It = "MARI0TIME";
|
|
4893
4924
|
class Qe {
|
|
4894
4925
|
_fetcher;
|
|
4895
4926
|
_submitter;
|
|
@@ -4897,40 +4928,40 @@ class Qe {
|
|
|
4897
4928
|
constructor(e) {
|
|
4898
4929
|
switch (this._fetcher = e.fetcher, this._submitter = e.submitter, e.key.type) {
|
|
4899
4930
|
case "mnemonic":
|
|
4900
|
-
this._wallet = new rt(e.networkId, rt.encryptMnemonic(e.key.words,
|
|
4931
|
+
this._wallet = new rt(e.networkId, rt.encryptMnemonic(e.key.words, It));
|
|
4901
4932
|
break;
|
|
4902
4933
|
case "root":
|
|
4903
|
-
this._wallet = new rt(e.networkId, rt.encryptPrivateKey(e.key.bech32,
|
|
4934
|
+
this._wallet = new rt(e.networkId, rt.encryptPrivateKey(e.key.bech32, It));
|
|
4904
4935
|
break;
|
|
4905
4936
|
case "cli":
|
|
4906
|
-
this._wallet = new rt(e.networkId, rt.encryptSigningKeys(e.key.payment, e.key.stake ?? "f0".repeat(34),
|
|
4937
|
+
this._wallet = new rt(e.networkId, rt.encryptSigningKeys(e.key.payment, e.key.stake ?? "f0".repeat(34), It));
|
|
4907
4938
|
}
|
|
4908
4939
|
}
|
|
4909
4940
|
getBaseAddress(e = 0) {
|
|
4910
|
-
return this._wallet.getAccount(e,
|
|
4941
|
+
return this._wallet.getAccount(e, It).baseAddress;
|
|
4911
4942
|
}
|
|
4912
4943
|
getPaymentAddress(e = 0) {
|
|
4913
|
-
return this._wallet.getAccount(e,
|
|
4944
|
+
return this._wallet.getAccount(e, It).enterpriseAddress;
|
|
4914
4945
|
}
|
|
4915
4946
|
getRewardAddress(e = 0) {
|
|
4916
|
-
return this._wallet.getAccount(e,
|
|
4947
|
+
return this._wallet.getAccount(e, It).rewardAddress;
|
|
4917
4948
|
}
|
|
4918
4949
|
getUsedAddress(e = 0) {
|
|
4919
|
-
const t = this._wallet.getAccount(e,
|
|
4950
|
+
const t = this._wallet.getAccount(e, It);
|
|
4920
4951
|
return yt(t.enterpriseAddress);
|
|
4921
4952
|
}
|
|
4922
|
-
getUsedCollateral(e =
|
|
4953
|
+
getUsedCollateral(e = mt.maxCollateralInputs) {
|
|
4923
4954
|
throw new Error("getUsedCollateral not implemented.");
|
|
4924
4955
|
}
|
|
4925
4956
|
async getUsedUTxOs(e = 0) {
|
|
4926
4957
|
if (!this._fetcher)
|
|
4927
4958
|
throw new Error("[AppWallet] Fetcher is required to fetch UTxOs. Please provide a fetcher.");
|
|
4928
|
-
const t = this._wallet.getAccount(e,
|
|
4929
|
-
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((n) =>
|
|
4959
|
+
const t = this._wallet.getAccount(e, It);
|
|
4960
|
+
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((n) => gt(n));
|
|
4930
4961
|
}
|
|
4931
4962
|
signData(e, t, r = 0) {
|
|
4932
4963
|
try {
|
|
4933
|
-
return this._wallet.signData(r,
|
|
4964
|
+
return this._wallet.signData(r, It, e, t);
|
|
4934
4965
|
} catch (n) {
|
|
4935
4966
|
throw new Error(`[AppWallet] An error occurred during signData: ${n}.`);
|
|
4936
4967
|
}
|
|
@@ -4939,8 +4970,8 @@ class Qe {
|
|
|
4939
4970
|
try {
|
|
4940
4971
|
if (!this._fetcher)
|
|
4941
4972
|
throw new Error("[AppWallet] Fetcher is required to fetch UTxOs. Please provide a fetcher.");
|
|
4942
|
-
const n = this._wallet.getAccount(r,
|
|
4943
|
-
return
|
|
4973
|
+
const n = this._wallet.getAccount(r, It), i = await this._fetcher.fetchAddressUTxOs(n.enterpriseAddress), c = this._wallet.signTx(r, It, i, e, t), l = _t(e), A = l.witness_set(), y = Me(A, c);
|
|
4974
|
+
return A.set_vkeys(y), a.Transaction.new(l.body(), A, l.auxiliary_data()).to_hex();
|
|
4944
4975
|
} catch (n) {
|
|
4945
4976
|
throw new Error(`[AppWallet] An error occurred during signTx: ${n}.`);
|
|
4946
4977
|
}
|
|
@@ -4996,25 +5027,25 @@ class Ke {
|
|
|
4996
5027
|
}
|
|
4997
5028
|
async getChangeAddress() {
|
|
4998
5029
|
const e = await this._walletInstance.getChangeAddress();
|
|
4999
|
-
return
|
|
5030
|
+
return Gt(e).to_bech32();
|
|
5000
5031
|
}
|
|
5001
|
-
async getCollateral(e =
|
|
5002
|
-
return (await this.getUsedCollateral(e)).map((r) =>
|
|
5032
|
+
async getCollateral(e = mt.maxCollateralInputs) {
|
|
5033
|
+
return (await this.getUsedCollateral(e)).map((r) => oe(r));
|
|
5003
5034
|
}
|
|
5004
5035
|
getNetworkId() {
|
|
5005
5036
|
return this._walletInstance.getNetworkId();
|
|
5006
5037
|
}
|
|
5007
5038
|
async getRewardAddresses() {
|
|
5008
|
-
return (await this._walletInstance.getRewardAddresses()).map((t) =>
|
|
5039
|
+
return (await this._walletInstance.getRewardAddresses()).map((t) => Gt(t).to_bech32());
|
|
5009
5040
|
}
|
|
5010
5041
|
async getUnusedAddresses() {
|
|
5011
|
-
return (await this._walletInstance.getUnusedAddresses()).map((t) =>
|
|
5042
|
+
return (await this._walletInstance.getUnusedAddresses()).map((t) => Gt(t).to_bech32());
|
|
5012
5043
|
}
|
|
5013
5044
|
async getUsedAddresses() {
|
|
5014
|
-
return (await this._walletInstance.getUsedAddresses()).map((t) =>
|
|
5045
|
+
return (await this._walletInstance.getUsedAddresses()).map((t) => Gt(t).to_bech32());
|
|
5015
5046
|
}
|
|
5016
5047
|
async getUtxos(e = void 0) {
|
|
5017
|
-
return (await this.getUsedUTxOs(e)).map((r) =>
|
|
5048
|
+
return (await this.getUsedUTxOs(e)).map((r) => oe(r));
|
|
5018
5049
|
}
|
|
5019
5050
|
signData(e, t) {
|
|
5020
5051
|
const r = yt(e).to_hex();
|
|
@@ -5048,7 +5079,7 @@ class Ke {
|
|
|
5048
5079
|
throw new Error("Wallet does not support signTxs");
|
|
5049
5080
|
const n = [];
|
|
5050
5081
|
for (let i = 0; i < r.length; i++) {
|
|
5051
|
-
const c = _t(e[i]), l = c.witness_set(),
|
|
5082
|
+
const c = _t(e[i]), l = c.witness_set(), A = fr(r[i]).vkeys() ?? a.Vkeywitnesses.new(), y = Me(l, A);
|
|
5052
5083
|
l.set_vkeys(y);
|
|
5053
5084
|
const B = ut(a.Transaction.new(c.body(), l, c.auxiliary_data()).to_bytes());
|
|
5054
5085
|
n.push(B);
|
|
@@ -5060,13 +5091,13 @@ class Ke {
|
|
|
5060
5091
|
}
|
|
5061
5092
|
async getUsedAddress() {
|
|
5062
5093
|
const e = await this._walletInstance.getUsedAddresses();
|
|
5063
|
-
return
|
|
5094
|
+
return Gt(e[0]);
|
|
5064
5095
|
}
|
|
5065
|
-
async getUsedCollateral(e =
|
|
5096
|
+
async getUsedCollateral(e = mt.maxCollateralInputs) {
|
|
5066
5097
|
return (await this._walletInstance.experimental.getCollateral() ?? []).map((r) => dr(r)).slice(0, e);
|
|
5067
5098
|
}
|
|
5068
5099
|
async getUsedUTxOs(e = void 0) {
|
|
5069
|
-
const t = e ?
|
|
5100
|
+
const t = e ? Bt(e).to_hex() : void 0;
|
|
5070
5101
|
return (await this._walletInstance.getUtxos(t) ?? []).map((n) => dr(n));
|
|
5071
5102
|
}
|
|
5072
5103
|
async getAssets() {
|
|
@@ -5099,7 +5130,7 @@ class Ke {
|
|
|
5099
5130
|
return t == null ? void 0 : t.enable();
|
|
5100
5131
|
}
|
|
5101
5132
|
}
|
|
5102
|
-
class
|
|
5133
|
+
class Nn {
|
|
5103
5134
|
_wallet;
|
|
5104
5135
|
_network;
|
|
5105
5136
|
constructor(e) {
|
|
@@ -5145,8 +5176,8 @@ class Tn {
|
|
|
5145
5176
|
n.output.amount.map((i) => {
|
|
5146
5177
|
const c = i.unit, l = Number(i.quantity);
|
|
5147
5178
|
if (t.has(c)) {
|
|
5148
|
-
const
|
|
5149
|
-
t.set(c,
|
|
5179
|
+
const A = t.get(c);
|
|
5180
|
+
t.set(c, A + l);
|
|
5150
5181
|
} else
|
|
5151
5182
|
t.set(c, l);
|
|
5152
5183
|
});
|
|
@@ -5179,7 +5210,7 @@ class Tn {
|
|
|
5179
5210
|
return [this.getChangeAddress()];
|
|
5180
5211
|
}
|
|
5181
5212
|
async getUtxos() {
|
|
5182
|
-
return (await this.getUsedUTxOs()).map((t) =>
|
|
5213
|
+
return (await this.getUsedUTxOs()).map((t) => oe(t));
|
|
5183
5214
|
}
|
|
5184
5215
|
signData(e) {
|
|
5185
5216
|
return this._wallet.signData(this.getChangeAddress(), e);
|
|
@@ -5202,7 +5233,7 @@ class Tn {
|
|
|
5202
5233
|
return this._wallet.getUsedAddress();
|
|
5203
5234
|
}
|
|
5204
5235
|
async getUsedCollateral() {
|
|
5205
|
-
return (await this.getCollateral()).map((r) =>
|
|
5236
|
+
return (await this.getCollateral()).map((r) => gt(r));
|
|
5206
5237
|
}
|
|
5207
5238
|
async getUsedUTxOs() {
|
|
5208
5239
|
return await this._wallet.getUtxos();
|
|
@@ -5231,7 +5262,7 @@ class Tn {
|
|
|
5231
5262
|
return Array.from(new Set(e.map((t) => t.unit.slice(0, lt)))).filter((t) => t !== "lovelace");
|
|
5232
5263
|
}
|
|
5233
5264
|
async createCollateral() {
|
|
5234
|
-
const t = await new
|
|
5265
|
+
const t = await new St({ initiator: this._wallet }).sendLovelace(this.getChangeAddress(), "5000000").build(), r = await this.signTx(t);
|
|
5235
5266
|
return await this.submitTx(r);
|
|
5236
5267
|
}
|
|
5237
5268
|
static brew(e = !1, t = 256) {
|
|
@@ -5241,44 +5272,45 @@ class Tn {
|
|
|
5241
5272
|
}
|
|
5242
5273
|
export {
|
|
5243
5274
|
Qe as AppWallet,
|
|
5244
|
-
|
|
5275
|
+
Bn as BlockfrostProvider,
|
|
5245
5276
|
Ke as BrowserWallet,
|
|
5246
5277
|
rt as EmbeddedWallet,
|
|
5247
|
-
|
|
5248
|
-
|
|
5278
|
+
Dn as ForgeScript,
|
|
5279
|
+
Sn as InfuraProvider,
|
|
5249
5280
|
En as KoiosProvider,
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5281
|
+
vn as MaestroProvider,
|
|
5282
|
+
Tn as MeshTxBuilder,
|
|
5283
|
+
Nn as MeshWallet,
|
|
5284
|
+
bn as OgmiosProvider,
|
|
5285
|
+
St as Transaction,
|
|
5286
|
+
Qn as YaciProvider,
|
|
5256
5287
|
un as checkSignature,
|
|
5257
|
-
|
|
5288
|
+
xn as generateNonce,
|
|
5258
5289
|
Zr as isNetwork,
|
|
5259
5290
|
ns as keepRelevant,
|
|
5260
5291
|
cn as largestFirst,
|
|
5261
5292
|
is as largestFirstMultiAsset,
|
|
5262
5293
|
on as mergeAssets,
|
|
5263
5294
|
Kt as parseAssetUnit,
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5295
|
+
S as parseHttpError,
|
|
5296
|
+
wn as readPlutusData,
|
|
5297
|
+
Cn as readTransaction,
|
|
5267
5298
|
ln as resolveDataHash,
|
|
5268
5299
|
hn as resolveEpochNo,
|
|
5269
5300
|
Rr as resolveFingerprint,
|
|
5270
5301
|
dn as resolveLanguageView,
|
|
5271
5302
|
fn as resolveNativeScriptAddress,
|
|
5272
5303
|
gn as resolveNativeScriptHash,
|
|
5273
|
-
|
|
5274
|
-
|
|
5304
|
+
mn as resolveNativeScriptHex,
|
|
5305
|
+
$t as resolvePaymentKeyHash,
|
|
5306
|
+
pn as resolvePlutusScriptAddress,
|
|
5275
5307
|
An as resolvePlutusScriptHash,
|
|
5276
|
-
|
|
5308
|
+
In as resolvePoolId,
|
|
5277
5309
|
Ys as resolvePrivateKey,
|
|
5278
5310
|
ye as resolveRewardAddress,
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5311
|
+
_n as resolveScriptRef,
|
|
5312
|
+
yn as resolveSlotNo,
|
|
5313
|
+
se as resolveStakeKeyHash,
|
|
5282
5314
|
qr as resolveTxFees,
|
|
5283
5315
|
$s as resolveTxHash
|
|
5284
5316
|
};
|