@meshsdk/core 1.5.6 → 1.5.7
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/core.cjs +1 -1
- package/dist/core.js +948 -697
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/maestro.provider.d.ts +30 -0
- package/package.json +1 -1
package/dist/core.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { customAlphabet as ye } from "nanoid";
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as i from "@emurgo/cardano-serialization-lib-nodejs";
|
|
3
|
+
import L from "axios";
|
|
4
4
|
import { mnemonicToEntropy as Ce, generateMnemonic as $e } from "bip39";
|
|
5
|
-
import { COSEKey as we, COSESign1 as ze, Label as
|
|
6
|
-
const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes(s),
|
|
5
|
+
import { COSEKey as we, COSESign1 as ze, Label as j, Int as yt, BigNum as Nt, KeyType as We, AlgorithmId as Be, CBORValue as Pt, HeaderMap as Wt, Headers as Je, ProtectedHeaderMap as je, COSESign1Builder as Xe } from "@emurgo/cardano-message-signing-nodejs";
|
|
6
|
+
const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes(s), xe = {
|
|
7
7
|
mem: 7e6,
|
|
8
8
|
steps: 3e9
|
|
9
|
-
},
|
|
9
|
+
}, G = {
|
|
10
10
|
epoch: 0,
|
|
11
11
|
coinsPerUTxOSize: "4310",
|
|
12
12
|
priceMem: 0.0577,
|
|
@@ -27,23 +27,23 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
27
27
|
maxTxExSteps: "10000000000",
|
|
28
28
|
maxBlockExMem: "80000000",
|
|
29
29
|
maxBlockExSteps: "40000000000"
|
|
30
|
-
},
|
|
31
|
-
V1:
|
|
32
|
-
V2:
|
|
33
|
-
},
|
|
34
|
-
CERT:
|
|
35
|
-
MINT:
|
|
36
|
-
REWARD:
|
|
37
|
-
SPEND:
|
|
38
|
-
},
|
|
30
|
+
}, Ut = 2147483648, xt = {
|
|
31
|
+
V1: i.Language.new_plutus_v1(),
|
|
32
|
+
V2: i.Language.new_plutus_v2()
|
|
33
|
+
}, M = 56, es = {
|
|
34
|
+
CERT: i.RedeemerTag.new_cert(),
|
|
35
|
+
MINT: i.RedeemerTag.new_mint(),
|
|
36
|
+
REWARD: i.RedeemerTag.new_reward(),
|
|
37
|
+
SPEND: i.RedeemerTag.new_spend()
|
|
38
|
+
}, Et = {
|
|
39
39
|
testnet: ["74", "1598400", "1595967616", "432000"],
|
|
40
40
|
preview: ["183", "15811222", "1682467200", "86400"],
|
|
41
41
|
preprod: ["65", "26438400", "1682121600", "432000"],
|
|
42
42
|
mainnet: ["208", "4492800", "1596059091", "432000"]
|
|
43
|
-
},
|
|
44
|
-
ALONZO:
|
|
43
|
+
}, Jt = {
|
|
44
|
+
ALONZO: i.TxBuilderConstants.plutus_alonzo_cost_models(),
|
|
45
45
|
BABBAGE: (() => {
|
|
46
|
-
const s =
|
|
46
|
+
const s = i.Costmdls.new(), e = i.CostModel.new();
|
|
47
47
|
Object.values({
|
|
48
48
|
"addInteger-cpu-arguments-intercept": 205665,
|
|
49
49
|
"addInteger-cpu-arguments-slope": 812,
|
|
@@ -211,8 +211,8 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
211
211
|
"verifyEd25519Signature-cpu-arguments-intercept": 57996947,
|
|
212
212
|
"verifyEd25519Signature-cpu-arguments-slope": 18975,
|
|
213
213
|
"verifyEd25519Signature-memory-arguments": 10
|
|
214
|
-
}).forEach((r, a) => e.set(a,
|
|
215
|
-
const t =
|
|
214
|
+
}).forEach((r, a) => e.set(a, i.Int.new_i32(r)));
|
|
215
|
+
const t = i.CostModel.new();
|
|
216
216
|
return Object.values({
|
|
217
217
|
"addInteger-cpu-arguments-intercept": 205665,
|
|
218
218
|
"addInteger-cpu-arguments-slope": 812,
|
|
@@ -389,7 +389,7 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
389
389
|
"verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 38887044,
|
|
390
390
|
"verifySchnorrSecp256k1Signature-cpu-arguments-slope": 32947,
|
|
391
391
|
"verifySchnorrSecp256k1Signature-memory-arguments": 10
|
|
392
|
-
}).forEach((r, a) => t.set(a,
|
|
392
|
+
}).forEach((r, a) => t.set(a, i.Int.new_i32(r))), s.insert(i.Language.new_plutus_v1(), e), s.insert(i.Language.new_plutus_v2(), t), s;
|
|
393
393
|
})()
|
|
394
394
|
}, ss = {
|
|
395
395
|
ALONZO: {
|
|
@@ -399,9 +399,9 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
399
399
|
V1: "a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",
|
|
400
400
|
V2: "a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"
|
|
401
401
|
}
|
|
402
|
-
},
|
|
403
|
-
[
|
|
404
|
-
[
|
|
402
|
+
}, Mt = {
|
|
403
|
+
[i.NetworkInfo.testnet().network_id()]: "8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",
|
|
404
|
+
[i.NetworkInfo.mainnet().network_id()]: "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"
|
|
405
405
|
}, rs = {
|
|
406
406
|
mainnet: "wss://ogmios-api.mainnet.dandelion.link",
|
|
407
407
|
preprod: "wss://ogmios-api.iohk-preprod.dandelion.link",
|
|
@@ -447,123 +447,123 @@ const Ze = ["testnet", "preview", "preprod", "mainnet"], ts = (s) => Ze.includes
|
|
|
447
447
|
"typhoncip30",
|
|
448
448
|
"vespr"
|
|
449
449
|
], ns = (s, e, t = "5000000") => {
|
|
450
|
-
const r =
|
|
450
|
+
const r = i.BigNum.from_str(s.get("lovelace") ?? "0").checked_add(i.BigNum.from_str(t)), a = e.filter((c) => c.output.amount.filter((u) => u.unit !== "lovelace").some((u) => s.has(u.unit))), n = us(a);
|
|
451
451
|
return [
|
|
452
|
-
...
|
|
452
|
+
...n.less_than(r) ? As(r.clamped_sub(n).to_str(), e.filter((c) => !a.some((u) => u.input.txHash === c.input.txHash && u.input.outputIndex === c.input.outputIndex))) : [],
|
|
453
453
|
...a
|
|
454
454
|
];
|
|
455
|
-
}, ir = (s, e, t = !1, { maxTxSize: r, minFeeA: a, minFeeB:
|
|
456
|
-
const o = e.filter((g) =>
|
|
457
|
-
return
|
|
455
|
+
}, ir = (s, e, t = !1, { maxTxSize: r, minFeeA: a, minFeeB: n } = G) => {
|
|
456
|
+
const o = e.filter((g) => Ee(g) === !1).sort(Ht), c = i.BigNum.from_str(Le(r, a, n)), u = t ? i.BigNum.from_str(s).checked_add(c).to_str() : s;
|
|
457
|
+
return lt(o, /* @__PURE__ */ new Map([
|
|
458
458
|
["lovelace", u]
|
|
459
459
|
]));
|
|
460
|
-
}, is = (s, e, t = !1, r =
|
|
461
|
-
const a = e.filter(
|
|
462
|
-
return s.set("lovelace", c),
|
|
463
|
-
}, os = (s, e) => Array.from(e, (t) => ({ unit: t[0], quantity:
|
|
464
|
-
const
|
|
465
|
-
return r.checked_add(
|
|
466
|
-
},
|
|
467
|
-
var a,
|
|
468
|
-
const t =
|
|
469
|
-
return
|
|
460
|
+
}, is = (s, e, t = !1, r = G) => {
|
|
461
|
+
const a = e.filter(Ee).sort(Ht), n = cs(r), o = s.get("lovelace") ?? "0", c = t ? i.BigNum.from_str(o).checked_add(n).to_str() : o;
|
|
462
|
+
return s.set("lovelace", c), lt(a, s);
|
|
463
|
+
}, os = (s, e) => Array.from(e, (t) => ({ unit: t[0], quantity: i.BigNum.from_str(t[1]) })).every((t) => s.filter((r) => r.output.amount.find((a) => a.unit === t.unit) !== void 0).reduce((r, a) => {
|
|
464
|
+
const n = a.output.amount.reduce((o, c) => o.checked_add(i.BigNum.from_str(t.unit === c.unit ? c.quantity : "0")), i.BigNum.from_str("0"));
|
|
465
|
+
return r.checked_add(n);
|
|
466
|
+
}, i.BigNum.from_str("0")).less_than(t.quantity) === !1), Ht = (s, e) => {
|
|
467
|
+
var a, n;
|
|
468
|
+
const t = i.BigNum.from_str(((a = s.output.amount.find((o) => o.unit === "lovelace")) == null ? void 0 : a.quantity) ?? "0");
|
|
469
|
+
return i.BigNum.from_str(((n = e.output.amount.find((o) => o.unit === "lovelace")) == null ? void 0 : n.quantity) ?? "0").compare(t);
|
|
470
470
|
}, cs = (s) => {
|
|
471
471
|
const { maxTxSize: e, minFeeA: t, minFeeB: r } = s;
|
|
472
|
-
return
|
|
473
|
-
},
|
|
472
|
+
return i.BigNum.from_str(Le(e, t, r));
|
|
473
|
+
}, Ee = (s) => s.output.amount.length > 1, us = (s) => s.reduce((e, t) => {
|
|
474
474
|
var a;
|
|
475
|
-
const r = ((a = t.output.amount.find((
|
|
476
|
-
return e.checked_add(
|
|
477
|
-
},
|
|
478
|
-
const t = e.sort(
|
|
479
|
-
return
|
|
475
|
+
const r = ((a = t.output.amount.find((n) => n.unit === "lovelace")) == null ? void 0 : a.quantity) ?? "0";
|
|
476
|
+
return e.checked_add(i.BigNum.from_str(r));
|
|
477
|
+
}, i.BigNum.from_str("0")), As = (s, e) => {
|
|
478
|
+
const t = e.sort(Ht);
|
|
479
|
+
return lt(t, /* @__PURE__ */ new Map([
|
|
480
480
|
["lovelace", s]
|
|
481
481
|
]));
|
|
482
|
-
},
|
|
482
|
+
}, lt = (s, e, t = []) => s.length === 0 || os(t, e) ? t : ds(s[0], e) ? lt(s.slice(1), e, [...t, s[0]]) : lt(s.slice(1), e, t), ds = (s, e) => Array.from(e.keys()).some((t) => s.output.amount.find((r) => r.unit === t) !== void 0), gs = (s, e) => {
|
|
483
483
|
const t = hs(e), r = Is(s, e);
|
|
484
484
|
return {
|
|
485
|
-
coseKey:
|
|
486
|
-
coseSign1:
|
|
485
|
+
coseKey: D(t.to_bytes()),
|
|
486
|
+
coseSign1: D(r.to_bytes())
|
|
487
487
|
};
|
|
488
488
|
}, or = (s, e, { key: t, signature: r }) => {
|
|
489
489
|
var o, c;
|
|
490
|
-
const a = we.from_bytes(m(t)),
|
|
490
|
+
const a = we.from_bytes(m(t)), n = ze.from_bytes(m(r));
|
|
491
491
|
if ((s == null ? void 0 : s.length) > 0) {
|
|
492
|
-
const u =
|
|
492
|
+
const u = D(n.payload() ?? new Uint8Array());
|
|
493
493
|
if (S(s) !== u)
|
|
494
494
|
return !1;
|
|
495
495
|
}
|
|
496
496
|
if ((e == null ? void 0 : e.length) > 0) {
|
|
497
|
-
const A = (o =
|
|
497
|
+
const A = (o = n.headers().protected().deserialized_headers().header(j.new_text("address"))) == null ? void 0 : o.as_bytes();
|
|
498
498
|
if (A === void 0)
|
|
499
499
|
throw new Error("Couldn't find a signer address in signature");
|
|
500
|
-
const
|
|
501
|
-
if (
|
|
500
|
+
const l = (c = a.header(j.new_int(yt.new_negative(Nt.from_str("2"))))) == null ? void 0 : c.as_bytes();
|
|
501
|
+
if (l === void 0)
|
|
502
502
|
throw new Error("Couldn't find a signer key in signature");
|
|
503
|
-
const g =
|
|
503
|
+
const g = st(D(A)), I = Vs(D(l));
|
|
504
504
|
if (ls(e, g, I) === !1)
|
|
505
505
|
throw new Error("Couldn't check signature because of address mismatch");
|
|
506
|
-
const
|
|
507
|
-
return I.verify(
|
|
506
|
+
const f = Os(D(n.signature())), y = n.signed_data().to_bytes();
|
|
507
|
+
return I.verify(y, f);
|
|
508
508
|
}
|
|
509
509
|
return !1;
|
|
510
510
|
}, ls = (s, e, t) => {
|
|
511
511
|
if (s !== e.to_bech32())
|
|
512
512
|
return !1;
|
|
513
513
|
try {
|
|
514
|
-
return
|
|
514
|
+
return dt(s) === t.hash().to_hex();
|
|
515
515
|
} catch {
|
|
516
516
|
return !1;
|
|
517
517
|
}
|
|
518
518
|
}, hs = (s) => {
|
|
519
|
-
const e = we.new(
|
|
520
|
-
return e.set_algorithm_id(
|
|
519
|
+
const e = we.new(j.from_key_type(We.OKP));
|
|
520
|
+
return e.set_algorithm_id(j.from_algorithm_id(Be.EdDSA)), e.set_header(j.new_int(yt.new_negative(Nt.from_str("1"))), Pt.new_int(yt.new_i32(6))), e.set_header(j.new_int(yt.new_negative(Nt.from_str("2"))), Pt.new_bytes(s.key.to_public().as_bytes())), e;
|
|
521
521
|
}, Is = (s, e) => {
|
|
522
|
-
const t =
|
|
523
|
-
t.set_algorithm_id(
|
|
524
|
-
const a =
|
|
525
|
-
s.externalAAD !== void 0 &&
|
|
526
|
-
const o =
|
|
527
|
-
return
|
|
522
|
+
const t = Wt.new(), r = Wt.new();
|
|
523
|
+
t.set_algorithm_id(j.from_algorithm_id(Be.EdDSA)), t.set_header(j.new_text("address"), Pt.new_bytes(e.address.to_bytes()));
|
|
524
|
+
const a = Je.new(je.new(t), r), n = Xe.new(a, m(s.payload), !1);
|
|
525
|
+
s.externalAAD !== void 0 && n.set_external_aad(m(s.externalAAD));
|
|
526
|
+
const o = n.make_data_to_sign(), c = e.key.sign(o.to_bytes());
|
|
527
|
+
return n.build(c.to_bytes());
|
|
528
528
|
};
|
|
529
529
|
var Xt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, Se = {}, Q = { exports: {} };
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
var Qe =
|
|
530
|
+
R.notEqual = ps;
|
|
531
|
+
R.notOk = fs;
|
|
532
|
+
R.equal = ms;
|
|
533
|
+
R.ok = R;
|
|
534
|
+
var Qe = R;
|
|
535
535
|
function ms(s, e, t) {
|
|
536
|
-
|
|
536
|
+
R(s == e, t);
|
|
537
537
|
}
|
|
538
538
|
function ps(s, e, t) {
|
|
539
|
-
|
|
539
|
+
R(s != e, t);
|
|
540
540
|
}
|
|
541
541
|
function fs(s, e) {
|
|
542
|
-
|
|
542
|
+
R(!s, e);
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function R(s, e) {
|
|
545
545
|
if (!s)
|
|
546
546
|
throw new Error(e || "AssertionError");
|
|
547
547
|
}
|
|
548
|
-
var
|
|
548
|
+
var O = { exports: {} };
|
|
549
549
|
function _s(s) {
|
|
550
550
|
throw new Error('Could not dynamically require "' + s + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
551
551
|
}
|
|
552
|
-
var ys =
|
|
553
|
-
|
|
554
|
-
function
|
|
555
|
-
if (!
|
|
552
|
+
var ys = Ot;
|
|
553
|
+
Ot.supported = typeof WebAssembly < "u";
|
|
554
|
+
function Ot(s) {
|
|
555
|
+
if (!Ot.supported)
|
|
556
556
|
return null;
|
|
557
557
|
var e = s && s.imports, t = Cs("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0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"), r = null, a = {
|
|
558
558
|
buffer: t,
|
|
559
559
|
memory: null,
|
|
560
560
|
exports: null,
|
|
561
|
-
realloc:
|
|
561
|
+
realloc: n,
|
|
562
562
|
onload: o
|
|
563
563
|
};
|
|
564
564
|
return o(function() {
|
|
565
565
|
}), a;
|
|
566
|
-
function
|
|
566
|
+
function n(u) {
|
|
567
567
|
a.exports.memory.grow(Math.ceil(Math.abs(u - a.memory.length) / 65536)), a.memory = new Uint8Array(a.exports.memory.buffer);
|
|
568
568
|
}
|
|
569
569
|
function o(u) {
|
|
@@ -592,58 +592,58 @@ function Cs(s) {
|
|
|
592
592
|
function ws(s) {
|
|
593
593
|
return s.charCodeAt(0);
|
|
594
594
|
}
|
|
595
|
-
var
|
|
596
|
-
|
|
597
|
-
var Zt =
|
|
598
|
-
|
|
599
|
-
var ee =
|
|
600
|
-
|
|
601
|
-
var re =
|
|
602
|
-
function
|
|
603
|
-
if (!(this instanceof
|
|
604
|
-
return new
|
|
605
|
-
if (!(
|
|
595
|
+
var P = Qe, _ = ys(), Y = 64, Ct = [];
|
|
596
|
+
O.exports = v;
|
|
597
|
+
var Zt = O.exports.BYTES_MIN = 16, te = O.exports.BYTES_MAX = 64;
|
|
598
|
+
O.exports.BYTES = 32;
|
|
599
|
+
var ee = O.exports.KEYBYTES_MIN = 16, se = O.exports.KEYBYTES_MAX = 64;
|
|
600
|
+
O.exports.KEYBYTES = 32;
|
|
601
|
+
var re = O.exports.SALTBYTES = 16, ae = O.exports.PERSONALBYTES = 16;
|
|
602
|
+
function v(s, e, t, r, a) {
|
|
603
|
+
if (!(this instanceof v))
|
|
604
|
+
return new v(s, e, t, r, a);
|
|
605
|
+
if (!(_ && _.exports))
|
|
606
606
|
throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");
|
|
607
|
-
s || (s = 32), a !== !0 && (
|
|
607
|
+
s || (s = 32), a !== !0 && (P(s >= Zt, "digestLength must be at least " + Zt + ", was given " + s), P(s <= te, "digestLength must be at most " + te + ", was given " + s), e != null && P(e.length >= ee, "key must be at least " + ee + ", was given " + e.length), e != null && P(e.length <= se, "key must be at least " + se + ", was given " + e.length), t != null && P(t.length === re, "salt must be exactly " + re + ", was given " + t.length), r != null && P(r.length === ae, "personal must be exactly " + ae + ", was given " + r.length)), Ct.length || (Ct.push(Y), Y += 216), this.digestLength = s, this.finalized = !1, this.pointer = Ct.pop(), _.memory.fill(0, 0, 64), _.memory[0] = this.digestLength, _.memory[1] = e ? e.length : 0, _.memory[2] = 1, _.memory[3] = 1, t && _.memory.set(t, 32), r && _.memory.set(r, 48), this.pointer + 216 > _.memory.length && _.realloc(this.pointer + 216), _.exports.blake2b_init(this.pointer, this.digestLength), e && (this.update(e), _.memory.fill(0, Y, Y + e.length), _.memory[this.pointer + 200] = 128);
|
|
608
608
|
}
|
|
609
|
-
|
|
610
|
-
return
|
|
609
|
+
v.prototype.update = function(s) {
|
|
610
|
+
return P(this.finalized === !1, "Hash instance finalized"), P(s, "input must be TypedArray or Buffer"), Y + s.length > _.memory.length && _.realloc(Y + s.length), _.memory.set(s, Y), _.exports.blake2b_update(this.pointer, Y, Y + s.length), this;
|
|
611
611
|
};
|
|
612
|
-
|
|
613
|
-
if (
|
|
614
|
-
return
|
|
612
|
+
v.prototype.digest = function(s) {
|
|
613
|
+
if (P(this.finalized === !1, "Hash instance finalized"), this.finalized = !0, Ct.push(this.pointer), _.exports.blake2b_final(this.pointer), !s || s === "binary")
|
|
614
|
+
return _.memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength);
|
|
615
615
|
if (s === "hex")
|
|
616
|
-
return
|
|
617
|
-
|
|
616
|
+
return xs(_.memory, this.pointer + 128, this.digestLength);
|
|
617
|
+
P(s.length >= this.digestLength, "input must be TypedArray or Buffer");
|
|
618
618
|
for (var e = 0; e < this.digestLength; e++)
|
|
619
|
-
s[e] =
|
|
619
|
+
s[e] = _.memory[this.pointer + 128 + e];
|
|
620
620
|
return s;
|
|
621
621
|
};
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (s || (s = Bs), !
|
|
622
|
+
v.prototype.final = v.prototype.digest;
|
|
623
|
+
v.WASM = _ && _.buffer;
|
|
624
|
+
v.SUPPORTED = typeof WebAssembly < "u";
|
|
625
|
+
v.ready = function(s) {
|
|
626
|
+
if (s || (s = Bs), !_)
|
|
627
627
|
return s(new Error("WebAssembly not supported"));
|
|
628
628
|
var e = new Promise(function(t, r) {
|
|
629
|
-
|
|
629
|
+
_.onload(function(a) {
|
|
630
630
|
a ? r() : t(), s(a);
|
|
631
631
|
});
|
|
632
632
|
});
|
|
633
633
|
return e;
|
|
634
634
|
};
|
|
635
|
-
|
|
635
|
+
v.prototype.ready = v.ready;
|
|
636
636
|
function Bs() {
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function xs(s, e, t) {
|
|
639
639
|
for (var r = "", a = 0; a < t; a++)
|
|
640
|
-
r +=
|
|
640
|
+
r += Es(s[e + a]);
|
|
641
641
|
return r;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function Es(s) {
|
|
644
644
|
return s < 16 ? "0" + s.toString(16) : s.toString(16);
|
|
645
645
|
}
|
|
646
|
-
var J = Qe,
|
|
646
|
+
var J = Qe, ht = O.exports;
|
|
647
647
|
function mt(s, e, t) {
|
|
648
648
|
var r = s[e] + s[t], a = s[e + 1] + s[t + 1];
|
|
649
649
|
r >= 4294967296 && a++, s[e] = r, s[e + 1] = a;
|
|
@@ -651,17 +651,17 @@ function mt(s, e, t) {
|
|
|
651
651
|
function ne(s, e, t, r) {
|
|
652
652
|
var a = s[e] + t;
|
|
653
653
|
t < 0 && (a += 4294967296);
|
|
654
|
-
var
|
|
655
|
-
a >= 4294967296 &&
|
|
654
|
+
var n = s[e + 1] + r;
|
|
655
|
+
a >= 4294967296 && n++, s[e] = a, s[e + 1] = n;
|
|
656
656
|
}
|
|
657
657
|
function be(s, e) {
|
|
658
658
|
return s[e] ^ s[e + 1] << 8 ^ s[e + 2] << 16 ^ s[e + 3] << 24;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
661
|
-
var o =
|
|
660
|
+
function z(s, e, t, r, a, n) {
|
|
661
|
+
var o = At[a], c = At[a + 1], u = At[n], A = At[n + 1];
|
|
662
662
|
mt(h, s, e), ne(h, s, o, c);
|
|
663
|
-
var
|
|
664
|
-
h[r] = g, h[r + 1] =
|
|
663
|
+
var l = h[r] ^ h[s], g = h[r + 1] ^ h[s + 1];
|
|
664
|
+
h[r] = g, h[r + 1] = l, mt(h, t, r), l = h[e] ^ h[t], g = h[e + 1] ^ h[t + 1], h[e] = l >>> 24 ^ g << 8, h[e + 1] = g >>> 24 ^ l << 8, mt(h, s, e), ne(h, s, u, A), l = h[r] ^ h[s], g = h[r + 1] ^ h[s + 1], h[r] = l >>> 16 ^ g << 16, h[r + 1] = g >>> 16 ^ l << 16, mt(h, t, r), l = h[e] ^ h[t], g = h[e + 1] ^ h[t + 1], h[e] = g >>> 31 ^ l << 1, h[e + 1] = l >>> 31 ^ g << 1;
|
|
665
665
|
}
|
|
666
666
|
var De = new Uint32Array([
|
|
667
667
|
4089235720,
|
|
@@ -873,21 +873,21 @@ var De = new Uint32Array([
|
|
|
873
873
|
7,
|
|
874
874
|
5,
|
|
875
875
|
3
|
|
876
|
-
],
|
|
876
|
+
], x = new Uint8Array(Ss.map(function(s) {
|
|
877
877
|
return s * 2;
|
|
878
|
-
})), h = new Uint32Array(32),
|
|
878
|
+
})), h = new Uint32Array(32), At = new Uint32Array(32);
|
|
879
879
|
function ve(s, e) {
|
|
880
880
|
var t = 0;
|
|
881
881
|
for (t = 0; t < 16; t++)
|
|
882
882
|
h[t] = s.h[t], h[t + 16] = De[t];
|
|
883
883
|
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++)
|
|
884
|
-
|
|
884
|
+
At[t] = be(s.b, 4 * t);
|
|
885
885
|
for (t = 0; t < 12; t++)
|
|
886
|
-
|
|
886
|
+
z(0, 8, 16, 24, x[t * 16 + 0], x[t * 16 + 1]), z(2, 10, 18, 26, x[t * 16 + 2], x[t * 16 + 3]), z(4, 12, 20, 28, x[t * 16 + 4], x[t * 16 + 5]), z(6, 14, 22, 30, x[t * 16 + 6], x[t * 16 + 7]), z(0, 10, 20, 30, x[t * 16 + 8], x[t * 16 + 9]), z(2, 12, 22, 24, x[t * 16 + 10], x[t * 16 + 11]), z(4, 14, 16, 26, x[t * 16 + 12], x[t * 16 + 13]), z(6, 8, 18, 28, x[t * 16 + 14], x[t * 16 + 15]);
|
|
887
887
|
for (t = 0; t < 16; t++)
|
|
888
888
|
s.h[t] = s.h[t] ^ h[t] ^ h[t + 16];
|
|
889
889
|
}
|
|
890
|
-
var
|
|
890
|
+
var W = new Uint8Array([
|
|
891
891
|
0,
|
|
892
892
|
0,
|
|
893
893
|
0,
|
|
@@ -953,22 +953,22 @@ var z = new Uint8Array([
|
|
|
953
953
|
0,
|
|
954
954
|
0
|
|
955
955
|
]);
|
|
956
|
-
function
|
|
957
|
-
|
|
956
|
+
function nt(s, e, t, r) {
|
|
957
|
+
W.fill(0), this.b = new Uint8Array(128), this.h = new Uint32Array(16), this.t = 0, this.c = 0, this.outlen = s, W[0] = s, e && (W[1] = e.length), W[2] = 1, W[3] = 1, t && W.set(t, 32), r && W.set(r, 48);
|
|
958
958
|
for (var a = 0; a < 16; a++)
|
|
959
|
-
this.h[a] = De[a] ^ be(
|
|
959
|
+
this.h[a] = De[a] ^ be(W, a * 4);
|
|
960
960
|
e && (ke(this, e), this.c = 128);
|
|
961
961
|
}
|
|
962
|
-
|
|
962
|
+
nt.prototype.update = function(s) {
|
|
963
963
|
return J(s != null, "input must be Uint8Array or Buffer"), ke(this, s), this;
|
|
964
964
|
};
|
|
965
|
-
|
|
965
|
+
nt.prototype.digest = function(s) {
|
|
966
966
|
var e = !s || s === "binary" || s === "hex" ? new Uint8Array(this.outlen) : s;
|
|
967
967
|
return J(e.length >= this.outlen, "out must have at least outlen bytes of space"), Qs(this, e), s === "hex" ? bs(e) : e;
|
|
968
968
|
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
969
|
+
nt.prototype.final = nt.prototype.digest;
|
|
970
|
+
nt.ready = function(s) {
|
|
971
|
+
ht.ready(function() {
|
|
972
972
|
s();
|
|
973
973
|
});
|
|
974
974
|
};
|
|
@@ -992,78 +992,78 @@ function bs(s) {
|
|
|
992
992
|
function Ds(s) {
|
|
993
993
|
return s < 16 ? "0" + s.toString(16) : s.toString(16);
|
|
994
994
|
}
|
|
995
|
-
var Ue =
|
|
996
|
-
Q.exports = function(e, t, r, a,
|
|
997
|
-
return
|
|
995
|
+
var Ue = nt;
|
|
996
|
+
Q.exports = function(e, t, r, a, n) {
|
|
997
|
+
return n !== !0 && (J(e >= ie, "outlen must be at least " + ie + ", was given " + e), J(e <= oe, "outlen must be at most " + oe + ", was given " + e), t != null && J(t.length >= ce, "key must be at least " + ce + ", was given " + t.length), t != null && J(t.length <= ue, "key must be at most " + ue + ", was given " + t.length), r != null && J(r.length === Ae, "salt must be exactly " + Ae + ", was given " + r.length), a != null && J(a.length === de, "personal must be exactly " + de + ", was given " + a.length)), new Ue(e, t, r, a);
|
|
998
998
|
};
|
|
999
999
|
Q.exports.ready = function(s) {
|
|
1000
|
-
|
|
1000
|
+
ht.ready(function() {
|
|
1001
1001
|
s();
|
|
1002
1002
|
});
|
|
1003
1003
|
};
|
|
1004
|
-
Q.exports.WASM_SUPPORTED =
|
|
1004
|
+
Q.exports.WASM_SUPPORTED = ht.SUPPORTED;
|
|
1005
1005
|
Q.exports.WASM_LOADED = !1;
|
|
1006
1006
|
var ie = Q.exports.BYTES_MIN = 16, oe = Q.exports.BYTES_MAX = 64;
|
|
1007
1007
|
Q.exports.BYTES = 32;
|
|
1008
1008
|
var ce = Q.exports.KEYBYTES_MIN = 16, ue = Q.exports.KEYBYTES_MAX = 64;
|
|
1009
1009
|
Q.exports.KEYBYTES = 32;
|
|
1010
|
-
var Ae = Q.exports.SALTBYTES = 16,
|
|
1011
|
-
|
|
1012
|
-
s || (Q.exports.WASM_LOADED = !0, Ue =
|
|
1010
|
+
var Ae = Q.exports.SALTBYTES = 16, de = Q.exports.PERSONALBYTES = 16;
|
|
1011
|
+
ht.ready(function(s) {
|
|
1012
|
+
s || (Q.exports.WASM_LOADED = !0, Ue = ht);
|
|
1013
1013
|
});
|
|
1014
|
-
var
|
|
1015
|
-
Object.defineProperty(
|
|
1016
|
-
|
|
1014
|
+
var it = {};
|
|
1015
|
+
Object.defineProperty(it, "__esModule", { value: !0 });
|
|
1016
|
+
it.bech32m = it.bech32 = void 0;
|
|
1017
1017
|
const St = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", Ke = {};
|
|
1018
1018
|
for (let s = 0; s < St.length; s++) {
|
|
1019
1019
|
const e = St.charAt(s);
|
|
1020
1020
|
Ke[e] = s;
|
|
1021
1021
|
}
|
|
1022
|
-
function
|
|
1022
|
+
function at(s) {
|
|
1023
1023
|
const e = s >> 25;
|
|
1024
1024
|
return (s & 33554431) << 5 ^ -(e >> 0 & 1) & 996825010 ^ -(e >> 1 & 1) & 642813549 ^ -(e >> 2 & 1) & 513874426 ^ -(e >> 3 & 1) & 1027748829 ^ -(e >> 4 & 1) & 705979059;
|
|
1025
1025
|
}
|
|
1026
|
-
function
|
|
1026
|
+
function ge(s) {
|
|
1027
1027
|
let e = 1;
|
|
1028
1028
|
for (let t = 0; t < s.length; ++t) {
|
|
1029
1029
|
const r = s.charCodeAt(t);
|
|
1030
1030
|
if (r < 33 || r > 126)
|
|
1031
1031
|
return "Invalid prefix (" + s + ")";
|
|
1032
|
-
e =
|
|
1032
|
+
e = at(e) ^ r >> 5;
|
|
1033
1033
|
}
|
|
1034
|
-
e =
|
|
1034
|
+
e = at(e);
|
|
1035
1035
|
for (let t = 0; t < s.length; ++t) {
|
|
1036
1036
|
const r = s.charCodeAt(t);
|
|
1037
|
-
e =
|
|
1037
|
+
e = at(e) ^ r & 31;
|
|
1038
1038
|
}
|
|
1039
1039
|
return e;
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1042
|
-
let a = 0,
|
|
1041
|
+
function Vt(s, e, t, r) {
|
|
1042
|
+
let a = 0, n = 0;
|
|
1043
1043
|
const o = (1 << t) - 1, c = [];
|
|
1044
1044
|
for (let u = 0; u < s.length; ++u)
|
|
1045
|
-
for (a = a << e | s[u],
|
|
1046
|
-
|
|
1045
|
+
for (a = a << e | s[u], n += e; n >= t; )
|
|
1046
|
+
n -= t, c.push(a >> n & o);
|
|
1047
1047
|
if (r)
|
|
1048
|
-
|
|
1048
|
+
n > 0 && c.push(a << t - n & o);
|
|
1049
1049
|
else {
|
|
1050
|
-
if (
|
|
1050
|
+
if (n >= e)
|
|
1051
1051
|
return "Excess padding";
|
|
1052
|
-
if (a << t -
|
|
1052
|
+
if (a << t - n & o)
|
|
1053
1053
|
return "Non-zero padding";
|
|
1054
1054
|
}
|
|
1055
1055
|
return c;
|
|
1056
1056
|
}
|
|
1057
1057
|
function vs(s) {
|
|
1058
|
-
return
|
|
1058
|
+
return Vt(s, 8, 5, !0);
|
|
1059
1059
|
}
|
|
1060
1060
|
function ks(s) {
|
|
1061
|
-
const e =
|
|
1061
|
+
const e = Vt(s, 5, 8, !1);
|
|
1062
1062
|
if (Array.isArray(e))
|
|
1063
1063
|
return e;
|
|
1064
1064
|
}
|
|
1065
1065
|
function Us(s) {
|
|
1066
|
-
const e =
|
|
1066
|
+
const e = Vt(s, 5, 8, !1);
|
|
1067
1067
|
if (Array.isArray(e))
|
|
1068
1068
|
return e;
|
|
1069
1069
|
throw new Error(e);
|
|
@@ -1075,24 +1075,24 @@ function Ne(s) {
|
|
|
1075
1075
|
if (u = u || 90, o.length + 7 + c.length > u)
|
|
1076
1076
|
throw new TypeError("Exceeds length limit");
|
|
1077
1077
|
o = o.toLowerCase();
|
|
1078
|
-
let A =
|
|
1078
|
+
let A = ge(o);
|
|
1079
1079
|
if (typeof A == "string")
|
|
1080
1080
|
throw new Error(A);
|
|
1081
|
-
let
|
|
1081
|
+
let l = o + "1";
|
|
1082
1082
|
for (let g = 0; g < c.length; ++g) {
|
|
1083
1083
|
const I = c[g];
|
|
1084
1084
|
if (I >> 5 !== 0)
|
|
1085
1085
|
throw new Error("Non 5-bit word");
|
|
1086
|
-
A =
|
|
1086
|
+
A = at(A) ^ I, l += St.charAt(I);
|
|
1087
1087
|
}
|
|
1088
1088
|
for (let g = 0; g < 6; ++g)
|
|
1089
|
-
A =
|
|
1089
|
+
A = at(A);
|
|
1090
1090
|
A ^= e;
|
|
1091
1091
|
for (let g = 0; g < 6; ++g) {
|
|
1092
1092
|
const I = A >> (5 - g) * 5 & 31;
|
|
1093
|
-
|
|
1093
|
+
l += St.charAt(I);
|
|
1094
1094
|
}
|
|
1095
|
-
return
|
|
1095
|
+
return l;
|
|
1096
1096
|
}
|
|
1097
1097
|
function r(o, c) {
|
|
1098
1098
|
if (c = c || 90, o.length < 8)
|
|
@@ -1103,32 +1103,32 @@ function Ne(s) {
|
|
|
1103
1103
|
if (o !== u && o !== A)
|
|
1104
1104
|
return "Mixed-case string " + o;
|
|
1105
1105
|
o = u;
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1106
|
+
const l = o.lastIndexOf("1");
|
|
1107
|
+
if (l === -1)
|
|
1108
1108
|
return "No separator character for " + o;
|
|
1109
|
-
if (
|
|
1109
|
+
if (l === 0)
|
|
1110
1110
|
return "Missing prefix for " + o;
|
|
1111
|
-
const g = o.slice(0,
|
|
1111
|
+
const g = o.slice(0, l), I = o.slice(l + 1);
|
|
1112
1112
|
if (I.length < 6)
|
|
1113
1113
|
return "Data too short";
|
|
1114
|
-
let
|
|
1115
|
-
if (typeof
|
|
1116
|
-
return
|
|
1117
|
-
const
|
|
1118
|
-
for (let
|
|
1119
|
-
const
|
|
1114
|
+
let f = ge(g);
|
|
1115
|
+
if (typeof f == "string")
|
|
1116
|
+
return f;
|
|
1117
|
+
const y = [];
|
|
1118
|
+
for (let b = 0; b < I.length; ++b) {
|
|
1119
|
+
const k = I.charAt(b), p = Ke[k];
|
|
1120
1120
|
if (p === void 0)
|
|
1121
|
-
return "Unknown character " +
|
|
1122
|
-
|
|
1121
|
+
return "Unknown character " + k;
|
|
1122
|
+
f = at(f) ^ p, !(b + 6 >= I.length) && y.push(p);
|
|
1123
1123
|
}
|
|
1124
|
-
return
|
|
1124
|
+
return f !== e ? "Invalid checksum for " + o : { prefix: g, words: y };
|
|
1125
1125
|
}
|
|
1126
1126
|
function a(o, c) {
|
|
1127
1127
|
const u = r(o, c);
|
|
1128
1128
|
if (typeof u == "object")
|
|
1129
1129
|
return u;
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function n(o, c) {
|
|
1132
1132
|
const u = r(o, c);
|
|
1133
1133
|
if (typeof u == "object")
|
|
1134
1134
|
return u;
|
|
@@ -1136,20 +1136,20 @@ function Ne(s) {
|
|
|
1136
1136
|
}
|
|
1137
1137
|
return {
|
|
1138
1138
|
decodeUnsafe: a,
|
|
1139
|
-
decode:
|
|
1139
|
+
decode: n,
|
|
1140
1140
|
encode: t,
|
|
1141
1141
|
toWords: vs,
|
|
1142
1142
|
fromWordsUnsafe: ks,
|
|
1143
1143
|
fromWords: Us
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1146
|
+
it.bech32 = Ne("bech32");
|
|
1147
|
+
it.bech32m = Ne("bech32m");
|
|
1148
1148
|
var Ks = Xt && Xt.__importDefault || function(s) {
|
|
1149
1149
|
return s && s.__esModule ? s : { default: s };
|
|
1150
1150
|
};
|
|
1151
1151
|
Object.defineProperty(Se, "__esModule", { value: !0 });
|
|
1152
|
-
const Ns = Ks(Q.exports), pt =
|
|
1152
|
+
const Ns = Ks(Q.exports), pt = it, Kt = "asset";
|
|
1153
1153
|
class gt {
|
|
1154
1154
|
constructor(e) {
|
|
1155
1155
|
this.hashBuf = e;
|
|
@@ -1163,20 +1163,20 @@ class gt {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
static fromBech32(e) {
|
|
1165
1165
|
const { prefix: t, words: r } = pt.bech32.decode(e);
|
|
1166
|
-
if (t !==
|
|
1166
|
+
if (t !== Kt)
|
|
1167
1167
|
throw new Error("Invalid asset fingerprint");
|
|
1168
1168
|
const a = Buffer.from(pt.bech32.fromWords(r));
|
|
1169
1169
|
return gt.fromHash(a);
|
|
1170
1170
|
}
|
|
1171
1171
|
fingerprint() {
|
|
1172
1172
|
const e = pt.bech32.toWords(this.hashBuf);
|
|
1173
|
-
return pt.bech32.encode(
|
|
1173
|
+
return pt.bech32.encode(Kt, e);
|
|
1174
1174
|
}
|
|
1175
1175
|
hash() {
|
|
1176
1176
|
return Buffer.from(this.hashBuf).toString("hex");
|
|
1177
1177
|
}
|
|
1178
1178
|
prefix() {
|
|
1179
|
-
return
|
|
1179
|
+
return Kt;
|
|
1180
1180
|
}
|
|
1181
1181
|
checksum() {
|
|
1182
1182
|
return this.fingerprint().slice(-6);
|
|
@@ -1184,9 +1184,9 @@ class gt {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
var Ps = Se.default = gt;
|
|
1186
1186
|
const Fs = Ps, Ts = (s, e) => {
|
|
1187
|
-
const t = Ms(s), r = t.derive(
|
|
1188
|
-
return r.free(), t.free(), { paymentKey: a, stakeKey:
|
|
1189
|
-
},
|
|
1187
|
+
const t = Ms(s), r = t.derive(Ut + 1852).derive(Ut + 1815).derive(Ut + e), a = r.derive(0).derive(0).to_raw_key(), n = r.derive(2).derive(0).to_raw_key();
|
|
1188
|
+
return r.free(), t.free(), { paymentKey: a, stakeKey: n };
|
|
1189
|
+
}, st = (s) => i.Address.from_bytes(m(s)), Ms = (s) => i.Bip32PrivateKey.from_bytes(m(s)), Hs = (s) => i.DataHash.from_bytes(m(s)), T = (s) => i.Ed25519KeyHash.from_bytes(m(s)), Os = (s) => i.Ed25519Signature.from_bytes(m(s)), bt = (s) => i.NativeScript.from_bytes(m(s)), Vs = (s) => i.PublicKey.from_bytes(m(s)), Pe = (s) => i.PlutusData.from_bytes(m(s)), ot = (s, e) => i.PlutusScript.from_bytes_with_version(m(s), xt[e]), Ys = (s) => i.ScriptRef.from_bytes(m(s)), qs = (s) => i.ScriptHash.from_bytes(m(s)), q = (s) => i.Transaction.from_bytes(m(s)), Fe = (s) => i.TransactionHash.from_bytes(m(s)), le = (s) => i.TransactionUnspentOutput.from_bytes(m(s)), Ls = (s) => i.TransactionWitnessSet.from_bytes(m(s)), Gs = (s) => i.Value.from_bytes(m(s)), H = (s) => i.Address.from_bech32(s), Yt = (s) => i.BaseAddress.from_address(H(s)), Te = (s) => i.EnterpriseAddress.from_address(H(s)), Me = (s) => i.RewardAddress.from_address(H(s)), D = (s) => Buffer.from(s).toString("hex"), m = (s) => s.length % 2 === 0 && /^[0-9A-F]*$/i.test(s) ? Buffer.from(s, "hex") : Buffer.from(s, "utf-8"), Dt = (s) => {
|
|
1190
1190
|
const e = (t) => {
|
|
1191
1191
|
const r = new Array();
|
|
1192
1192
|
for (let a = 0; a < t.len(); a += 1)
|
|
@@ -1194,21 +1194,21 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1194
1194
|
return r;
|
|
1195
1195
|
};
|
|
1196
1196
|
switch (s.kind()) {
|
|
1197
|
-
case
|
|
1197
|
+
case i.NativeScriptKind.ScriptAll: {
|
|
1198
1198
|
const t = s.as_script_all();
|
|
1199
1199
|
return {
|
|
1200
1200
|
type: "all",
|
|
1201
1201
|
scripts: e(t.native_scripts())
|
|
1202
1202
|
};
|
|
1203
1203
|
}
|
|
1204
|
-
case
|
|
1204
|
+
case i.NativeScriptKind.ScriptAny: {
|
|
1205
1205
|
const t = s.as_script_any();
|
|
1206
1206
|
return {
|
|
1207
1207
|
type: "any",
|
|
1208
1208
|
scripts: e(t.native_scripts())
|
|
1209
1209
|
};
|
|
1210
1210
|
}
|
|
1211
|
-
case
|
|
1211
|
+
case i.NativeScriptKind.ScriptNOfK: {
|
|
1212
1212
|
const t = s.as_script_n_of_k();
|
|
1213
1213
|
return {
|
|
1214
1214
|
type: "atLeast",
|
|
@@ -1216,21 +1216,21 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1216
1216
|
scripts: e(t.native_scripts())
|
|
1217
1217
|
};
|
|
1218
1218
|
}
|
|
1219
|
-
case
|
|
1219
|
+
case i.NativeScriptKind.TimelockStart: {
|
|
1220
1220
|
const t = s.as_timelock_start();
|
|
1221
1221
|
return {
|
|
1222
1222
|
type: "after",
|
|
1223
1223
|
slot: t.slot_bignum().to_str()
|
|
1224
1224
|
};
|
|
1225
1225
|
}
|
|
1226
|
-
case
|
|
1226
|
+
case i.NativeScriptKind.TimelockExpiry: {
|
|
1227
1227
|
const t = s.as_timelock_expiry();
|
|
1228
1228
|
return {
|
|
1229
1229
|
type: "before",
|
|
1230
1230
|
slot: t.slot_bignum().to_str()
|
|
1231
1231
|
};
|
|
1232
1232
|
}
|
|
1233
|
-
case
|
|
1233
|
+
case i.NativeScriptKind.ScriptPubkey: {
|
|
1234
1234
|
const t = s.as_script_pubkey();
|
|
1235
1235
|
return {
|
|
1236
1236
|
type: "sig",
|
|
@@ -1242,27 +1242,27 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1242
1242
|
}
|
|
1243
1243
|
}, vt = (s) => {
|
|
1244
1244
|
const e = (t) => {
|
|
1245
|
-
const r =
|
|
1245
|
+
const r = i.NativeScripts.new();
|
|
1246
1246
|
return t.forEach((a) => {
|
|
1247
1247
|
r.add(vt(a));
|
|
1248
1248
|
}), r;
|
|
1249
1249
|
};
|
|
1250
1250
|
switch (s.type) {
|
|
1251
1251
|
case "all":
|
|
1252
|
-
return
|
|
1252
|
+
return i.NativeScript.new_script_all(i.ScriptAll.new(e(s.scripts)));
|
|
1253
1253
|
case "any":
|
|
1254
|
-
return
|
|
1254
|
+
return i.NativeScript.new_script_any(i.ScriptAny.new(e(s.scripts)));
|
|
1255
1255
|
case "atLeast":
|
|
1256
|
-
return
|
|
1256
|
+
return i.NativeScript.new_script_n_of_k(i.ScriptNOfK.new(s.required, e(s.scripts)));
|
|
1257
1257
|
case "after":
|
|
1258
|
-
return
|
|
1258
|
+
return i.NativeScript.new_timelock_start(i.TimelockStart.new_timelockstart(i.BigNum.from_str(s.slot)));
|
|
1259
1259
|
case "before":
|
|
1260
|
-
return
|
|
1260
|
+
return i.NativeScript.new_timelock_expiry(i.TimelockExpiry.new_timelockexpiry(i.BigNum.from_str(s.slot)));
|
|
1261
1261
|
case "sig":
|
|
1262
|
-
return
|
|
1262
|
+
return i.NativeScript.new_script_pubkey(i.ScriptPubkey.new(T(s.keyHash)));
|
|
1263
1263
|
}
|
|
1264
1264
|
}, wt = (s) => {
|
|
1265
|
-
var r, a,
|
|
1265
|
+
var r, a, n;
|
|
1266
1266
|
const e = (o) => {
|
|
1267
1267
|
const c = [];
|
|
1268
1268
|
for (let u = 0; u < o.len(); u += 1)
|
|
@@ -1271,90 +1271,90 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1271
1271
|
}, t = (o) => {
|
|
1272
1272
|
const c = /* @__PURE__ */ new Map();
|
|
1273
1273
|
for (let u = 0; u < o.len(); u += 1) {
|
|
1274
|
-
const A = o.keys().get(u),
|
|
1275
|
-
c.set(wt(A), wt(
|
|
1274
|
+
const A = o.keys().get(u), l = o.get(A) ?? i.PlutusData.from_hex(S("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));
|
|
1275
|
+
c.set(wt(A), wt(l));
|
|
1276
1276
|
}
|
|
1277
1277
|
return c;
|
|
1278
1278
|
};
|
|
1279
1279
|
switch (s.kind()) {
|
|
1280
|
-
case
|
|
1281
|
-
return
|
|
1282
|
-
case
|
|
1280
|
+
case i.PlutusDataKind.Bytes:
|
|
1281
|
+
return D(s.as_bytes() ?? new Uint8Array());
|
|
1282
|
+
case i.PlutusDataKind.Integer:
|
|
1283
1283
|
return parseInt(((r = s.as_integer()) == null ? void 0 : r.to_str()) ?? "0", 10);
|
|
1284
|
-
case
|
|
1285
|
-
return e(s.as_list() ??
|
|
1286
|
-
case
|
|
1287
|
-
return t(s.as_map() ??
|
|
1288
|
-
case
|
|
1284
|
+
case i.PlutusDataKind.List:
|
|
1285
|
+
return e(s.as_list() ?? i.PlutusList.new());
|
|
1286
|
+
case i.PlutusDataKind.Map:
|
|
1287
|
+
return t(s.as_map() ?? i.PlutusMap.new());
|
|
1288
|
+
case i.PlutusDataKind.ConstrPlutusData:
|
|
1289
1289
|
return {
|
|
1290
1290
|
alternative: parseInt(((a = s.as_constr_plutus_data()) == null ? void 0 : a.alternative().to_str()) ?? "0", 10),
|
|
1291
|
-
fields: e(((
|
|
1291
|
+
fields: e(((n = s.as_constr_plutus_data()) == null ? void 0 : n.data()) ?? i.PlutusList.new())
|
|
1292
1292
|
};
|
|
1293
1293
|
default:
|
|
1294
1294
|
throw new Error(`PlutusData Kind: ${s.kind()}, is not supported`);
|
|
1295
1295
|
}
|
|
1296
|
-
},
|
|
1296
|
+
}, tt = (s) => {
|
|
1297
1297
|
const e = (t) => {
|
|
1298
|
-
const r =
|
|
1298
|
+
const r = i.PlutusList.new();
|
|
1299
1299
|
return t.forEach((a) => {
|
|
1300
|
-
r.add(
|
|
1300
|
+
r.add(tt(a));
|
|
1301
1301
|
}), r;
|
|
1302
1302
|
};
|
|
1303
1303
|
switch (typeof s) {
|
|
1304
1304
|
case "string":
|
|
1305
|
-
return
|
|
1305
|
+
return i.PlutusData.new_bytes(m(s));
|
|
1306
1306
|
case "number":
|
|
1307
|
-
return
|
|
1307
|
+
return i.PlutusData.new_integer(i.BigInt.from_str(s.toString()));
|
|
1308
1308
|
case "object":
|
|
1309
1309
|
if (s instanceof Array) {
|
|
1310
1310
|
const t = e(s);
|
|
1311
|
-
return
|
|
1311
|
+
return i.PlutusData.new_list(t);
|
|
1312
1312
|
} else if (s instanceof Map) {
|
|
1313
|
-
const t =
|
|
1313
|
+
const t = i.PlutusMap.new();
|
|
1314
1314
|
return s.forEach((r, a) => {
|
|
1315
|
-
t.insert(
|
|
1316
|
-
}),
|
|
1315
|
+
t.insert(tt(a), tt(r));
|
|
1316
|
+
}), i.PlutusData.new_map(t);
|
|
1317
1317
|
} else
|
|
1318
|
-
return
|
|
1318
|
+
return i.PlutusData.new_constr_plutus_data(i.ConstrPlutusData.new(i.BigNum.from_str(s.alternative.toString()), e(s.fields)));
|
|
1319
1319
|
}
|
|
1320
1320
|
}, Rs = (s) => {
|
|
1321
|
-
const e =
|
|
1321
|
+
const e = i.Relays.new();
|
|
1322
1322
|
throw s.relays.forEach((t) => {
|
|
1323
1323
|
e.add($s(t));
|
|
1324
1324
|
}), new Error("toPoolParams not implemented.");
|
|
1325
1325
|
}, He = (s) => {
|
|
1326
1326
|
const e = (t) => es[t];
|
|
1327
|
-
return
|
|
1327
|
+
return i.Redeemer.new(e(s.tag), i.BigNum.from_str(s.index.toString()), tt(s.data), i.ExUnits.new(i.BigNum.from_str(s.budget.mem.toString()), i.BigNum.from_str(s.budget.steps.toString())));
|
|
1328
1328
|
}, $s = (s) => {
|
|
1329
1329
|
switch (s.type) {
|
|
1330
1330
|
case "SingleHostAddr": {
|
|
1331
|
-
const e = s.IPV4 ?
|
|
1332
|
-
return
|
|
1331
|
+
const e = s.IPV4 ? i.Ipv4.new(new Uint8Array(s.IPV4.split(".").map((r) => parseInt(r)))) : void 0, t = s.IPV6 ? i.Ipv6.new(m(s.IPV6.replaceAll(":", ""))) : void 0;
|
|
1332
|
+
return i.Relay.new_single_host_addr(i.SingleHostAddr.new(s.port, e, t));
|
|
1333
1333
|
}
|
|
1334
1334
|
case "SingleHostName":
|
|
1335
|
-
return
|
|
1335
|
+
return i.Relay.new_single_host_name(i.SingleHostName.new(s.port, i.DNSRecordAorAAAA.new(s.domainName)));
|
|
1336
1336
|
case "MultiHostName":
|
|
1337
|
-
return
|
|
1337
|
+
return i.Relay.new_multi_host_name(i.MultiHostName.new(i.DNSRecordSRV.new(s.domainName)));
|
|
1338
1338
|
}
|
|
1339
1339
|
}, Oe = (s) => {
|
|
1340
1340
|
if (s.is_plutus_script()) {
|
|
1341
1341
|
const t = s.plutus_script();
|
|
1342
1342
|
return {
|
|
1343
1343
|
code: t.to_hex(),
|
|
1344
|
-
version: Object.keys(
|
|
1344
|
+
version: Object.keys(xt).find((r) => xt[r].to_hex() === t.language_version().to_hex())
|
|
1345
1345
|
};
|
|
1346
1346
|
}
|
|
1347
1347
|
const e = s.native_script();
|
|
1348
1348
|
return Dt(e);
|
|
1349
|
-
},
|
|
1349
|
+
}, ct = (s) => {
|
|
1350
1350
|
if ("code" in s) {
|
|
1351
|
-
const e =
|
|
1352
|
-
return
|
|
1351
|
+
const e = ot(s.code, s.version);
|
|
1352
|
+
return i.ScriptRef.new_plutus_script(e);
|
|
1353
1353
|
}
|
|
1354
|
-
return
|
|
1354
|
+
return i.ScriptRef.new_native_script(vt(s));
|
|
1355
1355
|
}, Qt = (s) => {
|
|
1356
|
-
var a,
|
|
1357
|
-
const e = s.output().has_data_hash() ? (a = s.output().data_hash()) == null ? void 0 : a.to_hex() : void 0, t = s.output().has_plutus_data() ? (
|
|
1356
|
+
var a, n, o;
|
|
1357
|
+
const e = s.output().has_data_hash() ? (a = s.output().data_hash()) == null ? void 0 : a.to_hex() : void 0, t = s.output().has_plutus_data() ? (n = s.output().plutus_data()) == null ? void 0 : n.to_hex() : void 0, r = s.output().has_script_ref() ? (o = s.output().script_ref()) == null ? void 0 : o.to_hex() : void 0;
|
|
1358
1358
|
return {
|
|
1359
1359
|
input: {
|
|
1360
1360
|
outputIndex: s.input().index(),
|
|
@@ -1368,121 +1368,121 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1368
1368
|
scriptRef: r
|
|
1369
1369
|
}
|
|
1370
1370
|
};
|
|
1371
|
-
},
|
|
1372
|
-
const e =
|
|
1373
|
-
return s.output.dataHash !== void 0 && t.set_data_hash(Hs(s.output.dataHash)), s.output.plutusData !== void 0 && t.set_plutus_data(Pe(s.output.plutusData)), s.output.scriptRef !== void 0 && t.set_script_ref(Ys(s.output.scriptRef)),
|
|
1371
|
+
}, F = (s) => {
|
|
1372
|
+
const e = i.TransactionInput.new(Fe(s.input.txHash), s.input.outputIndex), t = i.TransactionOutput.new(H(s.output.address), Bt(s.output.amount));
|
|
1373
|
+
return s.output.dataHash !== void 0 && t.set_data_hash(Hs(s.output.dataHash)), s.output.plutusData !== void 0 && t.set_plutus_data(Pe(s.output.plutusData)), s.output.scriptRef !== void 0 && t.set_script_ref(Ys(s.output.scriptRef)), i.TransactionUnspentOutput.new(e, t);
|
|
1374
1374
|
}, he = (s) => {
|
|
1375
1375
|
const e = s.split(".")[1] ?? "0", t = `${parseInt(e, 10)}`, r = "1" + "0".repeat(e.length);
|
|
1376
|
-
return
|
|
1377
|
-
}, S = (s) => s.length % 2 === 0 && /^[0-9A-F]*$/i.test(s) ? s :
|
|
1376
|
+
return i.UnitInterval.new(i.BigNum.from_str(t), i.BigNum.from_str(r));
|
|
1377
|
+
}, S = (s) => s.length % 2 === 0 && /^[0-9A-F]*$/i.test(s) ? s : D(Buffer.from(s, "utf-8")), qt = (s) => Buffer.from(s, "hex").toString("utf-8"), Ve = (s) => {
|
|
1378
1378
|
const e = [
|
|
1379
1379
|
{ unit: "lovelace", quantity: s.coin().to_str() }
|
|
1380
1380
|
], t = s.multiasset();
|
|
1381
1381
|
if (t !== void 0) {
|
|
1382
1382
|
const r = t.keys();
|
|
1383
1383
|
for (let a = 0; a < r.len(); a += 1) {
|
|
1384
|
-
const
|
|
1384
|
+
const n = r.get(a), o = t.get(n);
|
|
1385
1385
|
if (o !== void 0) {
|
|
1386
1386
|
const c = o.keys();
|
|
1387
1387
|
for (let u = 0; u < c.len(); u += 1) {
|
|
1388
|
-
const A = c.get(u),
|
|
1389
|
-
e.push({ unit: g, quantity:
|
|
1388
|
+
const A = c.get(u), l = o.get(A) ?? i.BigNum.from_str("0"), g = n.to_hex() + D(A.name());
|
|
1389
|
+
e.push({ unit: g, quantity: l.to_str() });
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
}
|
|
1393
1393
|
}
|
|
1394
1394
|
return e;
|
|
1395
1395
|
}, Bt = (s) => {
|
|
1396
|
-
const e = s.find((
|
|
1397
|
-
t.forEach((
|
|
1398
|
-
const o =
|
|
1399
|
-
s.filter((c) => c.unit.slice(0,
|
|
1400
|
-
o.insert(
|
|
1401
|
-
}), r.insert(qs(
|
|
1396
|
+
const e = s.find((n) => n.unit === "lovelace"), t = Array.from(new Set(s.filter((n) => n.unit !== "lovelace").map((n) => n.unit.slice(0, M)))), r = i.MultiAsset.new();
|
|
1397
|
+
t.forEach((n) => {
|
|
1398
|
+
const o = i.Assets.new();
|
|
1399
|
+
s.filter((c) => c.unit.slice(0, M) === n).forEach((c) => {
|
|
1400
|
+
o.insert(i.AssetName.new(m(c.unit.slice(M))), i.BigNum.from_str(c.quantity));
|
|
1401
|
+
}), r.insert(qs(n), o);
|
|
1402
1402
|
});
|
|
1403
|
-
const a =
|
|
1403
|
+
const a = i.Value.new(i.BigNum.from_str(e ? e.quantity : "0"));
|
|
1404
1404
|
return (s.length > 1 || !e) && a.set_multiasset(r), a;
|
|
1405
|
-
}, Ie = (s, e, t) =>
|
|
1405
|
+
}, Ie = (s, e, t) => i.BaseAddress.new(s, i.StakeCredential.from_keyhash(e), i.StakeCredential.from_keyhash(t)), Ye = (s, e = "") => i.Bip32PrivateKey.from_bip39_entropy(m(s), m(S(e))), me = (s) => i.DataCost.new_coins_per_byte(i.BigNum.from_str(s)), zs = (s) => {
|
|
1406
1406
|
if (typeof s != "object" || !("input" in s))
|
|
1407
|
-
return
|
|
1408
|
-
const e =
|
|
1407
|
+
return i.DatumSource.new(tt(s));
|
|
1408
|
+
const e = F(s);
|
|
1409
1409
|
if (e.output().has_plutus_data())
|
|
1410
|
-
return
|
|
1410
|
+
return i.DatumSource.new_ref_input(e.input());
|
|
1411
1411
|
throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1412
|
-
}, pe = (s, e) =>
|
|
1412
|
+
}, pe = (s, e) => i.EnterpriseAddress.new(s, i.StakeCredential.from_keyhash(e)), fe = (s, e) => {
|
|
1413
1413
|
if (typeof s == "string")
|
|
1414
|
-
return
|
|
1414
|
+
return i.MintWitness.new_native_script(bt(s));
|
|
1415
1415
|
if (e === void 0)
|
|
1416
1416
|
throw new Error("Minting with plutus requires a redeemer to be defined");
|
|
1417
1417
|
if (e.tag !== "MINT")
|
|
1418
1418
|
throw new Error("Minting redeemer's tag must be defined as 'MINT'");
|
|
1419
|
-
return
|
|
1419
|
+
return i.MintWitness.new_plutus_script(qe(s), He({
|
|
1420
1420
|
tag: "MINT",
|
|
1421
1421
|
index: 0,
|
|
1422
|
-
budget:
|
|
1422
|
+
budget: xe,
|
|
1423
1423
|
data: {
|
|
1424
1424
|
alternative: 0,
|
|
1425
1425
|
fields: []
|
|
1426
1426
|
},
|
|
1427
1427
|
...e
|
|
1428
1428
|
}));
|
|
1429
|
-
},
|
|
1429
|
+
}, Ft = (s, e) => i.RewardAddress.new(s, i.StakeCredential.from_keyhash(e)), qe = (s) => {
|
|
1430
1430
|
if ("code" in s)
|
|
1431
|
-
return
|
|
1432
|
-
const e =
|
|
1431
|
+
return i.PlutusScriptSource.new(ot(s.code, s.version));
|
|
1432
|
+
const e = F(s);
|
|
1433
1433
|
if (e.output().has_script_ref()) {
|
|
1434
1434
|
const t = e.output().script_ref();
|
|
1435
1435
|
if (t.is_plutus_script()) {
|
|
1436
|
-
const r = Oe(t), a =
|
|
1437
|
-
return
|
|
1436
|
+
const r = Oe(t), a = ot(r.code, r.version).hash();
|
|
1437
|
+
return i.PlutusScriptSource.new_ref_input_with_lang_ver(a, e.input(), xt[r.version]);
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1441
1441
|
}, ft = (s) => {
|
|
1442
|
-
const e =
|
|
1443
|
-
return
|
|
1444
|
-
},
|
|
1445
|
-
const e =
|
|
1446
|
-
return
|
|
1442
|
+
const e = i.ScriptPubkey.new(s);
|
|
1443
|
+
return i.NativeScript.new_script_pubkey(e);
|
|
1444
|
+
}, Ws = (s = G) => {
|
|
1445
|
+
const e = i.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(i.BigNum.from_str(s.coinsPerUTxOSize)).ex_unit_prices(i.ExUnitPrices.new(he(s.priceMem.toString()), he(s.priceStep.toString()))).fee_algo(i.LinearFee.new(i.BigNum.from_str(s.minFeeA.toString()), i.BigNum.from_str(s.minFeeB.toString()))).key_deposit(i.BigNum.from_str(s.keyDeposit)).max_tx_size(s.maxTxSize).max_value_size(parseInt(s.maxValSize, 10)).pool_deposit(i.BigNum.from_str(s.poolDeposit)).build();
|
|
1446
|
+
return i.TransactionBuilder.new(e);
|
|
1447
1447
|
}, _e = (s) => {
|
|
1448
|
-
const e =
|
|
1449
|
-
return s.map((t) => t instanceof
|
|
1448
|
+
const e = i.TxInputsBuilder.new();
|
|
1449
|
+
return s.map((t) => t instanceof i.TransactionUnspentOutput ? t : F(t)).forEach((t) => {
|
|
1450
1450
|
e.add_input(t.output().address(), t.input(), t.output().amount());
|
|
1451
1451
|
}), e;
|
|
1452
1452
|
}, _t = (s) => {
|
|
1453
1453
|
if (typeof s == "string")
|
|
1454
|
-
return
|
|
1455
|
-
let e =
|
|
1454
|
+
return i.TransactionOutputBuilder.new().with_address(H(s));
|
|
1455
|
+
let e = i.TransactionOutputBuilder.new().with_address(H(s.address));
|
|
1456
1456
|
if (s.datum) {
|
|
1457
|
-
const { value: t, inline: r } = s.datum, a =
|
|
1458
|
-
e = e.with_data_hash(
|
|
1457
|
+
const { value: t, inline: r } = s.datum, a = tt(t);
|
|
1458
|
+
e = e.with_data_hash(i.hash_plutus_data(a)), r && (e = e.with_plutus_data(a));
|
|
1459
1459
|
}
|
|
1460
1460
|
if (s.script) {
|
|
1461
|
-
const t =
|
|
1461
|
+
const t = ct(s.script);
|
|
1462
1462
|
e = e.with_script_ref(t);
|
|
1463
1463
|
}
|
|
1464
1464
|
return e;
|
|
1465
|
-
},
|
|
1466
|
-
const e = s.slice(0,
|
|
1465
|
+
}, X = (s) => {
|
|
1466
|
+
const e = s.slice(0, M), t = s.includes(".") ? S(s.split(".")[1]) : s.slice(M);
|
|
1467
1467
|
return { policyId: e, assetName: t };
|
|
1468
|
-
},
|
|
1468
|
+
}, d = (s) => L.isAxiosError(s) ? s.response ? JSON.stringify({
|
|
1469
1469
|
data: s.response.data,
|
|
1470
1470
|
headers: s.response.headers,
|
|
1471
1471
|
status: s.response.status
|
|
1472
1472
|
}) : s.request ? JSON.stringify(s.request) : s.message : JSON.stringify(s), cr = (s) => {
|
|
1473
|
-
const e =
|
|
1474
|
-
return
|
|
1473
|
+
const e = tt(s);
|
|
1474
|
+
return i.hash_plutus_data(e).to_hex();
|
|
1475
1475
|
}, ur = (s, e = Date.now()) => {
|
|
1476
|
-
if (
|
|
1477
|
-
const [t, r, a,
|
|
1478
|
-
return parseInt(
|
|
1476
|
+
if (Et[s]) {
|
|
1477
|
+
const [t, r, a, n] = Et[s];
|
|
1478
|
+
return parseInt(i.BigNum.from_str(e.toString()).div_floor(i.BigNum.from_str("1000")).checked_sub(i.BigNum.from_str(a)).div_floor(i.BigNum.from_str(n)).checked_add(i.BigNum.from_str(t)).to_str(), 10);
|
|
1479
1479
|
}
|
|
1480
1480
|
throw new Error(`Couldn't resolve EpochNo for network: ${s}`);
|
|
1481
|
-
},
|
|
1481
|
+
}, Js = (s, e) => Fs.fromParts(m(s), m(e)).fingerprint(), Ar = (s, e) => ss[s][e], dr = (s) => vt(s).hash().to_hex(), rt = (s) => {
|
|
1482
1482
|
var e, t;
|
|
1483
1483
|
try {
|
|
1484
1484
|
const r = [
|
|
1485
|
-
(e =
|
|
1485
|
+
(e = Yt(s)) == null ? void 0 : e.payment_cred().to_keyhash(),
|
|
1486
1486
|
(t = Te(s)) == null ? void 0 : t.payment_cred().to_keyhash()
|
|
1487
1487
|
].find((a) => a !== void 0);
|
|
1488
1488
|
if (r !== void 0)
|
|
@@ -1491,9 +1491,9 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1491
1491
|
} catch (r) {
|
|
1492
1492
|
throw new Error(`An error occurred during resolvePaymentKeyHash: ${r}.`);
|
|
1493
1493
|
}
|
|
1494
|
-
},
|
|
1495
|
-
const t =
|
|
1496
|
-
return
|
|
1494
|
+
}, gr = (s, e = 0) => {
|
|
1495
|
+
const t = ot(s.code, s.version);
|
|
1496
|
+
return i.EnterpriseAddress.new(e, i.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32();
|
|
1497
1497
|
}, lr = (s) => {
|
|
1498
1498
|
try {
|
|
1499
1499
|
const e = Te(s), t = e == null ? void 0 : e.payment_cred().to_scripthash();
|
|
@@ -1503,29 +1503,29 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1503
1503
|
} catch (e) {
|
|
1504
1504
|
throw new Error(`An error occurred during resolveScriptHash: ${e}.`);
|
|
1505
1505
|
}
|
|
1506
|
-
}, hr = (s) =>
|
|
1506
|
+
}, hr = (s) => i.Ed25519KeyHash.from_hex(s).to_bech32("pool1"), Ir = (s) => {
|
|
1507
1507
|
const e = Ce(s.join(" ")), t = Ye(e), r = t.to_bech32();
|
|
1508
1508
|
return t.free(), r;
|
|
1509
|
-
}, mr = (s) =>
|
|
1510
|
-
if (
|
|
1511
|
-
const [t, r, a] =
|
|
1512
|
-
return
|
|
1509
|
+
}, mr = (s) => ct(s).to_hex(), pr = (s, e = Date.now()) => {
|
|
1510
|
+
if (Et[s]) {
|
|
1511
|
+
const [t, r, a] = Et[s];
|
|
1512
|
+
return i.BigNum.from_str(e.toString()).div_floor(i.BigNum.from_str("1000")).checked_sub(i.BigNum.from_str(a)).checked_add(i.BigNum.from_str(r)).to_str();
|
|
1513
1513
|
}
|
|
1514
1514
|
throw new Error(`Couldn't resolve SlotNo for network: ${s}`);
|
|
1515
|
-
},
|
|
1515
|
+
}, kt = (s) => {
|
|
1516
1516
|
try {
|
|
1517
|
-
const e =
|
|
1517
|
+
const e = H(s), t = Yt(s), r = t == null ? void 0 : t.stake_cred().to_keyhash();
|
|
1518
1518
|
if (r !== void 0)
|
|
1519
|
-
return
|
|
1519
|
+
return Ft(e.network_id(), r).to_address().to_bech32();
|
|
1520
1520
|
throw new Error(`Couldn't resolve reward address from address: ${s}`);
|
|
1521
1521
|
} catch (e) {
|
|
1522
1522
|
throw new Error(`An error occurred during resolveRewardAddress: ${e}.`);
|
|
1523
1523
|
}
|
|
1524
|
-
},
|
|
1524
|
+
}, dt = (s) => {
|
|
1525
1525
|
var e, t;
|
|
1526
1526
|
try {
|
|
1527
1527
|
const r = [
|
|
1528
|
-
(e =
|
|
1528
|
+
(e = Yt(s)) == null ? void 0 : e.stake_cred().to_keyhash(),
|
|
1529
1529
|
(t = Me(s)) == null ? void 0 : t.payment_cred().to_keyhash()
|
|
1530
1530
|
].find((a) => a !== void 0);
|
|
1531
1531
|
if (r !== void 0)
|
|
@@ -1534,44 +1534,44 @@ const Fs = Ps, Ts = (s, e) => {
|
|
|
1534
1534
|
} catch (r) {
|
|
1535
1535
|
throw new Error(`An error occurred during resolveStakeKeyHash: ${r}.`);
|
|
1536
1536
|
}
|
|
1537
|
-
},
|
|
1538
|
-
const e =
|
|
1539
|
-
return
|
|
1537
|
+
}, Le = (s, e = G.minFeeA, t = G.minFeeB) => (BigInt(e) * BigInt(s) + BigInt(t)).toString(), js = (s) => {
|
|
1538
|
+
const e = q(s).body();
|
|
1539
|
+
return i.hash_transaction(e).to_hex();
|
|
1540
1540
|
}, fr = (s = "", e = 32) => {
|
|
1541
1541
|
if (e <= 0 || e > 2048)
|
|
1542
1542
|
throw new Error("Length must be bewteen 1 and 2048");
|
|
1543
1543
|
const r = ye("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);
|
|
1544
1544
|
return S(`${s}${r}`);
|
|
1545
|
-
},
|
|
1545
|
+
}, Ge = (s, e) => {
|
|
1546
1546
|
const t = s.vkeys();
|
|
1547
1547
|
if (t !== void 0) {
|
|
1548
1548
|
const r = /* @__PURE__ */ new Set();
|
|
1549
|
-
for (let
|
|
1550
|
-
r.add(t.get(
|
|
1551
|
-
for (let
|
|
1552
|
-
r.add(e.get(
|
|
1553
|
-
const a =
|
|
1554
|
-
return r.forEach((
|
|
1555
|
-
a.add(
|
|
1549
|
+
for (let n = 0; n < t.len(); n += 1)
|
|
1550
|
+
r.add(t.get(n).to_hex());
|
|
1551
|
+
for (let n = 0; n < e.len(); n += 1)
|
|
1552
|
+
r.add(e.get(n).to_hex());
|
|
1553
|
+
const a = i.Vkeywitnesses.new();
|
|
1554
|
+
return r.forEach((n) => {
|
|
1555
|
+
a.add(i.Vkeywitness.from_hex(n));
|
|
1556
1556
|
}), a;
|
|
1557
1557
|
}
|
|
1558
1558
|
return e;
|
|
1559
|
-
}, _r = (s) => wt(Pe(s)), yr = (s) =>
|
|
1559
|
+
}, _r = (s) => wt(Pe(s)), yr = (s) => q(s).to_js_value();
|
|
1560
1560
|
class Cr {
|
|
1561
1561
|
_axiosInstance;
|
|
1562
1562
|
constructor(...e) {
|
|
1563
1563
|
if (typeof e[0] == "string" && e[0].startsWith("http"))
|
|
1564
|
-
this._axiosInstance =
|
|
1564
|
+
this._axiosInstance = L.create({ baseURL: e[0] });
|
|
1565
1565
|
else {
|
|
1566
1566
|
const t = e[0], r = t.slice(0, 7);
|
|
1567
|
-
this._axiosInstance =
|
|
1567
|
+
this._axiosInstance = L.create({
|
|
1568
1568
|
baseURL: `https://cardano-${r}.blockfrost.io/api/v${e[1] ?? 0}`,
|
|
1569
1569
|
headers: { project_id: t }
|
|
1570
1570
|
});
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
1573
|
async fetchAccountInfo(e) {
|
|
1574
|
-
const t = e.startsWith("addr") ?
|
|
1574
|
+
const t = e.startsWith("addr") ? kt(e) : e;
|
|
1575
1575
|
try {
|
|
1576
1576
|
const { data: r, status: a } = await this._axiosInstance.get(`accounts/${t}`);
|
|
1577
1577
|
if (a === 200)
|
|
@@ -1582,28 +1582,28 @@ class Cr {
|
|
|
1582
1582
|
rewards: r.withdrawable_amount,
|
|
1583
1583
|
withdrawals: r.withdrawals_sum
|
|
1584
1584
|
};
|
|
1585
|
-
throw
|
|
1585
|
+
throw d(r);
|
|
1586
1586
|
} catch (r) {
|
|
1587
|
-
throw
|
|
1587
|
+
throw d(r);
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
async fetchAddressUTxOs(e, t) {
|
|
1591
|
-
const r = t !== void 0 ? `/${t}` : "", a = `addresses/${e}/utxos` + r,
|
|
1592
|
-
const { data:
|
|
1591
|
+
const r = t !== void 0 ? `/${t}` : "", a = `addresses/${e}/utxos` + r, n = async (u = 1, A = []) => {
|
|
1592
|
+
const { data: l, status: g } = await this._axiosInstance.get(`${a}?page=${u}`);
|
|
1593
1593
|
if (g === 200)
|
|
1594
|
-
return
|
|
1595
|
-
throw l
|
|
1594
|
+
return l.length > 0 ? n(u + 1, [...A, ...await Promise.all(l.map(c))]) : A;
|
|
1595
|
+
throw d(l);
|
|
1596
1596
|
}, o = async (u) => {
|
|
1597
1597
|
if (u) {
|
|
1598
|
-
const { data: A, status:
|
|
1599
|
-
if (
|
|
1598
|
+
const { data: A, status: l } = await this._axiosInstance.get(`scripts/${u}`);
|
|
1599
|
+
if (l === 200) {
|
|
1600
1600
|
const g = A.type.startsWith("plutus") ? {
|
|
1601
1601
|
code: await this.fetchPlutusScriptCBOR(u),
|
|
1602
1602
|
version: A.type.replace("plutus", "")
|
|
1603
1603
|
} : await this.fetchNativeScriptJSON(u);
|
|
1604
|
-
return
|
|
1604
|
+
return ct(g).to_hex();
|
|
1605
1605
|
}
|
|
1606
|
-
throw
|
|
1606
|
+
throw d(A);
|
|
1607
1607
|
}
|
|
1608
1608
|
}, c = async (u) => ({
|
|
1609
1609
|
input: {
|
|
@@ -1619,17 +1619,17 @@ class Cr {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
});
|
|
1621
1621
|
try {
|
|
1622
|
-
return await
|
|
1622
|
+
return await n();
|
|
1623
1623
|
} catch {
|
|
1624
1624
|
return [];
|
|
1625
1625
|
}
|
|
1626
1626
|
}
|
|
1627
1627
|
async fetchAssetAddresses(e) {
|
|
1628
1628
|
const t = async (r = 1, a = []) => {
|
|
1629
|
-
const { policyId:
|
|
1629
|
+
const { policyId: n, assetName: o } = X(e), { data: c, status: u } = await this._axiosInstance.get(`assets/${n}${o}/addresses?page=${r}`);
|
|
1630
1630
|
if (u === 200)
|
|
1631
1631
|
return c.length > 0 ? t(r + 1, [...a, ...c]) : a;
|
|
1632
|
-
throw
|
|
1632
|
+
throw d(c);
|
|
1633
1633
|
};
|
|
1634
1634
|
try {
|
|
1635
1635
|
return await t();
|
|
@@ -1639,14 +1639,14 @@ class Cr {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
async fetchAssetMetadata(e) {
|
|
1641
1641
|
try {
|
|
1642
|
-
const { policyId: t, assetName: r } =
|
|
1643
|
-
if (
|
|
1642
|
+
const { policyId: t, assetName: r } = X(e), { data: a, status: n } = await this._axiosInstance.get(`assets/${t}${r}`);
|
|
1643
|
+
if (n === 200)
|
|
1644
1644
|
return {
|
|
1645
1645
|
...a.onchain_metadata
|
|
1646
1646
|
};
|
|
1647
|
-
throw
|
|
1647
|
+
throw d(a);
|
|
1648
1648
|
} catch (t) {
|
|
1649
|
-
throw
|
|
1649
|
+
throw d(t);
|
|
1650
1650
|
}
|
|
1651
1651
|
}
|
|
1652
1652
|
async fetchBlockInfo(e) {
|
|
@@ -1670,9 +1670,9 @@ class Cr {
|
|
|
1670
1670
|
txCount: t.tx_count,
|
|
1671
1671
|
VRFKey: t.block_vrf
|
|
1672
1672
|
};
|
|
1673
|
-
throw
|
|
1673
|
+
throw d(t);
|
|
1674
1674
|
} catch (t) {
|
|
1675
|
-
throw
|
|
1675
|
+
throw d(t);
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
async fetchCollectionAssets(e, t = 1) {
|
|
@@ -1680,25 +1680,25 @@ class Cr {
|
|
|
1680
1680
|
const { data: r, status: a } = await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);
|
|
1681
1681
|
if (a === 200)
|
|
1682
1682
|
return {
|
|
1683
|
-
assets: r.map((
|
|
1684
|
-
unit:
|
|
1685
|
-
quantity:
|
|
1683
|
+
assets: r.map((n) => ({
|
|
1684
|
+
unit: n.asset,
|
|
1685
|
+
quantity: n.quantity
|
|
1686
1686
|
})),
|
|
1687
1687
|
next: r.length === 100 ? t + 1 : null
|
|
1688
1688
|
};
|
|
1689
|
-
throw
|
|
1689
|
+
throw d(r);
|
|
1690
1690
|
} catch {
|
|
1691
1691
|
return { assets: [], next: null };
|
|
1692
1692
|
}
|
|
1693
1693
|
}
|
|
1694
1694
|
async fetchHandleAddress(e) {
|
|
1695
1695
|
try {
|
|
1696
|
-
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`assets/${
|
|
1696
|
+
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`assets/${Mt[1]}${t}/addresses`);
|
|
1697
1697
|
if (a === 200)
|
|
1698
1698
|
return r[0].address;
|
|
1699
|
-
throw
|
|
1699
|
+
throw d(r);
|
|
1700
1700
|
} catch (t) {
|
|
1701
|
-
throw
|
|
1701
|
+
throw d(t);
|
|
1702
1702
|
}
|
|
1703
1703
|
}
|
|
1704
1704
|
async fetchProtocolParameters(e = Number.NaN) {
|
|
@@ -1727,9 +1727,9 @@ class Cr {
|
|
|
1727
1727
|
priceMem: t.price_mem,
|
|
1728
1728
|
priceStep: t.price_step
|
|
1729
1729
|
};
|
|
1730
|
-
throw
|
|
1730
|
+
throw d(t);
|
|
1731
1731
|
} catch (t) {
|
|
1732
|
-
throw
|
|
1732
|
+
throw d(t);
|
|
1733
1733
|
}
|
|
1734
1734
|
}
|
|
1735
1735
|
async fetchTxInfo(e) {
|
|
@@ -1747,17 +1747,17 @@ class Cr {
|
|
|
1747
1747
|
slot: t.slot.toString(),
|
|
1748
1748
|
size: t.size
|
|
1749
1749
|
};
|
|
1750
|
-
throw
|
|
1750
|
+
throw d(t);
|
|
1751
1751
|
} catch (t) {
|
|
1752
|
-
throw
|
|
1752
|
+
throw d(t);
|
|
1753
1753
|
}
|
|
1754
1754
|
}
|
|
1755
1755
|
onTxConfirmed(e, t, r = 100) {
|
|
1756
1756
|
let a = 0;
|
|
1757
|
-
const
|
|
1758
|
-
a >= r && clearInterval(
|
|
1757
|
+
const n = setInterval(() => {
|
|
1758
|
+
a >= r && clearInterval(n), this.fetchTxInfo(e).then((o) => {
|
|
1759
1759
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
1760
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
1760
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(n), t());
|
|
1761
1761
|
}).catch(() => {
|
|
1762
1762
|
a += 1;
|
|
1763
1763
|
});
|
|
@@ -1771,54 +1771,54 @@ class Cr {
|
|
|
1771
1771
|
const t = { "Content-Type": "application/cbor" }, { data: r, status: a } = await this._axiosInstance.post("tx/submit", m(e), { headers: t });
|
|
1772
1772
|
if (a === 200)
|
|
1773
1773
|
return r;
|
|
1774
|
-
throw
|
|
1774
|
+
throw d(r);
|
|
1775
1775
|
} catch (t) {
|
|
1776
|
-
throw
|
|
1776
|
+
throw d(t);
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
1779
|
async fetchPlutusScriptCBOR(e) {
|
|
1780
1780
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/cbor`);
|
|
1781
1781
|
if (r === 200)
|
|
1782
1782
|
return t.cbor;
|
|
1783
|
-
throw
|
|
1783
|
+
throw d(t);
|
|
1784
1784
|
}
|
|
1785
1785
|
async fetchNativeScriptJSON(e) {
|
|
1786
1786
|
const { data: t, status: r } = await this._axiosInstance.get(`scripts/${e}/json`);
|
|
1787
1787
|
if (r === 200)
|
|
1788
1788
|
return t.json;
|
|
1789
|
-
throw
|
|
1789
|
+
throw d(t);
|
|
1790
1790
|
}
|
|
1791
1791
|
}
|
|
1792
1792
|
class wr {
|
|
1793
1793
|
_axiosInstance;
|
|
1794
1794
|
constructor(e, t, r) {
|
|
1795
|
-
const a = r.host ?? "ipfs.infura.io",
|
|
1796
|
-
this._axiosInstance =
|
|
1797
|
-
baseURL: `https://${a}:${
|
|
1795
|
+
const a = r.host ?? "ipfs.infura.io", n = r.port ?? 5001, o = r.version ?? 0;
|
|
1796
|
+
this._axiosInstance = L.create({
|
|
1797
|
+
baseURL: `https://${a}:${n}/api/v${o}`,
|
|
1798
1798
|
auth: { username: e, password: t }
|
|
1799
1799
|
});
|
|
1800
1800
|
}
|
|
1801
1801
|
async uploadContent(e, t = !1) {
|
|
1802
1802
|
try {
|
|
1803
|
-
const r = { "Content-Type": "multipart/form-data" }, { data: a, status:
|
|
1804
|
-
if (
|
|
1803
|
+
const r = { "Content-Type": "multipart/form-data" }, { data: a, status: n } = await this._axiosInstance.post(`add?recursive=${t}`, e, { headers: r });
|
|
1804
|
+
if (n === 200)
|
|
1805
1805
|
return a;
|
|
1806
|
-
throw
|
|
1806
|
+
throw d(a);
|
|
1807
1807
|
} catch (r) {
|
|
1808
|
-
throw
|
|
1808
|
+
throw d(r);
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
1812
|
class Br {
|
|
1813
1813
|
_axiosInstance;
|
|
1814
1814
|
constructor(...e) {
|
|
1815
|
-
typeof e[0] == "string" && e[0].startsWith("http") ? this._axiosInstance =
|
|
1815
|
+
typeof e[0] == "string" && e[0].startsWith("http") ? this._axiosInstance = L.create({ baseURL: e[0] }) : this._axiosInstance = L.create({
|
|
1816
1816
|
baseURL: `https://${e[0]}.koios.rest/api/v${e[1] ?? 0}`
|
|
1817
1817
|
});
|
|
1818
1818
|
}
|
|
1819
1819
|
async fetchAccountInfo(e) {
|
|
1820
1820
|
try {
|
|
1821
|
-
const t = e.startsWith("addr") ?
|
|
1821
|
+
const t = e.startsWith("addr") ? kt(e) : e, { data: r, status: a } = await this._axiosInstance.post("account_info", { _stake_addresses: [t] });
|
|
1822
1822
|
if (a === 200)
|
|
1823
1823
|
return {
|
|
1824
1824
|
poolId: r[0].delegated_pool,
|
|
@@ -1827,24 +1827,24 @@ class Br {
|
|
|
1827
1827
|
rewards: r[0].rewards_available,
|
|
1828
1828
|
withdrawals: r[0].withdrawals
|
|
1829
1829
|
};
|
|
1830
|
-
throw
|
|
1830
|
+
throw d(r);
|
|
1831
1831
|
} catch (t) {
|
|
1832
|
-
throw
|
|
1832
|
+
throw d(t);
|
|
1833
1833
|
}
|
|
1834
1834
|
}
|
|
1835
1835
|
async fetchAddressUTxOs(e, t) {
|
|
1836
1836
|
const r = (a) => {
|
|
1837
1837
|
if (a) {
|
|
1838
|
-
const
|
|
1838
|
+
const n = a.type.startsWith("plutus") ? {
|
|
1839
1839
|
code: a.bytes,
|
|
1840
1840
|
version: a.type.replace("plutus", "")
|
|
1841
1841
|
} : Dt(bt(a.bytes));
|
|
1842
|
-
return
|
|
1842
|
+
return ct(n).to_hex();
|
|
1843
1843
|
}
|
|
1844
1844
|
};
|
|
1845
1845
|
try {
|
|
1846
|
-
const { data: a, status:
|
|
1847
|
-
if (
|
|
1846
|
+
const { data: a, status: n } = await this._axiosInstance.post("address_info", { _addresses: [e] });
|
|
1847
|
+
if (n === 200) {
|
|
1848
1848
|
const o = a.flatMap((c) => c.utxo_set).map((c) => {
|
|
1849
1849
|
var u;
|
|
1850
1850
|
return {
|
|
@@ -1869,34 +1869,34 @@ class Br {
|
|
|
1869
1869
|
});
|
|
1870
1870
|
return t !== void 0 ? o.filter((c) => c.output.amount.find((u) => u.unit === t) !== void 0) : o;
|
|
1871
1871
|
}
|
|
1872
|
-
throw
|
|
1872
|
+
throw d(a);
|
|
1873
1873
|
} catch {
|
|
1874
1874
|
return [];
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
1877
|
async fetchAssetAddresses(e) {
|
|
1878
1878
|
try {
|
|
1879
|
-
const { policyId: t, assetName: r } =
|
|
1880
|
-
if (
|
|
1879
|
+
const { policyId: t, assetName: r } = X(e), { data: a, status: n } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${t}&_asset_name=${r}`);
|
|
1880
|
+
if (n === 200)
|
|
1881
1881
|
return a.map((o) => ({
|
|
1882
1882
|
address: o.payment_address,
|
|
1883
1883
|
quantity: o.quantity
|
|
1884
1884
|
}));
|
|
1885
|
-
throw
|
|
1885
|
+
throw d(a);
|
|
1886
1886
|
} catch (t) {
|
|
1887
|
-
throw
|
|
1887
|
+
throw d(t);
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
1890
|
async fetchAssetMetadata(e) {
|
|
1891
1891
|
try {
|
|
1892
|
-
const { policyId: t, assetName: r } =
|
|
1893
|
-
if (
|
|
1892
|
+
const { policyId: t, assetName: r } = X(e), { data: a, status: n } = await this._axiosInstance.get(`asset_info?_asset_policy=${t}&_asset_name=${r}`);
|
|
1893
|
+
if (n === 200)
|
|
1894
1894
|
return {
|
|
1895
|
-
...a[0].minting_tx_metadata[721][t][
|
|
1895
|
+
...a[0].minting_tx_metadata[721][t][qt(r)]
|
|
1896
1896
|
};
|
|
1897
|
-
throw
|
|
1897
|
+
throw d(a);
|
|
1898
1898
|
} catch (t) {
|
|
1899
|
-
throw
|
|
1899
|
+
throw d(t);
|
|
1900
1900
|
}
|
|
1901
1901
|
}
|
|
1902
1902
|
async fetchBlockInfo(e) {
|
|
@@ -1920,9 +1920,9 @@ class Br {
|
|
|
1920
1920
|
txCount: t[0].tx_count,
|
|
1921
1921
|
VRFKey: t[0].vrf_key
|
|
1922
1922
|
};
|
|
1923
|
-
throw
|
|
1923
|
+
throw d(t);
|
|
1924
1924
|
} catch (t) {
|
|
1925
|
-
throw
|
|
1925
|
+
throw d(t);
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
1928
|
async fetchCollectionAssets(e, t = 0) {
|
|
@@ -1930,25 +1930,25 @@ class Br {
|
|
|
1930
1930
|
const { data: r, status: a } = await this._axiosInstance.get(`asset_policy_info?_asset_policy=${e}&limit=100&offset=${t}`);
|
|
1931
1931
|
if (a === 200)
|
|
1932
1932
|
return {
|
|
1933
|
-
assets: r.map((
|
|
1934
|
-
unit: `${e}${
|
|
1935
|
-
quantity:
|
|
1933
|
+
assets: r.map((n) => ({
|
|
1934
|
+
unit: `${e}${n.asset_name}`,
|
|
1935
|
+
quantity: n.total_supply
|
|
1936
1936
|
})),
|
|
1937
1937
|
next: r.length === 100 ? t + 100 : null
|
|
1938
1938
|
};
|
|
1939
|
-
throw
|
|
1939
|
+
throw d(r);
|
|
1940
1940
|
} catch (r) {
|
|
1941
|
-
throw
|
|
1941
|
+
throw d(r);
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
1944
1944
|
async fetchHandleAddress(e) {
|
|
1945
1945
|
try {
|
|
1946
|
-
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${
|
|
1946
|
+
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${Mt[1]}&_asset_name=${t}`);
|
|
1947
1947
|
if (a === 200)
|
|
1948
1948
|
return r[0].payment_address;
|
|
1949
|
-
throw
|
|
1949
|
+
throw d(r);
|
|
1950
1950
|
} catch (t) {
|
|
1951
|
-
throw
|
|
1951
|
+
throw d(t);
|
|
1952
1952
|
}
|
|
1953
1953
|
}
|
|
1954
1954
|
async fetchProtocolParameters(e) {
|
|
@@ -1977,16 +1977,16 @@ class Br {
|
|
|
1977
1977
|
priceMem: t[0].price_mem,
|
|
1978
1978
|
priceStep: t[0].price_step
|
|
1979
1979
|
};
|
|
1980
|
-
throw
|
|
1980
|
+
throw d(t);
|
|
1981
1981
|
} catch (t) {
|
|
1982
|
-
throw
|
|
1982
|
+
throw d(t);
|
|
1983
1983
|
}
|
|
1984
1984
|
}
|
|
1985
1985
|
async fetchTxInfo(e) {
|
|
1986
1986
|
var t, r;
|
|
1987
1987
|
try {
|
|
1988
|
-
const { data: a, status:
|
|
1989
|
-
if (
|
|
1988
|
+
const { data: a, status: n } = await this._axiosInstance.post("tx_info", { _tx_hashes: [e] });
|
|
1989
|
+
if (n === 200)
|
|
1990
1990
|
return {
|
|
1991
1991
|
block: a[0].block_hash,
|
|
1992
1992
|
deposit: a[0].deposit,
|
|
@@ -1998,17 +1998,17 @@ class Br {
|
|
|
1998
1998
|
slot: a[0].absolute_slot.toString(),
|
|
1999
1999
|
size: a[0].tx_size
|
|
2000
2000
|
};
|
|
2001
|
-
throw
|
|
2001
|
+
throw d(a);
|
|
2002
2002
|
} catch (a) {
|
|
2003
|
-
throw
|
|
2003
|
+
throw d(a);
|
|
2004
2004
|
}
|
|
2005
2005
|
}
|
|
2006
2006
|
onTxConfirmed(e, t, r = 100) {
|
|
2007
2007
|
let a = 0;
|
|
2008
|
-
const
|
|
2009
|
-
a >= r && clearInterval(
|
|
2008
|
+
const n = setInterval(() => {
|
|
2009
|
+
a >= r && clearInterval(n), this.fetchTxInfo(e).then((o) => {
|
|
2010
2010
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
2011
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
2011
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(n), t());
|
|
2012
2012
|
}).catch(() => {
|
|
2013
2013
|
a += 1;
|
|
2014
2014
|
});
|
|
@@ -2022,13 +2022,13 @@ class Br {
|
|
|
2022
2022
|
const t = { "Content-Type": "application/cbor" }, { data: r, status: a } = await this._axiosInstance.post("submittx", m(e), { headers: t });
|
|
2023
2023
|
if (a === 202)
|
|
2024
2024
|
return r;
|
|
2025
|
-
throw
|
|
2025
|
+
throw d(r);
|
|
2026
2026
|
} catch (t) {
|
|
2027
|
-
throw
|
|
2027
|
+
throw d(t);
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
}
|
|
2031
|
-
class
|
|
2031
|
+
class xr {
|
|
2032
2032
|
_baseUrl;
|
|
2033
2033
|
constructor(...e) {
|
|
2034
2034
|
this._baseUrl = ts(e[0]) ? rs[e[0]] : e[0];
|
|
@@ -2038,9 +2038,9 @@ class Er {
|
|
|
2038
2038
|
return this.send(t, "EvaluateTx", {
|
|
2039
2039
|
evaluate: e
|
|
2040
2040
|
}), new Promise((r, a) => {
|
|
2041
|
-
t.addEventListener("message", (
|
|
2041
|
+
t.addEventListener("message", (n) => {
|
|
2042
2042
|
try {
|
|
2043
|
-
const { result: o } = JSON.parse(
|
|
2043
|
+
const { result: o } = JSON.parse(n.data);
|
|
2044
2044
|
o.EvaluationResult ? r(Object.keys(o.EvaluationResult).map((c) => ({
|
|
2045
2045
|
index: parseInt(c.split(":")[1], 10),
|
|
2046
2046
|
tag: c.split(":")[0].toUpperCase(),
|
|
@@ -2069,9 +2069,9 @@ class Er {
|
|
|
2069
2069
|
return this.send(t, "SubmitTx", {
|
|
2070
2070
|
submit: e
|
|
2071
2071
|
}), new Promise((r, a) => {
|
|
2072
|
-
t.addEventListener("message", (
|
|
2072
|
+
t.addEventListener("message", (n) => {
|
|
2073
2073
|
try {
|
|
2074
|
-
const { result: o } = JSON.parse(
|
|
2074
|
+
const { result: o } = JSON.parse(n.data);
|
|
2075
2075
|
o.SubmitSuccess ? r(o.SubmitSuccess.txId) : a(o.SubmitFail), t.close();
|
|
2076
2076
|
} catch (o) {
|
|
2077
2077
|
a(o);
|
|
@@ -2095,10 +2095,10 @@ class Er {
|
|
|
2095
2095
|
}));
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
|
-
class
|
|
2098
|
+
class Er {
|
|
2099
2099
|
_axiosInstance;
|
|
2100
2100
|
constructor(e, t, r, a = 1) {
|
|
2101
|
-
this._axiosInstance =
|
|
2101
|
+
this._axiosInstance = L.create({
|
|
2102
2102
|
baseURL: `https://cardano-${e}.tangocrypto.com/${t}/v${a}`,
|
|
2103
2103
|
headers: { "x-api-key": r }
|
|
2104
2104
|
});
|
|
@@ -2115,14 +2115,14 @@ class xr {
|
|
|
2115
2115
|
steps: a.unit_steps
|
|
2116
2116
|
}
|
|
2117
2117
|
}));
|
|
2118
|
-
throw
|
|
2118
|
+
throw d(t);
|
|
2119
2119
|
} catch (t) {
|
|
2120
|
-
throw
|
|
2120
|
+
throw d(t);
|
|
2121
2121
|
}
|
|
2122
2122
|
}
|
|
2123
2123
|
async fetchAccountInfo(e) {
|
|
2124
2124
|
try {
|
|
2125
|
-
const t = e.startsWith("addr") ?
|
|
2125
|
+
const t = e.startsWith("addr") ? kt(e) : e, { data: r, status: a } = await this._axiosInstance.get(`wallets/${t}`);
|
|
2126
2126
|
if (a === 200)
|
|
2127
2127
|
return {
|
|
2128
2128
|
poolId: r.pool_id,
|
|
@@ -2131,40 +2131,40 @@ class xr {
|
|
|
2131
2131
|
rewards: r.rewards_sum,
|
|
2132
2132
|
withdrawals: r.withdrawals_sum
|
|
2133
2133
|
};
|
|
2134
|
-
throw
|
|
2134
|
+
throw d(r);
|
|
2135
2135
|
} catch (t) {
|
|
2136
|
-
throw
|
|
2136
|
+
throw d(t);
|
|
2137
2137
|
}
|
|
2138
2138
|
}
|
|
2139
2139
|
async fetchAddressUTxOs(e, t) {
|
|
2140
|
-
const r = t !== void 0 ? `/assets/${t}` : "", a = `addresses/${e}${r}/utxos?size=50`,
|
|
2141
|
-
var
|
|
2140
|
+
const r = t !== void 0 ? `/assets/${t}` : "", a = `addresses/${e}${r}/utxos?size=50`, n = async (A = "", l = []) => {
|
|
2141
|
+
var f;
|
|
2142
2142
|
const { data: g, status: I } = await this._axiosInstance.get(`${a}&cursor=${A}`);
|
|
2143
2143
|
if (I === 200)
|
|
2144
|
-
return g.cursor !== null && ((
|
|
2145
|
-
throw
|
|
2146
|
-
}, o = (A,
|
|
2144
|
+
return g.cursor !== null && ((f = g.cursor) == null ? void 0 : f.length) > 0 ? n(g.cursor, [...l, ...g.data.map(u)]) : g.data.map(u);
|
|
2145
|
+
throw d(g);
|
|
2146
|
+
}, o = (A, l) => {
|
|
2147
2147
|
const g = [{
|
|
2148
2148
|
unit: "lovelace",
|
|
2149
2149
|
quantity: A.toString()
|
|
2150
2150
|
}];
|
|
2151
|
-
return
|
|
2152
|
-
const
|
|
2151
|
+
return l.forEach((I) => {
|
|
2152
|
+
const f = S(I.asset_name);
|
|
2153
2153
|
g.push({
|
|
2154
|
-
unit: `${I.policy_id}${
|
|
2154
|
+
unit: `${I.policy_id}${f}`,
|
|
2155
2155
|
quantity: I.quantity.toString()
|
|
2156
2156
|
});
|
|
2157
2157
|
}), g;
|
|
2158
2158
|
}, c = (A) => {
|
|
2159
2159
|
if (A) {
|
|
2160
|
-
const
|
|
2160
|
+
const l = A.type.startsWith("plutus") ? {
|
|
2161
2161
|
code: A.code,
|
|
2162
2162
|
version: A.type.replace("plutus", "")
|
|
2163
2163
|
} : Dt(bt(A.json));
|
|
2164
|
-
return
|
|
2164
|
+
return ct(l).to_hex();
|
|
2165
2165
|
}
|
|
2166
2166
|
}, u = (A) => {
|
|
2167
|
-
var
|
|
2167
|
+
var l;
|
|
2168
2168
|
return {
|
|
2169
2169
|
input: {
|
|
2170
2170
|
outputIndex: A.index,
|
|
@@ -2174,13 +2174,13 @@ class xr {
|
|
|
2174
2174
|
address: e,
|
|
2175
2175
|
amount: o(A.value, A.assets),
|
|
2176
2176
|
dataHash: void 0,
|
|
2177
|
-
plutusData: ((
|
|
2177
|
+
plutusData: ((l = A.inline_datum) == null ? void 0 : l.value_raw) ?? void 0,
|
|
2178
2178
|
scriptRef: c(A.reference_script)
|
|
2179
2179
|
}
|
|
2180
2180
|
};
|
|
2181
2181
|
};
|
|
2182
2182
|
try {
|
|
2183
|
-
return await
|
|
2183
|
+
return await n();
|
|
2184
2184
|
} catch {
|
|
2185
2185
|
return [];
|
|
2186
2186
|
}
|
|
@@ -2189,12 +2189,12 @@ class xr {
|
|
|
2189
2189
|
const t = (a) => ({
|
|
2190
2190
|
address: a.address,
|
|
2191
2191
|
quantity: a.quantity.toString()
|
|
2192
|
-
}), r = async (a = "",
|
|
2193
|
-
var
|
|
2194
|
-
const { policyId: o, assetName: c } =
|
|
2192
|
+
}), r = async (a = "", n = []) => {
|
|
2193
|
+
var l;
|
|
2194
|
+
const { policyId: o, assetName: c } = X(e), { data: u, status: A } = await this._axiosInstance.get(`assets/${o}${c}/addresses?size=100&cursor=${a}`);
|
|
2195
2195
|
if (A === 200)
|
|
2196
|
-
return u.cursor !== null && ((
|
|
2197
|
-
throw
|
|
2196
|
+
return u.cursor !== null && ((l = u.cursor) == null ? void 0 : l.length) > 0 ? r(u.cursor, [...n, ...u.data.map(t)]) : u.data.map(t);
|
|
2197
|
+
throw d(u);
|
|
2198
2198
|
};
|
|
2199
2199
|
try {
|
|
2200
2200
|
return await r();
|
|
@@ -2205,14 +2205,14 @@ class xr {
|
|
|
2205
2205
|
async fetchAssetMetadata(e) {
|
|
2206
2206
|
var t;
|
|
2207
2207
|
try {
|
|
2208
|
-
const { policyId: r, assetName: a } =
|
|
2208
|
+
const { policyId: r, assetName: a } = X(e), { data: n, status: o } = await this._axiosInstance.get(`assets/${r}${a}`);
|
|
2209
2209
|
if (o === 200)
|
|
2210
2210
|
return {
|
|
2211
|
-
...(t =
|
|
2211
|
+
...(t = n.metadata.find((c) => c.label === 721)) == null ? void 0 : t.json[r][qt(a)]
|
|
2212
2212
|
};
|
|
2213
|
-
throw
|
|
2213
|
+
throw d(n);
|
|
2214
2214
|
} catch (r) {
|
|
2215
|
-
throw
|
|
2215
|
+
throw d(r);
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
async fetchBlockInfo(e) {
|
|
@@ -2236,9 +2236,9 @@ class xr {
|
|
|
2236
2236
|
txCount: t.tx_count,
|
|
2237
2237
|
VRFKey: t.vrf_key
|
|
2238
2238
|
};
|
|
2239
|
-
throw
|
|
2239
|
+
throw d(t);
|
|
2240
2240
|
} catch (t) {
|
|
2241
|
-
throw
|
|
2241
|
+
throw d(t);
|
|
2242
2242
|
}
|
|
2243
2243
|
}
|
|
2244
2244
|
async fetchCollectionAssets(e, t = "") {
|
|
@@ -2246,25 +2246,25 @@ class xr {
|
|
|
2246
2246
|
const { data: r, status: a } = await this._axiosInstance.get(`policies/${e}/assets?size=100&cursor=${t}`);
|
|
2247
2247
|
if (a === 200)
|
|
2248
2248
|
return {
|
|
2249
|
-
assets: r.data.map((
|
|
2250
|
-
unit: `${
|
|
2251
|
-
quantity:
|
|
2249
|
+
assets: r.data.map((n) => ({
|
|
2250
|
+
unit: `${n.policy_id}${n.asset_name}`,
|
|
2251
|
+
quantity: n.quantity
|
|
2252
2252
|
})),
|
|
2253
2253
|
next: r.cursor
|
|
2254
2254
|
};
|
|
2255
|
-
throw
|
|
2255
|
+
throw d(r);
|
|
2256
2256
|
} catch {
|
|
2257
2257
|
return { assets: [], next: null };
|
|
2258
2258
|
}
|
|
2259
2259
|
}
|
|
2260
2260
|
async fetchHandleAddress(e) {
|
|
2261
2261
|
try {
|
|
2262
|
-
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`assets/${
|
|
2262
|
+
const t = S(e.replace("$", "")), { data: r, status: a } = await this._axiosInstance.get(`assets/${Mt[1]}${t}/addresses`);
|
|
2263
2263
|
if (a === 200)
|
|
2264
2264
|
return r.data[0].address;
|
|
2265
|
-
throw
|
|
2265
|
+
throw d(r);
|
|
2266
2266
|
} catch (t) {
|
|
2267
|
-
throw
|
|
2267
|
+
throw d(t);
|
|
2268
2268
|
}
|
|
2269
2269
|
}
|
|
2270
2270
|
async fetchProtocolParameters(e) {
|
|
@@ -2293,9 +2293,9 @@ class xr {
|
|
|
2293
2293
|
priceMem: t.price_mem,
|
|
2294
2294
|
priceStep: t.price_step
|
|
2295
2295
|
};
|
|
2296
|
-
throw
|
|
2296
|
+
throw d(t);
|
|
2297
2297
|
} catch (t) {
|
|
2298
|
-
throw
|
|
2298
|
+
throw d(t);
|
|
2299
2299
|
}
|
|
2300
2300
|
}
|
|
2301
2301
|
async fetchTxInfo(e) {
|
|
@@ -2313,17 +2313,17 @@ class xr {
|
|
|
2313
2313
|
slot: t.block.slot_no.toString(),
|
|
2314
2314
|
size: t.size
|
|
2315
2315
|
};
|
|
2316
|
-
throw
|
|
2316
|
+
throw d(t);
|
|
2317
2317
|
} catch (t) {
|
|
2318
|
-
throw
|
|
2318
|
+
throw d(t);
|
|
2319
2319
|
}
|
|
2320
2320
|
}
|
|
2321
2321
|
onTxConfirmed(e, t, r = 100) {
|
|
2322
2322
|
let a = 0;
|
|
2323
|
-
const
|
|
2324
|
-
a >= r && clearInterval(
|
|
2323
|
+
const n = setInterval(() => {
|
|
2324
|
+
a >= r && clearInterval(n), this.fetchTxInfo(e).then((o) => {
|
|
2325
2325
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
2326
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
2326
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(n), t());
|
|
2327
2327
|
}).catch(() => {
|
|
2328
2328
|
a += 1;
|
|
2329
2329
|
});
|
|
@@ -2337,67 +2337,317 @@ class xr {
|
|
|
2337
2337
|
const t = { "Content-Type": "application/json" }, { data: r, status: a } = await this._axiosInstance.post("transactions/submit", { tx: e }, { headers: t });
|
|
2338
2338
|
if (a === 200)
|
|
2339
2339
|
return r.tx_id;
|
|
2340
|
-
throw
|
|
2340
|
+
throw d(r);
|
|
2341
2341
|
} catch (t) {
|
|
2342
|
-
throw
|
|
2342
|
+
throw d(t);
|
|
2343
2343
|
}
|
|
2344
2344
|
}
|
|
2345
2345
|
}
|
|
2346
2346
|
class Sr {
|
|
2347
|
+
_axiosInstance;
|
|
2348
|
+
submitUrl;
|
|
2349
|
+
constructor({ network: e, apiKey: t, turboSubmit: r = !1 }) {
|
|
2350
|
+
this._axiosInstance = L.create({
|
|
2351
|
+
baseURL: `https://${e}.gomaestro-api.org/v1`,
|
|
2352
|
+
headers: { "api-key": t }
|
|
2353
|
+
}), this.submitUrl = r ? "txmanager" : "txmanager/turbosubmit";
|
|
2354
|
+
}
|
|
2355
|
+
async fetchAccountInfo(e) {
|
|
2356
|
+
const t = e.startsWith("addr") ? kt(e) : e;
|
|
2357
|
+
try {
|
|
2358
|
+
const { data: r, status: a } = await this._axiosInstance.get(`accounts/${t}`);
|
|
2359
|
+
if (a === 200) {
|
|
2360
|
+
const n = r.data;
|
|
2361
|
+
return {
|
|
2362
|
+
poolId: n.delegated_pool,
|
|
2363
|
+
active: n.registered,
|
|
2364
|
+
balance: n.total_balance.toString(),
|
|
2365
|
+
rewards: n.rewards_available.toString(),
|
|
2366
|
+
withdrawals: n.total_withdrawn.toString()
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
throw d(r);
|
|
2370
|
+
} catch (r) {
|
|
2371
|
+
throw d(r);
|
|
2372
|
+
}
|
|
2373
|
+
}
|
|
2374
|
+
async fetchAddressUTxOs(e, t) {
|
|
2375
|
+
const r = (() => e.startsWith("addr_vkh") || e.startsWith("addr_shared_vkh") ? `addresses/cred/${e}` : `addresses/${e}`)(), a = t ? `&asset=${t}` : "", n = (u) => {
|
|
2376
|
+
if (u.reference_script) {
|
|
2377
|
+
const A = u.reference_script.type === "native" ? u.reference_script.json : {
|
|
2378
|
+
code: u.reference_script.bytes,
|
|
2379
|
+
version: u.reference_script.type.replace("plutusv", "V")
|
|
2380
|
+
};
|
|
2381
|
+
return ct(A).to_hex();
|
|
2382
|
+
} else
|
|
2383
|
+
return;
|
|
2384
|
+
}, o = async (u = null, A = []) => {
|
|
2385
|
+
const l = u === null ? "" : `&cursor=${u}`, { data: g, status: I } = await this._axiosInstance.get(`${r}/utxos?count=100${a}${l}`);
|
|
2386
|
+
if (I === 200) {
|
|
2387
|
+
const y = g.data.map(c), b = [...A, ...y], k = g.next_cursor;
|
|
2388
|
+
return k == null ? b : o(k, b);
|
|
2389
|
+
}
|
|
2390
|
+
throw d(g);
|
|
2391
|
+
}, c = (u) => {
|
|
2392
|
+
var A, l;
|
|
2393
|
+
return {
|
|
2394
|
+
input: {
|
|
2395
|
+
outputIndex: u.index,
|
|
2396
|
+
txHash: u.tx_hash
|
|
2397
|
+
},
|
|
2398
|
+
output: {
|
|
2399
|
+
address: e,
|
|
2400
|
+
amount: u.assets.map((g) => ({
|
|
2401
|
+
unit: g.unit,
|
|
2402
|
+
quantity: g.amount.toString()
|
|
2403
|
+
})),
|
|
2404
|
+
dataHash: (A = u.datum) == null ? void 0 : A.hash,
|
|
2405
|
+
plutusData: (l = u.datum) == null ? void 0 : l.bytes,
|
|
2406
|
+
scriptRef: n(u)
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2409
|
+
};
|
|
2410
|
+
try {
|
|
2411
|
+
return await o();
|
|
2412
|
+
} catch {
|
|
2413
|
+
return [];
|
|
2414
|
+
}
|
|
2415
|
+
}
|
|
2416
|
+
async fetchAssetAddresses(e) {
|
|
2417
|
+
const { policyId: t, assetName: r } = X(e), a = async (n = null, o = []) => {
|
|
2418
|
+
const c = n === null ? "" : `&cursor=${n}`, { data: u, status: A } = await this._axiosInstance.get(`assets/${t}${r}/addresses?count=100${c}`);
|
|
2419
|
+
if (A === 200) {
|
|
2420
|
+
const g = u.data.map((y) => ({ address: y.address, quantity: y.amount.toString() })), I = u.next_cursor, f = [...o, ...g];
|
|
2421
|
+
return I == null ? f : a(I, f);
|
|
2422
|
+
}
|
|
2423
|
+
throw d(u);
|
|
2424
|
+
};
|
|
2425
|
+
try {
|
|
2426
|
+
return await a();
|
|
2427
|
+
} catch {
|
|
2428
|
+
return [];
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
async fetchAssetMetadata(e) {
|
|
2432
|
+
try {
|
|
2433
|
+
const { policyId: t, assetName: r } = X(e), { data: a, status: n } = await this._axiosInstance.get(`assets/${t}${r}`);
|
|
2434
|
+
if (n === 200) {
|
|
2435
|
+
const o = a.data;
|
|
2436
|
+
return {
|
|
2437
|
+
...o.asset_standards.cip25_metadata,
|
|
2438
|
+
...o.asset_standards.cip68_metadata
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
throw d(a);
|
|
2442
|
+
} catch (t) {
|
|
2443
|
+
throw d(t);
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
async fetchBlockInfo(e) {
|
|
2447
|
+
var t;
|
|
2448
|
+
try {
|
|
2449
|
+
const { data: r, status: a } = await this._axiosInstance.get(`blocks/${e}`);
|
|
2450
|
+
if (a === 200) {
|
|
2451
|
+
const n = r.data;
|
|
2452
|
+
return {
|
|
2453
|
+
confirmations: n.confirmations,
|
|
2454
|
+
epoch: n.epoch,
|
|
2455
|
+
epochSlot: n.epoch_slot.toString(),
|
|
2456
|
+
fees: n.total_fees.toString(),
|
|
2457
|
+
hash: n.hash,
|
|
2458
|
+
nextBlock: n.next_block ?? "",
|
|
2459
|
+
operationalCertificate: (t = n.operational_certificate) == null ? void 0 : t.hot_vkey,
|
|
2460
|
+
output: n.total_output_lovelace ?? "0",
|
|
2461
|
+
previousBlock: n.previous_block,
|
|
2462
|
+
size: n.size,
|
|
2463
|
+
slot: n.absolute_slot.toString(),
|
|
2464
|
+
slotLeader: n.block_producer ?? "",
|
|
2465
|
+
time: Date.parse(n.timestamp) / 1e3,
|
|
2466
|
+
txCount: n.tx_hashes.length,
|
|
2467
|
+
VRFKey: i.VRFVKey.from_hex(n.vrf_key).to_bech32("vrf_vk")
|
|
2468
|
+
};
|
|
2469
|
+
}
|
|
2470
|
+
throw d(r);
|
|
2471
|
+
} catch (r) {
|
|
2472
|
+
throw d(r);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
async fetchCollectionAssets(e, t) {
|
|
2476
|
+
try {
|
|
2477
|
+
const { data: r, status: a } = await this._axiosInstance.get(`assets/policy/${e}?count=100${t ? `&cursor=${t}` : ""}`);
|
|
2478
|
+
if (console.log(r), a === 200)
|
|
2479
|
+
return {
|
|
2480
|
+
assets: r.data.map((o) => ({
|
|
2481
|
+
unit: e + o.asset_name,
|
|
2482
|
+
quantity: o.total_supply.toString()
|
|
2483
|
+
})),
|
|
2484
|
+
next: r.next_cursor
|
|
2485
|
+
};
|
|
2486
|
+
throw d(r);
|
|
2487
|
+
} catch {
|
|
2488
|
+
return { assets: [], next: null };
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
async fetchHandleAddress(e) {
|
|
2492
|
+
try {
|
|
2493
|
+
const t = e.charAt(0) === "$" ? e.substring(1) : e, { data: r, status: a } = await this._axiosInstance.get(`ecosystem/adahandle/${t}`);
|
|
2494
|
+
if (a === 200)
|
|
2495
|
+
return r.data;
|
|
2496
|
+
throw d(r);
|
|
2497
|
+
} catch (t) {
|
|
2498
|
+
throw d(t);
|
|
2499
|
+
}
|
|
2500
|
+
}
|
|
2501
|
+
async fetchProtocolParameters(e = Number.NaN) {
|
|
2502
|
+
if (!isNaN(e))
|
|
2503
|
+
throw new Error("Maestro only supports fetching Protocol parameters of the latest completed epoch.");
|
|
2504
|
+
const t = (r) => {
|
|
2505
|
+
const a = r.indexOf("/");
|
|
2506
|
+
return parseInt(r.slice(0, a)) / parseInt(r.slice(a + 1));
|
|
2507
|
+
};
|
|
2508
|
+
try {
|
|
2509
|
+
const { data: r, status: a } = await this._axiosInstance.get("protocol-params");
|
|
2510
|
+
if (a === 200) {
|
|
2511
|
+
const n = r.data;
|
|
2512
|
+
try {
|
|
2513
|
+
const { data: o, status: c } = await this._axiosInstance.get("epochs/current");
|
|
2514
|
+
if (c === 200) {
|
|
2515
|
+
const u = o.data;
|
|
2516
|
+
return {
|
|
2517
|
+
coinsPerUTxOSize: n.coins_per_utxo_byte.toString(),
|
|
2518
|
+
collateralPercent: parseInt(n.collateral_percentage),
|
|
2519
|
+
decentralisation: 0,
|
|
2520
|
+
epoch: parseInt(u.epoch_no),
|
|
2521
|
+
keyDeposit: n.stake_key_deposit.toString(),
|
|
2522
|
+
maxBlockExMem: n.max_execution_units_per_block.memory.toString(),
|
|
2523
|
+
maxBlockExSteps: n.max_execution_units_per_block.steps.toString(),
|
|
2524
|
+
maxBlockHeaderSize: parseInt(n.max_block_header_size),
|
|
2525
|
+
maxBlockSize: parseInt(n.max_block_body_size),
|
|
2526
|
+
maxCollateralInputs: parseInt(n.max_collateral_inputs),
|
|
2527
|
+
maxTxExMem: n.max_execution_units_per_transaction.memory.toString(),
|
|
2528
|
+
maxTxExSteps: n.max_execution_units_per_transaction.steps.toString(),
|
|
2529
|
+
maxTxSize: parseInt(n.max_tx_size),
|
|
2530
|
+
maxValSize: n.max_value_size.toString(),
|
|
2531
|
+
minFeeA: n.min_fee_coefficient,
|
|
2532
|
+
minFeeB: n.min_fee_constant,
|
|
2533
|
+
minPoolCost: n.min_pool_cost.toString(),
|
|
2534
|
+
poolDeposit: n.pool_deposit.toString(),
|
|
2535
|
+
priceMem: t(n.prices.memory),
|
|
2536
|
+
priceStep: t(n.prices.steps)
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
throw d(o);
|
|
2540
|
+
} catch (o) {
|
|
2541
|
+
throw d(o);
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
throw d(r);
|
|
2545
|
+
} catch (r) {
|
|
2546
|
+
throw d(r);
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
async fetchTxInfo(e) {
|
|
2550
|
+
try {
|
|
2551
|
+
const { data: t, status: r } = await this._axiosInstance.get(`transactions/${e}`);
|
|
2552
|
+
if (r === 200) {
|
|
2553
|
+
const a = t.data;
|
|
2554
|
+
return {
|
|
2555
|
+
block: a.block_hash,
|
|
2556
|
+
deposit: a.deposit.toString(),
|
|
2557
|
+
fees: a.fee.toString(),
|
|
2558
|
+
hash: a.tx_hash,
|
|
2559
|
+
index: a.block_tx_index,
|
|
2560
|
+
invalidAfter: a.invalid_hereafter ?? "",
|
|
2561
|
+
invalidBefore: a.invalid_before ?? "",
|
|
2562
|
+
slot: a.block_absolute_slot.toString(),
|
|
2563
|
+
size: a.size - 1
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
throw d(t);
|
|
2567
|
+
} catch (t) {
|
|
2568
|
+
throw d(t);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
onTxConfirmed(e, t, r = 100) {
|
|
2572
|
+
let a = 0;
|
|
2573
|
+
const n = setInterval(() => {
|
|
2574
|
+
a >= r && clearInterval(n), this.fetchTxInfo(e).then((o) => {
|
|
2575
|
+
this.fetchBlockInfo(o.block).then((c) => {
|
|
2576
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(n), t());
|
|
2577
|
+
}).catch(() => {
|
|
2578
|
+
a += 1;
|
|
2579
|
+
});
|
|
2580
|
+
}).catch(() => {
|
|
2581
|
+
a += 1;
|
|
2582
|
+
});
|
|
2583
|
+
}, 5e3);
|
|
2584
|
+
}
|
|
2585
|
+
async submitTx(e) {
|
|
2586
|
+
try {
|
|
2587
|
+
const t = { "Content-Type": "application/cbor" }, { data: r, status: a } = await this._axiosInstance.post(this.submitUrl, m(e), { headers: t });
|
|
2588
|
+
if (a === 202)
|
|
2589
|
+
return r;
|
|
2590
|
+
throw d(r);
|
|
2591
|
+
} catch (t) {
|
|
2592
|
+
throw d(t);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
class Qr {
|
|
2347
2597
|
static withOneSignature(e) {
|
|
2348
|
-
const t =
|
|
2598
|
+
const t = T(rt(e));
|
|
2349
2599
|
return ft(t).to_hex();
|
|
2350
2600
|
}
|
|
2351
2601
|
static withAtLeastNSignatures(e, t) {
|
|
2352
|
-
const r =
|
|
2353
|
-
e.forEach((
|
|
2354
|
-
const o =
|
|
2602
|
+
const r = i.NativeScripts.new();
|
|
2603
|
+
e.forEach((n) => {
|
|
2604
|
+
const o = T(rt(n));
|
|
2355
2605
|
r.add(ft(o));
|
|
2356
2606
|
});
|
|
2357
|
-
const a =
|
|
2358
|
-
return
|
|
2607
|
+
const a = i.ScriptNOfK.new(t, r);
|
|
2608
|
+
return i.NativeScript.new_script_any(a).to_hex();
|
|
2359
2609
|
}
|
|
2360
2610
|
static withAnySignature(e) {
|
|
2361
|
-
const t =
|
|
2611
|
+
const t = i.NativeScripts.new();
|
|
2362
2612
|
e.forEach((a) => {
|
|
2363
|
-
const
|
|
2364
|
-
t.add(ft(
|
|
2613
|
+
const n = T(rt(a));
|
|
2614
|
+
t.add(ft(n));
|
|
2365
2615
|
});
|
|
2366
|
-
const r =
|
|
2367
|
-
return
|
|
2616
|
+
const r = i.ScriptAny.new(t);
|
|
2617
|
+
return i.NativeScript.new_script_any(r).to_hex();
|
|
2368
2618
|
}
|
|
2369
2619
|
static withAllSignatures(e) {
|
|
2370
|
-
const t =
|
|
2620
|
+
const t = i.NativeScripts.new();
|
|
2371
2621
|
e.forEach((a) => {
|
|
2372
|
-
const
|
|
2373
|
-
t.add(ft(
|
|
2622
|
+
const n = T(rt(a));
|
|
2623
|
+
t.add(ft(n));
|
|
2374
2624
|
});
|
|
2375
|
-
const r =
|
|
2376
|
-
return
|
|
2625
|
+
const r = i.ScriptAll.new(t);
|
|
2626
|
+
return i.NativeScript.new_script_any(r).to_hex();
|
|
2377
2627
|
}
|
|
2378
2628
|
static fromNativeScript(e) {
|
|
2379
2629
|
return vt(e).to_hex();
|
|
2380
2630
|
}
|
|
2381
2631
|
}
|
|
2382
|
-
function
|
|
2383
|
-
var a = arguments.length,
|
|
2632
|
+
function Z(s, e, t, r) {
|
|
2633
|
+
var a = arguments.length, n = a < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, t) : r, o;
|
|
2384
2634
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
2385
|
-
|
|
2635
|
+
n = Reflect.decorate(s, e, t, r);
|
|
2386
2636
|
else
|
|
2387
2637
|
for (var c = s.length - 1; c >= 0; c--)
|
|
2388
|
-
(o = s[c]) && (
|
|
2389
|
-
return a > 3 &&
|
|
2638
|
+
(o = s[c]) && (n = (a < 3 ? o(n) : a > 3 ? o(e, t, n) : o(e, t)) || n);
|
|
2639
|
+
return a > 3 && n && Object.defineProperty(e, t, n), n;
|
|
2390
2640
|
}
|
|
2391
2641
|
const Xs = (s) => class extends s {
|
|
2392
2642
|
__visits = [];
|
|
2393
|
-
},
|
|
2643
|
+
}, et = () => function(s, e, t) {
|
|
2394
2644
|
const r = t.value;
|
|
2395
2645
|
t.value = function(...a) {
|
|
2396
|
-
const
|
|
2397
|
-
return this.__visits && this.__visits.push(e),
|
|
2646
|
+
const n = r.call(this, ...a);
|
|
2647
|
+
return this.__visits && this.__visits.push(e), n;
|
|
2398
2648
|
};
|
|
2399
2649
|
};
|
|
2400
|
-
let
|
|
2650
|
+
let $ = class {
|
|
2401
2651
|
_changeAddress;
|
|
2402
2652
|
_txOutputs = /* @__PURE__ */ new Map();
|
|
2403
2653
|
_recipients = /* @__PURE__ */ new Map();
|
|
@@ -2412,29 +2662,29 @@ let L = class {
|
|
|
2412
2662
|
_txInputsBuilder;
|
|
2413
2663
|
_txWithdrawals;
|
|
2414
2664
|
constructor(e = {}) {
|
|
2415
|
-
this._era = e.era, this._initiator = e.initiator, this._mintBuilder =
|
|
2665
|
+
this._era = e.era, this._initiator = e.initiator, this._mintBuilder = i.MintBuilder.new(), this._protocolParameters = e.parameters ?? G, this._txBuilder = Ws(e.parameters), this._txCertificates = i.Certificates.new(), this._txInputsBuilder = i.TxInputsBuilder.new(), this._txWithdrawals = i.Withdrawals.new();
|
|
2416
2666
|
}
|
|
2417
2667
|
static maskMetadata(e, t = "BABBAGE") {
|
|
2418
|
-
var
|
|
2419
|
-
const r =
|
|
2668
|
+
var n;
|
|
2669
|
+
const r = q(e), a = (n = r.auxiliary_data()) == null ? void 0 : n.metadata();
|
|
2420
2670
|
if (a !== void 0) {
|
|
2421
|
-
const o =
|
|
2671
|
+
const o = i.GeneralTransactionMetadata.new();
|
|
2422
2672
|
for (let u = 0; u < a.len(); u += 1) {
|
|
2423
|
-
const A = a.keys().get(u),
|
|
2424
|
-
o.insert(A,
|
|
2673
|
+
const A = a.keys().get(u), l = a.get(A);
|
|
2674
|
+
o.insert(A, i.TransactionMetadatum.from_hex("0".repeat(((l == null ? void 0 : l.to_hex()) ?? "").length)));
|
|
2425
2675
|
}
|
|
2426
2676
|
const c = r.auxiliary_data();
|
|
2427
|
-
return c !== void 0 && (c.set_metadata(o), c.set_prefer_alonzo_format(t === "ALONZO")),
|
|
2677
|
+
return c !== void 0 && (c.set_metadata(o), c.set_prefer_alonzo_format(t === "ALONZO")), i.Transaction.new(r.body(), r.witness_set(), c).to_hex();
|
|
2428
2678
|
}
|
|
2429
2679
|
return e;
|
|
2430
2680
|
}
|
|
2431
2681
|
static readMetadata(e) {
|
|
2432
2682
|
var r, a;
|
|
2433
|
-
return ((a = (r =
|
|
2683
|
+
return ((a = (r = q(e).auxiliary_data()) == null ? void 0 : r.metadata()) == null ? void 0 : a.to_hex()) ?? "";
|
|
2434
2684
|
}
|
|
2435
2685
|
static writeMetadata(e, t, r = "BABBAGE") {
|
|
2436
|
-
const a =
|
|
2437
|
-
return
|
|
2686
|
+
const a = q(e), n = a.auxiliary_data() ?? i.AuxiliaryData.new();
|
|
2687
|
+
return n.set_metadata(i.GeneralTransactionMetadata.from_hex(t)), n.set_prefer_alonzo_format(r === "ALONZO"), i.Transaction.new(a.body(), a.witness_set(), n).to_hex();
|
|
2438
2688
|
}
|
|
2439
2689
|
get size() {
|
|
2440
2690
|
return this._txBuilder.full_size();
|
|
@@ -2447,39 +2697,39 @@ let L = class {
|
|
|
2447
2697
|
}
|
|
2448
2698
|
}
|
|
2449
2699
|
burnAsset(e, t, r) {
|
|
2450
|
-
const a = this._totalBurns.has(t.unit) ?
|
|
2451
|
-
return this._mintBuilder.add_asset(fe(e, r),
|
|
2700
|
+
const a = this._totalBurns.has(t.unit) ? i.BigNum.from_str(this._totalBurns.get(t.unit) ?? "0").checked_add(i.BigNum.from_str(t.quantity)).to_str() : t.quantity;
|
|
2701
|
+
return this._mintBuilder.add_asset(fe(e, r), i.AssetName.new(m(t.unit.slice(M))), i.Int.new_negative(i.BigNum.from_str(t.quantity))), this._totalBurns.set(t.unit, a), this;
|
|
2452
2702
|
}
|
|
2453
2703
|
delegateStake(e, t) {
|
|
2454
|
-
const r =
|
|
2704
|
+
const r = i.Certificate.new_stake_delegation(i.StakeDelegation.new(i.StakeCredential.from_keyhash(T(dt(e))), i.Ed25519KeyHash.from_bech32(t)));
|
|
2455
2705
|
return this._txCertificates.add(r), this;
|
|
2456
2706
|
}
|
|
2457
2707
|
deregisterStake(e) {
|
|
2458
|
-
const t =
|
|
2708
|
+
const t = i.Certificate.new_stake_deregistration(i.StakeDeregistration.new(i.StakeCredential.from_keyhash(T(dt(e)))));
|
|
2459
2709
|
return this._txCertificates.add(t), this;
|
|
2460
2710
|
}
|
|
2461
2711
|
mintAsset(e, t, r) {
|
|
2462
|
-
var A,
|
|
2712
|
+
var A, l;
|
|
2463
2713
|
const a = (g, I) => {
|
|
2464
|
-
const
|
|
2714
|
+
const f = typeof g == "string" ? bt(g).hash().to_hex() : n(g).hash().to_hex(), y = S(I.assetName);
|
|
2465
2715
|
return {
|
|
2466
|
-
unit: `${
|
|
2716
|
+
unit: `${f}${y}`,
|
|
2467
2717
|
quantity: I.assetQuantity
|
|
2468
2718
|
};
|
|
2469
|
-
},
|
|
2719
|
+
}, n = (g) => {
|
|
2470
2720
|
if ("code" in g)
|
|
2471
|
-
return
|
|
2472
|
-
const I =
|
|
2721
|
+
return ot(g.code, g.version);
|
|
2722
|
+
const I = F(g);
|
|
2473
2723
|
if (I.output().has_script_ref()) {
|
|
2474
|
-
const
|
|
2475
|
-
if (
|
|
2476
|
-
const
|
|
2477
|
-
return
|
|
2724
|
+
const f = I.output().script_ref();
|
|
2725
|
+
if (f.is_plutus_script()) {
|
|
2726
|
+
const y = Oe(f);
|
|
2727
|
+
return ot(y.code, y.version);
|
|
2478
2728
|
}
|
|
2479
2729
|
}
|
|
2480
2730
|
throw new Error(`No plutus script reference found in UTxO: ${I.input().transaction_id().to_hex()}`);
|
|
2481
|
-
}, o = a(e, t), u =
|
|
2482
|
-
return this._mintBuilder.add_asset(fe(e, r),
|
|
2731
|
+
}, o = a(e, t), u = i.BigNum.from_str(((A = this._totalMints.get(o.unit)) == null ? void 0 : A.assetQuantity) ?? "0").checked_add(i.BigNum.from_str(o.quantity));
|
|
2732
|
+
return this._mintBuilder.add_asset(fe(e, r), i.AssetName.new(m(S(t.assetName))), i.Int.new(i.BigNum.from_str(o.quantity))), this._recipients.has(t.recipient) ? (l = this._recipients.get(t.recipient)) == null || l.push(o) : this._recipients.set(t.recipient, [o]), this._totalMints.set(o.unit, {
|
|
2483
2733
|
...t,
|
|
2484
2734
|
assetQuantity: u.to_str()
|
|
2485
2735
|
}), this;
|
|
@@ -2487,39 +2737,39 @@ let L = class {
|
|
|
2487
2737
|
redeemValue(e) {
|
|
2488
2738
|
const t = {
|
|
2489
2739
|
tag: "SPEND",
|
|
2490
|
-
budget:
|
|
2740
|
+
budget: xe,
|
|
2491
2741
|
index: this._txInputsBuilder.inputs().len(),
|
|
2492
2742
|
data: {
|
|
2493
2743
|
alternative: 0,
|
|
2494
2744
|
fields: []
|
|
2495
2745
|
},
|
|
2496
2746
|
...e.redeemer
|
|
2497
|
-
}, r =
|
|
2747
|
+
}, r = F(e.value), a = i.PlutusWitness.new_with_ref(qe(e.script), zs(e.datum), He(t));
|
|
2498
2748
|
return this._txInputsBuilder.add_plutus_script_input(a, r.input(), r.output().amount()), this;
|
|
2499
2749
|
}
|
|
2500
2750
|
registerStake(e) {
|
|
2501
|
-
const t =
|
|
2751
|
+
const t = i.Certificate.new_stake_registration(i.StakeRegistration.new(i.StakeCredential.from_keyhash(T(dt(e)))));
|
|
2502
2752
|
return this._txCertificates.add(t), this;
|
|
2503
2753
|
}
|
|
2504
2754
|
registerPool(e) {
|
|
2505
|
-
const t =
|
|
2755
|
+
const t = i.Certificate.new_pool_registration(i.PoolRegistration.new(Rs(e)));
|
|
2506
2756
|
return this._txCertificates.add(t), this;
|
|
2507
2757
|
}
|
|
2508
2758
|
retirePool(e, t) {
|
|
2509
|
-
const r =
|
|
2759
|
+
const r = i.Certificate.new_pool_retirement(i.PoolRetirement.new(i.Ed25519KeyHash.from_bech32(e), t));
|
|
2510
2760
|
return this._txCertificates.add(r), this;
|
|
2511
2761
|
}
|
|
2512
2762
|
sendAssets(e, t) {
|
|
2513
2763
|
const r = Bt(t), a = r.multiasset();
|
|
2514
2764
|
if (r.is_zero() || a === void 0)
|
|
2515
2765
|
return this;
|
|
2516
|
-
const
|
|
2766
|
+
const n = _t(e).next(), o = r.coin().is_zero() ? n.with_asset_and_min_required_coin_by_utxo_cost(a, me(this._protocolParameters.coinsPerUTxOSize)).build() : n.with_coin_and_asset(r.coin(), a).build();
|
|
2517
2767
|
return t.forEach((c) => {
|
|
2518
2768
|
this.setTxOutput(c);
|
|
2519
2769
|
}), this._txBuilder.add_output(o), this;
|
|
2520
2770
|
}
|
|
2521
2771
|
sendLovelace(e, t) {
|
|
2522
|
-
const a = _t(e).next().with_coin(
|
|
2772
|
+
const a = _t(e).next().with_coin(i.BigNum.from_str(t)).build();
|
|
2523
2773
|
return this.setTxOutput({
|
|
2524
2774
|
unit: "lovelace",
|
|
2525
2775
|
quantity: t
|
|
@@ -2532,50 +2782,50 @@ let L = class {
|
|
|
2532
2782
|
}]), this;
|
|
2533
2783
|
}
|
|
2534
2784
|
sendValue(e, t) {
|
|
2535
|
-
const r = Bt(t.output.amount),
|
|
2785
|
+
const r = Bt(t.output.amount), n = _t(e).next().with_value(r).build();
|
|
2536
2786
|
return t.output.amount.forEach((o) => {
|
|
2537
2787
|
this.setTxOutput(o);
|
|
2538
|
-
}), this._txBuilder.add_output(
|
|
2788
|
+
}), this._txBuilder.add_output(n), this;
|
|
2539
2789
|
}
|
|
2540
2790
|
setChangeAddress(e) {
|
|
2541
|
-
return this._changeAddress =
|
|
2791
|
+
return this._changeAddress = H(e), this;
|
|
2542
2792
|
}
|
|
2543
2793
|
setCollateral(e) {
|
|
2544
2794
|
const t = _e(e);
|
|
2545
2795
|
return this._txBuilder.set_collateral(t), this;
|
|
2546
2796
|
}
|
|
2547
2797
|
setMetadata(e, t) {
|
|
2548
|
-
return this._txBuilder.add_json_metadatum_with_schema(
|
|
2798
|
+
return this._txBuilder.add_json_metadatum_with_schema(i.BigNum.from_str(e.toString()), JSON.stringify(t), i.MetadataJsonSchema.NoConversions), this;
|
|
2549
2799
|
}
|
|
2550
2800
|
setRequiredSigners(e) {
|
|
2551
|
-
return Array.from(new Set(e.map((r) => r.startsWith("addr") ?
|
|
2801
|
+
return Array.from(new Set(e.map((r) => r.startsWith("addr") ? rt(r) : dt(r)).map((r) => T(r)))).forEach((r) => {
|
|
2552
2802
|
this._txBuilder.add_required_signer(r);
|
|
2553
2803
|
}), this;
|
|
2554
2804
|
}
|
|
2555
2805
|
setTimeToStart(e) {
|
|
2556
|
-
return this._txBuilder.set_validity_start_interval_bignum(
|
|
2806
|
+
return this._txBuilder.set_validity_start_interval_bignum(i.BigNum.from_str(e)), this;
|
|
2557
2807
|
}
|
|
2558
2808
|
setTimeToExpire(e) {
|
|
2559
|
-
return this._txBuilder.set_ttl_bignum(
|
|
2809
|
+
return this._txBuilder.set_ttl_bignum(i.BigNum.from_str(e)), this;
|
|
2560
2810
|
}
|
|
2561
2811
|
setTxInputs(e) {
|
|
2562
|
-
return e.map((t) =>
|
|
2812
|
+
return e.map((t) => F(t)).forEach((t) => {
|
|
2563
2813
|
this._txInputsBuilder.add_input(t.output().address(), t.input(), t.output().amount());
|
|
2564
2814
|
}), this;
|
|
2565
2815
|
}
|
|
2566
2816
|
setTxRefInputs(e) {
|
|
2567
|
-
return e.map((t) =>
|
|
2817
|
+
return e.map((t) => F(t)).forEach((t) => {
|
|
2568
2818
|
this._txBuilder.add_reference_input(t.input());
|
|
2569
2819
|
}), this;
|
|
2570
2820
|
}
|
|
2571
2821
|
withdrawRewards(e, t) {
|
|
2572
2822
|
const r = Me(e);
|
|
2573
|
-
return r !== void 0 && this._txWithdrawals.insert(r,
|
|
2823
|
+
return r !== void 0 && this._txWithdrawals.insert(r, i.BigNum.from_str(t)), this;
|
|
2574
2824
|
}
|
|
2575
2825
|
async addBurnInputsIfNeeded() {
|
|
2576
2826
|
if (this._initiator && this._totalBurns.size > 0 && this.notVisited("setTxInputs")) {
|
|
2577
2827
|
const e = await this._initiator.getUsedUTxOs();
|
|
2578
|
-
is(this._totalBurns, e.map((r) => Qt(r))).map((r) =>
|
|
2828
|
+
is(this._totalBurns, e.map((r) => Qt(r))).map((r) => F(r)).forEach((r) => {
|
|
2579
2829
|
this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
|
|
2580
2830
|
});
|
|
2581
2831
|
}
|
|
@@ -2595,30 +2845,30 @@ let L = class {
|
|
|
2595
2845
|
}
|
|
2596
2846
|
async addRequiredSignersIfNeeded() {
|
|
2597
2847
|
if (this._initiator && this.notVisited("setRequiredSigners")) {
|
|
2598
|
-
const e = await this._initiator.getUsedAddress(), t =
|
|
2599
|
-
this._txBuilder.add_required_signer(
|
|
2848
|
+
const e = await this._initiator.getUsedAddress(), t = rt(e.to_bech32());
|
|
2849
|
+
this._txBuilder.add_required_signer(T(t));
|
|
2600
2850
|
}
|
|
2601
2851
|
}
|
|
2602
2852
|
async addTxInputsAsNeeded() {
|
|
2603
2853
|
if (this.notVisited("setTxInputs")) {
|
|
2604
2854
|
const e = await this.filterAvailableUTxOs();
|
|
2605
|
-
ns(this._txOutputs, e.map((r) => Qt(r))).map((r) =>
|
|
2855
|
+
ns(this._txOutputs, e.map((r) => Qt(r))).map((r) => F(r)).forEach((r) => {
|
|
2606
2856
|
this._txInputsBuilder.add_input(r.output().address(), r.input(), r.output().amount());
|
|
2607
2857
|
});
|
|
2608
2858
|
}
|
|
2609
2859
|
if (this._txBuilder.set_inputs(this._txInputsBuilder), (this._mintBuilder.has_native_scripts() || this._mintBuilder.has_plutus_scripts()) && this._txBuilder.set_mint_builder(this._mintBuilder), this._txCertificates.len() > 0 && this._txBuilder.set_certs(this._txCertificates), this._txWithdrawals.len() > 0 && this._txBuilder.set_withdrawals(this._txWithdrawals), this._txBuilder.get_mint_builder() || this.notVisited("redeemValue") === !1) {
|
|
2610
|
-
const e = this._era !== void 0 ?
|
|
2860
|
+
const e = this._era !== void 0 ? Jt[this._era] : Jt.BABBAGE;
|
|
2611
2861
|
this._txBuilder.calc_script_data_hash(e);
|
|
2612
2862
|
}
|
|
2613
2863
|
}
|
|
2614
2864
|
async forgeAssetsIfNeeded() {
|
|
2615
2865
|
const e = (t, r) => {
|
|
2616
|
-
const a = t.data.assetName,
|
|
2866
|
+
const a = t.data.assetName, n = t.data.metadata, o = t.unit.slice(0, M);
|
|
2617
2867
|
if (t.data.label === "777")
|
|
2618
|
-
return
|
|
2868
|
+
return n;
|
|
2619
2869
|
if (r && r[o]) {
|
|
2620
2870
|
const { [o]: c, ...u } = r, A = {
|
|
2621
|
-
[a]:
|
|
2871
|
+
[a]: n,
|
|
2622
2872
|
...c
|
|
2623
2873
|
};
|
|
2624
2874
|
return {
|
|
@@ -2630,18 +2880,18 @@ let L = class {
|
|
|
2630
2880
|
}
|
|
2631
2881
|
return r !== void 0 ? {
|
|
2632
2882
|
[o]: {
|
|
2633
|
-
[a]:
|
|
2883
|
+
[a]: n
|
|
2634
2884
|
},
|
|
2635
2885
|
...r
|
|
2636
2886
|
} : {
|
|
2637
|
-
[o]: { [a]:
|
|
2887
|
+
[o]: { [a]: n }
|
|
2638
2888
|
};
|
|
2639
2889
|
};
|
|
2640
2890
|
await this.addBurnInputsIfNeeded(), Array.from(this._totalMints, (t) => ({
|
|
2641
2891
|
unit: t[0],
|
|
2642
2892
|
data: t[1]
|
|
2643
2893
|
})).reduce((t, r) => t.set(r.data.label, e(r, t.get(r.data.label))), /* @__PURE__ */ new Map()).forEach((t, r) => {
|
|
2644
|
-
this._txBuilder.add_json_metadatum(
|
|
2894
|
+
this._txBuilder.add_json_metadatum(i.BigNum.from_str(r), JSON.stringify(t));
|
|
2645
2895
|
}), this.addMintOutputs();
|
|
2646
2896
|
}
|
|
2647
2897
|
async filterAvailableUTxOs(e = []) {
|
|
@@ -2660,35 +2910,35 @@ let L = class {
|
|
|
2660
2910
|
return this.__visits.includes(e) === !1;
|
|
2661
2911
|
}
|
|
2662
2912
|
setTxOutput(e) {
|
|
2663
|
-
const r =
|
|
2913
|
+
const r = i.BigNum.from_str(this._txOutputs.get(e.unit) ?? "0").checked_add(i.BigNum.from_str(e.quantity)).to_str();
|
|
2664
2914
|
this._txOutputs.set(e.unit, r);
|
|
2665
2915
|
}
|
|
2666
2916
|
};
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
],
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
],
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
],
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
],
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
],
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
],
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
],
|
|
2688
|
-
|
|
2917
|
+
Z([
|
|
2918
|
+
et()
|
|
2919
|
+
], $.prototype, "mintAsset", null);
|
|
2920
|
+
Z([
|
|
2921
|
+
et()
|
|
2922
|
+
], $.prototype, "redeemValue", null);
|
|
2923
|
+
Z([
|
|
2924
|
+
et()
|
|
2925
|
+
], $.prototype, "sendAssets", null);
|
|
2926
|
+
Z([
|
|
2927
|
+
et()
|
|
2928
|
+
], $.prototype, "sendValue", null);
|
|
2929
|
+
Z([
|
|
2930
|
+
et()
|
|
2931
|
+
], $.prototype, "setCollateral", null);
|
|
2932
|
+
Z([
|
|
2933
|
+
et()
|
|
2934
|
+
], $.prototype, "setRequiredSigners", null);
|
|
2935
|
+
Z([
|
|
2936
|
+
et()
|
|
2937
|
+
], $.prototype, "setTxInputs", null);
|
|
2938
|
+
$ = Z([
|
|
2689
2939
|
Xs
|
|
2690
|
-
],
|
|
2691
|
-
class
|
|
2940
|
+
], $);
|
|
2941
|
+
class w {
|
|
2692
2942
|
_networkId;
|
|
2693
2943
|
_encryptedSecret;
|
|
2694
2944
|
constructor(e, t) {
|
|
@@ -2696,9 +2946,9 @@ class C {
|
|
|
2696
2946
|
}
|
|
2697
2947
|
getAccount(e, t) {
|
|
2698
2948
|
return this.accountContext(e, t, (r, a) => {
|
|
2699
|
-
const
|
|
2949
|
+
const n = Ie(this._networkId, r.to_public().hash(), a.to_public().hash()).to_address().to_bech32(), o = pe(this._networkId, r.to_public().hash()).to_address().to_bech32(), c = Ft(this._networkId, a.to_public().hash()).to_address().to_bech32();
|
|
2700
2950
|
return {
|
|
2701
|
-
baseAddress:
|
|
2951
|
+
baseAddress: n,
|
|
2702
2952
|
enterpriseAddress: o,
|
|
2703
2953
|
rewardAddress: c
|
|
2704
2954
|
};
|
|
@@ -2706,28 +2956,28 @@ class C {
|
|
|
2706
2956
|
}
|
|
2707
2957
|
signData(e, t, r, a) {
|
|
2708
2958
|
try {
|
|
2709
|
-
return this.accountContext(e, t, (
|
|
2959
|
+
return this.accountContext(e, t, (n, o) => {
|
|
2710
2960
|
const c = { payload: a }, u = {
|
|
2711
|
-
address:
|
|
2712
|
-
key: r.startsWith("stake") ? o :
|
|
2713
|
-
}, { coseSign1: A, coseKey:
|
|
2714
|
-
return { signature: A, key:
|
|
2961
|
+
address: w.resolveAddress(this._networkId, r, n, o),
|
|
2962
|
+
key: r.startsWith("stake") ? o : n
|
|
2963
|
+
}, { coseSign1: A, coseKey: l } = gs(c, u);
|
|
2964
|
+
return { signature: A, key: l };
|
|
2715
2965
|
});
|
|
2716
|
-
} catch (
|
|
2717
|
-
throw new Error(`An error occurred during signData: ${
|
|
2966
|
+
} catch (n) {
|
|
2967
|
+
throw new Error(`An error occurred during signData: ${n}.`);
|
|
2718
2968
|
}
|
|
2719
2969
|
}
|
|
2720
|
-
signTx(e, t, r, a,
|
|
2970
|
+
signTx(e, t, r, a, n) {
|
|
2721
2971
|
try {
|
|
2722
2972
|
const o = Fe(js(a));
|
|
2723
2973
|
return this.accountContext(e, t, (c, u) => {
|
|
2724
|
-
const A =
|
|
2725
|
-
return
|
|
2974
|
+
const A = i.Vkeywitnesses.new();
|
|
2975
|
+
return w.resolveSigners(a, r, c.to_public().hash().to_hex()).forEach((g) => {
|
|
2726
2976
|
if (g === c.to_public().hash().to_hex())
|
|
2727
|
-
A.add(
|
|
2977
|
+
A.add(i.make_vkey_witness(o, c));
|
|
2728
2978
|
else if (g === u.to_public().hash().to_hex())
|
|
2729
|
-
A.add(
|
|
2730
|
-
else if (
|
|
2979
|
+
A.add(i.make_vkey_witness(o, u));
|
|
2980
|
+
else if (n === !1)
|
|
2731
2981
|
throw new Error(`Missing key witness for: ${g}`);
|
|
2732
2982
|
}), A;
|
|
2733
2983
|
});
|
|
@@ -2736,130 +2986,130 @@ class C {
|
|
|
2736
2986
|
}
|
|
2737
2987
|
}
|
|
2738
2988
|
static encryptMnemonic(e, t) {
|
|
2739
|
-
const r = Ce(e.join(" ")), a = Ye(r),
|
|
2740
|
-
return a.free(),
|
|
2989
|
+
const r = Ce(e.join(" ")), a = Ye(r), n = D(a.as_bytes());
|
|
2990
|
+
return a.free(), w.encrypt(n, t);
|
|
2741
2991
|
}
|
|
2742
2992
|
static encryptPrivateKey(e, t) {
|
|
2743
|
-
const r =
|
|
2744
|
-
return r.free(),
|
|
2993
|
+
const r = i.Bip32PrivateKey.from_bech32(e), a = D(r.as_bytes());
|
|
2994
|
+
return r.free(), w.encrypt(a, t);
|
|
2745
2995
|
}
|
|
2746
2996
|
static encryptSigningKeys(e, t, r) {
|
|
2747
|
-
const a =
|
|
2748
|
-
return [a,
|
|
2997
|
+
const a = w.encrypt(e.slice(4), r), n = w.encrypt(t.slice(4), r);
|
|
2998
|
+
return [a, n];
|
|
2749
2999
|
}
|
|
2750
3000
|
static generateMnemonic(e = 256) {
|
|
2751
3001
|
return $e(e).split(" ");
|
|
2752
3002
|
}
|
|
2753
3003
|
accountContext(e, t, r) {
|
|
2754
|
-
const { paymentKey: a, stakeKey:
|
|
2755
|
-
return a.free(),
|
|
3004
|
+
const { paymentKey: a, stakeKey: n } = w.resolveKeys(e, t, this._encryptedSecret), o = r(a, n);
|
|
3005
|
+
return a.free(), n.free(), o;
|
|
2756
3006
|
}
|
|
2757
3007
|
static decrypt(e, t) {
|
|
2758
3008
|
try {
|
|
2759
|
-
return
|
|
3009
|
+
return i.decrypt_with_password(S(t), e);
|
|
2760
3010
|
} catch {
|
|
2761
3011
|
throw new Error("The password is incorrect.");
|
|
2762
3012
|
}
|
|
2763
3013
|
}
|
|
2764
3014
|
static encrypt(e, t) {
|
|
2765
|
-
const r = ye("0123456789abcdef"), a = r(64),
|
|
2766
|
-
return
|
|
3015
|
+
const r = ye("0123456789abcdef"), a = r(64), n = r(24);
|
|
3016
|
+
return i.encrypt_with_password(S(t), a, n, e);
|
|
2767
3017
|
}
|
|
2768
3018
|
static resolveAddress(e, t, r, a) {
|
|
2769
|
-
const
|
|
3019
|
+
const n = [
|
|
2770
3020
|
Ie(e, r.to_public().hash(), a.to_public().hash()),
|
|
2771
3021
|
pe(e, r.to_public().hash()),
|
|
2772
|
-
|
|
3022
|
+
Ft(e, a.to_public().hash())
|
|
2773
3023
|
].find((o) => o.to_address().to_bech32() === t);
|
|
2774
|
-
if (
|
|
2775
|
-
return
|
|
3024
|
+
if (n !== void 0)
|
|
3025
|
+
return n.to_address();
|
|
2776
3026
|
throw new Error(`Address: ${t} doesn't belong to this account.`);
|
|
2777
3027
|
}
|
|
2778
3028
|
static resolveKeys(e, t, r) {
|
|
2779
3029
|
if (typeof r == "string") {
|
|
2780
|
-
const o =
|
|
3030
|
+
const o = w.decrypt(r, t);
|
|
2781
3031
|
return Ts(o, e);
|
|
2782
3032
|
}
|
|
2783
|
-
const a =
|
|
3033
|
+
const a = w.decrypt(r[0], t), n = w.decrypt(r[1], t);
|
|
2784
3034
|
return {
|
|
2785
|
-
paymentKey:
|
|
2786
|
-
stakeKey:
|
|
3035
|
+
paymentKey: i.PrivateKey.from_hex(a),
|
|
3036
|
+
stakeKey: i.PrivateKey.from_hex(n)
|
|
2787
3037
|
};
|
|
2788
3038
|
}
|
|
2789
3039
|
static resolveSigners(e, t, r) {
|
|
2790
3040
|
const a = (c) => {
|
|
2791
|
-
const u = (p, E = [],
|
|
2792
|
-
var It,
|
|
2793
|
-
if (p === void 0 ||
|
|
3041
|
+
const u = (p, E = [], B = 0) => {
|
|
3042
|
+
var It, ut, Lt, Gt, Rt;
|
|
3043
|
+
if (p === void 0 || B >= p.len())
|
|
2794
3044
|
return E;
|
|
2795
|
-
const
|
|
2796
|
-
switch (
|
|
2797
|
-
case
|
|
2798
|
-
const
|
|
2799
|
-
|
|
3045
|
+
const U = p.get(B), K = new Array();
|
|
3046
|
+
switch (U.kind()) {
|
|
3047
|
+
case i.CertificateKind.StakeDeregistration: {
|
|
3048
|
+
const C = (It = U.as_stake_deregistration()) == null ? void 0 : It.stake_credential(), V = (C == null ? void 0 : C.kind()) === i.StakeCredKind.Key ? C.to_keyhash() : void 0;
|
|
3049
|
+
V && K.push(V.to_hex());
|
|
2800
3050
|
break;
|
|
2801
3051
|
}
|
|
2802
|
-
case
|
|
2803
|
-
const
|
|
2804
|
-
|
|
3052
|
+
case i.CertificateKind.StakeDelegation: {
|
|
3053
|
+
const C = (ut = U.as_stake_delegation()) == null ? void 0 : ut.stake_credential(), V = (C == null ? void 0 : C.kind()) === i.StakeCredKind.Key ? C.to_keyhash() : void 0;
|
|
3054
|
+
V && K.push(V.to_hex());
|
|
2805
3055
|
break;
|
|
2806
3056
|
}
|
|
2807
|
-
case
|
|
2808
|
-
const
|
|
2809
|
-
|
|
3057
|
+
case i.CertificateKind.PoolRegistration: {
|
|
3058
|
+
const C = (Lt = U.as_pool_registration()) == null ? void 0 : Lt.pool_params().pool_owners();
|
|
3059
|
+
K.push(...l(C));
|
|
2810
3060
|
break;
|
|
2811
3061
|
}
|
|
2812
|
-
case
|
|
2813
|
-
const
|
|
2814
|
-
|
|
3062
|
+
case i.CertificateKind.PoolRetirement: {
|
|
3063
|
+
const C = (Gt = U.as_pool_retirement()) == null ? void 0 : Gt.pool_keyhash();
|
|
3064
|
+
C && K.push(C.to_hex());
|
|
2815
3065
|
break;
|
|
2816
3066
|
}
|
|
2817
|
-
case
|
|
2818
|
-
const
|
|
2819
|
-
if (
|
|
2820
|
-
for (let
|
|
2821
|
-
const $t =
|
|
2822
|
-
zt &&
|
|
3067
|
+
case i.CertificateKind.MoveInstantaneousRewardsCert: {
|
|
3068
|
+
const C = (Rt = U.as_move_instantaneous_rewards_cert()) == null ? void 0 : Rt.move_instantaneous_reward().as_to_stake_creds();
|
|
3069
|
+
if (C)
|
|
3070
|
+
for (let V = 0; V < C.len(); V += 1) {
|
|
3071
|
+
const $t = C.keys().get(V), zt = $t.kind() === i.StakeCredKind.Key ? $t.to_keyhash() : void 0;
|
|
3072
|
+
zt && K.push(zt.to_hex());
|
|
2823
3073
|
}
|
|
2824
3074
|
break;
|
|
2825
3075
|
}
|
|
2826
3076
|
}
|
|
2827
|
-
return u(p, [...E, ...
|
|
2828
|
-
}, A = (p, E = [],
|
|
2829
|
-
if (p === void 0 ||
|
|
3077
|
+
return u(p, [...E, ...K], B + 1);
|
|
3078
|
+
}, A = (p, E = [], B = 0) => {
|
|
3079
|
+
if (p === void 0 || B >= p.len())
|
|
2830
3080
|
return E;
|
|
2831
|
-
const
|
|
2832
|
-
return A(p, [...E, It],
|
|
2833
|
-
},
|
|
2834
|
-
if (p === void 0 ||
|
|
3081
|
+
const U = p.get(B).index(), K = p.get(B).transaction_id(), It = t.find((ut) => ut.input.outputIndex === U && ut.input.txHash === K.to_hex()) !== void 0 ? r : "OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";
|
|
3082
|
+
return A(p, [...E, It], B + 1);
|
|
3083
|
+
}, l = (p, E = [], B = 0) => p === void 0 || B >= p.len() ? E : l(p, [...E, p.get(B).to_hex()], B + 1), g = (p, E = [], B = 0) => {
|
|
3084
|
+
if (p === void 0 || B >= p.len())
|
|
2835
3085
|
return E;
|
|
2836
|
-
const
|
|
2837
|
-
return g(p,
|
|
2838
|
-
}, I = c.certs(),
|
|
3086
|
+
const U = p.keys().get(B).payment_cred(), K = U.kind() === i.StakeCredKind.Key ? U.to_keyhash() : void 0;
|
|
3087
|
+
return g(p, K ? [...E, K.to_hex()] : E, B + 1);
|
|
3088
|
+
}, I = c.certs(), f = c.collateral(), y = c.inputs(), b = c.required_signers(), k = c.withdrawals();
|
|
2839
3089
|
return [
|
|
2840
3090
|
...u(I),
|
|
2841
|
-
...A(
|
|
2842
|
-
...A(
|
|
2843
|
-
...
|
|
2844
|
-
...g(
|
|
3091
|
+
...A(f),
|
|
3092
|
+
...A(y),
|
|
3093
|
+
...l(b),
|
|
3094
|
+
...g(k)
|
|
2845
3095
|
];
|
|
2846
|
-
},
|
|
2847
|
-
const u = (
|
|
2848
|
-
var I,
|
|
2849
|
-
if (
|
|
2850
|
-
for (let
|
|
2851
|
-
const p =
|
|
3096
|
+
}, n = (c) => {
|
|
3097
|
+
const u = (l, g = []) => {
|
|
3098
|
+
var I, f, y, b;
|
|
3099
|
+
if (l)
|
|
3100
|
+
for (let k = 0; k < l.len(); k += 1) {
|
|
3101
|
+
const p = l.get(k);
|
|
2852
3102
|
switch (p.kind()) {
|
|
2853
|
-
case
|
|
3103
|
+
case i.NativeScriptKind.ScriptPubkey: {
|
|
2854
3104
|
const E = (I = p.as_script_pubkey()) == null ? void 0 : I.addr_keyhash().to_hex();
|
|
2855
3105
|
return E ? [...g, E] : g;
|
|
2856
3106
|
}
|
|
2857
|
-
case
|
|
2858
|
-
return u((
|
|
2859
|
-
case
|
|
2860
|
-
return u((
|
|
2861
|
-
case
|
|
2862
|
-
return u((
|
|
3107
|
+
case i.NativeScriptKind.ScriptAll:
|
|
3108
|
+
return u((f = p.as_script_all()) == null ? void 0 : f.native_scripts(), g);
|
|
3109
|
+
case i.NativeScriptKind.ScriptAny:
|
|
3110
|
+
return u((y = p.as_script_any()) == null ? void 0 : y.native_scripts(), g);
|
|
3111
|
+
case i.NativeScriptKind.ScriptNOfK:
|
|
3112
|
+
return u((b = p.as_script_n_of_k()) == null ? void 0 : b.native_scripts(), g);
|
|
2863
3113
|
}
|
|
2864
3114
|
}
|
|
2865
3115
|
return g;
|
|
@@ -2867,61 +3117,61 @@ class C {
|
|
|
2867
3117
|
return [
|
|
2868
3118
|
...u(A)
|
|
2869
3119
|
];
|
|
2870
|
-
}, o =
|
|
3120
|
+
}, o = q(e);
|
|
2871
3121
|
return /* @__PURE__ */ new Set([
|
|
2872
3122
|
...a(o.body()),
|
|
2873
|
-
...
|
|
3123
|
+
...n(o.witness_set())
|
|
2874
3124
|
]);
|
|
2875
3125
|
}
|
|
2876
3126
|
}
|
|
2877
|
-
const
|
|
2878
|
-
class
|
|
3127
|
+
const N = "MARI0TIME";
|
|
3128
|
+
class Dr {
|
|
2879
3129
|
_fetcher;
|
|
2880
3130
|
_submitter;
|
|
2881
3131
|
_wallet;
|
|
2882
3132
|
constructor(e) {
|
|
2883
3133
|
switch (this._fetcher = e.fetcher, this._submitter = e.submitter, e.key.type) {
|
|
2884
3134
|
case "mnemonic":
|
|
2885
|
-
this._wallet = new
|
|
3135
|
+
this._wallet = new w(e.networkId, w.encryptMnemonic(e.key.words, N));
|
|
2886
3136
|
break;
|
|
2887
3137
|
case "root":
|
|
2888
|
-
this._wallet = new
|
|
3138
|
+
this._wallet = new w(e.networkId, w.encryptPrivateKey(e.key.bech32, N));
|
|
2889
3139
|
break;
|
|
2890
3140
|
case "cli":
|
|
2891
|
-
this._wallet = new
|
|
3141
|
+
this._wallet = new w(e.networkId, w.encryptSigningKeys(e.key.payment, e.key.stake ?? "f0".repeat(34), N));
|
|
2892
3142
|
}
|
|
2893
3143
|
}
|
|
2894
3144
|
getBaseAddress(e = 0) {
|
|
2895
|
-
return this._wallet.getAccount(e,
|
|
3145
|
+
return this._wallet.getAccount(e, N).baseAddress;
|
|
2896
3146
|
}
|
|
2897
3147
|
getPaymentAddress(e = 0) {
|
|
2898
|
-
return this._wallet.getAccount(e,
|
|
3148
|
+
return this._wallet.getAccount(e, N).enterpriseAddress;
|
|
2899
3149
|
}
|
|
2900
3150
|
getRewardAddress(e = 0) {
|
|
2901
|
-
return this._wallet.getAccount(e,
|
|
3151
|
+
return this._wallet.getAccount(e, N).rewardAddress;
|
|
2902
3152
|
}
|
|
2903
3153
|
getUsedAddress(e = 0) {
|
|
2904
|
-
const t = this._wallet.getAccount(e,
|
|
2905
|
-
return
|
|
3154
|
+
const t = this._wallet.getAccount(e, N);
|
|
3155
|
+
return H(t.enterpriseAddress);
|
|
2906
3156
|
}
|
|
2907
|
-
getUsedCollateral(e =
|
|
3157
|
+
getUsedCollateral(e = G.maxCollateralInputs) {
|
|
2908
3158
|
throw new Error("getUsedCollateral not implemented.");
|
|
2909
3159
|
}
|
|
2910
3160
|
async getUsedUTxOs(e = 0) {
|
|
2911
|
-
const t = this._wallet.getAccount(e,
|
|
2912
|
-
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((a) =>
|
|
3161
|
+
const t = this._wallet.getAccount(e, N);
|
|
3162
|
+
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((a) => F(a));
|
|
2913
3163
|
}
|
|
2914
3164
|
signData(e, t, r = 0) {
|
|
2915
3165
|
try {
|
|
2916
|
-
return this._wallet.signData(r,
|
|
3166
|
+
return this._wallet.signData(r, N, e, t);
|
|
2917
3167
|
} catch (a) {
|
|
2918
3168
|
throw new Error(`[AppWallet] An error occurred during signData: ${a}.`);
|
|
2919
3169
|
}
|
|
2920
3170
|
}
|
|
2921
3171
|
async signTx(e, t = !1, r = 0) {
|
|
2922
3172
|
try {
|
|
2923
|
-
const a = this._wallet.getAccount(r,
|
|
2924
|
-
return u.set_vkeys(A),
|
|
3173
|
+
const a = this._wallet.getAccount(r, N), n = await this._fetcher.fetchAddressUTxOs(a.enterpriseAddress), o = this._wallet.signTx(r, N, n, e, t), c = q(e), u = c.witness_set(), A = Ge(u, o);
|
|
3174
|
+
return u.set_vkeys(A), i.Transaction.new(c.body(), u, c.auxiliary_data()).to_hex();
|
|
2925
3175
|
} catch (a) {
|
|
2926
3176
|
throw new Error(`[AppWallet] An error occurred during signTx: ${a}.`);
|
|
2927
3177
|
}
|
|
@@ -2930,10 +3180,10 @@ class br {
|
|
|
2930
3180
|
return this._submitter.submitTx(e);
|
|
2931
3181
|
}
|
|
2932
3182
|
static brew(e = 256) {
|
|
2933
|
-
return
|
|
3183
|
+
return w.generateMnemonic(e);
|
|
2934
3184
|
}
|
|
2935
3185
|
}
|
|
2936
|
-
class
|
|
3186
|
+
class Tt {
|
|
2937
3187
|
_walletInstance;
|
|
2938
3188
|
constructor(e) {
|
|
2939
3189
|
this._walletInstance = e;
|
|
@@ -2947,9 +3197,9 @@ class Ft {
|
|
|
2947
3197
|
}
|
|
2948
3198
|
static async enable(e) {
|
|
2949
3199
|
try {
|
|
2950
|
-
const t = await
|
|
3200
|
+
const t = await Tt.resolveInstance(e);
|
|
2951
3201
|
if (t !== void 0)
|
|
2952
|
-
return new
|
|
3202
|
+
return new Tt(t);
|
|
2953
3203
|
throw new Error(`Couldn't create an instance of wallet: ${e}`);
|
|
2954
3204
|
} catch (t) {
|
|
2955
3205
|
throw new Error(`[BrowserWallet] An error occurred during enable: ${t}.`);
|
|
@@ -2957,38 +3207,38 @@ class Ft {
|
|
|
2957
3207
|
}
|
|
2958
3208
|
async getBalance() {
|
|
2959
3209
|
const e = await this._walletInstance.getBalance();
|
|
2960
|
-
return Ve(
|
|
3210
|
+
return Ve(Gs(e));
|
|
2961
3211
|
}
|
|
2962
3212
|
async getChangeAddress() {
|
|
2963
3213
|
const e = await this._walletInstance.getChangeAddress();
|
|
2964
|
-
return
|
|
3214
|
+
return st(e).to_bech32();
|
|
2965
3215
|
}
|
|
2966
|
-
async getCollateral(e =
|
|
3216
|
+
async getCollateral(e = G.maxCollateralInputs) {
|
|
2967
3217
|
return (await this.getUsedCollateral(e)).map((r) => Qt(r));
|
|
2968
3218
|
}
|
|
2969
3219
|
getNetworkId() {
|
|
2970
3220
|
return this._walletInstance.getNetworkId();
|
|
2971
3221
|
}
|
|
2972
3222
|
async getRewardAddresses() {
|
|
2973
|
-
return (await this._walletInstance.getRewardAddresses()).map((t) =>
|
|
3223
|
+
return (await this._walletInstance.getRewardAddresses()).map((t) => st(t).to_bech32());
|
|
2974
3224
|
}
|
|
2975
3225
|
async getUnusedAddresses() {
|
|
2976
|
-
return (await this._walletInstance.getUnusedAddresses()).map((t) =>
|
|
3226
|
+
return (await this._walletInstance.getUnusedAddresses()).map((t) => st(t).to_bech32());
|
|
2977
3227
|
}
|
|
2978
3228
|
async getUsedAddresses() {
|
|
2979
|
-
return (await this._walletInstance.getUsedAddresses()).map((t) =>
|
|
3229
|
+
return (await this._walletInstance.getUsedAddresses()).map((t) => st(t).to_bech32());
|
|
2980
3230
|
}
|
|
2981
3231
|
async getUtxos() {
|
|
2982
3232
|
return (await this.getUsedUTxOs()).map((t) => Qt(t));
|
|
2983
3233
|
}
|
|
2984
3234
|
signData(e, t) {
|
|
2985
|
-
const r =
|
|
3235
|
+
const r = H(e).to_hex();
|
|
2986
3236
|
return this._walletInstance.signData(r, S(t));
|
|
2987
3237
|
}
|
|
2988
3238
|
async signTx(e, t = !1) {
|
|
2989
3239
|
try {
|
|
2990
|
-
const r =
|
|
2991
|
-
return a.set_vkeys(c),
|
|
3240
|
+
const r = q(e), a = r.witness_set(), n = await this._walletInstance.signTx(e, t), o = Ls(n).vkeys() ?? i.Vkeywitnesses.new(), c = Ge(a, o);
|
|
3241
|
+
return a.set_vkeys(c), D(i.Transaction.new(r.body(), a, r.auxiliary_data()).to_bytes());
|
|
2992
3242
|
} catch (r) {
|
|
2993
3243
|
throw new Error(`[BrowserWallet] An error occurred during signTx: ${JSON.stringify(r)}.`);
|
|
2994
3244
|
}
|
|
@@ -2998,9 +3248,9 @@ class Ft {
|
|
|
2998
3248
|
}
|
|
2999
3249
|
async getUsedAddress() {
|
|
3000
3250
|
const e = await this._walletInstance.getUsedAddresses();
|
|
3001
|
-
return
|
|
3251
|
+
return st(e[0]);
|
|
3002
3252
|
}
|
|
3003
|
-
async getUsedCollateral(e =
|
|
3253
|
+
async getUsedCollateral(e = G.maxCollateralInputs) {
|
|
3004
3254
|
return (await this._walletInstance.experimental.getCollateral() ?? []).map((r) => le(r)).slice(0, e);
|
|
3005
3255
|
}
|
|
3006
3256
|
async getUsedUTxOs() {
|
|
@@ -3008,12 +3258,12 @@ class Ft {
|
|
|
3008
3258
|
}
|
|
3009
3259
|
async getAssets() {
|
|
3010
3260
|
return (await this.getBalance()).filter((t) => t.unit !== "lovelace").map((t) => {
|
|
3011
|
-
const r = t.unit.slice(0,
|
|
3261
|
+
const r = t.unit.slice(0, M), a = t.unit.slice(M), n = Js(r, a);
|
|
3012
3262
|
return {
|
|
3013
3263
|
unit: t.unit,
|
|
3014
3264
|
policyId: r,
|
|
3015
|
-
assetName:
|
|
3016
|
-
fingerprint:
|
|
3265
|
+
assetName: qt(a),
|
|
3266
|
+
fingerprint: n,
|
|
3017
3267
|
quantity: t.quantity
|
|
3018
3268
|
};
|
|
3019
3269
|
});
|
|
@@ -3027,7 +3277,7 @@ class Ft {
|
|
|
3027
3277
|
}
|
|
3028
3278
|
async getPolicyIds() {
|
|
3029
3279
|
const e = await this.getBalance();
|
|
3030
|
-
return Array.from(new Set(e.map((t) => t.unit.slice(0,
|
|
3280
|
+
return Array.from(new Set(e.map((t) => t.unit.slice(0, M)))).filter((t) => t !== "lovelace");
|
|
3031
3281
|
}
|
|
3032
3282
|
static resolveInstance(e) {
|
|
3033
3283
|
if (window.cardano === void 0)
|
|
@@ -3037,9 +3287,9 @@ class Ft {
|
|
|
3037
3287
|
}
|
|
3038
3288
|
}
|
|
3039
3289
|
const Re = "http://localhost:4000/", Zs = "http://localhost:5000/", tr = `${Re}access`, er = `${Re}transaction/signtx`;
|
|
3040
|
-
class
|
|
3290
|
+
class vr {
|
|
3041
3291
|
static getAxiosInstance() {
|
|
3042
|
-
return
|
|
3292
|
+
return L.create({
|
|
3043
3293
|
baseURL: Zs,
|
|
3044
3294
|
withCredentials: !0
|
|
3045
3295
|
});
|
|
@@ -3051,9 +3301,9 @@ class Dr {
|
|
|
3051
3301
|
const t = this.getAppId();
|
|
3052
3302
|
e.includes("?") ? e = `${e}&appId=${t}` : e = `${e}?appId=${t}`;
|
|
3053
3303
|
const r = "left=100,top=100,width=540,height=540", a = window.open(e, "meshWindow", r);
|
|
3054
|
-
return a || console.error("the window did not open", a), await (async () => new Promise((
|
|
3304
|
+
return a || console.error("the window did not open", a), await (async () => new Promise((n) => {
|
|
3055
3305
|
window.addEventListener("message", async (o) => {
|
|
3056
|
-
o.data.target == "minaWallet" &&
|
|
3306
|
+
o.data.target == "minaWallet" && n(o.data);
|
|
3057
3307
|
});
|
|
3058
3308
|
}))();
|
|
3059
3309
|
}
|
|
@@ -3091,10 +3341,10 @@ class Dr {
|
|
|
3091
3341
|
const r = await this.get("wallet/getuserwalletsmeta");
|
|
3092
3342
|
if (console.log("userWalletsMeta", r), r) {
|
|
3093
3343
|
const a = await this.openMinaFrontend(`${er}?unsignedTx=${e}&partialSign=${t}`);
|
|
3094
|
-
if (a instanceof
|
|
3095
|
-
const
|
|
3344
|
+
if (a instanceof i.Vkeywitnesses) {
|
|
3345
|
+
const n = q(e), o = n.witness_set();
|
|
3096
3346
|
o.set_vkeys(a);
|
|
3097
|
-
const c =
|
|
3347
|
+
const c = i.Transaction.new(n.body(), o, n.auxiliary_data()).to_hex();
|
|
3098
3348
|
return console.log("signedTx", c), c;
|
|
3099
3349
|
}
|
|
3100
3350
|
} else
|
|
@@ -3102,41 +3352,42 @@ class Dr {
|
|
|
3102
3352
|
}
|
|
3103
3353
|
}
|
|
3104
3354
|
export {
|
|
3105
|
-
|
|
3355
|
+
Dr as AppWallet,
|
|
3106
3356
|
Cr as BlockfrostProvider,
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3357
|
+
Tt as BrowserWallet,
|
|
3358
|
+
w as EmbeddedWallet,
|
|
3359
|
+
Qr as ForgeScript,
|
|
3110
3360
|
wr as InfuraProvider,
|
|
3111
3361
|
Br as KoiosProvider,
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
xr as
|
|
3115
|
-
|
|
3362
|
+
Sr as MaestroProvider,
|
|
3363
|
+
vr as MinaWallet,
|
|
3364
|
+
xr as OgmiosProvider,
|
|
3365
|
+
Er as TangoProvider,
|
|
3366
|
+
$ as Transaction,
|
|
3116
3367
|
or as checkSignature,
|
|
3117
3368
|
fr as generateNonce,
|
|
3118
3369
|
ts as isNetwork,
|
|
3119
3370
|
ns as keepRelevant,
|
|
3120
3371
|
ir as largestFirst,
|
|
3121
3372
|
is as largestFirstMultiAsset,
|
|
3122
|
-
|
|
3123
|
-
|
|
3373
|
+
X as parseAssetUnit,
|
|
3374
|
+
d as parseHttpError,
|
|
3124
3375
|
_r as readPlutusData,
|
|
3125
3376
|
yr as readTransaction,
|
|
3126
3377
|
cr as resolveDataHash,
|
|
3127
3378
|
ur as resolveEpochNo,
|
|
3128
|
-
|
|
3379
|
+
Js as resolveFingerprint,
|
|
3129
3380
|
Ar as resolveLanguageView,
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3381
|
+
dr as resolveNativeScriptHash,
|
|
3382
|
+
rt as resolvePaymentKeyHash,
|
|
3383
|
+
gr as resolvePlutusScriptAddress,
|
|
3133
3384
|
lr as resolvePlutusScriptHash,
|
|
3134
3385
|
hr as resolvePoolId,
|
|
3135
3386
|
Ir as resolvePrivateKey,
|
|
3136
|
-
|
|
3387
|
+
kt as resolveRewardAddress,
|
|
3137
3388
|
mr as resolveScriptRef,
|
|
3138
3389
|
pr as resolveSlotNo,
|
|
3139
|
-
|
|
3140
|
-
|
|
3390
|
+
dt as resolveStakeKeyHash,
|
|
3391
|
+
Le as resolveTxFees,
|
|
3141
3392
|
js as resolveTxHash
|
|
3142
3393
|
};
|