@meshsdk/core 1.5.11-beta.5 → 1.5.11-beta.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/common/contracts/fetcher.d.ts +3 -0
- package/dist/core.cjs +1 -1
- package/dist/core.js +1134 -1130
- package/dist/providers/blockfrost.provider.d.ts +17 -0
- package/dist/transaction/meshTxBuilder/meshTxBuilderCore.d.ts +40 -3
- package/dist/transaction/meshTxBuilder/type.d.ts +21 -2
- package/dist/transaction/transaction.service.d.ts +3 -1
- package/dist/wallet/browser.service.d.ts +3 -3
- package/dist/wallet/index.d.ts +0 -1
- package/package.json +6 -3
package/dist/core.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { customAlphabet as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { mnemonicToEntropy as
|
|
5
|
-
import { COSEKey as
|
|
6
|
-
const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes(r),
|
|
1
|
+
import { customAlphabet as Be } from "nanoid";
|
|
2
|
+
import * as n from "@emurgo/cardano-serialization-lib-nodejs";
|
|
3
|
+
import tt from "axios";
|
|
4
|
+
import { mnemonicToEntropy as Se, generateMnemonic as ze } from "bip39";
|
|
5
|
+
import { COSEKey as Ee, COSESign1 as Je, Label as X, Int as wt, BigNum as Kt, KeyType as We, AlgorithmId as be, CBORValue as Ht, HeaderMap as te, Headers as je, ProtectedHeaderMap as Xe, COSESign1Builder as Ze } from "@emurgo/cardano-message-signing-nodejs";
|
|
6
|
+
const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes(r), nt = {
|
|
7
7
|
mem: 7e6,
|
|
8
8
|
steps: 3e9
|
|
9
|
-
},
|
|
9
|
+
}, T = {
|
|
10
10
|
epoch: 0,
|
|
11
11
|
coinsPerUTxOSize: "4310",
|
|
12
12
|
priceMem: 0.0577,
|
|
@@ -27,23 +27,23 @@ const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
27
27
|
maxTxExSteps: "10000000000",
|
|
28
28
|
maxBlockExMem: "80000000",
|
|
29
29
|
maxBlockExSteps: "40000000000"
|
|
30
|
-
}, Pt = 2147483648,
|
|
31
|
-
V1:
|
|
32
|
-
V2:
|
|
33
|
-
},
|
|
34
|
-
CERT:
|
|
35
|
-
MINT:
|
|
36
|
-
REWARD:
|
|
37
|
-
SPEND:
|
|
30
|
+
}, Pt = 2147483648, Y = {
|
|
31
|
+
V1: n.Language.new_plutus_v1(),
|
|
32
|
+
V2: n.Language.new_plutus_v2()
|
|
33
|
+
}, R = 56, ss = {
|
|
34
|
+
CERT: n.RedeemerTag.new_cert(),
|
|
35
|
+
MINT: n.RedeemerTag.new_mint(),
|
|
36
|
+
REWARD: n.RedeemerTag.new_reward(),
|
|
37
|
+
SPEND: n.RedeemerTag.new_spend()
|
|
38
38
|
}, bt = {
|
|
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
|
+
}, ee = {
|
|
44
|
+
ALONZO: n.TxBuilderConstants.plutus_alonzo_cost_models(),
|
|
45
45
|
BABBAGE: (() => {
|
|
46
|
-
const r =
|
|
46
|
+
const r = n.Costmdls.new(), e = n.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 ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
211
211
|
"verifyEd25519Signature-cpu-arguments-intercept": 57996947,
|
|
212
212
|
"verifyEd25519Signature-cpu-arguments-slope": 18975,
|
|
213
213
|
"verifyEd25519Signature-memory-arguments": 10
|
|
214
|
-
}).forEach((s,
|
|
215
|
-
const t =
|
|
214
|
+
}).forEach((s, a) => e.set(a, n.Int.new_i32(s)));
|
|
215
|
+
const t = n.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 ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
389
389
|
"verifySchnorrSecp256k1Signature-cpu-arguments-intercept": 38887044,
|
|
390
390
|
"verifySchnorrSecp256k1Signature-cpu-arguments-slope": 32947,
|
|
391
391
|
"verifySchnorrSecp256k1Signature-memory-arguments": 10
|
|
392
|
-
}).forEach((s,
|
|
392
|
+
}).forEach((s, a) => t.set(a, n.Int.new_i32(s))), r.insert(n.Language.new_plutus_v1(), e), r.insert(n.Language.new_plutus_v2(), t), r;
|
|
393
393
|
})()
|
|
394
394
|
}, rs = {
|
|
395
395
|
ALONZO: {
|
|
@@ -399,15 +399,15 @@ const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
399
399
|
V1: "a141005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff",
|
|
400
400
|
V2: "a20198af1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a0011b22c1a0005fdde00021a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201b00000004a817c8001b00000004a817c8001a009063b91903fd0a1b00000004a817c800001b00000004a817c80041005901b69f1a0003236119032c01011903e819023b00011903e8195e7104011903e818201a0001ca761928eb041959d818641959d818641959d818641959d818641959d818641959d81864186418641959d81864194c5118201a0002acfa182019b551041a000363151901ff00011a00015c3518201a000797751936f404021a0002ff941a0006ea7818dc0001011903e8196ff604021a0003bd081a00034ec5183e011a00102e0f19312a011a00032e801901a5011a0002da781903e819cf06011a00013a34182019a8f118201903e818201a00013aac0119e143041903e80a1a00030219189c011a00030219189c011a0003207c1901d9011a000330001901ff0119ccf3182019fd40182019ffd5182019581e18201940b318201a00012adf18201a0002ff941a0006ea7818dc0001011a00010f92192da7000119eabb18201a0002ff941a0006ea7818dc0001011a0002ff941a0006ea7818dc0001011a000c504e197712041a001d6af61a0001425b041a00040c660004001a00014fab18201a0003236119032c010119a0de18201a00033d7618201979f41820197fb8182019a95d1820197df718201995aa18201a009063b91903fd0aff"
|
|
401
401
|
}
|
|
402
|
-
},
|
|
403
|
-
[
|
|
404
|
-
[
|
|
405
|
-
},
|
|
402
|
+
}, qt = {
|
|
403
|
+
[n.NetworkInfo.testnet().network_id()]: "8d18d786e92776c824607fd8e193ec535c79dc61ea2405ddf3b09fe3",
|
|
404
|
+
[n.NetworkInfo.mainnet().network_id()]: "f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a"
|
|
405
|
+
}, as = {
|
|
406
406
|
mainnet: "wss://ogmios-api.mainnet.dandelion.link",
|
|
407
407
|
preprod: "wss://ogmios-api.iohk-preprod.dandelion.link",
|
|
408
408
|
preview: "__TBD_SOON_TM__",
|
|
409
409
|
testnet: "wss://ogmios-api.testnet.dandelion.link"
|
|
410
|
-
},
|
|
410
|
+
}, ns = {
|
|
411
411
|
LQ: "da8c30857834c6ae7203935b89278c532b3995245295456f993e1d244c51",
|
|
412
412
|
MIN: "29d222ce763455e3d7a09a665ce554f00ac89d2e99a1a83d267170c64d494e",
|
|
413
413
|
NTX: "edfd7a1d77bcb8b884c474bdc92a16002d1fb720e454fa6e993444794e5458",
|
|
@@ -436,7 +436,7 @@ const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
436
436
|
SHEN: "8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd615368656e4d6963726f555344",
|
|
437
437
|
WMT: "1d7f33bd23d85e1a25d87d86fac4f199c3197a2f7afeb662a0f34e1e776f726c646d6f62696c65746f6b656e",
|
|
438
438
|
COPI: "b6a7467ea1deb012808ef4e87b5ff371e85f7142d7b356a40d9b42a0436f726e75636f70696173205b76696120436861696e506f72742e696f5d"
|
|
439
|
-
},
|
|
439
|
+
}, se = [
|
|
440
440
|
"begin",
|
|
441
441
|
"eternl",
|
|
442
442
|
"flint",
|
|
@@ -448,91 +448,91 @@ const ts = ["testnet", "preview", "preprod", "mainnet"], es = (r) => ts.includes
|
|
|
448
448
|
"vespr",
|
|
449
449
|
"yoroi"
|
|
450
450
|
], is = (r, e, t = "5000000") => {
|
|
451
|
-
const s =
|
|
451
|
+
const s = n.BigNum.from_str(r.get("lovelace") ?? "0").checked_add(n.BigNum.from_str(t)), a = e.filter((c) => c.output.amount.filter((u) => u.unit !== "lovelace").some((u) => r.has(u.unit))), i = ds(a);
|
|
452
452
|
return [
|
|
453
|
-
...
|
|
454
|
-
...
|
|
453
|
+
...i.less_than(s) ? hs(s.clamped_sub(i).to_str(), e.filter((c) => !a.some((u) => u.input.txHash === c.input.txHash && u.input.outputIndex === c.input.outputIndex))) : [],
|
|
454
|
+
...a
|
|
455
455
|
];
|
|
456
|
-
},
|
|
457
|
-
const o = e.filter((
|
|
456
|
+
}, nr = (r, e, t = !1, { maxTxSize: s, minFeeA: a, minFeeB: i } = T) => {
|
|
457
|
+
const o = e.filter((m) => Qe(m) === !1).sort(Yt), c = n.BigNum.from_str(Ge(s, a, i)), u = t ? n.BigNum.from_str(r).checked_add(c).to_str() : r;
|
|
458
458
|
return It(o, /* @__PURE__ */ new Map([
|
|
459
459
|
["lovelace", u]
|
|
460
460
|
]));
|
|
461
|
-
}, os = (r, e, t = !1, s =
|
|
462
|
-
const
|
|
463
|
-
return r.set("lovelace", c), It(
|
|
464
|
-
}, cs = (r, e) => Array.from(e, (t) => ({ unit: t[0], quantity:
|
|
465
|
-
const
|
|
466
|
-
return s.checked_add(
|
|
467
|
-
},
|
|
468
|
-
var
|
|
469
|
-
const t =
|
|
470
|
-
return
|
|
461
|
+
}, os = (r, e, t = !1, s = T) => {
|
|
462
|
+
const a = e.filter(Qe).sort(Yt), i = us(s), o = r.get("lovelace") ?? "0", c = t ? n.BigNum.from_str(o).checked_add(i).to_str() : o;
|
|
463
|
+
return r.set("lovelace", c), It(a, r);
|
|
464
|
+
}, cs = (r, e) => Array.from(e, (t) => ({ unit: t[0], quantity: n.BigNum.from_str(t[1]) })).every((t) => r.filter((s) => s.output.amount.find((a) => a.unit === t.unit) !== void 0).reduce((s, a) => {
|
|
465
|
+
const i = a.output.amount.reduce((o, c) => o.checked_add(n.BigNum.from_str(t.unit === c.unit ? c.quantity : "0")), n.BigNum.from_str("0"));
|
|
466
|
+
return s.checked_add(i);
|
|
467
|
+
}, n.BigNum.from_str("0")).less_than(t.quantity) === !1), Yt = (r, e) => {
|
|
468
|
+
var a, i;
|
|
469
|
+
const t = n.BigNum.from_str(((a = r.output.amount.find((o) => o.unit === "lovelace")) == null ? void 0 : a.quantity) ?? "0");
|
|
470
|
+
return n.BigNum.from_str(((i = e.output.amount.find((o) => o.unit === "lovelace")) == null ? void 0 : i.quantity) ?? "0").compare(t);
|
|
471
471
|
}, us = (r) => {
|
|
472
472
|
const { maxTxSize: e, minFeeA: t, minFeeB: s } = r;
|
|
473
|
-
return
|
|
474
|
-
},
|
|
475
|
-
var
|
|
476
|
-
const s = ((
|
|
477
|
-
return e.checked_add(
|
|
478
|
-
},
|
|
479
|
-
const t = e.sort(
|
|
473
|
+
return n.BigNum.from_str(Ge(e, t, s));
|
|
474
|
+
}, Qe = (r) => r.output.amount.length > 1, ds = (r) => r.reduce((e, t) => {
|
|
475
|
+
var a;
|
|
476
|
+
const s = ((a = t.output.amount.find((i) => i.unit === "lovelace")) == null ? void 0 : a.quantity) ?? "0";
|
|
477
|
+
return e.checked_add(n.BigNum.from_str(s));
|
|
478
|
+
}, n.BigNum.from_str("0")), hs = (r, e) => {
|
|
479
|
+
const t = e.sort(Yt);
|
|
480
480
|
return It(t, /* @__PURE__ */ new Map([
|
|
481
481
|
["lovelace", r]
|
|
482
482
|
]));
|
|
483
|
-
}, It = (r, e, t = []) => r.length === 0 || cs(t, e) ? t : ls(r[0], e) ? It(r.slice(1), e, [...t, r[0]]) : It(r.slice(1), e, t), ls = (r, e) => Array.from(e.keys()).some((t) => r.output.amount.find((s) => s.unit === t) !== void 0),
|
|
484
|
-
const t =
|
|
483
|
+
}, It = (r, e, t = []) => r.length === 0 || cs(t, e) ? t : ls(r[0], e) ? It(r.slice(1), e, [...t, r[0]]) : It(r.slice(1), e, t), ls = (r, e) => Array.from(e.keys()).some((t) => r.output.amount.find((s) => s.unit === t) !== void 0), ms = (r, e) => {
|
|
484
|
+
const t = As(e), s = Is(r, e);
|
|
485
485
|
return {
|
|
486
|
-
coseKey:
|
|
487
|
-
coseSign1:
|
|
486
|
+
coseKey: k(t.to_bytes()),
|
|
487
|
+
coseSign1: k(s.to_bytes())
|
|
488
488
|
};
|
|
489
|
-
},
|
|
489
|
+
}, ir = (r, e, { key: t, signature: s }) => {
|
|
490
490
|
var o, c;
|
|
491
|
-
const
|
|
491
|
+
const a = Ee.from_bytes(_(t)), i = Je.from_bytes(_(s));
|
|
492
492
|
if ((r == null ? void 0 : r.length) > 0) {
|
|
493
|
-
const u =
|
|
494
|
-
if (
|
|
493
|
+
const u = k(i.payload() ?? new Uint8Array());
|
|
494
|
+
if (b(r) !== u)
|
|
495
495
|
return !1;
|
|
496
496
|
}
|
|
497
497
|
if ((e == null ? void 0 : e.length) > 0) {
|
|
498
|
-
const d = (o =
|
|
498
|
+
const d = (o = i.headers().protected().deserialized_headers().header(X.new_text("address"))) == null ? void 0 : o.as_bytes();
|
|
499
499
|
if (d === void 0)
|
|
500
500
|
throw new Error("Couldn't find a signer address in signature");
|
|
501
|
-
const l = (c =
|
|
501
|
+
const l = (c = a.header(X.new_int(wt.new_negative(Kt.from_str("2"))))) == null ? void 0 : c.as_bytes();
|
|
502
502
|
if (l === void 0)
|
|
503
503
|
throw new Error("Couldn't find a signer key in signature");
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
504
|
+
const m = at(k(d)), g = Vs(k(l));
|
|
505
|
+
if (gs(e, m, g) === !1)
|
|
506
506
|
throw new Error("Couldn't check signature because of address mismatch");
|
|
507
|
-
const
|
|
508
|
-
return
|
|
507
|
+
const A = Rs(k(i.signature())), I = i.signed_data().to_bytes();
|
|
508
|
+
return g.verify(I, A);
|
|
509
509
|
}
|
|
510
510
|
return !1;
|
|
511
|
-
},
|
|
511
|
+
}, gs = (r, e, t) => {
|
|
512
512
|
if (r !== e.to_bech32())
|
|
513
513
|
return !1;
|
|
514
514
|
try {
|
|
515
|
-
return
|
|
515
|
+
return gt(r) === t.hash().to_hex();
|
|
516
516
|
} catch {
|
|
517
517
|
return !1;
|
|
518
518
|
}
|
|
519
|
-
},
|
|
520
|
-
const e =
|
|
521
|
-
return e.set_algorithm_id(X.from_algorithm_id(
|
|
519
|
+
}, As = (r) => {
|
|
520
|
+
const e = Ee.new(X.from_key_type(We.OKP));
|
|
521
|
+
return e.set_algorithm_id(X.from_algorithm_id(be.EdDSA)), e.set_header(X.new_int(wt.new_negative(Kt.from_str("1"))), Ht.new_int(wt.new_i32(6))), e.set_header(X.new_int(wt.new_negative(Kt.from_str("2"))), Ht.new_bytes(r.key.to_public().as_bytes())), e;
|
|
522
522
|
}, Is = (r, e) => {
|
|
523
|
-
const t =
|
|
524
|
-
t.set_algorithm_id(X.from_algorithm_id(
|
|
525
|
-
const
|
|
526
|
-
r.externalAAD !== void 0 &&
|
|
527
|
-
const o =
|
|
528
|
-
return
|
|
523
|
+
const t = te.new(), s = te.new();
|
|
524
|
+
t.set_algorithm_id(X.from_algorithm_id(be.EdDSA)), t.set_header(X.new_text("address"), Ht.new_bytes(e.address.to_bytes()));
|
|
525
|
+
const a = je.new(Xe.new(t), s), i = Ze.new(a, _(r.payload), !1);
|
|
526
|
+
r.externalAAD !== void 0 && i.set_external_aad(_(r.externalAAD));
|
|
527
|
+
const o = i.make_data_to_sign(), c = e.key.sign(o.to_bytes());
|
|
528
|
+
return i.build(c.to_bytes());
|
|
529
529
|
};
|
|
530
|
-
var
|
|
530
|
+
var re = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ve = {}, Q = { exports: {} };
|
|
531
531
|
$.notEqual = fs;
|
|
532
532
|
$.notOk = _s;
|
|
533
533
|
$.equal = ps;
|
|
534
534
|
$.ok = $;
|
|
535
|
-
var
|
|
535
|
+
var De = $;
|
|
536
536
|
function ps(r, e, t) {
|
|
537
537
|
$(r == e, t);
|
|
538
538
|
}
|
|
@@ -550,25 +550,25 @@ var V = { exports: {} };
|
|
|
550
550
|
function ys(r) {
|
|
551
551
|
throw new Error('Could not dynamically require "' + r + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
552
552
|
}
|
|
553
|
-
var xs =
|
|
554
|
-
|
|
555
|
-
function
|
|
556
|
-
if (!
|
|
553
|
+
var xs = Lt;
|
|
554
|
+
Lt.supported = typeof WebAssembly < "u";
|
|
555
|
+
function Lt(r) {
|
|
556
|
+
if (!Lt.supported)
|
|
557
557
|
return null;
|
|
558
|
-
var e = r && r.imports, t = Cs("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBg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ASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"), s = null, n = {
|
|
558
|
+
var e = r && r.imports, t = Cs("AGFzbQEAAAABEANgAn9/AGADf39/AGABfwADBQQAAQICBQUBAQroBwdNBQZtZW1vcnkCAAxibGFrZTJiX2luaXQAAA5ibGFrZTJiX3VwZGF0ZQABDWJsYWtlMmJfZmluYWwAAhBibGFrZTJiX2NvbXByZXNzAAMK00AElgMAIABCADcDACAAQQhqQgA3AwAgAEEQakIANwMAIABBGGpCADcDACAAQSBqQgA3AwAgAEEoakIANwMAIABBMGpCADcDACAAQThqQgA3AwAgAEHAAGpCADcDACAAQcgAakIANwMAIABB0ABqQgA3AwAgAEHYAGpCADcDACAAQeAAakIANwMAIABB6ABqQgA3AwAgAEHwAGpCADcDACAAQfgAakIANwMAIABBgAFqQoiS853/zPmE6gBBACkDAIU3AwAgAEGIAWpCu86qptjQ67O7f0EIKQMAhTcDACAAQZABakKr8NP0r+68tzxBECkDAIU3AwAgAEGYAWpC8e30+KWn/aelf0EYKQMAhTcDACAAQaABakLRhZrv+s+Uh9EAQSApAwCFNwMAIABBqAFqQp/Y+dnCkdqCm39BKCkDAIU3AwAgAEGwAWpC6/qG2r+19sEfQTApAwCFNwMAIABBuAFqQvnC+JuRo7Pw2wBBOCkDAIU3AwAgAEHAAWpCADcDACAAQcgBakIANwMAIABB0AFqQgA3AwALbQEDfyAAQcABaiEDIABByAFqIQQgBCkDAKchBQJAA0AgASACRg0BIAVBgAFGBEAgAyADKQMAIAWtfDcDAEEAIQUgABADCyAAIAVqIAEtAAA6AAAgBUEBaiEFIAFBAWohAQwACwsgBCAFrTcDAAtkAQN/IABBwAFqIQEgAEHIAWohAiABIAEpAwAgAikDAHw3AwAgAEHQAWpCfzcDACACKQMApyEDAkADQCADQYABRg0BIAAgA2pBADoAACADQQFqIQMMAAsLIAIgA603AwAgABADC+U7AiB+CX8gAEGAAWohISAAQYgBaiEiIABBkAFqISMgAEGYAWohJCAAQaABaiElIABBqAFqISYgAEGwAWohJyAAQbgBaiEoICEpAwAhASAiKQMAIQIgIykDACEDICQpAwAhBCAlKQMAIQUgJikDACEGICcpAwAhByAoKQMAIQhCiJLznf/M+YTqACEJQrvOqqbY0Ouzu38hCkKr8NP0r+68tzwhC0Lx7fT4paf9p6V/IQxC0YWa7/rPlIfRACENQp/Y+dnCkdqCm38hDkLr+obav7X2wR8hD0L5wvibkaOz8NsAIRAgACkDACERIABBCGopAwAhEiAAQRBqKQMAIRMgAEEYaikDACEUIABBIGopAwAhFSAAQShqKQMAIRYgAEEwaikDACEXIABBOGopAwAhGCAAQcAAaikDACEZIABByABqKQMAIRogAEHQAGopAwAhGyAAQdgAaikDACEcIABB4ABqKQMAIR0gAEHoAGopAwAhHiAAQfAAaikDACEfIABB+ABqKQMAISAgDSAAQcABaikDAIUhDSAPIABB0AFqKQMAhSEPIAEgBSARfHwhASANIAGFQiCKIQ0gCSANfCEJIAUgCYVCGIohBSABIAUgEnx8IQE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IAUgCYVCP4ohBSACIAYgFXx8IQIgDiAChUIgiiEOIAogDnwhCiAGIAqFQhiKIQYgAiAGIBl8fCECIA4gAoVCEIohDiAKIA58IQogBiAKhUI/iiEGIAMgByAafHwhAyAPIAOFQiCKIQ8gCyAPfCELIAcgC4VCGIohByADIAcgIHx8IQMgDyADhUIQiiEPIAsgD3whCyAHIAuFQj+KIQcgBCAIIB58fCEEIBAgBIVCIIohECAMIBB8IQwgCCAMhUIYiiEIIAQgCCAXfHwhBCAQIASFQhCKIRAgDCAQfCEMIAggDIVCP4ohCCABIAYgEnx8IQEgECABhUIgiiEQIAsgEHwhCyAGIAuFQhiKIQYgASAGIB18fCEBIBAgAYVCEIohECALIBB8IQsgBiALhUI/iiEGIAIgByARfHwhAiANIAKFQiCKIQ0gDCANfCEMIAcgDIVCGIohByACIAcgE3x8IQIgDSAChUIQiiENIAwgDXwhDCAHIAyFQj+KIQcgAyAIIBx8fCEDIA4gA4VCIIohDiAJIA58IQkgCCAJhUIYiiEIIAMgCCAYfHwhAyAOIAOFQhCKIQ4gCSAOfCEJIAggCYVCP4ohCCAEIAUgFnx8IQQgDyAEhUIgiiEPIAogD3whCiAFIAqFQhiKIQUgBCAFIBR8fCEEIA8gBIVCEIohDyAKIA98IQogBSAKhUI/iiEFICEgISkDACABIAmFhTcDACAiICIpAwAgAiAKhYU3AwAgIyAjKQMAIAMgC4WFNwMAICQgJCkDACAEIAyFhTcDACAlICUpAwAgBSANhYU3AwAgJiAmKQMAIAYgDoWFNwMAICcgJykDACAHIA+FhTcDACAoICgpAwAgCCAQhYU3AwAL"), s = null, a = {
|
|
559
559
|
buffer: t,
|
|
560
560
|
memory: null,
|
|
561
561
|
exports: null,
|
|
562
|
-
realloc:
|
|
562
|
+
realloc: i,
|
|
563
563
|
onload: o
|
|
564
564
|
};
|
|
565
565
|
return o(function() {
|
|
566
|
-
}),
|
|
567
|
-
function
|
|
568
|
-
|
|
566
|
+
}), a;
|
|
567
|
+
function i(u) {
|
|
568
|
+
a.exports.memory.grow(Math.ceil(Math.abs(u - a.memory.length) / 65536)), a.memory = new Uint8Array(a.exports.memory.buffer);
|
|
569
569
|
}
|
|
570
570
|
function o(u) {
|
|
571
|
-
if (
|
|
571
|
+
if (a.exports)
|
|
572
572
|
return u();
|
|
573
573
|
if (s) {
|
|
574
574
|
s.then(u.bind(null, null)).catch(u);
|
|
@@ -584,7 +584,7 @@ function Rt(r) {
|
|
|
584
584
|
o(u);
|
|
585
585
|
}
|
|
586
586
|
function c(u) {
|
|
587
|
-
|
|
587
|
+
a.exports = u.instance.exports, a.memory = a.exports.memory && a.exports.memory.buffer && new Uint8Array(a.exports.memory.buffer);
|
|
588
588
|
}
|
|
589
589
|
}
|
|
590
590
|
function Cs(r) {
|
|
@@ -593,78 +593,78 @@ function Cs(r) {
|
|
|
593
593
|
function ws(r) {
|
|
594
594
|
return r.charCodeAt(0);
|
|
595
595
|
}
|
|
596
|
-
var
|
|
597
|
-
V.exports =
|
|
598
|
-
var
|
|
596
|
+
var H = De, y = xs(), L = 64, Bt = [];
|
|
597
|
+
V.exports = U;
|
|
598
|
+
var ae = V.exports.BYTES_MIN = 16, ne = V.exports.BYTES_MAX = 64;
|
|
599
599
|
V.exports.BYTES = 32;
|
|
600
|
-
var
|
|
600
|
+
var ie = V.exports.KEYBYTES_MIN = 16, oe = V.exports.KEYBYTES_MAX = 64;
|
|
601
601
|
V.exports.KEYBYTES = 32;
|
|
602
|
-
var
|
|
603
|
-
function
|
|
604
|
-
if (!(this instanceof
|
|
605
|
-
return new
|
|
602
|
+
var ce = V.exports.SALTBYTES = 16, ue = V.exports.PERSONALBYTES = 16;
|
|
603
|
+
function U(r, e, t, s, a) {
|
|
604
|
+
if (!(this instanceof U))
|
|
605
|
+
return new U(r, e, t, s, a);
|
|
606
606
|
if (!(y && y.exports))
|
|
607
607
|
throw new Error("WASM not loaded. Wait for Blake2b.ready(cb)");
|
|
608
|
-
r || (r = 32),
|
|
608
|
+
r || (r = 32), a !== !0 && (H(r >= ae, "digestLength must be at least " + ae + ", was given " + r), H(r <= ne, "digestLength must be at most " + ne + ", was given " + r), e != null && H(e.length >= ie, "key must be at least " + ie + ", was given " + e.length), e != null && H(e.length <= oe, "key must be at least " + oe + ", was given " + e.length), t != null && H(t.length === ce, "salt must be exactly " + ce + ", was given " + t.length), s != null && H(s.length === ue, "personal must be exactly " + ue + ", was given " + s.length)), Bt.length || (Bt.push(L), L += 216), this.digestLength = r, this.finalized = !1, this.pointer = Bt.pop(), y.memory.fill(0, 0, 64), y.memory[0] = this.digestLength, y.memory[1] = e ? e.length : 0, y.memory[2] = 1, y.memory[3] = 1, t && y.memory.set(t, 32), s && y.memory.set(s, 48), this.pointer + 216 > y.memory.length && y.realloc(this.pointer + 216), y.exports.blake2b_init(this.pointer, this.digestLength), e && (this.update(e), y.memory.fill(0, L, L + e.length), y.memory[this.pointer + 200] = 128);
|
|
609
609
|
}
|
|
610
|
-
|
|
611
|
-
return
|
|
610
|
+
U.prototype.update = function(r) {
|
|
611
|
+
return H(this.finalized === !1, "Hash instance finalized"), H(r, "input must be TypedArray or Buffer"), L + r.length > y.memory.length && y.realloc(L + r.length), y.memory.set(r, L), y.exports.blake2b_update(this.pointer, L, L + r.length), this;
|
|
612
612
|
};
|
|
613
|
-
|
|
614
|
-
if (
|
|
613
|
+
U.prototype.digest = function(r) {
|
|
614
|
+
if (H(this.finalized === !1, "Hash instance finalized"), this.finalized = !0, Bt.push(this.pointer), y.exports.blake2b_final(this.pointer), !r || r === "binary")
|
|
615
615
|
return y.memory.slice(this.pointer + 128, this.pointer + 128 + this.digestLength);
|
|
616
616
|
if (r === "hex")
|
|
617
617
|
return Ss(y.memory, this.pointer + 128, this.digestLength);
|
|
618
|
-
|
|
618
|
+
H(r.length >= this.digestLength, "input must be TypedArray or Buffer");
|
|
619
619
|
for (var e = 0; e < this.digestLength; e++)
|
|
620
620
|
r[e] = y.memory[this.pointer + 128 + e];
|
|
621
621
|
return r;
|
|
622
622
|
};
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
623
|
+
U.prototype.final = U.prototype.digest;
|
|
624
|
+
U.WASM = y && y.buffer;
|
|
625
|
+
U.SUPPORTED = typeof WebAssembly < "u";
|
|
626
|
+
U.ready = function(r) {
|
|
627
627
|
if (r || (r = Bs), !y)
|
|
628
628
|
return r(new Error("WebAssembly not supported"));
|
|
629
629
|
var e = new Promise(function(t, s) {
|
|
630
|
-
y.onload(function(
|
|
631
|
-
|
|
630
|
+
y.onload(function(a) {
|
|
631
|
+
a ? s() : t(), r(a);
|
|
632
632
|
});
|
|
633
633
|
});
|
|
634
634
|
return e;
|
|
635
635
|
};
|
|
636
|
-
|
|
636
|
+
U.prototype.ready = U.ready;
|
|
637
637
|
function Bs() {
|
|
638
638
|
}
|
|
639
639
|
function Ss(r, e, t) {
|
|
640
|
-
for (var s = "",
|
|
641
|
-
s += Es(r[e +
|
|
640
|
+
for (var s = "", a = 0; a < t; a++)
|
|
641
|
+
s += Es(r[e + a]);
|
|
642
642
|
return s;
|
|
643
643
|
}
|
|
644
644
|
function Es(r) {
|
|
645
645
|
return r < 16 ? "0" + r.toString(16) : r.toString(16);
|
|
646
646
|
}
|
|
647
|
-
var j =
|
|
647
|
+
var j = De, pt = V.exports;
|
|
648
648
|
function _t(r, e, t) {
|
|
649
|
-
var s = r[e] + r[t],
|
|
650
|
-
s >= 4294967296 &&
|
|
649
|
+
var s = r[e] + r[t], a = r[e + 1] + r[t + 1];
|
|
650
|
+
s >= 4294967296 && a++, r[e] = s, r[e + 1] = a;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
653
|
-
var
|
|
654
|
-
t < 0 && (
|
|
655
|
-
var
|
|
656
|
-
|
|
652
|
+
function de(r, e, t, s) {
|
|
653
|
+
var a = r[e] + t;
|
|
654
|
+
t < 0 && (a += 4294967296);
|
|
655
|
+
var i = r[e + 1] + s;
|
|
656
|
+
a >= 4294967296 && i++, r[e] = a, r[e + 1] = i;
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function ke(r, e) {
|
|
659
659
|
return r[e] ^ r[e + 1] << 8 ^ r[e + 2] << 16 ^ r[e + 3] << 24;
|
|
660
660
|
}
|
|
661
|
-
function J(r, e, t, s,
|
|
662
|
-
var o =
|
|
663
|
-
_t(
|
|
664
|
-
var l =
|
|
665
|
-
|
|
661
|
+
function J(r, e, t, s, a, i) {
|
|
662
|
+
var o = mt[a], c = mt[a + 1], u = mt[i], d = mt[i + 1];
|
|
663
|
+
_t(p, r, e), de(p, r, o, c);
|
|
664
|
+
var l = p[s] ^ p[r], m = p[s + 1] ^ p[r + 1];
|
|
665
|
+
p[s] = m, p[s + 1] = l, _t(p, t, s), l = p[e] ^ p[t], m = p[e + 1] ^ p[t + 1], p[e] = l >>> 24 ^ m << 8, p[e + 1] = m >>> 24 ^ l << 8, _t(p, r, e), de(p, r, u, d), l = p[s] ^ p[r], m = p[s + 1] ^ p[r + 1], p[s] = l >>> 16 ^ m << 16, p[s + 1] = m >>> 16 ^ l << 16, _t(p, t, s), l = p[e] ^ p[t], m = p[e + 1] ^ p[t + 1], p[e] = m >>> 31 ^ l << 1, p[e + 1] = l >>> 31 ^ m << 1;
|
|
666
666
|
}
|
|
667
|
-
var
|
|
667
|
+
var Te = new Uint32Array([
|
|
668
668
|
4089235720,
|
|
669
669
|
1779033703,
|
|
670
670
|
2227873595,
|
|
@@ -874,19 +874,19 @@ var De = new Uint32Array([
|
|
|
874
874
|
7,
|
|
875
875
|
5,
|
|
876
876
|
3
|
|
877
|
-
],
|
|
877
|
+
], E = new Uint8Array(bs.map(function(r) {
|
|
878
878
|
return r * 2;
|
|
879
|
-
})),
|
|
880
|
-
function
|
|
879
|
+
})), p = new Uint32Array(32), mt = new Uint32Array(32);
|
|
880
|
+
function Ue(r, e) {
|
|
881
881
|
var t = 0;
|
|
882
882
|
for (t = 0; t < 16; t++)
|
|
883
|
-
|
|
884
|
-
for (
|
|
885
|
-
|
|
883
|
+
p[t] = r.h[t], p[t + 16] = Te[t];
|
|
884
|
+
for (p[24] = p[24] ^ r.t, p[25] = p[25] ^ r.t / 4294967296, e && (p[28] = ~p[28], p[29] = ~p[29]), t = 0; t < 32; t++)
|
|
885
|
+
mt[t] = ke(r.b, 4 * t);
|
|
886
886
|
for (t = 0; t < 12; t++)
|
|
887
|
-
J(0, 8, 16, 24,
|
|
887
|
+
J(0, 8, 16, 24, E[t * 16 + 0], E[t * 16 + 1]), J(2, 10, 18, 26, E[t * 16 + 2], E[t * 16 + 3]), J(4, 12, 20, 28, E[t * 16 + 4], E[t * 16 + 5]), J(6, 14, 22, 30, E[t * 16 + 6], E[t * 16 + 7]), J(0, 10, 20, 30, E[t * 16 + 8], E[t * 16 + 9]), J(2, 12, 22, 24, E[t * 16 + 10], E[t * 16 + 11]), J(4, 14, 16, 26, E[t * 16 + 12], E[t * 16 + 13]), J(6, 8, 18, 28, E[t * 16 + 14], E[t * 16 + 15]);
|
|
888
888
|
for (t = 0; t < 16; t++)
|
|
889
|
-
r.h[t] = r.h[t] ^
|
|
889
|
+
r.h[t] = r.h[t] ^ p[t] ^ p[t + 16];
|
|
890
890
|
}
|
|
891
891
|
var W = new Uint8Array([
|
|
892
892
|
0,
|
|
@@ -956,12 +956,12 @@ var W = new Uint8Array([
|
|
|
956
956
|
]);
|
|
957
957
|
function ct(r, e, t, s) {
|
|
958
958
|
W.fill(0), this.b = new Uint8Array(128), this.h = new Uint32Array(16), this.t = 0, this.c = 0, this.outlen = r, W[0] = r, e && (W[1] = e.length), W[2] = 1, W[3] = 1, t && W.set(t, 32), s && W.set(s, 48);
|
|
959
|
-
for (var
|
|
960
|
-
this.h[
|
|
961
|
-
e && (
|
|
959
|
+
for (var a = 0; a < 16; a++)
|
|
960
|
+
this.h[a] = Te[a] ^ ke(W, a * 4);
|
|
961
|
+
e && (Pe(this, e), this.c = 128);
|
|
962
962
|
}
|
|
963
963
|
ct.prototype.update = function(r) {
|
|
964
|
-
return j(r != null, "input must be Uint8Array or Buffer"),
|
|
964
|
+
return j(r != null, "input must be Uint8Array or Buffer"), Pe(this, r), this;
|
|
965
965
|
};
|
|
966
966
|
ct.prototype.digest = function(r) {
|
|
967
967
|
var e = !r || r === "binary" || r === "hex" ? new Uint8Array(this.outlen) : r;
|
|
@@ -973,14 +973,14 @@ ct.ready = function(r) {
|
|
|
973
973
|
r();
|
|
974
974
|
});
|
|
975
975
|
};
|
|
976
|
-
function
|
|
976
|
+
function Pe(r, e) {
|
|
977
977
|
for (var t = 0; t < e.length; t++)
|
|
978
|
-
r.c === 128 && (r.t += r.c,
|
|
978
|
+
r.c === 128 && (r.t += r.c, Ue(r, !1), r.c = 0), r.b[r.c++] = e[t];
|
|
979
979
|
}
|
|
980
980
|
function Qs(r, e) {
|
|
981
981
|
for (r.t += r.c; r.c < 128; )
|
|
982
982
|
r.b[r.c++] = 0;
|
|
983
|
-
|
|
983
|
+
Ue(r, !0);
|
|
984
984
|
for (var t = 0; t < r.outlen; t++)
|
|
985
985
|
e[t] = r.h[t >> 2] >> 8 * (t & 3);
|
|
986
986
|
return e;
|
|
@@ -993,38 +993,38 @@ function vs(r) {
|
|
|
993
993
|
function Ds(r) {
|
|
994
994
|
return r < 16 ? "0" + r.toString(16) : r.toString(16);
|
|
995
995
|
}
|
|
996
|
-
var
|
|
997
|
-
|
|
998
|
-
return
|
|
996
|
+
var Ne = ct;
|
|
997
|
+
Q.exports = function(e, t, s, a, i) {
|
|
998
|
+
return i !== !0 && (j(e >= he, "outlen must be at least " + he + ", was given " + e), j(e <= le, "outlen must be at most " + le + ", was given " + e), t != null && j(t.length >= me, "key must be at least " + me + ", was given " + t.length), t != null && j(t.length <= ge, "key must be at most " + ge + ", was given " + t.length), s != null && j(s.length === Ae, "salt must be exactly " + Ae + ", was given " + s.length), a != null && j(a.length === Ie, "personal must be exactly " + Ie + ", was given " + a.length)), new Ne(e, t, s, a);
|
|
999
999
|
};
|
|
1000
|
-
|
|
1000
|
+
Q.exports.ready = function(r) {
|
|
1001
1001
|
pt.ready(function() {
|
|
1002
1002
|
r();
|
|
1003
1003
|
});
|
|
1004
1004
|
};
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
var
|
|
1008
|
-
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1011
|
-
var
|
|
1005
|
+
Q.exports.WASM_SUPPORTED = pt.SUPPORTED;
|
|
1006
|
+
Q.exports.WASM_LOADED = !1;
|
|
1007
|
+
var he = Q.exports.BYTES_MIN = 16, le = Q.exports.BYTES_MAX = 64;
|
|
1008
|
+
Q.exports.BYTES = 32;
|
|
1009
|
+
var me = Q.exports.KEYBYTES_MIN = 16, ge = Q.exports.KEYBYTES_MAX = 64;
|
|
1010
|
+
Q.exports.KEYBYTES = 32;
|
|
1011
|
+
var Ae = Q.exports.SALTBYTES = 16, Ie = Q.exports.PERSONALBYTES = 16;
|
|
1012
1012
|
pt.ready(function(r) {
|
|
1013
|
-
r || (
|
|
1013
|
+
r || (Q.exports.WASM_LOADED = !0, Ne = pt);
|
|
1014
1014
|
});
|
|
1015
1015
|
var ut = {};
|
|
1016
1016
|
Object.defineProperty(ut, "__esModule", { value: !0 });
|
|
1017
1017
|
ut.bech32m = ut.bech32 = void 0;
|
|
1018
|
-
const Qt = "qpzry9x8gf2tvdw0s3jn54khce6mua7l",
|
|
1018
|
+
const Qt = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", Ke = {};
|
|
1019
1019
|
for (let r = 0; r < Qt.length; r++) {
|
|
1020
1020
|
const e = Qt.charAt(r);
|
|
1021
|
-
|
|
1021
|
+
Ke[e] = r;
|
|
1022
1022
|
}
|
|
1023
1023
|
function ot(r) {
|
|
1024
1024
|
const e = r >> 25;
|
|
1025
1025
|
return (r & 33554431) << 5 ^ -(e >> 0 & 1) & 996825010 ^ -(e >> 1 & 1) & 642813549 ^ -(e >> 2 & 1) & 513874426 ^ -(e >> 3 & 1) & 1027748829 ^ -(e >> 4 & 1) & 705979059;
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function pe(r) {
|
|
1028
1028
|
let e = 1;
|
|
1029
1029
|
for (let t = 0; t < r.length; ++t) {
|
|
1030
1030
|
const s = r.charCodeAt(t);
|
|
@@ -1039,59 +1039,59 @@ function me(r) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
return e;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1043
|
-
let
|
|
1042
|
+
function Gt(r, e, t, s) {
|
|
1043
|
+
let a = 0, i = 0;
|
|
1044
1044
|
const o = (1 << t) - 1, c = [];
|
|
1045
1045
|
for (let u = 0; u < r.length; ++u)
|
|
1046
|
-
for (
|
|
1047
|
-
|
|
1046
|
+
for (a = a << e | r[u], i += e; i >= t; )
|
|
1047
|
+
i -= t, c.push(a >> i & o);
|
|
1048
1048
|
if (s)
|
|
1049
|
-
|
|
1049
|
+
i > 0 && c.push(a << t - i & o);
|
|
1050
1050
|
else {
|
|
1051
|
-
if (
|
|
1051
|
+
if (i >= e)
|
|
1052
1052
|
return "Excess padding";
|
|
1053
|
-
if (
|
|
1053
|
+
if (a << t - i & o)
|
|
1054
1054
|
return "Non-zero padding";
|
|
1055
1055
|
}
|
|
1056
1056
|
return c;
|
|
1057
1057
|
}
|
|
1058
1058
|
function ks(r) {
|
|
1059
|
-
return
|
|
1059
|
+
return Gt(r, 8, 5, !0);
|
|
1060
1060
|
}
|
|
1061
1061
|
function Ts(r) {
|
|
1062
|
-
const e =
|
|
1062
|
+
const e = Gt(r, 5, 8, !1);
|
|
1063
1063
|
if (Array.isArray(e))
|
|
1064
1064
|
return e;
|
|
1065
1065
|
}
|
|
1066
1066
|
function Us(r) {
|
|
1067
|
-
const e =
|
|
1067
|
+
const e = Gt(r, 5, 8, !1);
|
|
1068
1068
|
if (Array.isArray(e))
|
|
1069
1069
|
return e;
|
|
1070
1070
|
throw new Error(e);
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function He(r) {
|
|
1073
1073
|
let e;
|
|
1074
1074
|
r === "bech32" ? e = 1 : e = 734539939;
|
|
1075
1075
|
function t(o, c, u) {
|
|
1076
1076
|
if (u = u || 90, o.length + 7 + c.length > u)
|
|
1077
1077
|
throw new TypeError("Exceeds length limit");
|
|
1078
1078
|
o = o.toLowerCase();
|
|
1079
|
-
let d =
|
|
1079
|
+
let d = pe(o);
|
|
1080
1080
|
if (typeof d == "string")
|
|
1081
1081
|
throw new Error(d);
|
|
1082
1082
|
let l = o + "1";
|
|
1083
|
-
for (let
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1083
|
+
for (let m = 0; m < c.length; ++m) {
|
|
1084
|
+
const g = c[m];
|
|
1085
|
+
if (g >> 5 !== 0)
|
|
1086
1086
|
throw new Error("Non 5-bit word");
|
|
1087
|
-
d = ot(d) ^
|
|
1087
|
+
d = ot(d) ^ g, l += Qt.charAt(g);
|
|
1088
1088
|
}
|
|
1089
|
-
for (let
|
|
1089
|
+
for (let m = 0; m < 6; ++m)
|
|
1090
1090
|
d = ot(d);
|
|
1091
1091
|
d ^= e;
|
|
1092
|
-
for (let
|
|
1093
|
-
const
|
|
1094
|
-
l += Qt.charAt(
|
|
1092
|
+
for (let m = 0; m < 6; ++m) {
|
|
1093
|
+
const g = d >> (5 - m) * 5 & 31;
|
|
1094
|
+
l += Qt.charAt(g);
|
|
1095
1095
|
}
|
|
1096
1096
|
return l;
|
|
1097
1097
|
}
|
|
@@ -1109,65 +1109,65 @@ function Ne(r) {
|
|
|
1109
1109
|
return "No separator character for " + o;
|
|
1110
1110
|
if (l === 0)
|
|
1111
1111
|
return "Missing prefix for " + o;
|
|
1112
|
-
const
|
|
1113
|
-
if (
|
|
1112
|
+
const m = o.slice(0, l), g = o.slice(l + 1);
|
|
1113
|
+
if (g.length < 6)
|
|
1114
1114
|
return "Data too short";
|
|
1115
|
-
let
|
|
1116
|
-
if (typeof
|
|
1117
|
-
return
|
|
1118
|
-
const
|
|
1119
|
-
for (let
|
|
1120
|
-
const
|
|
1115
|
+
let A = pe(m);
|
|
1116
|
+
if (typeof A == "string")
|
|
1117
|
+
return A;
|
|
1118
|
+
const I = [];
|
|
1119
|
+
for (let x = 0; x < g.length; ++x) {
|
|
1120
|
+
const v = g.charAt(x), f = Ke[v];
|
|
1121
1121
|
if (f === void 0)
|
|
1122
|
-
return "Unknown character " +
|
|
1123
|
-
|
|
1122
|
+
return "Unknown character " + v;
|
|
1123
|
+
A = ot(A) ^ f, !(x + 6 >= g.length) && I.push(f);
|
|
1124
1124
|
}
|
|
1125
|
-
return
|
|
1125
|
+
return A !== e ? "Invalid checksum for " + o : { prefix: m, words: I };
|
|
1126
1126
|
}
|
|
1127
|
-
function
|
|
1127
|
+
function a(o, c) {
|
|
1128
1128
|
const u = s(o, c);
|
|
1129
1129
|
if (typeof u == "object")
|
|
1130
1130
|
return u;
|
|
1131
1131
|
}
|
|
1132
|
-
function
|
|
1132
|
+
function i(o, c) {
|
|
1133
1133
|
const u = s(o, c);
|
|
1134
1134
|
if (typeof u == "object")
|
|
1135
1135
|
return u;
|
|
1136
1136
|
throw new Error(u);
|
|
1137
1137
|
}
|
|
1138
1138
|
return {
|
|
1139
|
-
decodeUnsafe:
|
|
1140
|
-
decode:
|
|
1139
|
+
decodeUnsafe: a,
|
|
1140
|
+
decode: i,
|
|
1141
1141
|
encode: t,
|
|
1142
1142
|
toWords: ks,
|
|
1143
1143
|
fromWordsUnsafe: Ts,
|
|
1144
1144
|
fromWords: Us
|
|
1145
1145
|
};
|
|
1146
1146
|
}
|
|
1147
|
-
ut.bech32 =
|
|
1148
|
-
ut.bech32m =
|
|
1149
|
-
var Ps =
|
|
1147
|
+
ut.bech32 = He("bech32");
|
|
1148
|
+
ut.bech32m = He("bech32m");
|
|
1149
|
+
var Ps = re && re.__importDefault || function(r) {
|
|
1150
1150
|
return r && r.__esModule ? r : { default: r };
|
|
1151
1151
|
};
|
|
1152
|
-
Object.defineProperty(
|
|
1153
|
-
const Ns = Ps(
|
|
1154
|
-
class
|
|
1152
|
+
Object.defineProperty(ve, "__esModule", { value: !0 });
|
|
1153
|
+
const Ns = Ps(Q.exports), yt = ut, Nt = "asset";
|
|
1154
|
+
class At {
|
|
1155
1155
|
constructor(e) {
|
|
1156
1156
|
this.hashBuf = e;
|
|
1157
1157
|
}
|
|
1158
1158
|
static fromHash(e) {
|
|
1159
|
-
return new
|
|
1159
|
+
return new At(e);
|
|
1160
1160
|
}
|
|
1161
1161
|
static fromParts(e, t) {
|
|
1162
1162
|
const s = (0, Ns.default)(20).update(new Uint8Array([...e, ...t])).digest("binary");
|
|
1163
|
-
return
|
|
1163
|
+
return At.fromHash(s);
|
|
1164
1164
|
}
|
|
1165
1165
|
static fromBech32(e) {
|
|
1166
1166
|
const { prefix: t, words: s } = yt.bech32.decode(e);
|
|
1167
1167
|
if (t !== Nt)
|
|
1168
1168
|
throw new Error("Invalid asset fingerprint");
|
|
1169
|
-
const
|
|
1170
|
-
return
|
|
1169
|
+
const a = Buffer.from(yt.bech32.fromWords(s));
|
|
1170
|
+
return At.fromHash(a);
|
|
1171
1171
|
}
|
|
1172
1172
|
fingerprint() {
|
|
1173
1173
|
const e = yt.bech32.toWords(this.hashBuf);
|
|
@@ -1183,33 +1183,33 @@ class mt {
|
|
|
1183
1183
|
return this.fingerprint().slice(-6);
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
1186
|
-
var Ks =
|
|
1187
|
-
const
|
|
1188
|
-
const t = Fs(r), s = t.derive(Pt + 1852).derive(Pt + 1815).derive(Pt + e),
|
|
1189
|
-
return s.free(), t.free(), { paymentKey:
|
|
1190
|
-
},
|
|
1186
|
+
var Ks = ve.default = At;
|
|
1187
|
+
const Hs = Ks, Ms = (r, e) => {
|
|
1188
|
+
const t = Fs(r), s = t.derive(Pt + 1852).derive(Pt + 1815).derive(Pt + e), a = s.derive(0).derive(0).to_raw_key(), i = s.derive(2).derive(0).to_raw_key();
|
|
1189
|
+
return s.free(), t.free(), { paymentKey: a, stakeKey: i };
|
|
1190
|
+
}, at = (r) => n.Address.from_bytes(_(r)), Fs = (r) => n.Bip32PrivateKey.from_bytes(_(r)), Os = (r) => n.DataHash.from_bytes(_(r)), F = (r) => n.Ed25519KeyHash.from_bytes(_(r)), Rs = (r) => n.Ed25519Signature.from_bytes(_(r)), Dt = (r) => n.NativeScript.from_bytes(_(r)), Vs = (r) => n.PublicKey.from_bytes(_(r)), Me = (r) => n.PlutusData.from_bytes(_(r)), dt = (r, e) => n.PlutusScript.from_bytes_with_version(_(r), Y[e]), qs = (r) => n.ScriptRef.from_bytes(_(r)), Ys = (r) => n.ScriptHash.from_bytes(_(r)), O = (r) => n.Transaction.from_bytes(_(r)), Fe = (r) => n.TransactionHash.from_bytes(_(r)), fe = (r) => n.TransactionUnspentOutput.from_bytes(_(r)), Ls = (r) => n.TransactionWitnessSet.from_bytes(_(r)), Gs = (r) => n.Value.from_bytes(_(r)), K = (r) => n.Address.from_bech32(r), $t = (r) => n.BaseAddress.from_address(K(r)), Oe = (r) => n.EnterpriseAddress.from_address(K(r)), Re = (r) => n.RewardAddress.from_address(K(r)), k = (r) => Buffer.from(r).toString("hex"), _ = (r) => r.length % 2 === 0 && /^[0-9A-F]*$/i.test(r) ? Buffer.from(r, "hex") : Buffer.from(r, "utf-8"), kt = (r) => {
|
|
1191
1191
|
const e = (t) => {
|
|
1192
1192
|
const s = new Array();
|
|
1193
|
-
for (let
|
|
1194
|
-
s.push(kt(t.get(
|
|
1193
|
+
for (let a = 0; a < t.len(); a += 1)
|
|
1194
|
+
s.push(kt(t.get(a)));
|
|
1195
1195
|
return s;
|
|
1196
1196
|
};
|
|
1197
1197
|
switch (r.kind()) {
|
|
1198
|
-
case
|
|
1198
|
+
case n.NativeScriptKind.ScriptAll: {
|
|
1199
1199
|
const t = r.as_script_all();
|
|
1200
1200
|
return {
|
|
1201
1201
|
type: "all",
|
|
1202
1202
|
scripts: e(t.native_scripts())
|
|
1203
1203
|
};
|
|
1204
1204
|
}
|
|
1205
|
-
case
|
|
1205
|
+
case n.NativeScriptKind.ScriptAny: {
|
|
1206
1206
|
const t = r.as_script_any();
|
|
1207
1207
|
return {
|
|
1208
1208
|
type: "any",
|
|
1209
1209
|
scripts: e(t.native_scripts())
|
|
1210
1210
|
};
|
|
1211
1211
|
}
|
|
1212
|
-
case
|
|
1212
|
+
case n.NativeScriptKind.ScriptNOfK: {
|
|
1213
1213
|
const t = r.as_script_n_of_k();
|
|
1214
1214
|
return {
|
|
1215
1215
|
type: "atLeast",
|
|
@@ -1217,53 +1217,47 @@ const Ms = Ks, Hs = (r, e) => {
|
|
|
1217
1217
|
scripts: e(t.native_scripts())
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
|
-
case
|
|
1221
|
-
const t = r.as_timelock_start();
|
|
1220
|
+
case n.NativeScriptKind.TimelockStart:
|
|
1222
1221
|
return {
|
|
1223
1222
|
type: "after",
|
|
1224
|
-
slot:
|
|
1223
|
+
slot: r.as_timelock_start().slot_bignum().to_str()
|
|
1225
1224
|
};
|
|
1226
|
-
|
|
1227
|
-
case i.NativeScriptKind.TimelockExpiry: {
|
|
1228
|
-
const t = r.as_timelock_expiry();
|
|
1225
|
+
case n.NativeScriptKind.TimelockExpiry:
|
|
1229
1226
|
return {
|
|
1230
1227
|
type: "before",
|
|
1231
|
-
slot:
|
|
1228
|
+
slot: r.as_timelock_expiry().slot_bignum().to_str()
|
|
1232
1229
|
};
|
|
1233
|
-
|
|
1234
|
-
case i.NativeScriptKind.ScriptPubkey: {
|
|
1235
|
-
const t = r.as_script_pubkey();
|
|
1230
|
+
case n.NativeScriptKind.ScriptPubkey:
|
|
1236
1231
|
return {
|
|
1237
1232
|
type: "sig",
|
|
1238
|
-
keyHash:
|
|
1233
|
+
keyHash: r.as_script_pubkey().addr_keyhash().to_hex()
|
|
1239
1234
|
};
|
|
1240
|
-
}
|
|
1241
1235
|
default:
|
|
1242
1236
|
throw new Error(`Script Kind: ${r.kind()}, is not supported`);
|
|
1243
1237
|
}
|
|
1244
1238
|
}, Tt = (r) => {
|
|
1245
1239
|
const e = (t) => {
|
|
1246
|
-
const s =
|
|
1247
|
-
return t.forEach((
|
|
1248
|
-
s.add(Tt(
|
|
1240
|
+
const s = n.NativeScripts.new();
|
|
1241
|
+
return t.forEach((a) => {
|
|
1242
|
+
s.add(Tt(a));
|
|
1249
1243
|
}), s;
|
|
1250
1244
|
};
|
|
1251
1245
|
switch (r.type) {
|
|
1252
1246
|
case "all":
|
|
1253
|
-
return
|
|
1247
|
+
return n.NativeScript.new_script_all(n.ScriptAll.new(e(r.scripts)));
|
|
1254
1248
|
case "any":
|
|
1255
|
-
return
|
|
1249
|
+
return n.NativeScript.new_script_any(n.ScriptAny.new(e(r.scripts)));
|
|
1256
1250
|
case "atLeast":
|
|
1257
|
-
return
|
|
1251
|
+
return n.NativeScript.new_script_n_of_k(n.ScriptNOfK.new(r.required, e(r.scripts)));
|
|
1258
1252
|
case "after":
|
|
1259
|
-
return
|
|
1253
|
+
return n.NativeScript.new_timelock_start(n.TimelockStart.new_timelockstart(n.BigNum.from_str(r.slot)));
|
|
1260
1254
|
case "before":
|
|
1261
|
-
return
|
|
1255
|
+
return n.NativeScript.new_timelock_expiry(n.TimelockExpiry.new_timelockexpiry(n.BigNum.from_str(r.slot)));
|
|
1262
1256
|
case "sig":
|
|
1263
|
-
return
|
|
1257
|
+
return n.NativeScript.new_script_pubkey(n.ScriptPubkey.new(F(r.keyHash)));
|
|
1264
1258
|
}
|
|
1265
1259
|
}, St = (r) => {
|
|
1266
|
-
var s,
|
|
1260
|
+
var s, a, i;
|
|
1267
1261
|
const e = (o) => {
|
|
1268
1262
|
const c = [];
|
|
1269
1263
|
for (let u = 0; u < o.len(); u += 1)
|
|
@@ -1272,77 +1266,77 @@ const Ms = Ks, Hs = (r, e) => {
|
|
|
1272
1266
|
}, t = (o) => {
|
|
1273
1267
|
const c = /* @__PURE__ */ new Map();
|
|
1274
1268
|
for (let u = 0; u < o.len(); u += 1) {
|
|
1275
|
-
const d = o.keys().get(u), l = o.get(d) ??
|
|
1269
|
+
const d = o.keys().get(u), l = o.get(d) ?? n.PlutusData.from_hex(b("NO_ITEM_FOUND_INSIDE_GOLD_ROOM"));
|
|
1276
1270
|
c.set(St(d), St(l));
|
|
1277
1271
|
}
|
|
1278
1272
|
return c;
|
|
1279
1273
|
};
|
|
1280
1274
|
switch (r.kind()) {
|
|
1281
|
-
case
|
|
1282
|
-
return
|
|
1283
|
-
case
|
|
1275
|
+
case n.PlutusDataKind.Bytes:
|
|
1276
|
+
return k(r.as_bytes() ?? new Uint8Array());
|
|
1277
|
+
case n.PlutusDataKind.Integer:
|
|
1284
1278
|
return parseInt(((s = r.as_integer()) == null ? void 0 : s.to_str()) ?? "0", 10);
|
|
1285
|
-
case
|
|
1286
|
-
return e(r.as_list() ??
|
|
1287
|
-
case
|
|
1288
|
-
return t(r.as_map() ??
|
|
1289
|
-
case
|
|
1279
|
+
case n.PlutusDataKind.List:
|
|
1280
|
+
return e(r.as_list() ?? n.PlutusList.new());
|
|
1281
|
+
case n.PlutusDataKind.Map:
|
|
1282
|
+
return t(r.as_map() ?? n.PlutusMap.new());
|
|
1283
|
+
case n.PlutusDataKind.ConstrPlutusData:
|
|
1290
1284
|
return {
|
|
1291
|
-
alternative: parseInt(((
|
|
1292
|
-
fields: e(((
|
|
1285
|
+
alternative: parseInt(((a = r.as_constr_plutus_data()) == null ? void 0 : a.alternative().to_str()) ?? "0", 10),
|
|
1286
|
+
fields: e(((i = r.as_constr_plutus_data()) == null ? void 0 : i.data()) ?? n.PlutusList.new())
|
|
1293
1287
|
};
|
|
1294
1288
|
default:
|
|
1295
1289
|
throw new Error(`PlutusData Kind: ${r.kind()}, is not supported`);
|
|
1296
1290
|
}
|
|
1297
|
-
},
|
|
1291
|
+
}, Z = (r) => {
|
|
1298
1292
|
const e = (t) => {
|
|
1299
|
-
const s =
|
|
1300
|
-
return t.forEach((
|
|
1301
|
-
s.add(
|
|
1293
|
+
const s = n.PlutusList.new();
|
|
1294
|
+
return t.forEach((a) => {
|
|
1295
|
+
s.add(Z(a));
|
|
1302
1296
|
}), s;
|
|
1303
1297
|
};
|
|
1304
1298
|
switch (typeof r) {
|
|
1305
1299
|
case "string":
|
|
1306
|
-
return
|
|
1300
|
+
return n.PlutusData.new_bytes(_(r));
|
|
1307
1301
|
case "number":
|
|
1308
|
-
return
|
|
1302
|
+
return n.PlutusData.new_integer(n.BigInt.from_str(r.toString()));
|
|
1309
1303
|
case "object":
|
|
1310
1304
|
if (r instanceof Array) {
|
|
1311
1305
|
const t = e(r);
|
|
1312
|
-
return
|
|
1306
|
+
return n.PlutusData.new_list(t);
|
|
1313
1307
|
} else if (r instanceof Map) {
|
|
1314
|
-
const t =
|
|
1315
|
-
return r.forEach((s,
|
|
1316
|
-
t.insert(
|
|
1317
|
-
}),
|
|
1308
|
+
const t = n.PlutusMap.new();
|
|
1309
|
+
return r.forEach((s, a) => {
|
|
1310
|
+
t.insert(Z(a), Z(s));
|
|
1311
|
+
}), n.PlutusData.new_map(t);
|
|
1318
1312
|
} else
|
|
1319
|
-
return
|
|
1313
|
+
return n.PlutusData.new_constr_plutus_data(n.ConstrPlutusData.new(n.BigNum.from_str(r.alternative.toString()), e(r.fields)));
|
|
1320
1314
|
}
|
|
1321
1315
|
}, $s = (r) => {
|
|
1322
|
-
const e =
|
|
1316
|
+
const e = n.Relays.new();
|
|
1323
1317
|
throw r.relays.forEach((t) => {
|
|
1324
|
-
e.add(
|
|
1318
|
+
e.add(Ve(t));
|
|
1325
1319
|
}), new Error("toPoolParams not implemented.");
|
|
1326
|
-
},
|
|
1320
|
+
}, Mt = (r) => {
|
|
1327
1321
|
const e = (t) => ss[t];
|
|
1328
|
-
return
|
|
1329
|
-
},
|
|
1322
|
+
return n.Redeemer.new(e(r.tag), n.BigNum.from_str(r.index.toString()), Z(r.data), n.ExUnits.new(n.BigNum.from_str(r.budget.mem.toString()), n.BigNum.from_str(r.budget.steps.toString())));
|
|
1323
|
+
}, Ve = (r) => {
|
|
1330
1324
|
switch (r.type) {
|
|
1331
1325
|
case "SingleHostAddr": {
|
|
1332
|
-
const e = r.IPV4 ?
|
|
1333
|
-
return
|
|
1326
|
+
const e = r.IPV4 ? n.Ipv4.new(new Uint8Array(r.IPV4.split(".").map((s) => parseInt(s)))) : void 0, t = r.IPV6 ? n.Ipv6.new(_(r.IPV6.replaceAll(":", ""))) : void 0;
|
|
1327
|
+
return n.Relay.new_single_host_addr(n.SingleHostAddr.new(r.port, e, t));
|
|
1334
1328
|
}
|
|
1335
1329
|
case "SingleHostName":
|
|
1336
|
-
return
|
|
1330
|
+
return n.Relay.new_single_host_name(n.SingleHostName.new(r.port, n.DNSRecordAorAAAA.new(r.domainName)));
|
|
1337
1331
|
case "MultiHostName":
|
|
1338
|
-
return
|
|
1332
|
+
return n.Relay.new_multi_host_name(n.MultiHostName.new(n.DNSRecordSRV.new(r.domainName)));
|
|
1339
1333
|
}
|
|
1340
|
-
},
|
|
1334
|
+
}, qe = (r) => {
|
|
1341
1335
|
if (r.is_plutus_script()) {
|
|
1342
1336
|
const t = r.plutus_script();
|
|
1343
1337
|
return {
|
|
1344
1338
|
code: t.to_hex(),
|
|
1345
|
-
version: Object.keys(
|
|
1339
|
+
version: Object.keys(Y).find((s) => Y[s].to_hex() === t.language_version().to_hex())
|
|
1346
1340
|
};
|
|
1347
1341
|
}
|
|
1348
1342
|
const e = r.native_script();
|
|
@@ -1350,12 +1344,12 @@ const Ms = Ks, Hs = (r, e) => {
|
|
|
1350
1344
|
}, ht = (r) => {
|
|
1351
1345
|
if ("code" in r) {
|
|
1352
1346
|
const e = dt(r.code, r.version);
|
|
1353
|
-
return
|
|
1347
|
+
return n.ScriptRef.new_plutus_script(e);
|
|
1354
1348
|
}
|
|
1355
|
-
return
|
|
1349
|
+
return n.ScriptRef.new_native_script(Tt(r));
|
|
1356
1350
|
}, vt = (r) => {
|
|
1357
|
-
var
|
|
1358
|
-
const e = r.output().has_data_hash() ? (
|
|
1351
|
+
var a, i, o;
|
|
1352
|
+
const e = r.output().has_data_hash() ? (a = r.output().data_hash()) == null ? void 0 : a.to_hex() : void 0, t = r.output().has_plutus_data() ? (i = r.output().plutus_data()) == null ? void 0 : i.to_hex() : void 0, s = r.output().has_script_ref() ? (o = r.output().script_ref()) == null ? void 0 : o.to_hex() : void 0;
|
|
1359
1353
|
return {
|
|
1360
1354
|
input: {
|
|
1361
1355
|
outputIndex: r.input().index(),
|
|
@@ -1363,100 +1357,100 @@ const Ms = Ks, Hs = (r, e) => {
|
|
|
1363
1357
|
},
|
|
1364
1358
|
output: {
|
|
1365
1359
|
address: r.output().address().to_bech32(),
|
|
1366
|
-
amount:
|
|
1360
|
+
amount: Ye(r.output().amount()),
|
|
1367
1361
|
dataHash: e,
|
|
1368
1362
|
plutusData: t,
|
|
1369
1363
|
scriptRef: s
|
|
1370
1364
|
}
|
|
1371
1365
|
};
|
|
1372
|
-
},
|
|
1373
|
-
const e =
|
|
1374
|
-
return r.output.dataHash !== void 0 && t.set_data_hash(Os(r.output.dataHash)), r.output.plutusData !== void 0 && t.set_plutus_data(
|
|
1375
|
-
},
|
|
1366
|
+
}, M = (r) => {
|
|
1367
|
+
const e = n.TransactionInput.new(Fe(r.input.txHash), r.input.outputIndex), t = n.TransactionOutput.new(K(r.output.address), G(r.output.amount));
|
|
1368
|
+
return r.output.dataHash !== void 0 && t.set_data_hash(Os(r.output.dataHash)), r.output.plutusData !== void 0 && t.set_plutus_data(Me(r.output.plutusData)), r.output.scriptRef !== void 0 && t.set_script_ref(qs(r.output.scriptRef)), n.TransactionUnspentOutput.new(e, t);
|
|
1369
|
+
}, _e = (r) => {
|
|
1376
1370
|
const e = r.split(".")[1] ?? "0", t = `${parseInt(e, 10)}`, s = "1" + "0".repeat(e.length);
|
|
1377
|
-
return
|
|
1378
|
-
},
|
|
1371
|
+
return n.UnitInterval.new(n.BigNum.from_str(t), n.BigNum.from_str(s));
|
|
1372
|
+
}, b = (r) => r.length % 2 === 0 && /^[0-9A-F]*$/i.test(r) ? r : k(Buffer.from(r, "utf-8")), zt = (r) => Buffer.from(r, "hex").toString("utf-8"), Ye = (r) => {
|
|
1379
1373
|
const e = [
|
|
1380
1374
|
{ unit: "lovelace", quantity: r.coin().to_str() }
|
|
1381
1375
|
], t = r.multiasset();
|
|
1382
1376
|
if (t !== void 0) {
|
|
1383
1377
|
const s = t.keys();
|
|
1384
|
-
for (let
|
|
1385
|
-
const
|
|
1378
|
+
for (let a = 0; a < s.len(); a += 1) {
|
|
1379
|
+
const i = s.get(a), o = t.get(i);
|
|
1386
1380
|
if (o !== void 0) {
|
|
1387
1381
|
const c = o.keys();
|
|
1388
1382
|
for (let u = 0; u < c.len(); u += 1) {
|
|
1389
|
-
const d = c.get(u), l = o.get(d) ??
|
|
1390
|
-
e.push({ unit:
|
|
1383
|
+
const d = c.get(u), l = o.get(d) ?? n.BigNum.from_str("0"), m = i.to_hex() + k(d.name());
|
|
1384
|
+
e.push({ unit: m, quantity: l.to_str() });
|
|
1391
1385
|
}
|
|
1392
1386
|
}
|
|
1393
1387
|
}
|
|
1394
1388
|
}
|
|
1395
1389
|
return e;
|
|
1396
|
-
},
|
|
1397
|
-
const e = r.find((
|
|
1398
|
-
t.forEach((
|
|
1399
|
-
const o =
|
|
1400
|
-
r.filter((c) => c.unit.slice(0,
|
|
1401
|
-
o.insert(
|
|
1402
|
-
}), s.insert(Ys(
|
|
1390
|
+
}, G = (r) => {
|
|
1391
|
+
const e = r.find((i) => i.unit === "lovelace"), t = Array.from(new Set(r.filter((i) => i.unit !== "lovelace").map((i) => i.unit.slice(0, R)))), s = n.MultiAsset.new();
|
|
1392
|
+
t.forEach((i) => {
|
|
1393
|
+
const o = n.Assets.new();
|
|
1394
|
+
r.filter((c) => c.unit.slice(0, R) === i).forEach((c) => {
|
|
1395
|
+
o.insert(n.AssetName.new(_(c.unit.slice(R))), n.BigNum.from_str(c.quantity));
|
|
1396
|
+
}), s.insert(Ys(i), o);
|
|
1403
1397
|
});
|
|
1404
|
-
const
|
|
1405
|
-
return (r.length > 1 || !e) &&
|
|
1406
|
-
},
|
|
1398
|
+
const a = n.Value.new(n.BigNum.from_str(e ? e.quantity : "0"));
|
|
1399
|
+
return (r.length > 1 || !e) && a.set_multiasset(s), a;
|
|
1400
|
+
}, ye = (r, e, t) => n.BaseAddress.new(r, n.StakeCredential.from_keyhash(e), n.StakeCredential.from_keyhash(t)), Le = (r, e = "") => n.Bip32PrivateKey.from_bip39_entropy(_(r), _(b(e))), Ft = (r) => n.DataCost.new_coins_per_byte(n.BigNum.from_str(r)), zs = (r) => {
|
|
1407
1401
|
if (typeof r != "object" || !("input" in r))
|
|
1408
|
-
return
|
|
1409
|
-
const e =
|
|
1402
|
+
return n.DatumSource.new(Z(r));
|
|
1403
|
+
const e = M(r);
|
|
1410
1404
|
if (e.output().has_plutus_data())
|
|
1411
|
-
return
|
|
1405
|
+
return n.DatumSource.new_ref_input(e.input());
|
|
1412
1406
|
throw new Error(`No inline datum found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1413
|
-
},
|
|
1407
|
+
}, xe = (r, e) => n.EnterpriseAddress.new(r, n.StakeCredential.from_keyhash(e)), Ce = (r, e) => {
|
|
1414
1408
|
if (typeof r == "string")
|
|
1415
|
-
return
|
|
1409
|
+
return n.MintWitness.new_native_script(Dt(r));
|
|
1416
1410
|
if (e === void 0)
|
|
1417
1411
|
throw new Error("Minting with plutus requires a redeemer to be defined");
|
|
1418
1412
|
if (e.tag !== "MINT")
|
|
1419
1413
|
throw new Error("Minting redeemer's tag must be defined as 'MINT'");
|
|
1420
|
-
return
|
|
1414
|
+
return n.MintWitness.new_plutus_script(Rt(r), Mt({
|
|
1421
1415
|
tag: "MINT",
|
|
1422
1416
|
index: 0,
|
|
1423
|
-
budget:
|
|
1417
|
+
budget: nt,
|
|
1424
1418
|
data: {
|
|
1425
1419
|
alternative: 0,
|
|
1426
1420
|
fields: []
|
|
1427
1421
|
},
|
|
1428
1422
|
...e
|
|
1429
1423
|
}));
|
|
1430
|
-
},
|
|
1424
|
+
}, Ot = (r, e) => n.RewardAddress.new(r, n.StakeCredential.from_keyhash(e)), Rt = (r) => {
|
|
1431
1425
|
if ("code" in r)
|
|
1432
|
-
return
|
|
1433
|
-
const e =
|
|
1426
|
+
return n.PlutusScriptSource.new(dt(r.code, r.version));
|
|
1427
|
+
const e = M(r);
|
|
1434
1428
|
if (e.output().has_script_ref()) {
|
|
1435
1429
|
const t = e.output().script_ref();
|
|
1436
1430
|
if (t.is_plutus_script()) {
|
|
1437
|
-
const s =
|
|
1438
|
-
return
|
|
1431
|
+
const s = qe(t), a = dt(s.code, s.version).hash();
|
|
1432
|
+
return n.PlutusScriptSource.new_ref_input_with_lang_ver(a, e.input(), Y[s.version]);
|
|
1439
1433
|
}
|
|
1440
1434
|
}
|
|
1441
1435
|
throw new Error(`No plutus script reference found in UTxO: ${e.input().transaction_id().to_hex()}`);
|
|
1442
1436
|
}, xt = (r) => {
|
|
1443
|
-
const e =
|
|
1444
|
-
return
|
|
1445
|
-
}, Et = (r =
|
|
1446
|
-
const e =
|
|
1447
|
-
return
|
|
1448
|
-
},
|
|
1449
|
-
const e =
|
|
1450
|
-
return r.map((t) => t instanceof
|
|
1437
|
+
const e = n.ScriptPubkey.new(r);
|
|
1438
|
+
return n.NativeScript.new_script_pubkey(e);
|
|
1439
|
+
}, Et = (r = T) => {
|
|
1440
|
+
const e = n.TransactionBuilderConfigBuilder.new().coins_per_utxo_byte(n.BigNum.from_str(r.coinsPerUTxOSize)).ex_unit_prices(n.ExUnitPrices.new(_e(r.priceMem.toString()), _e(r.priceStep.toString()))).fee_algo(n.LinearFee.new(n.BigNum.from_str(r.minFeeA.toString()), n.BigNum.from_str(r.minFeeB.toString()))).key_deposit(n.BigNum.from_str(r.keyDeposit)).max_tx_size(r.maxTxSize).max_value_size(parseInt(r.maxValSize, 10)).pool_deposit(n.BigNum.from_str(r.poolDeposit)).build();
|
|
1441
|
+
return n.TransactionBuilder.new(e);
|
|
1442
|
+
}, we = (r) => {
|
|
1443
|
+
const e = n.TxInputsBuilder.new();
|
|
1444
|
+
return r.map((t) => t instanceof n.TransactionUnspentOutput ? t : M(t)).forEach((t) => {
|
|
1451
1445
|
e.add_input(t.output().address(), t.input(), t.output().amount());
|
|
1452
1446
|
}), e;
|
|
1453
1447
|
}, Ct = (r) => {
|
|
1454
1448
|
if (typeof r == "string")
|
|
1455
|
-
return
|
|
1456
|
-
let e =
|
|
1449
|
+
return n.TransactionOutputBuilder.new().with_address(K(r));
|
|
1450
|
+
let e = n.TransactionOutputBuilder.new().with_address(K(r.address));
|
|
1457
1451
|
if (r.datum) {
|
|
1458
|
-
const { value: t, inline: s } = r.datum,
|
|
1459
|
-
e = e.with_data_hash(
|
|
1452
|
+
const { value: t, inline: s } = r.datum, a = Z(t);
|
|
1453
|
+
e = e.with_data_hash(n.hash_plutus_data(a)), s && (e = e.with_plutus_data(a));
|
|
1460
1454
|
}
|
|
1461
1455
|
if (r.script) {
|
|
1462
1456
|
const t = ht(r.script);
|
|
@@ -1464,108 +1458,108 @@ const Ms = Ks, Hs = (r, e) => {
|
|
|
1464
1458
|
}
|
|
1465
1459
|
return e;
|
|
1466
1460
|
}, et = (r) => {
|
|
1467
|
-
const e = r.slice(0,
|
|
1461
|
+
const e = r.slice(0, R), t = r.includes(".") ? b(r.split(".")[1]) : r.slice(R);
|
|
1468
1462
|
return { policyId: e, assetName: t };
|
|
1469
|
-
}, h = (r) =>
|
|
1463
|
+
}, h = (r) => tt.isAxiosError(r) ? r.response ? JSON.stringify({
|
|
1470
1464
|
data: r.response.data,
|
|
1471
1465
|
headers: r.response.headers,
|
|
1472
1466
|
status: r.response.status
|
|
1473
|
-
}) : r.request ? JSON.stringify(r.request) : r.message : JSON.stringify(r),
|
|
1474
|
-
const e =
|
|
1475
|
-
return
|
|
1476
|
-
},
|
|
1467
|
+
}) : r.request ? JSON.stringify(r.request) : r.message : JSON.stringify(r), or = (r) => {
|
|
1468
|
+
const e = Z(r);
|
|
1469
|
+
return n.hash_plutus_data(e).to_hex();
|
|
1470
|
+
}, cr = (r, e = Date.now()) => {
|
|
1477
1471
|
if (bt[r]) {
|
|
1478
|
-
const [t, s,
|
|
1479
|
-
return parseInt(
|
|
1472
|
+
const [t, s, a, i] = bt[r];
|
|
1473
|
+
return parseInt(n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).div_floor(n.BigNum.from_str(i)).checked_add(n.BigNum.from_str(t)).to_str(), 10);
|
|
1480
1474
|
}
|
|
1481
1475
|
throw new Error(`Couldn't resolve EpochNo for network: ${r}`);
|
|
1482
|
-
},
|
|
1476
|
+
}, Js = (r, e) => Hs.fromParts(_(r), _(e)).fingerprint(), ur = (r, e) => rs[r][e], dr = (r) => Tt(r).hash().to_hex(), it = (r) => {
|
|
1483
1477
|
var e, t;
|
|
1484
1478
|
try {
|
|
1485
1479
|
const s = [
|
|
1486
|
-
(e =
|
|
1487
|
-
(t =
|
|
1488
|
-
].find((
|
|
1480
|
+
(e = $t(r)) == null ? void 0 : e.payment_cred().to_keyhash(),
|
|
1481
|
+
(t = Oe(r)) == null ? void 0 : t.payment_cred().to_keyhash()
|
|
1482
|
+
].find((a) => a !== void 0);
|
|
1489
1483
|
if (s !== void 0)
|
|
1490
1484
|
return s.to_hex();
|
|
1491
1485
|
throw new Error(`Couldn't resolve payment key hash from address: ${r}`);
|
|
1492
1486
|
} catch (s) {
|
|
1493
1487
|
throw new Error(`An error occurred during resolvePaymentKeyHash: ${s}.`);
|
|
1494
1488
|
}
|
|
1495
|
-
},
|
|
1489
|
+
}, hr = (r, e = 0) => {
|
|
1496
1490
|
const t = dt(r.code, r.version);
|
|
1497
|
-
return
|
|
1498
|
-
},
|
|
1491
|
+
return n.EnterpriseAddress.new(e, n.StakeCredential.from_scripthash(t.hash())).to_address().to_bech32();
|
|
1492
|
+
}, lr = (r) => {
|
|
1499
1493
|
try {
|
|
1500
|
-
const e =
|
|
1494
|
+
const e = Oe(r), t = e == null ? void 0 : e.payment_cred().to_scripthash();
|
|
1501
1495
|
if (t !== void 0)
|
|
1502
1496
|
return t.to_hex();
|
|
1503
1497
|
throw new Error(`Couldn't resolve script hash from address: ${r}`);
|
|
1504
1498
|
} catch (e) {
|
|
1505
1499
|
throw new Error(`An error occurred during resolveScriptHash: ${e}.`);
|
|
1506
1500
|
}
|
|
1507
|
-
},
|
|
1508
|
-
const e =
|
|
1501
|
+
}, mr = (r) => n.Ed25519KeyHash.from_hex(r).to_bech32("pool1"), gr = (r) => {
|
|
1502
|
+
const e = Se(r.join(" ")), t = Le(e), s = t.to_bech32();
|
|
1509
1503
|
return t.free(), s;
|
|
1510
|
-
},
|
|
1504
|
+
}, Ar = (r) => ht(r).to_hex(), Ir = (r, e = Date.now()) => {
|
|
1511
1505
|
if (bt[r]) {
|
|
1512
|
-
const [t, s,
|
|
1513
|
-
return
|
|
1506
|
+
const [t, s, a] = bt[r];
|
|
1507
|
+
return n.BigNum.from_str(e.toString()).div_floor(n.BigNum.from_str("1000")).checked_sub(n.BigNum.from_str(a)).checked_add(n.BigNum.from_str(s)).to_str();
|
|
1514
1508
|
}
|
|
1515
1509
|
throw new Error(`Couldn't resolve SlotNo for network: ${r}`);
|
|
1516
1510
|
}, Ut = (r) => {
|
|
1517
1511
|
try {
|
|
1518
|
-
const e = K(r), t =
|
|
1512
|
+
const e = K(r), t = $t(r), s = t == null ? void 0 : t.stake_cred().to_keyhash();
|
|
1519
1513
|
if (s !== void 0)
|
|
1520
|
-
return
|
|
1514
|
+
return Ot(e.network_id(), s).to_address().to_bech32();
|
|
1521
1515
|
throw new Error(`Couldn't resolve reward address from address: ${r}`);
|
|
1522
1516
|
} catch (e) {
|
|
1523
1517
|
throw new Error(`An error occurred during resolveRewardAddress: ${e}.`);
|
|
1524
1518
|
}
|
|
1525
|
-
},
|
|
1519
|
+
}, gt = (r) => {
|
|
1526
1520
|
var e, t;
|
|
1527
1521
|
try {
|
|
1528
1522
|
const s = [
|
|
1529
|
-
(e =
|
|
1530
|
-
(t =
|
|
1531
|
-
].find((
|
|
1523
|
+
(e = $t(r)) == null ? void 0 : e.stake_cred().to_keyhash(),
|
|
1524
|
+
(t = Re(r)) == null ? void 0 : t.payment_cred().to_keyhash()
|
|
1525
|
+
].find((a) => a !== void 0);
|
|
1532
1526
|
if (s !== void 0)
|
|
1533
1527
|
return s.to_hex();
|
|
1534
1528
|
throw new Error(`Couldn't resolve stake key hash from address: ${r}`);
|
|
1535
1529
|
} catch (s) {
|
|
1536
1530
|
throw new Error(`An error occurred during resolveStakeKeyHash: ${s}.`);
|
|
1537
1531
|
}
|
|
1538
|
-
},
|
|
1539
|
-
const e =
|
|
1540
|
-
return
|
|
1541
|
-
},
|
|
1532
|
+
}, Ge = (r, e = T.minFeeA, t = T.minFeeB) => (BigInt(e) * BigInt(r) + BigInt(t)).toString(), Ws = (r) => {
|
|
1533
|
+
const e = O(r).body();
|
|
1534
|
+
return n.hash_transaction(e).to_hex();
|
|
1535
|
+
}, pr = (r = "", e = 32) => {
|
|
1542
1536
|
if (e <= 0 || e > 2048)
|
|
1543
1537
|
throw new Error("Length must be bewteen 1 and 2048");
|
|
1544
|
-
const s =
|
|
1545
|
-
return
|
|
1546
|
-
},
|
|
1538
|
+
const s = Be("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")(e);
|
|
1539
|
+
return b(`${r}${s}`);
|
|
1540
|
+
}, $e = (r, e) => {
|
|
1547
1541
|
const t = r.vkeys();
|
|
1548
1542
|
if (t !== void 0) {
|
|
1549
1543
|
const s = /* @__PURE__ */ new Set();
|
|
1550
|
-
for (let
|
|
1551
|
-
s.add(t.get(
|
|
1552
|
-
for (let
|
|
1553
|
-
s.add(e.get(
|
|
1554
|
-
const
|
|
1555
|
-
return s.forEach((
|
|
1556
|
-
|
|
1557
|
-
}),
|
|
1544
|
+
for (let i = 0; i < t.len(); i += 1)
|
|
1545
|
+
s.add(t.get(i).to_hex());
|
|
1546
|
+
for (let i = 0; i < e.len(); i += 1)
|
|
1547
|
+
s.add(e.get(i).to_hex());
|
|
1548
|
+
const a = n.Vkeywitnesses.new();
|
|
1549
|
+
return s.forEach((i) => {
|
|
1550
|
+
a.add(n.Vkeywitness.from_hex(i));
|
|
1551
|
+
}), a;
|
|
1558
1552
|
}
|
|
1559
1553
|
return e;
|
|
1560
|
-
},
|
|
1561
|
-
class
|
|
1554
|
+
}, fr = (r) => St(Me(r)), _r = (r) => O(r).to_js_value();
|
|
1555
|
+
class yr {
|
|
1562
1556
|
_axiosInstance;
|
|
1563
1557
|
constructor(...e) {
|
|
1564
1558
|
if (typeof e[0] == "string" && e[0].startsWith("http"))
|
|
1565
|
-
this._axiosInstance =
|
|
1559
|
+
this._axiosInstance = tt.create({ baseURL: e[0] });
|
|
1566
1560
|
else {
|
|
1567
1561
|
const t = e[0], s = t.slice(0, 7);
|
|
1568
|
-
this._axiosInstance =
|
|
1562
|
+
this._axiosInstance = tt.create({
|
|
1569
1563
|
baseURL: `https://cardano-${s}.blockfrost.io/api/v${e[1] ?? 0}`,
|
|
1570
1564
|
headers: { project_id: t }
|
|
1571
1565
|
});
|
|
@@ -1574,8 +1568,8 @@ class Br {
|
|
|
1574
1568
|
async fetchAccountInfo(e) {
|
|
1575
1569
|
const t = e.startsWith("addr") ? Ut(e) : e;
|
|
1576
1570
|
try {
|
|
1577
|
-
const { data: s, status:
|
|
1578
|
-
if (
|
|
1571
|
+
const { data: s, status: a } = await this._axiosInstance.get(`accounts/${t}`);
|
|
1572
|
+
if (a === 200)
|
|
1579
1573
|
return {
|
|
1580
1574
|
poolId: s.pool_id,
|
|
1581
1575
|
active: s.active || s.active_epoch !== null,
|
|
@@ -1592,11 +1586,11 @@ class Br {
|
|
|
1592
1586
|
if (e) {
|
|
1593
1587
|
const { data: t, status: s } = await this._axiosInstance.get(`scripts/${e}`);
|
|
1594
1588
|
if (s === 200) {
|
|
1595
|
-
const
|
|
1589
|
+
const a = t.type.startsWith("plutus") ? {
|
|
1596
1590
|
code: await this.fetchPlutusScriptCBOR(e),
|
|
1597
1591
|
version: t.type.replace("plutus", "")
|
|
1598
1592
|
} : await this.fetchNativeScriptJSON(e);
|
|
1599
|
-
return ht(
|
|
1593
|
+
return ht(a).to_hex();
|
|
1600
1594
|
}
|
|
1601
1595
|
throw h(t);
|
|
1602
1596
|
}
|
|
@@ -1616,26 +1610,26 @@ class Br {
|
|
|
1616
1610
|
}
|
|
1617
1611
|
});
|
|
1618
1612
|
async fetchAddressUTxOs(e, t) {
|
|
1619
|
-
const s = t !== void 0 ? `/${t}` : "",
|
|
1620
|
-
const { data: u, status: d } = await this._axiosInstance.get(`${
|
|
1613
|
+
const s = t !== void 0 ? `/${t}` : "", a = `addresses/${e}/utxos` + s, i = async (o = 1, c = []) => {
|
|
1614
|
+
const { data: u, status: d } = await this._axiosInstance.get(`${a}?page=${o}`);
|
|
1621
1615
|
if (d === 200)
|
|
1622
|
-
return u.length > 0 ?
|
|
1616
|
+
return u.length > 0 ? i(o + 1, [
|
|
1623
1617
|
...c,
|
|
1624
1618
|
...await Promise.all(u.map((l) => this.toUTxO(l, l.tx_hash)))
|
|
1625
1619
|
]) : c;
|
|
1626
1620
|
throw h(u);
|
|
1627
1621
|
};
|
|
1628
1622
|
try {
|
|
1629
|
-
return await
|
|
1623
|
+
return await i();
|
|
1630
1624
|
} catch {
|
|
1631
1625
|
return [];
|
|
1632
1626
|
}
|
|
1633
1627
|
}
|
|
1634
1628
|
async fetchAssetAddresses(e) {
|
|
1635
|
-
const t = async (s = 1,
|
|
1636
|
-
const { policyId:
|
|
1629
|
+
const t = async (s = 1, a = []) => {
|
|
1630
|
+
const { policyId: i, assetName: o } = et(e), { data: c, status: u } = await this._axiosInstance.get(`assets/${i}${o}/addresses?page=${s}`);
|
|
1637
1631
|
if (u === 200)
|
|
1638
|
-
return c.length > 0 ? t(s + 1, [...
|
|
1632
|
+
return c.length > 0 ? t(s + 1, [...a, ...c]) : a;
|
|
1639
1633
|
throw h(c);
|
|
1640
1634
|
};
|
|
1641
1635
|
try {
|
|
@@ -1646,12 +1640,12 @@ class Br {
|
|
|
1646
1640
|
}
|
|
1647
1641
|
async fetchAssetMetadata(e) {
|
|
1648
1642
|
try {
|
|
1649
|
-
const { policyId: t, assetName: s } = et(e), { data:
|
|
1650
|
-
if (
|
|
1643
|
+
const { policyId: t, assetName: s } = et(e), { data: a, status: i } = await this._axiosInstance.get(`assets/${t}${s}`);
|
|
1644
|
+
if (i === 200)
|
|
1651
1645
|
return {
|
|
1652
|
-
...
|
|
1646
|
+
...a.onchain_metadata
|
|
1653
1647
|
};
|
|
1654
|
-
throw h(
|
|
1648
|
+
throw h(a);
|
|
1655
1649
|
} catch (t) {
|
|
1656
1650
|
throw h(t);
|
|
1657
1651
|
}
|
|
@@ -1684,12 +1678,12 @@ class Br {
|
|
|
1684
1678
|
}
|
|
1685
1679
|
async fetchCollectionAssets(e, t = 1) {
|
|
1686
1680
|
try {
|
|
1687
|
-
const { data: s, status:
|
|
1688
|
-
if (
|
|
1681
|
+
const { data: s, status: a } = await this._axiosInstance.get(`assets/policy/${e}?page=${t}`);
|
|
1682
|
+
if (a === 200)
|
|
1689
1683
|
return {
|
|
1690
|
-
assets: s.map((
|
|
1691
|
-
unit:
|
|
1692
|
-
quantity:
|
|
1684
|
+
assets: s.map((i) => ({
|
|
1685
|
+
unit: i.asset,
|
|
1686
|
+
quantity: i.quantity
|
|
1693
1687
|
})),
|
|
1694
1688
|
next: s.length === 100 ? t + 1 : null
|
|
1695
1689
|
};
|
|
@@ -1700,8 +1694,8 @@ class Br {
|
|
|
1700
1694
|
}
|
|
1701
1695
|
async fetchHandleAddress(e) {
|
|
1702
1696
|
try {
|
|
1703
|
-
const t =
|
|
1704
|
-
if (
|
|
1697
|
+
const t = b(e.replace("$", "")), { data: s, status: a } = await this._axiosInstance.get(`assets/${qt[1]}${t}/addresses`);
|
|
1698
|
+
if (a === 200)
|
|
1705
1699
|
return s[0].address;
|
|
1706
1700
|
throw h(s);
|
|
1707
1701
|
} catch (t) {
|
|
@@ -1763,10 +1757,10 @@ class Br {
|
|
|
1763
1757
|
try {
|
|
1764
1758
|
const { data: t, status: s } = await this._axiosInstance.get(`txs/${e}/utxos`);
|
|
1765
1759
|
if (s === 200) {
|
|
1766
|
-
const
|
|
1767
|
-
return
|
|
1768
|
-
|
|
1769
|
-
}), await Promise.all(
|
|
1760
|
+
const a = t.outputs, i = [];
|
|
1761
|
+
return a.forEach((c) => {
|
|
1762
|
+
i.push(this.toUTxO(c, e));
|
|
1763
|
+
}), await Promise.all(i);
|
|
1770
1764
|
}
|
|
1771
1765
|
throw h(t);
|
|
1772
1766
|
} catch (t) {
|
|
@@ -1774,23 +1768,23 @@ class Br {
|
|
|
1774
1768
|
}
|
|
1775
1769
|
}
|
|
1776
1770
|
onTxConfirmed(e, t, s = 100) {
|
|
1777
|
-
let
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1771
|
+
let a = 0;
|
|
1772
|
+
const i = setInterval(() => {
|
|
1773
|
+
a >= s && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
1780
1774
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
1781
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
1775
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(i), t());
|
|
1782
1776
|
}).catch(() => {
|
|
1783
|
-
|
|
1777
|
+
a += 1;
|
|
1784
1778
|
});
|
|
1785
1779
|
}).catch(() => {
|
|
1786
|
-
|
|
1780
|
+
a += 1;
|
|
1787
1781
|
});
|
|
1788
1782
|
}, 5e3);
|
|
1789
1783
|
}
|
|
1790
1784
|
async submitTx(e) {
|
|
1791
1785
|
try {
|
|
1792
|
-
const t = { "Content-Type": "application/cbor" }, { data: s, status:
|
|
1793
|
-
if (
|
|
1786
|
+
const t = { "Content-Type": "application/cbor" }, { data: s, status: a } = await this._axiosInstance.post("tx/submit", _(e), { headers: t });
|
|
1787
|
+
if (a === 200)
|
|
1794
1788
|
return s;
|
|
1795
1789
|
throw h(s);
|
|
1796
1790
|
} catch (t) {
|
|
@@ -1810,35 +1804,35 @@ class Br {
|
|
|
1810
1804
|
throw h(t);
|
|
1811
1805
|
}
|
|
1812
1806
|
}
|
|
1813
|
-
class
|
|
1807
|
+
class xr {
|
|
1814
1808
|
_axiosInstance;
|
|
1815
1809
|
constructor(e, t, s) {
|
|
1816
|
-
const
|
|
1817
|
-
this._axiosInstance =
|
|
1818
|
-
baseURL: `https://${
|
|
1810
|
+
const a = s.host ?? "ipfs.infura.io", i = s.port ?? 5001, o = s.version ?? 0;
|
|
1811
|
+
this._axiosInstance = tt.create({
|
|
1812
|
+
baseURL: `https://${a}:${i}/api/v${o}`,
|
|
1819
1813
|
auth: { username: e, password: t }
|
|
1820
1814
|
});
|
|
1821
1815
|
}
|
|
1822
1816
|
async uploadContent(e, t = !1) {
|
|
1823
1817
|
try {
|
|
1824
|
-
const s = { "Content-Type": "multipart/form-data" }, { data:
|
|
1825
|
-
if (
|
|
1826
|
-
return
|
|
1827
|
-
throw h(
|
|
1818
|
+
const s = { "Content-Type": "multipart/form-data" }, { data: a, status: i } = await this._axiosInstance.post(`add?recursive=${t}`, e, { headers: s });
|
|
1819
|
+
if (i === 200)
|
|
1820
|
+
return a;
|
|
1821
|
+
throw h(a);
|
|
1828
1822
|
} catch (s) {
|
|
1829
1823
|
throw h(s);
|
|
1830
1824
|
}
|
|
1831
1825
|
}
|
|
1832
1826
|
}
|
|
1833
|
-
class
|
|
1827
|
+
class Cr {
|
|
1834
1828
|
_axiosInstance;
|
|
1835
1829
|
constructor(...e) {
|
|
1836
|
-
typeof e[0] == "string" && e[0].startsWith("http") ? this._axiosInstance =
|
|
1830
|
+
typeof e[0] == "string" && e[0].startsWith("http") ? this._axiosInstance = tt.create({
|
|
1837
1831
|
baseURL: e[0],
|
|
1838
1832
|
headers: {
|
|
1839
1833
|
Authorization: `Bearer ${e[1]}`
|
|
1840
1834
|
}
|
|
1841
|
-
}) : this._axiosInstance =
|
|
1835
|
+
}) : this._axiosInstance = tt.create({
|
|
1842
1836
|
baseURL: `https://${e[0]}.koios.rest/api/v${e[2] ?? 0}`,
|
|
1843
1837
|
headers: {
|
|
1844
1838
|
Authorization: `Bearer ${e[1]}`
|
|
@@ -1847,10 +1841,10 @@ class Er {
|
|
|
1847
1841
|
}
|
|
1848
1842
|
async fetchAccountInfo(e) {
|
|
1849
1843
|
try {
|
|
1850
|
-
const t = e.startsWith("addr") ? Ut(e) : e, { data: s, status:
|
|
1844
|
+
const t = e.startsWith("addr") ? Ut(e) : e, { data: s, status: a } = await this._axiosInstance.post("account_info", {
|
|
1851
1845
|
_stake_addresses: [t]
|
|
1852
1846
|
});
|
|
1853
|
-
if (
|
|
1847
|
+
if (a === 200)
|
|
1854
1848
|
return {
|
|
1855
1849
|
poolId: s[0].delegated_pool,
|
|
1856
1850
|
active: s[0].status === "registered",
|
|
@@ -1865,12 +1859,12 @@ class Er {
|
|
|
1865
1859
|
}
|
|
1866
1860
|
async fetchAddressUTxOs(e, t) {
|
|
1867
1861
|
try {
|
|
1868
|
-
const { data: s, status:
|
|
1862
|
+
const { data: s, status: a } = await this._axiosInstance.post("address_info", {
|
|
1869
1863
|
_addresses: [e]
|
|
1870
1864
|
});
|
|
1871
|
-
if (
|
|
1872
|
-
const
|
|
1873
|
-
return t !== void 0 ?
|
|
1865
|
+
if (a === 200) {
|
|
1866
|
+
const i = s.flatMap((o) => o.utxo_set).map((o) => this.toUTxO(o, e));
|
|
1867
|
+
return t !== void 0 ? i.filter((o) => o.output.amount.find((c) => c.unit === t) !== void 0) : i;
|
|
1874
1868
|
}
|
|
1875
1869
|
throw h(s);
|
|
1876
1870
|
} catch {
|
|
@@ -1879,25 +1873,25 @@ class Er {
|
|
|
1879
1873
|
}
|
|
1880
1874
|
async fetchAssetAddresses(e) {
|
|
1881
1875
|
try {
|
|
1882
|
-
const { policyId: t, assetName: s } = et(e), { data:
|
|
1883
|
-
if (
|
|
1884
|
-
return
|
|
1876
|
+
const { policyId: t, assetName: s } = et(e), { data: a, status: i } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${t}&_asset_name=${s}`);
|
|
1877
|
+
if (i === 200)
|
|
1878
|
+
return a.map((o) => ({
|
|
1885
1879
|
address: o.payment_address,
|
|
1886
1880
|
quantity: o.quantity
|
|
1887
1881
|
}));
|
|
1888
|
-
throw h(
|
|
1882
|
+
throw h(a);
|
|
1889
1883
|
} catch (t) {
|
|
1890
1884
|
throw h(t);
|
|
1891
1885
|
}
|
|
1892
1886
|
}
|
|
1893
1887
|
async fetchAssetMetadata(e) {
|
|
1894
1888
|
try {
|
|
1895
|
-
const { policyId: t, assetName: s } = et(e), { data:
|
|
1896
|
-
if (
|
|
1889
|
+
const { policyId: t, assetName: s } = et(e), { data: a, status: i } = await this._axiosInstance.get(`asset_info?_asset_policy=${t}&_asset_name=${s}`);
|
|
1890
|
+
if (i === 200)
|
|
1897
1891
|
return {
|
|
1898
|
-
...
|
|
1892
|
+
...a[0].minting_tx_metadata[721][t][zt(s)]
|
|
1899
1893
|
};
|
|
1900
|
-
throw h(
|
|
1894
|
+
throw h(a);
|
|
1901
1895
|
} catch (t) {
|
|
1902
1896
|
throw h(t);
|
|
1903
1897
|
}
|
|
@@ -1932,12 +1926,12 @@ class Er {
|
|
|
1932
1926
|
}
|
|
1933
1927
|
async fetchCollectionAssets(e, t = 0) {
|
|
1934
1928
|
try {
|
|
1935
|
-
const { data: s, status:
|
|
1936
|
-
if (
|
|
1929
|
+
const { data: s, status: a } = await this._axiosInstance.get(`asset_policy_info?_asset_policy=${e}&limit=100&offset=${t}`);
|
|
1930
|
+
if (a === 200)
|
|
1937
1931
|
return {
|
|
1938
|
-
assets: s.map((
|
|
1939
|
-
unit: `${e}${
|
|
1940
|
-
quantity:
|
|
1932
|
+
assets: s.map((i) => ({
|
|
1933
|
+
unit: `${e}${i.asset_name}`,
|
|
1934
|
+
quantity: i.total_supply
|
|
1941
1935
|
})),
|
|
1942
1936
|
next: s.length === 100 ? t + 100 : null
|
|
1943
1937
|
};
|
|
@@ -1948,8 +1942,8 @@ class Er {
|
|
|
1948
1942
|
}
|
|
1949
1943
|
async fetchHandleAddress(e) {
|
|
1950
1944
|
try {
|
|
1951
|
-
const t =
|
|
1952
|
-
if (
|
|
1945
|
+
const t = b(e.replace("$", "")), { data: s, status: a } = await this._axiosInstance.get(`asset_address_list?_asset_policy=${qt[1]}&_asset_name=${t}`);
|
|
1946
|
+
if (a === 200)
|
|
1953
1947
|
return s[0].payment_address;
|
|
1954
1948
|
throw h(s);
|
|
1955
1949
|
} catch (t) {
|
|
@@ -1990,24 +1984,24 @@ class Er {
|
|
|
1990
1984
|
async fetchTxInfo(e) {
|
|
1991
1985
|
var t, s;
|
|
1992
1986
|
try {
|
|
1993
|
-
const { data:
|
|
1987
|
+
const { data: a, status: i } = await this._axiosInstance.post("tx_info", {
|
|
1994
1988
|
_tx_hashes: [e]
|
|
1995
1989
|
});
|
|
1996
|
-
if (
|
|
1990
|
+
if (i === 200)
|
|
1997
1991
|
return {
|
|
1998
|
-
block:
|
|
1999
|
-
deposit:
|
|
2000
|
-
fees:
|
|
2001
|
-
hash:
|
|
2002
|
-
index:
|
|
2003
|
-
invalidAfter: ((t =
|
|
2004
|
-
invalidBefore: ((s =
|
|
2005
|
-
slot:
|
|
2006
|
-
size:
|
|
1992
|
+
block: a[0].block_hash,
|
|
1993
|
+
deposit: a[0].deposit,
|
|
1994
|
+
fees: a[0].fee,
|
|
1995
|
+
hash: a[0].tx_hash,
|
|
1996
|
+
index: a[0].tx_block_index,
|
|
1997
|
+
invalidAfter: ((t = a[0].invalid_after) == null ? void 0 : t.toString()) ?? "",
|
|
1998
|
+
invalidBefore: ((s = a[0].invalid_before) == null ? void 0 : s.toString()) ?? "",
|
|
1999
|
+
slot: a[0].absolute_slot.toString(),
|
|
2000
|
+
size: a[0].tx_size
|
|
2007
2001
|
};
|
|
2008
|
-
throw h(
|
|
2009
|
-
} catch (
|
|
2010
|
-
throw h(
|
|
2002
|
+
throw h(a);
|
|
2003
|
+
} catch (a) {
|
|
2004
|
+
throw h(a);
|
|
2011
2005
|
}
|
|
2012
2006
|
}
|
|
2013
2007
|
async fetchUTxOs(e) {
|
|
@@ -2017,30 +2011,30 @@ class Er {
|
|
|
2017
2011
|
_tx_hashes: [e]
|
|
2018
2012
|
});
|
|
2019
2013
|
if (s === 200)
|
|
2020
|
-
return console.log(t[0]), t[0].outputs.map((
|
|
2014
|
+
return console.log(t[0]), t[0].outputs.map((i) => this.toUTxO(i, i.payment_addr.bech32));
|
|
2021
2015
|
throw h(t);
|
|
2022
2016
|
} catch (t) {
|
|
2023
2017
|
throw h(t);
|
|
2024
2018
|
}
|
|
2025
2019
|
}
|
|
2026
2020
|
onTxConfirmed(e, t, s = 100) {
|
|
2027
|
-
let
|
|
2028
|
-
const
|
|
2029
|
-
|
|
2021
|
+
let a = 0;
|
|
2022
|
+
const i = setInterval(() => {
|
|
2023
|
+
a >= s && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
2030
2024
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
2031
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
2025
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(i), t());
|
|
2032
2026
|
}).catch(() => {
|
|
2033
|
-
|
|
2027
|
+
a += 1;
|
|
2034
2028
|
});
|
|
2035
2029
|
}).catch(() => {
|
|
2036
|
-
|
|
2030
|
+
a += 1;
|
|
2037
2031
|
});
|
|
2038
2032
|
}, 5e3);
|
|
2039
2033
|
}
|
|
2040
2034
|
async submitTx(e) {
|
|
2041
2035
|
try {
|
|
2042
|
-
const t = { "Content-Type": "application/cbor" }, { data: s, status:
|
|
2043
|
-
if (
|
|
2036
|
+
const t = { "Content-Type": "application/cbor" }, { data: s, status: a } = await this._axiosInstance.post("submittx", _(e), { headers: t });
|
|
2037
|
+
if (a === 202)
|
|
2044
2038
|
return s;
|
|
2045
2039
|
throw h(s);
|
|
2046
2040
|
} catch (t) {
|
|
@@ -2048,7 +2042,7 @@ class Er {
|
|
|
2048
2042
|
}
|
|
2049
2043
|
}
|
|
2050
2044
|
toUTxO(e, t) {
|
|
2051
|
-
var s,
|
|
2045
|
+
var s, a;
|
|
2052
2046
|
return {
|
|
2053
2047
|
input: {
|
|
2054
2048
|
outputIndex: e.tx_index,
|
|
@@ -2058,15 +2052,15 @@ class Er {
|
|
|
2058
2052
|
address: t,
|
|
2059
2053
|
amount: [
|
|
2060
2054
|
{ unit: "lovelace", quantity: e.value },
|
|
2061
|
-
...e.asset_list.map((
|
|
2062
|
-
unit: `${
|
|
2063
|
-
quantity: `${
|
|
2055
|
+
...e.asset_list.map((i) => ({
|
|
2056
|
+
unit: `${i.policy_id}${i.asset_name}`,
|
|
2057
|
+
quantity: `${i.quantity}`
|
|
2064
2058
|
}))
|
|
2065
2059
|
],
|
|
2066
2060
|
dataHash: e.datum_hash ?? void 0,
|
|
2067
2061
|
plutusData: ((s = e.inline_datum) == null ? void 0 : s.bytes) ?? void 0,
|
|
2068
2062
|
scriptRef: this.resolveScriptRef(e.reference_script),
|
|
2069
|
-
scriptHash: ((
|
|
2063
|
+
scriptHash: ((a = e.reference_script) == null ? void 0 : a.hash) ?? void 0
|
|
2070
2064
|
}
|
|
2071
2065
|
};
|
|
2072
2066
|
}
|
|
@@ -2080,19 +2074,19 @@ class Er {
|
|
|
2080
2074
|
}
|
|
2081
2075
|
};
|
|
2082
2076
|
}
|
|
2083
|
-
class
|
|
2077
|
+
class wr {
|
|
2084
2078
|
_baseUrl;
|
|
2085
2079
|
constructor(...e) {
|
|
2086
|
-
this._baseUrl = es(e[0]) ?
|
|
2080
|
+
this._baseUrl = es(e[0]) ? as[e[0]] : e[0];
|
|
2087
2081
|
}
|
|
2088
2082
|
async evaluateTx(e) {
|
|
2089
2083
|
const t = await this.open();
|
|
2090
2084
|
return this.send(t, "EvaluateTx", {
|
|
2091
2085
|
evaluate: e
|
|
2092
|
-
}), new Promise((s,
|
|
2093
|
-
t.addEventListener("message", (
|
|
2086
|
+
}), new Promise((s, a) => {
|
|
2087
|
+
t.addEventListener("message", (i) => {
|
|
2094
2088
|
try {
|
|
2095
|
-
const { result: o } = JSON.parse(
|
|
2089
|
+
const { result: o } = JSON.parse(i.data);
|
|
2096
2090
|
o.EvaluationResult ? s(Object.keys(o.EvaluationResult).map((c) => ({
|
|
2097
2091
|
index: parseInt(c.split(":")[1], 10),
|
|
2098
2092
|
tag: c.split(":")[0].toUpperCase(),
|
|
@@ -2100,9 +2094,9 @@ class br {
|
|
|
2100
2094
|
mem: o.EvaluationResult[c].memory,
|
|
2101
2095
|
steps: o.EvaluationResult[c].steps
|
|
2102
2096
|
}
|
|
2103
|
-
}))) :
|
|
2097
|
+
}))) : a(o.EvaluationFailure), t.close();
|
|
2104
2098
|
} catch (o) {
|
|
2105
|
-
|
|
2099
|
+
a(o);
|
|
2106
2100
|
}
|
|
2107
2101
|
}, { once: !0 });
|
|
2108
2102
|
});
|
|
@@ -2110,23 +2104,23 @@ class br {
|
|
|
2110
2104
|
async onNextTx(e) {
|
|
2111
2105
|
const t = await this.open();
|
|
2112
2106
|
return this.send(t, "AwaitAcquire", {}), t.addEventListener("message", (s) => {
|
|
2113
|
-
const { result:
|
|
2114
|
-
if (
|
|
2107
|
+
const { result: a } = JSON.parse(s.data);
|
|
2108
|
+
if (a === null)
|
|
2115
2109
|
return this.send(t, "AwaitAcquire", {});
|
|
2116
|
-
|
|
2110
|
+
a.AwaitAcquired === void 0 && e(a), this.send(t, "NextTx", {});
|
|
2117
2111
|
}), () => t.close();
|
|
2118
2112
|
}
|
|
2119
2113
|
async submitTx(e) {
|
|
2120
2114
|
const t = await this.open();
|
|
2121
2115
|
return this.send(t, "SubmitTx", {
|
|
2122
2116
|
submit: e
|
|
2123
|
-
}), new Promise((s,
|
|
2124
|
-
t.addEventListener("message", (
|
|
2117
|
+
}), new Promise((s, a) => {
|
|
2118
|
+
t.addEventListener("message", (i) => {
|
|
2125
2119
|
try {
|
|
2126
|
-
const { result: o } = JSON.parse(
|
|
2127
|
-
o.SubmitSuccess ? s(o.SubmitSuccess.txId) :
|
|
2120
|
+
const { result: o } = JSON.parse(i.data);
|
|
2121
|
+
o.SubmitSuccess ? s(o.SubmitSuccess.txId) : a(o.SubmitFail), t.close();
|
|
2128
2122
|
} catch (o) {
|
|
2129
|
-
|
|
2123
|
+
a(o);
|
|
2130
2124
|
}
|
|
2131
2125
|
}, { once: !0 });
|
|
2132
2126
|
});
|
|
@@ -2147,11 +2141,11 @@ class br {
|
|
|
2147
2141
|
}));
|
|
2148
2142
|
}
|
|
2149
2143
|
}
|
|
2150
|
-
class
|
|
2144
|
+
class Br {
|
|
2151
2145
|
_axiosInstance;
|
|
2152
|
-
constructor(e, t, s,
|
|
2153
|
-
this._axiosInstance =
|
|
2154
|
-
baseURL: `https://cardano-${e}.tangocrypto.com/${t}/v${
|
|
2146
|
+
constructor(e, t, s, a = 1) {
|
|
2147
|
+
this._axiosInstance = tt.create({
|
|
2148
|
+
baseURL: `https://cardano-${e}.tangocrypto.com/${t}/v${a}`,
|
|
2155
2149
|
headers: { "x-api-key": s }
|
|
2156
2150
|
});
|
|
2157
2151
|
}
|
|
@@ -2159,12 +2153,12 @@ class Qr {
|
|
|
2159
2153
|
try {
|
|
2160
2154
|
const { data: t, status: s } = await this._axiosInstance.post("transactions/evaluate", { tx: e, utxos: [] });
|
|
2161
2155
|
if (s === 200)
|
|
2162
|
-
return t.redeemers.map((
|
|
2163
|
-
index:
|
|
2164
|
-
tag:
|
|
2156
|
+
return t.redeemers.map((a) => ({
|
|
2157
|
+
index: a.index,
|
|
2158
|
+
tag: a.purpose.toUpperCase(),
|
|
2165
2159
|
budget: {
|
|
2166
|
-
mem:
|
|
2167
|
-
steps:
|
|
2160
|
+
mem: a.unit_mem,
|
|
2161
|
+
steps: a.unit_steps
|
|
2168
2162
|
}
|
|
2169
2163
|
}));
|
|
2170
2164
|
throw h(t);
|
|
@@ -2174,8 +2168,8 @@ class Qr {
|
|
|
2174
2168
|
}
|
|
2175
2169
|
async fetchAccountInfo(e) {
|
|
2176
2170
|
try {
|
|
2177
|
-
const t = e.startsWith("addr") ? Ut(e) : e, { data: s, status:
|
|
2178
|
-
if (
|
|
2171
|
+
const t = e.startsWith("addr") ? Ut(e) : e, { data: s, status: a } = await this._axiosInstance.get(`wallets/${t}`);
|
|
2172
|
+
if (a === 200)
|
|
2179
2173
|
return {
|
|
2180
2174
|
poolId: s.pool_id,
|
|
2181
2175
|
active: s.active,
|
|
@@ -2189,26 +2183,26 @@ class Qr {
|
|
|
2189
2183
|
}
|
|
2190
2184
|
}
|
|
2191
2185
|
async fetchAddressUTxOs(e, t) {
|
|
2192
|
-
const s = t !== void 0 ? `/assets/${t}` : "",
|
|
2193
|
-
var
|
|
2194
|
-
const { data:
|
|
2195
|
-
if (
|
|
2196
|
-
return
|
|
2197
|
-
throw h(
|
|
2186
|
+
const s = t !== void 0 ? `/assets/${t}` : "", a = `addresses/${e}${s}/utxos?size=50`, i = async (d = "", l = []) => {
|
|
2187
|
+
var A;
|
|
2188
|
+
const { data: m, status: g } = await this._axiosInstance.get(`${a}&cursor=${d}`);
|
|
2189
|
+
if (g === 200)
|
|
2190
|
+
return m.cursor !== null && ((A = m.cursor) == null ? void 0 : A.length) > 0 ? i(m.cursor, [...l, ...m.data.map(u)]) : m.data.map(u);
|
|
2191
|
+
throw h(m);
|
|
2198
2192
|
}, o = (d, l) => {
|
|
2199
|
-
const
|
|
2193
|
+
const m = [
|
|
2200
2194
|
{
|
|
2201
2195
|
unit: "lovelace",
|
|
2202
2196
|
quantity: d.toString()
|
|
2203
2197
|
}
|
|
2204
2198
|
];
|
|
2205
|
-
return l.forEach((
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
unit: `${
|
|
2209
|
-
quantity:
|
|
2199
|
+
return l.forEach((g) => {
|
|
2200
|
+
const A = b(g.asset_name);
|
|
2201
|
+
m.push({
|
|
2202
|
+
unit: `${g.policy_id}${A}`,
|
|
2203
|
+
quantity: g.quantity.toString()
|
|
2210
2204
|
});
|
|
2211
|
-
}),
|
|
2205
|
+
}), m;
|
|
2212
2206
|
}, c = (d) => {
|
|
2213
2207
|
if (d) {
|
|
2214
2208
|
const l = d.type.startsWith("plutus") ? {
|
|
@@ -2234,21 +2228,21 @@ class Qr {
|
|
|
2234
2228
|
};
|
|
2235
2229
|
};
|
|
2236
2230
|
try {
|
|
2237
|
-
return await
|
|
2231
|
+
return await i();
|
|
2238
2232
|
} catch {
|
|
2239
2233
|
return [];
|
|
2240
2234
|
}
|
|
2241
2235
|
}
|
|
2242
2236
|
async fetchAssetAddresses(e) {
|
|
2243
|
-
const t = (
|
|
2244
|
-
address:
|
|
2245
|
-
quantity:
|
|
2246
|
-
}), s = async (
|
|
2237
|
+
const t = (a) => ({
|
|
2238
|
+
address: a.address,
|
|
2239
|
+
quantity: a.quantity.toString()
|
|
2240
|
+
}), s = async (a = "", i = []) => {
|
|
2247
2241
|
var l;
|
|
2248
|
-
const { policyId: o, assetName: c } = et(e), { data: u, status: d } = await this._axiosInstance.get(`assets/${o}${c}/addresses?size=100&cursor=${
|
|
2242
|
+
const { policyId: o, assetName: c } = et(e), { data: u, status: d } = await this._axiosInstance.get(`assets/${o}${c}/addresses?size=100&cursor=${a}`);
|
|
2249
2243
|
if (d === 200)
|
|
2250
2244
|
return u.cursor !== null && ((l = u.cursor) == null ? void 0 : l.length) > 0 ? s(u.cursor, [
|
|
2251
|
-
...
|
|
2245
|
+
...i,
|
|
2252
2246
|
...u.data.map(t)
|
|
2253
2247
|
]) : u.data.map(t);
|
|
2254
2248
|
throw h(u);
|
|
@@ -2262,12 +2256,12 @@ class Qr {
|
|
|
2262
2256
|
async fetchAssetMetadata(e) {
|
|
2263
2257
|
var t;
|
|
2264
2258
|
try {
|
|
2265
|
-
const { policyId: s, assetName:
|
|
2259
|
+
const { policyId: s, assetName: a } = et(e), { data: i, status: o } = await this._axiosInstance.get(`assets/${s}${a}`);
|
|
2266
2260
|
if (o === 200)
|
|
2267
2261
|
return {
|
|
2268
|
-
...(t =
|
|
2262
|
+
...(t = i.metadata.find((c) => c.label === 721)) == null ? void 0 : t.json[s][zt(a)]
|
|
2269
2263
|
};
|
|
2270
|
-
throw h(
|
|
2264
|
+
throw h(i);
|
|
2271
2265
|
} catch (s) {
|
|
2272
2266
|
throw h(s);
|
|
2273
2267
|
}
|
|
@@ -2300,12 +2294,12 @@ class Qr {
|
|
|
2300
2294
|
}
|
|
2301
2295
|
async fetchCollectionAssets(e, t = "") {
|
|
2302
2296
|
try {
|
|
2303
|
-
const { data: s, status:
|
|
2304
|
-
if (
|
|
2297
|
+
const { data: s, status: a } = await this._axiosInstance.get(`policies/${e}/assets?size=100&cursor=${t}`);
|
|
2298
|
+
if (a === 200)
|
|
2305
2299
|
return {
|
|
2306
|
-
assets: s.data.map((
|
|
2307
|
-
unit: `${
|
|
2308
|
-
quantity:
|
|
2300
|
+
assets: s.data.map((i) => ({
|
|
2301
|
+
unit: `${i.policy_id}${i.asset_name}`,
|
|
2302
|
+
quantity: i.quantity
|
|
2309
2303
|
})),
|
|
2310
2304
|
next: s.cursor
|
|
2311
2305
|
};
|
|
@@ -2316,8 +2310,8 @@ class Qr {
|
|
|
2316
2310
|
}
|
|
2317
2311
|
async fetchHandleAddress(e) {
|
|
2318
2312
|
try {
|
|
2319
|
-
const t =
|
|
2320
|
-
if (
|
|
2313
|
+
const t = b(e.replace("$", "")), { data: s, status: a } = await this._axiosInstance.get(`assets/${qt[1]}${t}/addresses`);
|
|
2314
|
+
if (a === 200)
|
|
2321
2315
|
return s.data[0].address;
|
|
2322
2316
|
throw h(s);
|
|
2323
2317
|
} catch (t) {
|
|
@@ -2377,29 +2371,29 @@ class Qr {
|
|
|
2377
2371
|
}
|
|
2378
2372
|
async fetchUTxOs(e) {
|
|
2379
2373
|
try {
|
|
2380
|
-
return [];
|
|
2374
|
+
return console.log(e), [];
|
|
2381
2375
|
} catch (t) {
|
|
2382
2376
|
throw h(t);
|
|
2383
2377
|
}
|
|
2384
2378
|
}
|
|
2385
2379
|
onTxConfirmed(e, t, s = 100) {
|
|
2386
|
-
let
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2380
|
+
let a = 0;
|
|
2381
|
+
const i = setInterval(() => {
|
|
2382
|
+
a >= s && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
2389
2383
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
2390
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
2384
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(i), t());
|
|
2391
2385
|
}).catch(() => {
|
|
2392
|
-
|
|
2386
|
+
a += 1;
|
|
2393
2387
|
});
|
|
2394
2388
|
}).catch(() => {
|
|
2395
|
-
|
|
2389
|
+
a += 1;
|
|
2396
2390
|
});
|
|
2397
2391
|
}, 5e3);
|
|
2398
2392
|
}
|
|
2399
2393
|
async submitTx(e) {
|
|
2400
2394
|
try {
|
|
2401
|
-
const t = { "Content-Type": "application/json" }, { data: s, status:
|
|
2402
|
-
if (
|
|
2395
|
+
const t = { "Content-Type": "application/json" }, { data: s, status: a } = await this._axiosInstance.post("transactions/submit", { tx: e }, { headers: t });
|
|
2396
|
+
if (a === 200)
|
|
2403
2397
|
return s.tx_id;
|
|
2404
2398
|
throw h(s);
|
|
2405
2399
|
} catch (t) {
|
|
@@ -2407,7 +2401,7 @@ class Qr {
|
|
|
2407
2401
|
}
|
|
2408
2402
|
}
|
|
2409
2403
|
}
|
|
2410
|
-
class
|
|
2404
|
+
class Sr {
|
|
2411
2405
|
_axiosInstance;
|
|
2412
2406
|
_amountsAsStrings = {
|
|
2413
2407
|
headers: {
|
|
@@ -2416,7 +2410,7 @@ class vr {
|
|
|
2416
2410
|
};
|
|
2417
2411
|
submitUrl;
|
|
2418
2412
|
constructor({ network: e, apiKey: t, turboSubmit: s = !1 }) {
|
|
2419
|
-
this._axiosInstance =
|
|
2413
|
+
this._axiosInstance = tt.create({
|
|
2420
2414
|
baseURL: `https://${e}.gomaestro-api.org/v1`,
|
|
2421
2415
|
headers: { "api-key": t }
|
|
2422
2416
|
}), this.submitUrl = s ? "txmanager/turbosubmit" : "txmanager";
|
|
@@ -2425,14 +2419,14 @@ class vr {
|
|
|
2425
2419
|
try {
|
|
2426
2420
|
const { data: t, status: s } = await this._axiosInstance.post("transactions/evaluate", { cbor: e });
|
|
2427
2421
|
if (s === 200) {
|
|
2428
|
-
const
|
|
2422
|
+
const a = {
|
|
2429
2423
|
spend: "SPEND",
|
|
2430
2424
|
mint: "MINT",
|
|
2431
2425
|
cert: "CERT",
|
|
2432
2426
|
wdrl: "REWARD"
|
|
2433
2427
|
};
|
|
2434
2428
|
return t.map((o) => {
|
|
2435
|
-
const c = o.ex_units, u = o.redeemer_index, d =
|
|
2429
|
+
const c = o.ex_units, u = o.redeemer_index, d = a[o.redeemer_tag];
|
|
2436
2430
|
return { budget: c, index: u, tag: d };
|
|
2437
2431
|
});
|
|
2438
2432
|
}
|
|
@@ -2444,15 +2438,15 @@ class vr {
|
|
|
2444
2438
|
async fetchAccountInfo(e) {
|
|
2445
2439
|
const t = e.startsWith("addr") ? Ut(e) : e;
|
|
2446
2440
|
try {
|
|
2447
|
-
const { data: s, status:
|
|
2448
|
-
if (
|
|
2449
|
-
const
|
|
2441
|
+
const { data: s, status: a } = await this._axiosInstance.get(`accounts/${t}`, this._amountsAsStrings);
|
|
2442
|
+
if (a === 200) {
|
|
2443
|
+
const i = s.data;
|
|
2450
2444
|
return {
|
|
2451
|
-
poolId:
|
|
2452
|
-
active:
|
|
2453
|
-
balance:
|
|
2454
|
-
rewards:
|
|
2455
|
-
withdrawals:
|
|
2445
|
+
poolId: i.delegated_pool,
|
|
2446
|
+
active: i.registered,
|
|
2447
|
+
balance: i.total_balance,
|
|
2448
|
+
rewards: i.rewards_available,
|
|
2449
|
+
withdrawals: i.total_withdrawn
|
|
2456
2450
|
};
|
|
2457
2451
|
}
|
|
2458
2452
|
throw h(s);
|
|
@@ -2461,49 +2455,49 @@ class vr {
|
|
|
2461
2455
|
}
|
|
2462
2456
|
}
|
|
2463
2457
|
async fetchAddressUTxOs(e, t) {
|
|
2464
|
-
const s = (() => e.startsWith("addr_vkh") || e.startsWith("addr_shared_vkh") ? `addresses/cred/${e}` : `addresses/${e}`)(),
|
|
2465
|
-
const u = o === null ? "" : `&cursor=${o}`, { data: d, status: l } = await this._axiosInstance.get(`${s}/utxos?count=100${
|
|
2458
|
+
const s = (() => e.startsWith("addr_vkh") || e.startsWith("addr_shared_vkh") ? `addresses/cred/${e}` : `addresses/${e}`)(), a = t ? `&asset=${t}` : "", i = async (o = null, c = []) => {
|
|
2459
|
+
const u = o === null ? "" : `&cursor=${o}`, { data: d, status: l } = await this._axiosInstance.get(`${s}/utxos?count=100${a}${u}`, this._amountsAsStrings);
|
|
2466
2460
|
if (l === 200) {
|
|
2467
|
-
const
|
|
2468
|
-
return
|
|
2461
|
+
const g = d.data.map(this.toUTxO), A = [...c, ...g], I = d.next_cursor;
|
|
2462
|
+
return I == null ? A : i(I, A);
|
|
2469
2463
|
}
|
|
2470
2464
|
throw h(d);
|
|
2471
2465
|
};
|
|
2472
2466
|
try {
|
|
2473
|
-
return await
|
|
2467
|
+
return await i();
|
|
2474
2468
|
} catch {
|
|
2475
2469
|
return [];
|
|
2476
2470
|
}
|
|
2477
2471
|
}
|
|
2478
2472
|
async fetchAssetAddresses(e) {
|
|
2479
|
-
const { policyId: t, assetName: s } = et(e),
|
|
2480
|
-
const c =
|
|
2473
|
+
const { policyId: t, assetName: s } = et(e), a = async (i = null, o = []) => {
|
|
2474
|
+
const c = i === null ? "" : `&cursor=${i}`, { data: u, status: d } = await this._axiosInstance.get(`assets/${t}${s}/addresses?count=100${c}`, this._amountsAsStrings);
|
|
2481
2475
|
if (d === 200) {
|
|
2482
|
-
const
|
|
2476
|
+
const m = u.data.map((I) => ({ address: I.address, quantity: I.amount })), g = u.next_cursor, A = [
|
|
2483
2477
|
...o,
|
|
2484
|
-
...
|
|
2478
|
+
...m
|
|
2485
2479
|
];
|
|
2486
|
-
return
|
|
2480
|
+
return g == null ? A : a(g, A);
|
|
2487
2481
|
}
|
|
2488
2482
|
throw h(u);
|
|
2489
2483
|
};
|
|
2490
2484
|
try {
|
|
2491
|
-
return await
|
|
2485
|
+
return await a();
|
|
2492
2486
|
} catch {
|
|
2493
2487
|
return [];
|
|
2494
2488
|
}
|
|
2495
2489
|
}
|
|
2496
2490
|
async fetchAssetMetadata(e) {
|
|
2497
2491
|
try {
|
|
2498
|
-
const { policyId: t, assetName: s } = et(e), { data:
|
|
2499
|
-
if (
|
|
2500
|
-
const o =
|
|
2492
|
+
const { policyId: t, assetName: s } = et(e), { data: a, status: i } = await this._axiosInstance.get(`assets/${t}${s}`);
|
|
2493
|
+
if (i === 200) {
|
|
2494
|
+
const o = a.data;
|
|
2501
2495
|
return {
|
|
2502
2496
|
...o.asset_standards.cip25_metadata,
|
|
2503
2497
|
...o.asset_standards.cip68_metadata
|
|
2504
2498
|
};
|
|
2505
2499
|
}
|
|
2506
|
-
throw h(
|
|
2500
|
+
throw h(a);
|
|
2507
2501
|
} catch (t) {
|
|
2508
2502
|
throw h(t);
|
|
2509
2503
|
}
|
|
@@ -2511,25 +2505,25 @@ class vr {
|
|
|
2511
2505
|
async fetchBlockInfo(e) {
|
|
2512
2506
|
var t;
|
|
2513
2507
|
try {
|
|
2514
|
-
const { data: s, status:
|
|
2515
|
-
if (
|
|
2516
|
-
const
|
|
2508
|
+
const { data: s, status: a } = await this._axiosInstance.get(`blocks/${e}`, this._amountsAsStrings);
|
|
2509
|
+
if (a === 200) {
|
|
2510
|
+
const i = s.data;
|
|
2517
2511
|
return {
|
|
2518
|
-
confirmations:
|
|
2519
|
-
epoch:
|
|
2520
|
-
epochSlot:
|
|
2521
|
-
fees:
|
|
2522
|
-
hash:
|
|
2523
|
-
nextBlock:
|
|
2524
|
-
operationalCertificate: (t =
|
|
2525
|
-
output:
|
|
2526
|
-
previousBlock:
|
|
2527
|
-
size:
|
|
2528
|
-
slot:
|
|
2529
|
-
slotLeader:
|
|
2530
|
-
time: Date.parse(
|
|
2531
|
-
txCount:
|
|
2532
|
-
VRFKey:
|
|
2512
|
+
confirmations: i.confirmations,
|
|
2513
|
+
epoch: i.epoch,
|
|
2514
|
+
epochSlot: i.epoch_slot.toString(),
|
|
2515
|
+
fees: i.total_fees,
|
|
2516
|
+
hash: i.hash,
|
|
2517
|
+
nextBlock: i.next_block ?? "",
|
|
2518
|
+
operationalCertificate: (t = i.operational_certificate) == null ? void 0 : t.hot_vkey,
|
|
2519
|
+
output: i.total_output_lovelace ?? "0",
|
|
2520
|
+
previousBlock: i.previous_block,
|
|
2521
|
+
size: i.size,
|
|
2522
|
+
slot: i.absolute_slot.toString(),
|
|
2523
|
+
slotLeader: i.block_producer ?? "",
|
|
2524
|
+
time: Date.parse(i.timestamp) / 1e3,
|
|
2525
|
+
txCount: i.tx_hashes.length,
|
|
2526
|
+
VRFKey: n.VRFVKey.from_hex(i.vrf_key).to_bech32("vrf_vk")
|
|
2533
2527
|
};
|
|
2534
2528
|
}
|
|
2535
2529
|
throw h(s);
|
|
@@ -2539,8 +2533,8 @@ class vr {
|
|
|
2539
2533
|
}
|
|
2540
2534
|
async fetchCollectionAssets(e, t) {
|
|
2541
2535
|
try {
|
|
2542
|
-
const { data: s, status:
|
|
2543
|
-
if (
|
|
2536
|
+
const { data: s, status: a } = await this._axiosInstance.get(`policy/${e}/assets?count=100${t ? `&cursor=${t}` : ""}`);
|
|
2537
|
+
if (a === 200)
|
|
2544
2538
|
return {
|
|
2545
2539
|
assets: s.data.map((o) => ({
|
|
2546
2540
|
unit: e + o.asset_name,
|
|
@@ -2555,8 +2549,8 @@ class vr {
|
|
|
2555
2549
|
}
|
|
2556
2550
|
async fetchHandleAddress(e) {
|
|
2557
2551
|
try {
|
|
2558
|
-
const t = e.charAt(0) === "$" ? e.substring(1) : e, { data: s, status:
|
|
2559
|
-
if (
|
|
2552
|
+
const t = e.charAt(0) === "$" ? e.substring(1) : e, { data: s, status: a } = await this._axiosInstance.get(`ecosystem/adahandle/${t}`);
|
|
2553
|
+
if (a === 200)
|
|
2560
2554
|
return s.data;
|
|
2561
2555
|
throw h(s);
|
|
2562
2556
|
} catch (t) {
|
|
@@ -2567,38 +2561,38 @@ class vr {
|
|
|
2567
2561
|
if (!isNaN(e))
|
|
2568
2562
|
throw new Error("Maestro only supports fetching Protocol parameters of the latest completed epoch.");
|
|
2569
2563
|
const t = (s) => {
|
|
2570
|
-
const
|
|
2571
|
-
return parseInt(s.slice(0,
|
|
2564
|
+
const a = s.indexOf("/");
|
|
2565
|
+
return parseInt(s.slice(0, a)) / parseInt(s.slice(a + 1));
|
|
2572
2566
|
};
|
|
2573
2567
|
try {
|
|
2574
|
-
const { data: s, status:
|
|
2575
|
-
if (
|
|
2576
|
-
const
|
|
2568
|
+
const { data: s, status: a } = await this._axiosInstance.get("protocol-params");
|
|
2569
|
+
if (a === 200) {
|
|
2570
|
+
const i = s.data;
|
|
2577
2571
|
try {
|
|
2578
2572
|
const { data: o, status: c } = await this._axiosInstance.get("epochs/current");
|
|
2579
2573
|
if (c === 200) {
|
|
2580
2574
|
const u = o.data;
|
|
2581
2575
|
return {
|
|
2582
|
-
coinsPerUTxOSize:
|
|
2583
|
-
collateralPercent: parseInt(
|
|
2576
|
+
coinsPerUTxOSize: i.coins_per_utxo_byte.toString(),
|
|
2577
|
+
collateralPercent: parseInt(i.collateral_percentage),
|
|
2584
2578
|
decentralisation: 0,
|
|
2585
2579
|
epoch: parseInt(u.epoch_no),
|
|
2586
|
-
keyDeposit:
|
|
2587
|
-
maxBlockExMem:
|
|
2588
|
-
maxBlockExSteps:
|
|
2589
|
-
maxBlockHeaderSize: parseInt(
|
|
2590
|
-
maxBlockSize: parseInt(
|
|
2591
|
-
maxCollateralInputs: parseInt(
|
|
2592
|
-
maxTxExMem:
|
|
2593
|
-
maxTxExSteps:
|
|
2594
|
-
maxTxSize: parseInt(
|
|
2595
|
-
maxValSize:
|
|
2596
|
-
minFeeA:
|
|
2597
|
-
minFeeB:
|
|
2598
|
-
minPoolCost:
|
|
2599
|
-
poolDeposit:
|
|
2600
|
-
priceMem: t(
|
|
2601
|
-
priceStep: t(
|
|
2580
|
+
keyDeposit: i.stake_key_deposit.toString(),
|
|
2581
|
+
maxBlockExMem: i.max_execution_units_per_block.memory.toString(),
|
|
2582
|
+
maxBlockExSteps: i.max_execution_units_per_block.steps.toString(),
|
|
2583
|
+
maxBlockHeaderSize: parseInt(i.max_block_header_size),
|
|
2584
|
+
maxBlockSize: parseInt(i.max_block_body_size),
|
|
2585
|
+
maxCollateralInputs: parseInt(i.max_collateral_inputs),
|
|
2586
|
+
maxTxExMem: i.max_execution_units_per_transaction.memory.toString(),
|
|
2587
|
+
maxTxExSteps: i.max_execution_units_per_transaction.steps.toString(),
|
|
2588
|
+
maxTxSize: parseInt(i.max_tx_size),
|
|
2589
|
+
maxValSize: i.max_value_size.toString(),
|
|
2590
|
+
minFeeA: i.min_fee_coefficient,
|
|
2591
|
+
minFeeB: i.min_fee_constant,
|
|
2592
|
+
minPoolCost: i.min_pool_cost.toString(),
|
|
2593
|
+
poolDeposit: i.pool_deposit.toString(),
|
|
2594
|
+
priceMem: t(i.prices.memory),
|
|
2595
|
+
priceStep: t(i.prices.steps)
|
|
2602
2596
|
};
|
|
2603
2597
|
}
|
|
2604
2598
|
throw h(o);
|
|
@@ -2615,17 +2609,17 @@ class vr {
|
|
|
2615
2609
|
try {
|
|
2616
2610
|
const { data: t, status: s } = await this._axiosInstance.get(`transactions/${e}`);
|
|
2617
2611
|
if (s === 200) {
|
|
2618
|
-
const
|
|
2612
|
+
const a = t.data;
|
|
2619
2613
|
return {
|
|
2620
|
-
block:
|
|
2621
|
-
deposit:
|
|
2622
|
-
fees:
|
|
2623
|
-
hash:
|
|
2624
|
-
index:
|
|
2625
|
-
invalidAfter:
|
|
2626
|
-
invalidBefore:
|
|
2627
|
-
slot:
|
|
2628
|
-
size:
|
|
2614
|
+
block: a.block_hash,
|
|
2615
|
+
deposit: a.deposit.toString(),
|
|
2616
|
+
fees: a.fee.toString(),
|
|
2617
|
+
hash: a.tx_hash,
|
|
2618
|
+
index: a.block_tx_index,
|
|
2619
|
+
invalidAfter: a.invalid_hereafter ?? "",
|
|
2620
|
+
invalidBefore: a.invalid_before ?? "",
|
|
2621
|
+
slot: a.block_absolute_slot.toString(),
|
|
2622
|
+
size: a.size - 1
|
|
2629
2623
|
};
|
|
2630
2624
|
}
|
|
2631
2625
|
throw h(t);
|
|
@@ -2644,23 +2638,23 @@ class vr {
|
|
|
2644
2638
|
}
|
|
2645
2639
|
}
|
|
2646
2640
|
onTxConfirmed(e, t, s = 100) {
|
|
2647
|
-
let
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2641
|
+
let a = 0;
|
|
2642
|
+
const i = setInterval(() => {
|
|
2643
|
+
a >= s && clearInterval(i), this.fetchTxInfo(e).then((o) => {
|
|
2650
2644
|
this.fetchBlockInfo(o.block).then((c) => {
|
|
2651
|
-
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(
|
|
2645
|
+
(c == null ? void 0 : c.confirmations) > 0 && (clearInterval(i), t());
|
|
2652
2646
|
}).catch(() => {
|
|
2653
|
-
|
|
2647
|
+
a += 1;
|
|
2654
2648
|
});
|
|
2655
2649
|
}).catch(() => {
|
|
2656
|
-
|
|
2650
|
+
a += 1;
|
|
2657
2651
|
});
|
|
2658
2652
|
}, 5e3);
|
|
2659
2653
|
}
|
|
2660
2654
|
async submitTx(e) {
|
|
2661
2655
|
try {
|
|
2662
|
-
const t = { "Content-Type": "application/cbor" }, { data: s, status:
|
|
2663
|
-
if (
|
|
2656
|
+
const t = { "Content-Type": "application/cbor" }, { data: s, status: a } = await this._axiosInstance.post(this.submitUrl, _(e), { headers: t });
|
|
2657
|
+
if (a === 202)
|
|
2664
2658
|
return s;
|
|
2665
2659
|
throw h(s);
|
|
2666
2660
|
} catch (t) {
|
|
@@ -2668,7 +2662,7 @@ class vr {
|
|
|
2668
2662
|
}
|
|
2669
2663
|
}
|
|
2670
2664
|
toUTxO = (e) => {
|
|
2671
|
-
var t, s,
|
|
2665
|
+
var t, s, a;
|
|
2672
2666
|
return {
|
|
2673
2667
|
input: {
|
|
2674
2668
|
outputIndex: e.index,
|
|
@@ -2676,14 +2670,14 @@ class vr {
|
|
|
2676
2670
|
},
|
|
2677
2671
|
output: {
|
|
2678
2672
|
address: e.address,
|
|
2679
|
-
amount: e.assets.map((
|
|
2680
|
-
unit:
|
|
2681
|
-
quantity:
|
|
2673
|
+
amount: e.assets.map((i) => ({
|
|
2674
|
+
unit: i.unit,
|
|
2675
|
+
quantity: i.amount
|
|
2682
2676
|
})),
|
|
2683
2677
|
dataHash: (t = e.datum) == null ? void 0 : t.hash,
|
|
2684
2678
|
plutusData: (s = e.datum) == null ? void 0 : s.bytes,
|
|
2685
2679
|
scriptRef: this.resolveScript(e),
|
|
2686
|
-
scriptHash: (
|
|
2680
|
+
scriptHash: (a = e.reference_script) == null ? void 0 : a.hash
|
|
2687
2681
|
}
|
|
2688
2682
|
};
|
|
2689
2683
|
};
|
|
@@ -2698,58 +2692,58 @@ class vr {
|
|
|
2698
2692
|
return;
|
|
2699
2693
|
};
|
|
2700
2694
|
}
|
|
2701
|
-
class
|
|
2695
|
+
class Er {
|
|
2702
2696
|
static withOneSignature(e) {
|
|
2703
2697
|
const t = F(it(e));
|
|
2704
2698
|
return xt(t).to_hex();
|
|
2705
2699
|
}
|
|
2706
2700
|
static withAtLeastNSignatures(e, t) {
|
|
2707
|
-
const s =
|
|
2708
|
-
e.forEach((
|
|
2709
|
-
const o = F(it(
|
|
2701
|
+
const s = n.NativeScripts.new();
|
|
2702
|
+
e.forEach((i) => {
|
|
2703
|
+
const o = F(it(i));
|
|
2710
2704
|
s.add(xt(o));
|
|
2711
2705
|
});
|
|
2712
|
-
const
|
|
2713
|
-
return
|
|
2706
|
+
const a = n.ScriptNOfK.new(t, s);
|
|
2707
|
+
return n.NativeScript.new_script_any(a).to_hex();
|
|
2714
2708
|
}
|
|
2715
2709
|
static withAnySignature(e) {
|
|
2716
|
-
const t =
|
|
2717
|
-
e.forEach((
|
|
2718
|
-
const
|
|
2719
|
-
t.add(xt(
|
|
2710
|
+
const t = n.NativeScripts.new();
|
|
2711
|
+
e.forEach((a) => {
|
|
2712
|
+
const i = F(it(a));
|
|
2713
|
+
t.add(xt(i));
|
|
2720
2714
|
});
|
|
2721
|
-
const s =
|
|
2722
|
-
return
|
|
2715
|
+
const s = n.ScriptAny.new(t);
|
|
2716
|
+
return n.NativeScript.new_script_any(s).to_hex();
|
|
2723
2717
|
}
|
|
2724
2718
|
static withAllSignatures(e) {
|
|
2725
|
-
const t =
|
|
2726
|
-
e.forEach((
|
|
2727
|
-
const
|
|
2728
|
-
t.add(xt(
|
|
2719
|
+
const t = n.NativeScripts.new();
|
|
2720
|
+
e.forEach((a) => {
|
|
2721
|
+
const i = F(it(a));
|
|
2722
|
+
t.add(xt(i));
|
|
2729
2723
|
});
|
|
2730
|
-
const s =
|
|
2731
|
-
return
|
|
2724
|
+
const s = n.ScriptAll.new(t);
|
|
2725
|
+
return n.NativeScript.new_script_any(s).to_hex();
|
|
2732
2726
|
}
|
|
2733
2727
|
static fromNativeScript(e) {
|
|
2734
2728
|
return Tt(e).to_hex();
|
|
2735
2729
|
}
|
|
2736
2730
|
}
|
|
2737
2731
|
function st(r, e, t, s) {
|
|
2738
|
-
var
|
|
2732
|
+
var a = arguments.length, i = a < 3 ? e : s === null ? s = Object.getOwnPropertyDescriptor(e, t) : s, o;
|
|
2739
2733
|
if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
|
|
2740
|
-
|
|
2734
|
+
i = Reflect.decorate(r, e, t, s);
|
|
2741
2735
|
else
|
|
2742
2736
|
for (var c = r.length - 1; c >= 0; c--)
|
|
2743
|
-
(o = r[c]) && (
|
|
2744
|
-
return
|
|
2737
|
+
(o = r[c]) && (i = (a < 3 ? o(i) : a > 3 ? o(e, t, i) : o(e, t)) || i);
|
|
2738
|
+
return a > 3 && i && Object.defineProperty(e, t, i), i;
|
|
2745
2739
|
}
|
|
2746
|
-
const
|
|
2740
|
+
const js = (r) => class extends r {
|
|
2747
2741
|
__visits = [];
|
|
2748
2742
|
}, rt = () => function(r, e, t) {
|
|
2749
2743
|
const s = t.value;
|
|
2750
|
-
t.value = function(...
|
|
2751
|
-
const
|
|
2752
|
-
return this.__visits && this.__visits.push(e),
|
|
2744
|
+
t.value = function(...a) {
|
|
2745
|
+
const i = s.call(this, ...a);
|
|
2746
|
+
return this.__visits && this.__visits.push(e), i;
|
|
2753
2747
|
};
|
|
2754
2748
|
};
|
|
2755
2749
|
let z = class {
|
|
@@ -2767,29 +2761,40 @@ let z = class {
|
|
|
2767
2761
|
_txInputsBuilder;
|
|
2768
2762
|
_txWithdrawals;
|
|
2769
2763
|
constructor(e = {}) {
|
|
2770
|
-
this._era = e.era, this._initiator = e.initiator, this._mintBuilder =
|
|
2764
|
+
this._era = e.era, this._initiator = e.initiator, this._mintBuilder = n.MintBuilder.new(), this._protocolParameters = e.parameters ?? T, this._txBuilder = Et(e.parameters), this._txCertificates = n.Certificates.new(), this._txInputsBuilder = n.TxInputsBuilder.new(), this._txWithdrawals = n.Withdrawals.new();
|
|
2765
|
+
}
|
|
2766
|
+
static attachMetadata(e, t, s = "BABBAGE") {
|
|
2767
|
+
var o;
|
|
2768
|
+
const a = O(e), i = a.auxiliary_data() ?? n.AuxiliaryData.new();
|
|
2769
|
+
if (i.set_metadata(n.GeneralTransactionMetadata.from_hex(t)), i.set_prefer_alonzo_format(s === "ALONZO"), n.hash_auxiliary_data(i).to_hex() !== ((o = a.body().auxiliary_data_hash()) == null ? void 0 : o.to_hex()))
|
|
2770
|
+
throw new Error("[Transaction] attachMetadata: The metadata hash does not match the auxiliary data hash.");
|
|
2771
|
+
return n.Transaction.new(a.body(), a.witness_set(), i).to_hex();
|
|
2772
|
+
}
|
|
2773
|
+
static deattachMetadata(e) {
|
|
2774
|
+
const t = O(e);
|
|
2775
|
+
return n.Transaction.new(t.body(), t.witness_set(), void 0).to_hex();
|
|
2771
2776
|
}
|
|
2772
2777
|
static maskMetadata(e, t = "BABBAGE") {
|
|
2773
|
-
var
|
|
2774
|
-
const s =
|
|
2775
|
-
if (
|
|
2776
|
-
const o =
|
|
2777
|
-
for (let u = 0; u <
|
|
2778
|
-
const d =
|
|
2779
|
-
o.insert(d,
|
|
2778
|
+
var i;
|
|
2779
|
+
const s = O(e), a = (i = s.auxiliary_data()) == null ? void 0 : i.metadata();
|
|
2780
|
+
if (a !== void 0) {
|
|
2781
|
+
const o = n.GeneralTransactionMetadata.new();
|
|
2782
|
+
for (let u = 0; u < a.len(); u += 1) {
|
|
2783
|
+
const d = a.keys().get(u), l = a.get(d);
|
|
2784
|
+
o.insert(d, n.TransactionMetadatum.from_hex("0".repeat(((l == null ? void 0 : l.to_hex()) ?? "").length)));
|
|
2780
2785
|
}
|
|
2781
2786
|
const c = s.auxiliary_data();
|
|
2782
|
-
return c !== void 0 && (c.set_metadata(o), c.set_prefer_alonzo_format(t === "ALONZO")),
|
|
2787
|
+
return c !== void 0 && (c.set_metadata(o), c.set_prefer_alonzo_format(t === "ALONZO")), n.Transaction.new(s.body(), s.witness_set(), c).to_hex();
|
|
2783
2788
|
}
|
|
2784
2789
|
return e;
|
|
2785
2790
|
}
|
|
2786
2791
|
static readMetadata(e) {
|
|
2787
|
-
var s,
|
|
2788
|
-
return ((
|
|
2792
|
+
var s, a;
|
|
2793
|
+
return ((a = (s = O(e).auxiliary_data()) == null ? void 0 : s.metadata()) == null ? void 0 : a.to_hex()) ?? "";
|
|
2789
2794
|
}
|
|
2790
2795
|
static writeMetadata(e, t, s = "BABBAGE") {
|
|
2791
|
-
const
|
|
2792
|
-
return
|
|
2796
|
+
const a = O(e), i = a.auxiliary_data() ?? n.AuxiliaryData.new();
|
|
2797
|
+
return i.set_metadata(n.GeneralTransactionMetadata.from_hex(t)), i.set_prefer_alonzo_format(s === "ALONZO"), n.Transaction.new(a.body(), a.witness_set(), i).to_hex();
|
|
2793
2798
|
}
|
|
2794
2799
|
get size() {
|
|
2795
2800
|
return this._txBuilder.full_size();
|
|
@@ -2802,39 +2807,39 @@ let z = class {
|
|
|
2802
2807
|
}
|
|
2803
2808
|
}
|
|
2804
2809
|
burnAsset(e, t, s) {
|
|
2805
|
-
const
|
|
2806
|
-
return this._mintBuilder.add_asset(
|
|
2810
|
+
const a = this._totalBurns.has(t.unit) ? n.BigNum.from_str(this._totalBurns.get(t.unit) ?? "0").checked_add(n.BigNum.from_str(t.quantity)).to_str() : t.quantity;
|
|
2811
|
+
return this._mintBuilder.add_asset(Ce(e, s), n.AssetName.new(_(t.unit.slice(R))), n.Int.new_negative(n.BigNum.from_str(t.quantity))), this._totalBurns.set(t.unit, a), this;
|
|
2807
2812
|
}
|
|
2808
2813
|
delegateStake(e, t) {
|
|
2809
|
-
const s =
|
|
2814
|
+
const s = n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(F(gt(e))), n.Ed25519KeyHash.from_bech32(t)));
|
|
2810
2815
|
return this._txCertificates.add(s), this;
|
|
2811
2816
|
}
|
|
2812
2817
|
deregisterStake(e) {
|
|
2813
|
-
const t =
|
|
2818
|
+
const t = n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(F(gt(e)))));
|
|
2814
2819
|
return this._txCertificates.add(t), this;
|
|
2815
2820
|
}
|
|
2816
2821
|
mintAsset(e, t, s) {
|
|
2817
2822
|
var d, l;
|
|
2818
|
-
const
|
|
2819
|
-
const
|
|
2823
|
+
const a = (m, g) => {
|
|
2824
|
+
const A = typeof m == "string" ? Dt(m).hash().to_hex() : i(m).hash().to_hex(), I = b(g.assetName);
|
|
2820
2825
|
return {
|
|
2821
|
-
unit: `${
|
|
2822
|
-
quantity:
|
|
2826
|
+
unit: `${A}${I}`,
|
|
2827
|
+
quantity: g.assetQuantity
|
|
2823
2828
|
};
|
|
2824
|
-
},
|
|
2825
|
-
if ("code" in
|
|
2826
|
-
return dt(
|
|
2827
|
-
const
|
|
2828
|
-
if (
|
|
2829
|
-
const
|
|
2830
|
-
if (
|
|
2831
|
-
const
|
|
2832
|
-
return dt(
|
|
2829
|
+
}, i = (m) => {
|
|
2830
|
+
if ("code" in m)
|
|
2831
|
+
return dt(m.code, m.version);
|
|
2832
|
+
const g = M(m);
|
|
2833
|
+
if (g.output().has_script_ref()) {
|
|
2834
|
+
const A = g.output().script_ref();
|
|
2835
|
+
if (A.is_plutus_script()) {
|
|
2836
|
+
const I = qe(A);
|
|
2837
|
+
return dt(I.code, I.version);
|
|
2833
2838
|
}
|
|
2834
2839
|
}
|
|
2835
|
-
throw new Error(`No plutus script reference found in UTxO: ${
|
|
2836
|
-
}, o =
|
|
2837
|
-
return this._mintBuilder.add_asset(
|
|
2840
|
+
throw new Error(`[Transaction] No plutus script reference found in UTxO: ${g.input().transaction_id().to_hex()}`);
|
|
2841
|
+
}, o = a(e, t), u = n.BigNum.from_str(((d = this._totalMints.get(o.unit)) == null ? void 0 : d.assetQuantity) ?? "0").checked_add(n.BigNum.from_str(o.quantity));
|
|
2842
|
+
return this._mintBuilder.add_asset(Ce(e, s), n.AssetName.new(_(b(t.assetName))), n.Int.new(n.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, {
|
|
2838
2843
|
...t,
|
|
2839
2844
|
assetQuantity: u.to_str()
|
|
2840
2845
|
}), this;
|
|
@@ -2842,95 +2847,95 @@ let z = class {
|
|
|
2842
2847
|
redeemValue(e) {
|
|
2843
2848
|
const t = {
|
|
2844
2849
|
tag: "SPEND",
|
|
2845
|
-
budget:
|
|
2850
|
+
budget: nt,
|
|
2846
2851
|
index: this._txInputsBuilder.inputs().len(),
|
|
2847
2852
|
data: {
|
|
2848
2853
|
alternative: 0,
|
|
2849
2854
|
fields: []
|
|
2850
2855
|
},
|
|
2851
2856
|
...e.redeemer
|
|
2852
|
-
}, s =
|
|
2853
|
-
return this._txInputsBuilder.add_plutus_script_input(
|
|
2857
|
+
}, s = M(e.value), a = e.datum ? n.PlutusWitness.new_with_ref(Rt(e.script), zs(e.datum), Mt(t)) : n.PlutusWitness.new_with_ref_without_datum(Rt(e.script), Mt(t));
|
|
2858
|
+
return this._txInputsBuilder.add_plutus_script_input(a, s.input(), s.output().amount()), this;
|
|
2854
2859
|
}
|
|
2855
2860
|
registerStake(e) {
|
|
2856
|
-
const t =
|
|
2861
|
+
const t = n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(F(gt(e)))));
|
|
2857
2862
|
return this._txCertificates.add(t), this;
|
|
2858
2863
|
}
|
|
2859
2864
|
registerPool(e) {
|
|
2860
|
-
const t =
|
|
2865
|
+
const t = n.Certificate.new_pool_registration(n.PoolRegistration.new($s(e)));
|
|
2861
2866
|
return this._txCertificates.add(t), this;
|
|
2862
2867
|
}
|
|
2863
2868
|
retirePool(e, t) {
|
|
2864
|
-
const s =
|
|
2869
|
+
const s = n.Certificate.new_pool_retirement(n.PoolRetirement.new(n.Ed25519KeyHash.from_bech32(e), t));
|
|
2865
2870
|
return this._txCertificates.add(s), this;
|
|
2866
2871
|
}
|
|
2867
2872
|
sendAssets(e, t) {
|
|
2868
|
-
const s =
|
|
2869
|
-
if (s.is_zero() ||
|
|
2873
|
+
const s = G(t), a = s.multiasset();
|
|
2874
|
+
if (s.is_zero() || a === void 0)
|
|
2870
2875
|
return this;
|
|
2871
|
-
const
|
|
2876
|
+
const i = Ct(e).next(), o = s.coin().is_zero() ? i.with_asset_and_min_required_coin_by_utxo_cost(a, Ft(this._protocolParameters.coinsPerUTxOSize)).build() : i.with_coin_and_asset(s.coin(), a).build();
|
|
2872
2877
|
return t.forEach((c) => {
|
|
2873
2878
|
this.setTxOutput(c);
|
|
2874
2879
|
}), this._txBuilder.add_output(o), this;
|
|
2875
2880
|
}
|
|
2876
2881
|
sendLovelace(e, t) {
|
|
2877
|
-
const
|
|
2882
|
+
const a = Ct(e).next().with_coin(n.BigNum.from_str(t)).build();
|
|
2878
2883
|
return this.setTxOutput({
|
|
2879
2884
|
unit: "lovelace",
|
|
2880
2885
|
quantity: t
|
|
2881
|
-
}), this._txBuilder.add_output(
|
|
2886
|
+
}), this._txBuilder.add_output(a), this;
|
|
2882
2887
|
}
|
|
2883
2888
|
sendToken(e, t, s) {
|
|
2884
2889
|
return this.sendAssets(e, [{
|
|
2885
2890
|
quantity: s,
|
|
2886
|
-
unit:
|
|
2891
|
+
unit: ns[t]
|
|
2887
2892
|
}]), this;
|
|
2888
2893
|
}
|
|
2889
2894
|
sendValue(e, t) {
|
|
2890
|
-
const s =
|
|
2895
|
+
const s = G(t.output.amount), i = Ct(e).next().with_value(s).build();
|
|
2891
2896
|
return t.output.amount.forEach((o) => {
|
|
2892
2897
|
this.setTxOutput(o);
|
|
2893
|
-
}), this._txBuilder.add_output(
|
|
2898
|
+
}), this._txBuilder.add_output(i), this;
|
|
2894
2899
|
}
|
|
2895
2900
|
setChangeAddress(e) {
|
|
2896
2901
|
return this._changeAddress = K(e), this;
|
|
2897
2902
|
}
|
|
2898
2903
|
setCollateral(e) {
|
|
2899
|
-
const t =
|
|
2904
|
+
const t = we(e);
|
|
2900
2905
|
return this._txBuilder.set_collateral(t), this;
|
|
2901
2906
|
}
|
|
2902
2907
|
setMetadata(e, t) {
|
|
2903
|
-
return this._txBuilder.add_json_metadatum_with_schema(
|
|
2908
|
+
return this._txBuilder.add_json_metadatum_with_schema(n.BigNum.from_str(e.toString()), JSON.stringify(t), n.MetadataJsonSchema.NoConversions), this;
|
|
2904
2909
|
}
|
|
2905
2910
|
setRequiredSigners(e) {
|
|
2906
|
-
return Array.from(new Set(e.map((s) => s.startsWith("addr") ? it(s) :
|
|
2911
|
+
return Array.from(new Set(e.map((s) => s.startsWith("addr") ? it(s) : gt(s)).map((s) => F(s)))).forEach((s) => {
|
|
2907
2912
|
this._txBuilder.add_required_signer(s);
|
|
2908
2913
|
}), this;
|
|
2909
2914
|
}
|
|
2910
2915
|
setTimeToStart(e) {
|
|
2911
|
-
return this._txBuilder.set_validity_start_interval_bignum(
|
|
2916
|
+
return this._txBuilder.set_validity_start_interval_bignum(n.BigNum.from_str(e)), this;
|
|
2912
2917
|
}
|
|
2913
2918
|
setTimeToExpire(e) {
|
|
2914
|
-
return this._txBuilder.set_ttl_bignum(
|
|
2919
|
+
return this._txBuilder.set_ttl_bignum(n.BigNum.from_str(e)), this;
|
|
2915
2920
|
}
|
|
2916
2921
|
setTxInputs(e) {
|
|
2917
|
-
return e.map((t) =>
|
|
2922
|
+
return e.map((t) => M(t)).forEach((t) => {
|
|
2918
2923
|
this._txInputsBuilder.add_input(t.output().address(), t.input(), t.output().amount());
|
|
2919
2924
|
}), this;
|
|
2920
2925
|
}
|
|
2921
2926
|
setTxRefInputs(e) {
|
|
2922
|
-
return e.map((t) =>
|
|
2927
|
+
return e.map((t) => M(t)).forEach((t) => {
|
|
2923
2928
|
this._txBuilder.add_reference_input(t.input());
|
|
2924
2929
|
}), this;
|
|
2925
2930
|
}
|
|
2926
2931
|
withdrawRewards(e, t) {
|
|
2927
|
-
const s =
|
|
2928
|
-
return s !== void 0 && this._txWithdrawals.insert(s,
|
|
2932
|
+
const s = Re(e);
|
|
2933
|
+
return s !== void 0 && this._txWithdrawals.insert(s, n.BigNum.from_str(t)), this;
|
|
2929
2934
|
}
|
|
2930
2935
|
async addBurnInputsIfNeeded() {
|
|
2931
2936
|
if (this._initiator && this._totalBurns.size > 0 && this.notVisited("setTxInputs")) {
|
|
2932
2937
|
const e = await this._initiator.getUsedUTxOs();
|
|
2933
|
-
os(this._totalBurns, e.map((s) => vt(s))).map((s) =>
|
|
2938
|
+
os(this._totalBurns, e.map((s) => vt(s))).map((s) => M(s)).forEach((s) => {
|
|
2934
2939
|
this._txInputsBuilder.add_input(s.output().address(), s.input(), s.output().amount());
|
|
2935
2940
|
});
|
|
2936
2941
|
}
|
|
@@ -2945,7 +2950,7 @@ let z = class {
|
|
|
2945
2950
|
async addCollateralIfNeeded() {
|
|
2946
2951
|
if (this._initiator && this.notVisited("setCollateral")) {
|
|
2947
2952
|
const e = await this._initiator.getUsedCollateral();
|
|
2948
|
-
this._txBuilder.set_collateral(
|
|
2953
|
+
this._txBuilder.set_collateral(we(e));
|
|
2949
2954
|
}
|
|
2950
2955
|
}
|
|
2951
2956
|
async addRequiredSignersIfNeeded() {
|
|
@@ -2957,23 +2962,23 @@ let z = class {
|
|
|
2957
2962
|
async addTxInputsAsNeeded() {
|
|
2958
2963
|
if (this.notVisited("setTxInputs")) {
|
|
2959
2964
|
const e = await this.filterAvailableUTxOs();
|
|
2960
|
-
is(this._txOutputs, e.map((s) => vt(s))).map((s) =>
|
|
2965
|
+
is(this._txOutputs, e.map((s) => vt(s))).map((s) => M(s)).forEach((s) => {
|
|
2961
2966
|
this._txInputsBuilder.add_input(s.output().address(), s.input(), s.output().amount());
|
|
2962
2967
|
});
|
|
2963
2968
|
}
|
|
2964
2969
|
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) {
|
|
2965
|
-
const e = this._era !== void 0 ?
|
|
2970
|
+
const e = this._era !== void 0 ? ee[this._era] : ee.BABBAGE;
|
|
2966
2971
|
this._txBuilder.calc_script_data_hash(e);
|
|
2967
2972
|
}
|
|
2968
2973
|
}
|
|
2969
2974
|
async forgeAssetsIfNeeded() {
|
|
2970
2975
|
const e = (t, s) => {
|
|
2971
|
-
const
|
|
2976
|
+
const a = t.data.assetName, i = t.data.metadata, o = t.unit.slice(0, R);
|
|
2972
2977
|
if (t.data.label === "777")
|
|
2973
|
-
return
|
|
2978
|
+
return i;
|
|
2974
2979
|
if (s && s[o]) {
|
|
2975
2980
|
const { [o]: c, ...u } = s, d = {
|
|
2976
|
-
[
|
|
2981
|
+
[a]: i,
|
|
2977
2982
|
...c
|
|
2978
2983
|
};
|
|
2979
2984
|
return {
|
|
@@ -2985,28 +2990,28 @@ let z = class {
|
|
|
2985
2990
|
}
|
|
2986
2991
|
return s !== void 0 ? {
|
|
2987
2992
|
[o]: {
|
|
2988
|
-
[
|
|
2993
|
+
[a]: i
|
|
2989
2994
|
},
|
|
2990
2995
|
...s
|
|
2991
2996
|
} : {
|
|
2992
|
-
[o]: { [
|
|
2997
|
+
[o]: { [a]: i }
|
|
2993
2998
|
};
|
|
2994
2999
|
};
|
|
2995
3000
|
await this.addBurnInputsIfNeeded(), Array.from(this._totalMints, (t) => ({
|
|
2996
3001
|
unit: t[0],
|
|
2997
3002
|
data: t[1]
|
|
2998
3003
|
})).reduce((t, s) => t.set(s.data.label, e(s, t.get(s.data.label))), /* @__PURE__ */ new Map()).forEach((t, s) => {
|
|
2999
|
-
this._txBuilder.add_json_metadatum(
|
|
3004
|
+
this._txBuilder.add_json_metadatum(n.BigNum.from_str(s), JSON.stringify(t));
|
|
3000
3005
|
}), this.addMintOutputs();
|
|
3001
3006
|
}
|
|
3002
3007
|
async filterAvailableUTxOs(e = []) {
|
|
3003
|
-
return this._initiator === void 0 ? [] : (await this._initiator.getUsedUTxOs()).filter((s) => e.find((
|
|
3008
|
+
return this._initiator === void 0 ? [] : (await this._initiator.getUsedUTxOs()).filter((s) => e.find((a) => a.input.txHash === s.input().transaction_id().to_hex()) === void 0);
|
|
3004
3009
|
}
|
|
3005
3010
|
addMintOutputs() {
|
|
3006
3011
|
this._recipients.forEach((e, t) => {
|
|
3007
|
-
const
|
|
3008
|
-
if (
|
|
3009
|
-
const o = Ct(t).next().with_asset_and_min_required_coin_by_utxo_cost(
|
|
3012
|
+
const a = G(e).multiasset();
|
|
3013
|
+
if (a !== void 0) {
|
|
3014
|
+
const o = Ct(t).next().with_asset_and_min_required_coin_by_utxo_cost(a, Ft(this._protocolParameters.coinsPerUTxOSize)).build();
|
|
3010
3015
|
this._txBuilder.add_output(o);
|
|
3011
3016
|
}
|
|
3012
3017
|
});
|
|
@@ -3015,7 +3020,7 @@ let z = class {
|
|
|
3015
3020
|
return this.__visits.includes(e) === !1;
|
|
3016
3021
|
}
|
|
3017
3022
|
setTxOutput(e) {
|
|
3018
|
-
const s =
|
|
3023
|
+
const s = n.BigNum.from_str(this._txOutputs.get(e.unit) ?? "0").checked_add(n.BigNum.from_str(e.quantity)).to_str();
|
|
3019
3024
|
this._txOutputs.set(e.unit, s);
|
|
3020
3025
|
}
|
|
3021
3026
|
};
|
|
@@ -3041,110 +3046,110 @@ st([
|
|
|
3041
3046
|
rt()
|
|
3042
3047
|
], z.prototype, "setTxInputs", null);
|
|
3043
3048
|
z = st([
|
|
3044
|
-
|
|
3049
|
+
js
|
|
3045
3050
|
], z);
|
|
3046
|
-
const
|
|
3051
|
+
const Xs = (r, e, t) => {
|
|
3047
3052
|
const s = new Map(e);
|
|
3048
3053
|
s.set("lovelace", String(Number(s.get("lovelace")) + Number(t)));
|
|
3049
|
-
const
|
|
3050
|
-
for (let
|
|
3051
|
-
|
|
3052
|
-
const
|
|
3053
|
-
for (let
|
|
3054
|
-
switch (r[
|
|
3054
|
+
const a = /* @__PURE__ */ new Map();
|
|
3055
|
+
for (let g = 0; g < r.length; g++)
|
|
3056
|
+
a.set(g, r[g]);
|
|
3057
|
+
const i = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
3058
|
+
for (let g = 0; g < r.length; g++)
|
|
3059
|
+
switch (r[g].output.amount.length) {
|
|
3055
3060
|
case 1: {
|
|
3056
|
-
o.add(
|
|
3061
|
+
o.add(g);
|
|
3057
3062
|
break;
|
|
3058
3063
|
}
|
|
3059
3064
|
case 2: {
|
|
3060
|
-
c.add(
|
|
3065
|
+
c.add(g);
|
|
3061
3066
|
break;
|
|
3062
3067
|
}
|
|
3063
3068
|
case 3: {
|
|
3064
|
-
u.add(
|
|
3069
|
+
u.add(g);
|
|
3065
3070
|
break;
|
|
3066
3071
|
}
|
|
3067
3072
|
default: {
|
|
3068
|
-
d.add(
|
|
3073
|
+
d.add(g);
|
|
3069
3074
|
break;
|
|
3070
3075
|
}
|
|
3071
3076
|
}
|
|
3072
|
-
const l = (
|
|
3073
|
-
const
|
|
3074
|
-
if (!
|
|
3077
|
+
const l = (g, A, I) => {
|
|
3078
|
+
const x = a.get(g);
|
|
3079
|
+
if (!x)
|
|
3075
3080
|
return;
|
|
3076
|
-
const
|
|
3077
|
-
if (Number(
|
|
3078
|
-
|
|
3079
|
-
for (const f of
|
|
3081
|
+
const v = Zs(x, A);
|
|
3082
|
+
if (Number(v) > 0) {
|
|
3083
|
+
i.add(g), I.delete(g);
|
|
3084
|
+
for (const f of x.output.amount)
|
|
3080
3085
|
s.set(f.unit, String(Number(s.get(f.unit)) - Number(f.quantity)));
|
|
3081
3086
|
}
|
|
3082
3087
|
};
|
|
3083
|
-
for (const
|
|
3084
|
-
if (
|
|
3085
|
-
for (const
|
|
3086
|
-
const
|
|
3087
|
-
if (!
|
|
3088
|
+
for (const g of s.keys())
|
|
3089
|
+
if (g != "lovelace") {
|
|
3090
|
+
for (const A of c) {
|
|
3091
|
+
const I = s.get(g);
|
|
3092
|
+
if (!I || Number(I) <= 0)
|
|
3088
3093
|
break;
|
|
3089
|
-
l(
|
|
3094
|
+
l(A, g, c);
|
|
3090
3095
|
}
|
|
3091
|
-
for (const
|
|
3092
|
-
const
|
|
3093
|
-
if (!
|
|
3096
|
+
for (const A of u) {
|
|
3097
|
+
const I = s.get(g);
|
|
3098
|
+
if (!I || Number(I) <= 0)
|
|
3094
3099
|
break;
|
|
3095
|
-
l(
|
|
3100
|
+
l(A, g, u);
|
|
3096
3101
|
}
|
|
3097
|
-
for (const
|
|
3098
|
-
const
|
|
3099
|
-
if (!
|
|
3102
|
+
for (const A of d) {
|
|
3103
|
+
const I = s.get(g);
|
|
3104
|
+
if (!I || Number(I) <= 0)
|
|
3100
3105
|
break;
|
|
3101
|
-
l(
|
|
3106
|
+
l(A, g, d);
|
|
3102
3107
|
}
|
|
3103
3108
|
}
|
|
3104
|
-
for (const
|
|
3105
|
-
const
|
|
3106
|
-
if (!
|
|
3109
|
+
for (const g of o) {
|
|
3110
|
+
const A = s.get("lovelace");
|
|
3111
|
+
if (!A || Number(A) <= 0)
|
|
3107
3112
|
break;
|
|
3108
|
-
l(
|
|
3113
|
+
l(g, "lovelace", o);
|
|
3109
3114
|
}
|
|
3110
|
-
for (const
|
|
3111
|
-
const
|
|
3112
|
-
if (!
|
|
3115
|
+
for (const g of c) {
|
|
3116
|
+
const A = s.get("lovelace");
|
|
3117
|
+
if (!A || Number(A) <= 0)
|
|
3113
3118
|
break;
|
|
3114
|
-
l(
|
|
3119
|
+
l(g, "lovelace", c);
|
|
3115
3120
|
}
|
|
3116
|
-
for (const
|
|
3117
|
-
const
|
|
3118
|
-
if (!
|
|
3121
|
+
for (const g of u) {
|
|
3122
|
+
const A = s.get("lovelace");
|
|
3123
|
+
if (!A || Number(A) <= 0)
|
|
3119
3124
|
break;
|
|
3120
|
-
l(
|
|
3125
|
+
l(g, "lovelace", u);
|
|
3121
3126
|
}
|
|
3122
|
-
for (const
|
|
3123
|
-
const
|
|
3124
|
-
if (!
|
|
3127
|
+
for (const g of d) {
|
|
3128
|
+
const A = s.get("lovelace");
|
|
3129
|
+
if (!A || Number(A) <= 0)
|
|
3125
3130
|
break;
|
|
3126
|
-
l(
|
|
3131
|
+
l(g, "lovelace", d);
|
|
3127
3132
|
}
|
|
3128
|
-
for (const
|
|
3129
|
-
if (Number(s.get(
|
|
3133
|
+
for (const g of s.keys())
|
|
3134
|
+
if (Number(s.get(g)) > 0)
|
|
3130
3135
|
return [];
|
|
3131
|
-
const
|
|
3132
|
-
for (const
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3136
|
+
const m = [];
|
|
3137
|
+
for (const g of i) {
|
|
3138
|
+
const A = a.get(g);
|
|
3139
|
+
A && m.push(A);
|
|
3135
3140
|
}
|
|
3136
|
-
return
|
|
3137
|
-
},
|
|
3141
|
+
return m;
|
|
3142
|
+
}, Zs = (r, e) => {
|
|
3138
3143
|
for (const t of r.output.amount)
|
|
3139
3144
|
if (t.unit == e)
|
|
3140
3145
|
return t.quantity;
|
|
3141
3146
|
return "0";
|
|
3142
3147
|
};
|
|
3143
|
-
class
|
|
3148
|
+
class tr {
|
|
3144
3149
|
txHex = "";
|
|
3145
3150
|
txBuilder = Et();
|
|
3146
3151
|
txEvaluationMultiplier = 1.1;
|
|
3147
|
-
_protocolParams =
|
|
3152
|
+
_protocolParams = T;
|
|
3148
3153
|
txOutput;
|
|
3149
3154
|
addingScriptInput = !1;
|
|
3150
3155
|
addingPlutusMint = !1;
|
|
@@ -3154,7 +3159,7 @@ class er {
|
|
|
3154
3159
|
txInQueueItem;
|
|
3155
3160
|
collateralQueueItem;
|
|
3156
3161
|
refScriptTxInQueueItem;
|
|
3157
|
-
reset = () => (this.txHex = "", this.txBuilder = Et(), this.txEvaluationMultiplier = 1.1, this._protocolParams =
|
|
3162
|
+
reset = () => (this.txHex = "", this.txBuilder = Et(), this.txEvaluationMultiplier = 1.1, this._protocolParams = T, this.txOutput = void 0, this.addingScriptInput = !1, this.addingPlutusMint = !1, this.mintItem = void 0, this.txInQueueItem = void 0, this.collateralQueueItem = void 0, this.refScriptTxInQueueItem = void 0, this.meshTxBuilderBody = this.emptyTxBuilderBody(), this);
|
|
3158
3163
|
emptyTxBuilderBody = () => ({
|
|
3159
3164
|
inputs: [],
|
|
3160
3165
|
outputs: [],
|
|
@@ -3167,6 +3172,7 @@ class er {
|
|
|
3167
3172
|
changeAddress: "",
|
|
3168
3173
|
metadata: [],
|
|
3169
3174
|
validityRange: {},
|
|
3175
|
+
certificates: [],
|
|
3170
3176
|
signingKey: []
|
|
3171
3177
|
});
|
|
3172
3178
|
constructor() {
|
|
@@ -3178,7 +3184,7 @@ class er {
|
|
|
3178
3184
|
return e.length > 0 && this.addAllSigningKeys(e), this.txHex;
|
|
3179
3185
|
};
|
|
3180
3186
|
serializeTxBody = (e) => {
|
|
3181
|
-
const { inputs: t, outputs: s, extraInputs:
|
|
3187
|
+
const { inputs: t, outputs: s, extraInputs: a, selectionThreshold: i, collaterals: o, referenceInputs: c, mints: u, changeAddress: d, certificates: l, validityRange: m, requiredSignatures: g, metadata: A } = e;
|
|
3182
3188
|
if (this.isHydra ? this.protocolParams({
|
|
3183
3189
|
minFeeA: 0,
|
|
3184
3190
|
minFeeB: 0,
|
|
@@ -3186,27 +3192,27 @@ class er {
|
|
|
3186
3192
|
priceStep: 0,
|
|
3187
3193
|
collateralPercent: 0,
|
|
3188
3194
|
coinsPerUTxOSize: "0"
|
|
3189
|
-
}) : this.protocolParams({}),
|
|
3190
|
-
const
|
|
3191
|
-
var
|
|
3192
|
-
return ((
|
|
3193
|
-
}).reduce((
|
|
3194
|
-
let
|
|
3195
|
-
if (
|
|
3196
|
-
const
|
|
3197
|
-
|
|
3195
|
+
}) : this.protocolParams({}), a.length > 0 && this.addUtxosFrom(a, String(i)), this.removeDuplicateInputs(), this.meshTxBuilderBody.mints.sort((I, x) => I.policyId.localeCompare(x.policyId)), this.meshTxBuilderBody.inputs.sort((I, x) => I.txIn.txHash === x.txIn.txHash ? I.txIn.txIndex - x.txIn.txIndex : I.txIn.txHash.localeCompare(x.txIn.txHash)), this.addAllInputs(t), this.addAllOutputs(s), this.addAllCollaterals(o), this.addAllReferenceInputs(c), this.addAllMints(u), this.addAllCertificates(l), this.addValidityRange(m), this.addAllRequiredSignatures(g), this.addAllMetadata(A), this.addCostModels(), d) {
|
|
3196
|
+
const I = this.meshTxBuilderBody.collaterals.map((f) => {
|
|
3197
|
+
var C, w;
|
|
3198
|
+
return ((w = (C = f.txIn.amount) == null ? void 0 : C.find((D) => D.unit === "lovelace")) == null ? void 0 : w.quantity) || "0";
|
|
3199
|
+
}).reduce((f, C) => f + parseInt(C), 0), x = Math.ceil(this._protocolParams.collateralPercent * Number(Number(this.txBuilder.min_fee().checked_add(n.BigNum.from_str("10000")).to_js_value())) / 100);
|
|
3200
|
+
let v = !1;
|
|
3201
|
+
if (I - x > 0) {
|
|
3202
|
+
const f = n.TransactionOutput.new(n.Address.from_bech32(d), n.Value.new(n.BigNum.from_str(String(x))));
|
|
3203
|
+
I - x > Number(n.min_ada_for_output(f, n.DataCost.new_coins_per_byte(n.BigNum.from_str(this._protocolParams.coinsPerUTxOSize))).to_js_value()) && (this.txBuilder.set_collateral_return(n.TransactionOutput.new(n.Address.from_bech32(d), n.Value.new(n.BigNum.from_str(String(I))))), this.txBuilder.set_total_collateral(n.BigNum.from_str(String(I))), v = !0);
|
|
3198
3204
|
}
|
|
3199
|
-
this.addChange(d),
|
|
3205
|
+
this.addChange(d), v && this.addCollateralReturn(d);
|
|
3200
3206
|
}
|
|
3201
3207
|
return this.buildTx(), this;
|
|
3202
3208
|
};
|
|
3203
|
-
txIn = (e, t, s,
|
|
3209
|
+
txIn = (e, t, s, a) => (this.txInQueueItem && this.queueInput(), this.addingScriptInput ? this.txInQueueItem = {
|
|
3204
3210
|
type: "Script",
|
|
3205
3211
|
txIn: {
|
|
3206
3212
|
txHash: e,
|
|
3207
3213
|
txIndex: t,
|
|
3208
3214
|
amount: s,
|
|
3209
|
-
address:
|
|
3215
|
+
address: a
|
|
3210
3216
|
},
|
|
3211
3217
|
scriptTxIn: {}
|
|
3212
3218
|
} : this.txInQueueItem = {
|
|
@@ -3215,7 +3221,7 @@ class er {
|
|
|
3215
3221
|
txHash: e,
|
|
3216
3222
|
txIndex: t,
|
|
3217
3223
|
amount: s,
|
|
3218
|
-
address:
|
|
3224
|
+
address: a
|
|
3219
3225
|
}
|
|
3220
3226
|
}, this.addingScriptInput = !1, this);
|
|
3221
3227
|
txInScript = (e, t = "V2") => {
|
|
@@ -3263,22 +3269,22 @@ class er {
|
|
|
3263
3269
|
txIndex: t
|
|
3264
3270
|
}), this;
|
|
3265
3271
|
};
|
|
3266
|
-
txInRedeemerValue = (e, t = { ...
|
|
3272
|
+
txInRedeemerValue = (e, t = { ...nt }, s = "Mesh") => {
|
|
3267
3273
|
if (!this.txInQueueItem)
|
|
3268
3274
|
throw Error("Undefined input");
|
|
3269
3275
|
if (this.txInQueueItem.type === "PubKey")
|
|
3270
3276
|
throw Error("Spending tx in reference redeemer attempted to be called a non script input");
|
|
3271
|
-
let
|
|
3277
|
+
let a = e;
|
|
3272
3278
|
return s === "Mesh" ? (this.txInQueueItem.scriptTxIn.redeemer = {
|
|
3273
3279
|
data: {
|
|
3274
3280
|
type: s,
|
|
3275
3281
|
content: e
|
|
3276
3282
|
},
|
|
3277
3283
|
exUnits: t
|
|
3278
|
-
}, this) : (s === "JSON" && (
|
|
3284
|
+
}, this) : (s === "JSON" && (a = this.castRawDataToJsonString(e)), this.txInQueueItem.scriptTxIn.redeemer = {
|
|
3279
3285
|
data: {
|
|
3280
3286
|
type: s,
|
|
3281
|
-
content:
|
|
3287
|
+
content: a
|
|
3282
3288
|
},
|
|
3283
3289
|
exUnits: t
|
|
3284
3290
|
}, this);
|
|
@@ -3331,7 +3337,7 @@ class er {
|
|
|
3331
3337
|
};
|
|
3332
3338
|
txOutReferenceScript = (e, t = "V2") => (this.txOutput && (this.txOutput.referenceScript = { code: e, version: t }), this);
|
|
3333
3339
|
spendingPlutusScriptV2 = () => (this.addingScriptInput = !0, this);
|
|
3334
|
-
spendingTxInReference = (e, t, s,
|
|
3340
|
+
spendingTxInReference = (e, t, s, a = "V2") => {
|
|
3335
3341
|
if (!this.txInQueueItem)
|
|
3336
3342
|
throw Error("Undefined input");
|
|
3337
3343
|
if (this.txInQueueItem.type === "PubKey")
|
|
@@ -3342,12 +3348,12 @@ class er {
|
|
|
3342
3348
|
txHash: e,
|
|
3343
3349
|
txIndex: t,
|
|
3344
3350
|
spendingScriptHash: s,
|
|
3345
|
-
version:
|
|
3351
|
+
version: a
|
|
3346
3352
|
}
|
|
3347
3353
|
}, this;
|
|
3348
3354
|
};
|
|
3349
3355
|
spendingReferenceTxInInlineDatumPresent = () => (this.txInInlineDatumPresent(), this);
|
|
3350
|
-
spendingReferenceTxInRedeemerValue = (e, t = { ...
|
|
3356
|
+
spendingReferenceTxInRedeemerValue = (e, t = { ...nt }) => (this.txInRedeemerValue(e, t), this);
|
|
3351
3357
|
readOnlyTxInReference = (e, t) => (this.meshTxBuilderBody.referenceInputs.push({ txHash: e, txIndex: t }), this);
|
|
3352
3358
|
mintPlutusScriptV2 = () => (this.addingPlutusMint = !0, this);
|
|
3353
3359
|
mint = (e, t, s) => (this.mintItem && this.queueMint(), this.mintItem = {
|
|
@@ -3382,7 +3388,7 @@ class er {
|
|
|
3382
3388
|
version: s
|
|
3383
3389
|
}, this;
|
|
3384
3390
|
};
|
|
3385
|
-
mintReferenceTxInRedeemerValue = (e, t = { ...
|
|
3391
|
+
mintReferenceTxInRedeemerValue = (e, t = { ...nt }, s = "Mesh") => {
|
|
3386
3392
|
if (!this.mintItem)
|
|
3387
3393
|
throw Error("Undefined mint");
|
|
3388
3394
|
if (this.mintItem.type == "Native")
|
|
@@ -3390,85 +3396,107 @@ class er {
|
|
|
3390
3396
|
if (this.mintItem.type == "Plutus") {
|
|
3391
3397
|
if (!this.mintItem.policyId)
|
|
3392
3398
|
throw Error("PolicyId information missing from mint asset");
|
|
3393
|
-
let
|
|
3399
|
+
let a = e;
|
|
3394
3400
|
if (s === "Mesh")
|
|
3395
3401
|
return this.mintItem.redeemer = {
|
|
3396
3402
|
data: {
|
|
3397
3403
|
type: s,
|
|
3398
|
-
content:
|
|
3404
|
+
content: a
|
|
3399
3405
|
},
|
|
3400
3406
|
exUnits: t
|
|
3401
3407
|
}, this;
|
|
3402
|
-
s === "JSON" && (
|
|
3408
|
+
s === "JSON" && (a = this.castRawDataToJsonString(e)), this.mintItem.redeemer = {
|
|
3403
3409
|
data: {
|
|
3404
3410
|
type: s,
|
|
3405
|
-
content:
|
|
3411
|
+
content: a
|
|
3406
3412
|
},
|
|
3407
3413
|
exUnits: t
|
|
3408
3414
|
};
|
|
3409
3415
|
}
|
|
3410
3416
|
return this;
|
|
3411
3417
|
};
|
|
3412
|
-
mintRedeemerValue = (e, t = { ...
|
|
3418
|
+
mintRedeemerValue = (e, t = { ...nt }, s = "Mesh") => (this.mintReferenceTxInRedeemerValue(e, t, s), this);
|
|
3413
3419
|
requiredSignerHash = (e) => (this.meshTxBuilderBody.requiredSignatures.push(e), this);
|
|
3414
|
-
txInCollateral = (e, t, s,
|
|
3420
|
+
txInCollateral = (e, t, s, a) => (this.collateralQueueItem && this.meshTxBuilderBody.collaterals.push(this.collateralQueueItem), this.collateralQueueItem = {
|
|
3415
3421
|
type: "PubKey",
|
|
3416
3422
|
txIn: {
|
|
3417
3423
|
txHash: e,
|
|
3418
3424
|
txIndex: t,
|
|
3419
3425
|
amount: s,
|
|
3420
|
-
address:
|
|
3426
|
+
address: a
|
|
3421
3427
|
}
|
|
3422
3428
|
}, this);
|
|
3429
|
+
registerPoolCertificate = (e) => (this.meshTxBuilderBody.certificates.push({
|
|
3430
|
+
type: "RegisterPool",
|
|
3431
|
+
poolParams: e
|
|
3432
|
+
}), this);
|
|
3433
|
+
registerStakeCertificate = (e) => (this.meshTxBuilderBody.certificates.push({
|
|
3434
|
+
type: "RegisterStake",
|
|
3435
|
+
stakeKeyHash: e
|
|
3436
|
+
}), this);
|
|
3437
|
+
delegateStakeCertificate = (e, t) => (this.meshTxBuilderBody.certificates.push({
|
|
3438
|
+
type: "DelegateStake",
|
|
3439
|
+
stakeKeyHash: e,
|
|
3440
|
+
poolId: t
|
|
3441
|
+
}), this);
|
|
3442
|
+
deregisterStakeCertificate = (e) => (this.meshTxBuilderBody.certificates.push({
|
|
3443
|
+
type: "DeregisterStake",
|
|
3444
|
+
stakeKeyHash: e
|
|
3445
|
+
}), this);
|
|
3446
|
+
retirePoolCertificate = (e, t) => (this.meshTxBuilderBody.certificates.push({
|
|
3447
|
+
type: "RetirePool",
|
|
3448
|
+
poolId: e,
|
|
3449
|
+
epoch: t
|
|
3450
|
+
}), this);
|
|
3423
3451
|
changeAddress = (e) => (this.meshTxBuilderBody.changeAddress = e, this);
|
|
3424
3452
|
invalidBefore = (e) => (this.meshTxBuilderBody.validityRange.invalidBefore = e, this);
|
|
3425
3453
|
invalidHereafter = (e) => (this.meshTxBuilderBody.validityRange.invalidHereafter = e, this);
|
|
3426
3454
|
metadataValue = (e, t) => (this.meshTxBuilderBody.metadata.push({ tag: e, metadata: t }), this);
|
|
3427
3455
|
protocolParams = (e) => {
|
|
3428
|
-
const t = { ...
|
|
3456
|
+
const t = { ...T, ...e };
|
|
3429
3457
|
return this._protocolParams = t, this.txBuilder = Et(t), this;
|
|
3430
3458
|
};
|
|
3431
3459
|
signingKey = (e) => (this.meshTxBuilderBody.signingKey.push(e), this);
|
|
3432
3460
|
selectUtxosFrom = (e, t = 5e6) => (this.meshTxBuilderBody.extraInputs = e, this.meshTxBuilderBody.selectionThreshold = t, this);
|
|
3433
3461
|
addUtxosFrom = (e, t) => {
|
|
3434
|
-
const s = this.meshTxBuilderBody.outputs.reduce((
|
|
3435
|
-
const { unit: d, quantity: l } = u,
|
|
3436
|
-
|
|
3437
|
-
}),
|
|
3438
|
-
this.meshTxBuilderBody.inputs.reduce((
|
|
3462
|
+
const s = this.meshTxBuilderBody.outputs.reduce((i, o) => (o.amount.forEach((u) => {
|
|
3463
|
+
const { unit: d, quantity: l } = u, m = Number(i.get(d)) || 0;
|
|
3464
|
+
i.set(d, String(m + Number(l)));
|
|
3465
|
+
}), i), /* @__PURE__ */ new Map());
|
|
3466
|
+
this.meshTxBuilderBody.inputs.reduce((i, o) => {
|
|
3439
3467
|
const c = o.txIn.amount;
|
|
3440
3468
|
return c == null || c.forEach((u) => {
|
|
3441
|
-
const { unit: d, quantity: l } = u,
|
|
3442
|
-
|
|
3443
|
-
}),
|
|
3444
|
-
}, s), this.meshTxBuilderBody.mints.reduce((
|
|
3469
|
+
const { unit: d, quantity: l } = u, m = Number(i.get(d)) || 0;
|
|
3470
|
+
i.set(d, String(m - Number(l)));
|
|
3471
|
+
}), i;
|
|
3472
|
+
}, s), this.meshTxBuilderBody.mints.reduce((i, o) => {
|
|
3445
3473
|
const c = {
|
|
3446
3474
|
unit: o.policyId + o.assetName,
|
|
3447
3475
|
quantity: String(o.amount)
|
|
3448
|
-
}, u = Number(
|
|
3449
|
-
return
|
|
3450
|
-
}, s),
|
|
3476
|
+
}, u = Number(i.get(c.unit)) || 0;
|
|
3477
|
+
return i.set(c.unit, String(u - Number(c.quantity))), i;
|
|
3478
|
+
}, s), Xs(e, s, t).forEach((i) => {
|
|
3451
3479
|
this.addTxIn({
|
|
3452
3480
|
type: "PubKey",
|
|
3453
3481
|
txIn: {
|
|
3454
|
-
txHash:
|
|
3455
|
-
txIndex:
|
|
3456
|
-
amount:
|
|
3457
|
-
address:
|
|
3482
|
+
txHash: i.input.txHash,
|
|
3483
|
+
txIndex: i.input.outputIndex,
|
|
3484
|
+
amount: i.output.amount,
|
|
3485
|
+
address: i.output.address
|
|
3458
3486
|
}
|
|
3459
3487
|
});
|
|
3460
3488
|
});
|
|
3461
3489
|
};
|
|
3462
3490
|
addAllSigningKeys = (e) => {
|
|
3463
3491
|
if (e.length > 0) {
|
|
3464
|
-
const t =
|
|
3492
|
+
const t = n.Vkeywitnesses.new(), s = n.Transaction.from_hex(this.txHex), a = s.body();
|
|
3465
3493
|
e.forEach((c) => {
|
|
3466
|
-
const u = c.slice(0, 4) === "5820" ? c.slice(4) : c, d =
|
|
3494
|
+
const u = c.slice(0, 4) === "5820" ? c.slice(4) : c, d = n.PrivateKey.from_hex(u), l = n.make_vkey_witness(n.hash_transaction(a), d);
|
|
3467
3495
|
t.add(l);
|
|
3468
3496
|
});
|
|
3469
|
-
const
|
|
3470
|
-
|
|
3471
|
-
const o =
|
|
3497
|
+
const i = s.witness_set();
|
|
3498
|
+
i.set_vkeys(t);
|
|
3499
|
+
const o = n.Transaction.new(a, i, s.auxiliary_data());
|
|
3472
3500
|
this.txHex = o.to_hex();
|
|
3473
3501
|
}
|
|
3474
3502
|
};
|
|
@@ -3499,14 +3527,14 @@ class er {
|
|
|
3499
3527
|
this.meshTxBuilderBody.mints.push(this.mintItem), this.mintItem = void 0;
|
|
3500
3528
|
};
|
|
3501
3529
|
makePlutusScriptSource = (e) => {
|
|
3502
|
-
const t =
|
|
3503
|
-
return
|
|
3530
|
+
const t = n.ScriptHash.from_hex(e.spendingScriptHash), s = n.TransactionInput.new(n.TransactionHash.from_hex(e.txHash), e.txIndex);
|
|
3531
|
+
return n.PlutusScriptSource.new_ref_input_with_lang_ver(t, s, Y[e.version]);
|
|
3504
3532
|
};
|
|
3505
3533
|
removeDuplicateInputs = () => {
|
|
3506
|
-
const e = this.meshTxBuilderBody.inputs, t = (
|
|
3507
|
-
for (let
|
|
3508
|
-
const
|
|
3509
|
-
s.includes(
|
|
3534
|
+
const e = this.meshTxBuilderBody.inputs, t = (a) => `${a.txHash}#${a.txIndex}`, s = [];
|
|
3535
|
+
for (let a = 0; a < e.length; a++) {
|
|
3536
|
+
const i = t(e[a].txIn);
|
|
3537
|
+
s.includes(i) ? (e.splice(a, 1), a--) : s.push(i);
|
|
3510
3538
|
}
|
|
3511
3539
|
};
|
|
3512
3540
|
addAllInputs = (e) => {
|
|
@@ -3523,21 +3551,21 @@ class er {
|
|
|
3523
3551
|
}
|
|
3524
3552
|
};
|
|
3525
3553
|
addTxIn = (e) => {
|
|
3526
|
-
this.txBuilder.add_input(
|
|
3554
|
+
this.txBuilder.add_input(n.Address.from_bech32(e.txIn.address), n.TransactionInput.new(n.TransactionHash.from_hex(e.txIn.txHash), e.txIn.txIndex), G(e.txIn.amount));
|
|
3527
3555
|
};
|
|
3528
3556
|
addScriptTxIn = ({ scriptTxIn: e, txIn: t }) => {
|
|
3529
3557
|
let s;
|
|
3530
|
-
const { datumSource:
|
|
3531
|
-
if (
|
|
3532
|
-
s =
|
|
3558
|
+
const { datumSource: a, scriptSource: i, redeemer: o } = e;
|
|
3559
|
+
if (a.type === "Provided")
|
|
3560
|
+
s = n.DatumSource.new(this.castDataToPlutusData(a.data));
|
|
3533
3561
|
else {
|
|
3534
|
-
const d =
|
|
3535
|
-
s =
|
|
3562
|
+
const d = n.TransactionInput.new(n.TransactionHash.from_hex(a.txHash), a.txIndex);
|
|
3563
|
+
s = n.DatumSource.new_ref_input(d);
|
|
3536
3564
|
}
|
|
3537
3565
|
let c;
|
|
3538
|
-
|
|
3539
|
-
const u =
|
|
3540
|
-
this.txBuilder.add_plutus_script_input(
|
|
3566
|
+
i.type == "Inline" ? c = this.makePlutusScriptSource(i.txInInfo) : c = n.PlutusScriptSource.new(n.PlutusScript.from_hex_with_version(i.script.code, Y[i.script.version]));
|
|
3567
|
+
const u = n.Redeemer.new(n.RedeemerTag.new_spend(), n.BigNum.from_str("0"), this.castDataToPlutusData(o.data), n.ExUnits.new(n.BigNum.from_str(String(o.exUnits.mem)), n.BigNum.from_str(String(o.exUnits.steps))));
|
|
3568
|
+
this.txBuilder.add_plutus_script_input(n.PlutusWitness.new_with_ref(c, s, u), n.TransactionInput.new(n.TransactionHash.from_hex(t.txHash), t.txIndex), G(t.amount));
|
|
3541
3569
|
};
|
|
3542
3570
|
addAllOutputs = (e) => {
|
|
3543
3571
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -3545,38 +3573,38 @@ class er {
|
|
|
3545
3573
|
this.addOutput(s);
|
|
3546
3574
|
}
|
|
3547
3575
|
};
|
|
3548
|
-
addOutput = ({ amount: e, address: t, datum: s, referenceScript:
|
|
3549
|
-
const
|
|
3550
|
-
if (
|
|
3576
|
+
addOutput = ({ amount: e, address: t, datum: s, referenceScript: a }) => {
|
|
3577
|
+
const i = G(e), o = i.multiasset();
|
|
3578
|
+
if (i.is_zero() && o === void 0)
|
|
3551
3579
|
throw Error("Invalid output amount");
|
|
3552
|
-
let c =
|
|
3553
|
-
s && s.type === "Hash" && (c = c.with_data_hash(
|
|
3580
|
+
let c = n.TransactionOutputBuilder.new().with_address(K(t));
|
|
3581
|
+
s && s.type === "Hash" && (c = c.with_data_hash(n.hash_plutus_data(this.castDataToPlutusData(s.data)))), s && s.type === "Inline" && (c = c.with_plutus_data(this.castDataToPlutusData(s.data))), a && (c = c.with_script_ref(n.ScriptRef.new_plutus_script(n.PlutusScript.from_hex_with_version(a.code, Y[a.version]))));
|
|
3554
3582
|
const u = c.next();
|
|
3555
3583
|
if (o) {
|
|
3556
|
-
const d =
|
|
3584
|
+
const d = i.coin().is_zero() ? u.with_asset_and_min_required_coin_by_utxo_cost(o, Ft(this._protocolParams.coinsPerUTxOSize)).build() : u.with_coin_and_asset(i.coin(), o).build();
|
|
3557
3585
|
this.txBuilder.add_output(d);
|
|
3558
3586
|
} else {
|
|
3559
|
-
const d = u.with_coin(
|
|
3587
|
+
const d = u.with_coin(i.coin()).build();
|
|
3560
3588
|
this.txBuilder.add_output(d);
|
|
3561
3589
|
}
|
|
3562
3590
|
};
|
|
3563
3591
|
addAllCollaterals = (e) => {
|
|
3564
|
-
const t =
|
|
3592
|
+
const t = n.TxInputsBuilder.new();
|
|
3565
3593
|
for (let s = 0; s < e.length; s++) {
|
|
3566
|
-
const
|
|
3567
|
-
this.addCollateral(t,
|
|
3594
|
+
const a = e[s];
|
|
3595
|
+
this.addCollateral(t, a);
|
|
3568
3596
|
}
|
|
3569
3597
|
this.txBuilder.set_collateral(t);
|
|
3570
3598
|
};
|
|
3571
3599
|
addCollateral = (e, t) => {
|
|
3572
|
-
e.add_input(
|
|
3600
|
+
e.add_input(n.Address.from_bech32(t.txIn.address), n.TransactionInput.new(n.TransactionHash.from_hex(t.txIn.txHash), t.txIn.txIndex), G(t.txIn.amount));
|
|
3573
3601
|
};
|
|
3574
3602
|
addCollateralReturn = (e) => {
|
|
3575
3603
|
var s;
|
|
3576
3604
|
const t = (s = this.txBuilder.get_fee_if_set()) == null ? void 0 : s.to_js_value();
|
|
3577
3605
|
if (t) {
|
|
3578
|
-
const
|
|
3579
|
-
this.txBuilder.set_total_collateral_and_return(
|
|
3606
|
+
const a = Math.ceil(this._protocolParams.collateralPercent * Number(t) / 100);
|
|
3607
|
+
this.txBuilder.set_total_collateral_and_return(n.BigNum.from_str(String(a)), n.Address.from_bech32(e));
|
|
3580
3608
|
}
|
|
3581
3609
|
};
|
|
3582
3610
|
addAllReferenceInputs = (e) => {
|
|
@@ -3585,92 +3613,133 @@ class er {
|
|
|
3585
3613
|
});
|
|
3586
3614
|
};
|
|
3587
3615
|
addReferenceInput = ({ txHash: e, txIndex: t }) => {
|
|
3588
|
-
const s =
|
|
3616
|
+
const s = n.TransactionInput.new(n.TransactionHash.from_hex(e), t);
|
|
3589
3617
|
this.txBuilder.add_reference_input(s);
|
|
3590
3618
|
};
|
|
3591
3619
|
addAllMints = (e) => {
|
|
3592
|
-
const t =
|
|
3620
|
+
const t = n.MintBuilder.new();
|
|
3593
3621
|
let s = 0;
|
|
3594
|
-
for (let
|
|
3595
|
-
const
|
|
3596
|
-
if (!
|
|
3622
|
+
for (let a = 0; a < e.length; a++) {
|
|
3623
|
+
const i = e[a];
|
|
3624
|
+
if (!i.scriptSource)
|
|
3597
3625
|
throw Error("Mint script is expected to be provided");
|
|
3598
|
-
if (
|
|
3599
|
-
if (!
|
|
3626
|
+
if (i.type === "Plutus") {
|
|
3627
|
+
if (!i.redeemer)
|
|
3600
3628
|
throw Error("Missing mint redeemer information");
|
|
3601
|
-
this.addPlutusMint(t,
|
|
3629
|
+
this.addPlutusMint(t, i, s), s++;
|
|
3602
3630
|
} else
|
|
3603
|
-
|
|
3631
|
+
i.type === "Native" && this.addNativeMint(t, i);
|
|
3604
3632
|
}
|
|
3605
3633
|
this.txBuilder.set_mint_builder(t);
|
|
3606
3634
|
};
|
|
3607
|
-
addPlutusMint = (e, { redeemer: t, policyId: s, scriptSource:
|
|
3608
|
-
const u =
|
|
3609
|
-
e.add_asset(
|
|
3635
|
+
addPlutusMint = (e, { redeemer: t, policyId: s, scriptSource: a, assetName: i, amount: o }, c) => {
|
|
3636
|
+
const u = n.Redeemer.new(n.RedeemerTag.new_mint(), n.BigNum.from_str(String(c)), this.castDataToPlutusData(t.data), n.ExUnits.new(n.BigNum.from_str(String(t.exUnits.mem)), n.BigNum.from_str(String(t.exUnits.steps)))), d = a.type === "Reference Script" ? n.PlutusScriptSource.new_ref_input_with_lang_ver(n.ScriptHash.from_hex(s), n.TransactionInput.new(n.TransactionHash.from_hex(a.txHash), a.txIndex), Y[a.version]) : n.PlutusScriptSource.new(n.PlutusScript.from_hex_with_version(a.script.code, Y[a.script.version]));
|
|
3637
|
+
e.add_asset(n.MintWitness.new_plutus_script(d, u), n.AssetName.new(Buffer.from(i, "hex")), n.Int.new(n.BigNum.from_str(o)));
|
|
3610
3638
|
};
|
|
3611
|
-
addNativeMint = (e, { scriptSource: t, assetName: s, amount:
|
|
3639
|
+
addNativeMint = (e, { scriptSource: t, assetName: s, amount: a }) => {
|
|
3612
3640
|
if (t.type === "Reference Script")
|
|
3613
3641
|
throw Error("Native mint cannot have reference script");
|
|
3614
|
-
e.add_asset(
|
|
3642
|
+
e.add_asset(n.MintWitness.new_native_script(n.NativeScript.from_hex(t.script.code)), n.AssetName.new(Buffer.from(s, "hex")), n.Int.new(n.BigNum.from_str(a)));
|
|
3643
|
+
};
|
|
3644
|
+
decimalToFraction(e) {
|
|
3645
|
+
const t = 10 ** e.toString().split(".")[1].length;
|
|
3646
|
+
return [e * t, t];
|
|
3647
|
+
}
|
|
3648
|
+
toPoolParams = (e) => {
|
|
3649
|
+
const t = this.decimalToFraction(e.margin), s = n.Relays.new();
|
|
3650
|
+
e.relays.forEach((o) => {
|
|
3651
|
+
s.add(Ve(o));
|
|
3652
|
+
});
|
|
3653
|
+
const a = n.RewardAddress.from_address(n.Address.from_bech32(e.rewardAddress));
|
|
3654
|
+
if (a === void 0)
|
|
3655
|
+
throw new Error("Reward address is invalid");
|
|
3656
|
+
const i = n.Ed25519KeyHashes.new();
|
|
3657
|
+
return e.owners.forEach((o) => {
|
|
3658
|
+
i.add(n.Ed25519KeyHash.from_hex(o));
|
|
3659
|
+
}), n.PoolParams.new(n.Ed25519KeyHash.from_hex(e.operator), n.VRFKeyHash.from_hex(e.VRFKeyHash), n.BigNum.from_str(e.pledge), n.BigNum.from_str(e.cost), n.UnitInterval.new(n.BigNum.from_str(t[0].toString()), n.BigNum.from_str(t[1].toString())), a, i, s, e.metadata ? n.PoolMetadata.from_json(JSON.stringify(e.metadata)) : void 0);
|
|
3660
|
+
};
|
|
3661
|
+
addCertificate = (e, t) => {
|
|
3662
|
+
switch (t.type) {
|
|
3663
|
+
case "RegisterPool":
|
|
3664
|
+
e.add(n.Certificate.new_pool_registration(n.PoolRegistration.new(this.toPoolParams(t.poolParams))));
|
|
3665
|
+
break;
|
|
3666
|
+
case "RegisterStake":
|
|
3667
|
+
e.add(n.Certificate.new_stake_registration(n.StakeRegistration.new(n.StakeCredential.from_keyhash(n.Ed25519KeyHash.from_hex(t.stakeKeyHash)))));
|
|
3668
|
+
break;
|
|
3669
|
+
case "DelegateStake":
|
|
3670
|
+
e.add(n.Certificate.new_stake_delegation(n.StakeDelegation.new(n.StakeCredential.from_keyhash(n.Ed25519KeyHash.from_hex(t.stakeKeyHash)), t.poolId.startsWith("pool") ? n.Ed25519KeyHash.from_bech32(t.poolId) : n.Ed25519KeyHash.from_hex(t.poolId))));
|
|
3671
|
+
break;
|
|
3672
|
+
case "DeregisterStake":
|
|
3673
|
+
e.add(n.Certificate.new_stake_deregistration(n.StakeDeregistration.new(n.StakeCredential.from_keyhash(n.Ed25519KeyHash.from_hex(t.stakeKeyHash)))));
|
|
3674
|
+
break;
|
|
3675
|
+
case "RetirePool":
|
|
3676
|
+
e.add(n.Certificate.new_pool_retirement(n.PoolRetirement.new(t.poolId.startsWith("pool") ? n.Ed25519KeyHash.from_bech32(t.poolId) : n.Ed25519KeyHash.from_hex(t.poolId), t.epoch)));
|
|
3677
|
+
}
|
|
3615
3678
|
};
|
|
3616
3679
|
queueAllLastItem = () => {
|
|
3617
3680
|
this.txOutput && (this.meshTxBuilderBody.outputs.push(this.txOutput), this.txOutput = void 0), this.txInQueueItem && this.queueInput(), this.collateralQueueItem && (this.meshTxBuilderBody.collaterals.push(this.collateralQueueItem), this.collateralQueueItem = void 0), this.mintItem && this.queueMint();
|
|
3618
3681
|
};
|
|
3682
|
+
addAllCertificates = (e) => {
|
|
3683
|
+
const t = n.Certificates.new();
|
|
3684
|
+
e.forEach((s) => {
|
|
3685
|
+
this.addCertificate(t, s);
|
|
3686
|
+
}), this.txBuilder.set_certs(t);
|
|
3687
|
+
};
|
|
3619
3688
|
addCostModels = () => {
|
|
3620
|
-
this.txBuilder.calc_script_data_hash(
|
|
3689
|
+
this.txBuilder.calc_script_data_hash(n.TxBuilderConstants.plutus_vasil_cost_models());
|
|
3621
3690
|
};
|
|
3622
3691
|
addChange = (e) => {
|
|
3623
|
-
this.txBuilder.add_change_if_needed(
|
|
3692
|
+
this.txBuilder.add_change_if_needed(n.Address.from_bech32(e));
|
|
3624
3693
|
};
|
|
3625
3694
|
addValidityRange = ({ invalidBefore: e, invalidHereafter: t }) => {
|
|
3626
|
-
e && this.txBuilder.set_validity_start_interval_bignum(
|
|
3695
|
+
e && this.txBuilder.set_validity_start_interval_bignum(n.BigNum.from_str(e.toString())), t && this.txBuilder.set_ttl_bignum(n.BigNum.from_str(t.toString()));
|
|
3627
3696
|
};
|
|
3628
3697
|
addAllRequiredSignatures = (e) => {
|
|
3629
3698
|
e.forEach((t) => {
|
|
3630
|
-
this.txBuilder.add_required_signer(
|
|
3699
|
+
this.txBuilder.add_required_signer(n.Ed25519KeyHash.from_hex(t));
|
|
3631
3700
|
});
|
|
3632
3701
|
};
|
|
3633
3702
|
addAllMetadata = (e) => {
|
|
3634
3703
|
e.forEach(({ tag: t, metadata: s }) => {
|
|
3635
|
-
this.txBuilder.add_json_metadatum(
|
|
3704
|
+
this.txBuilder.add_json_metadatum(n.BigNum.from_str(t), JSON.stringify(s));
|
|
3636
3705
|
});
|
|
3637
3706
|
};
|
|
3638
3707
|
updateRedeemer = (e, t) => {
|
|
3639
3708
|
t.forEach((s) => {
|
|
3640
3709
|
switch (s.tag) {
|
|
3641
3710
|
case "SPEND": {
|
|
3642
|
-
const
|
|
3643
|
-
|
|
3711
|
+
const a = e.inputs[s.index];
|
|
3712
|
+
a.type == "Script" && a.scriptTxIn.redeemer && (a.scriptTxIn.redeemer.exUnits.mem = Math.floor(s.budget.mem * this.txEvaluationMultiplier), a.scriptTxIn.redeemer.exUnits.steps = Math.floor(s.budget.steps * this.txEvaluationMultiplier));
|
|
3644
3713
|
break;
|
|
3645
3714
|
}
|
|
3646
3715
|
case "MINT": {
|
|
3647
|
-
const
|
|
3648
|
-
|
|
3716
|
+
const a = e.mints[s.index];
|
|
3717
|
+
a.type == "Plutus" && a.redeemer && (a.redeemer.exUnits.mem = Math.floor(s.budget.mem * this.txEvaluationMultiplier), a.redeemer.exUnits.steps = Math.floor(s.budget.steps * this.txEvaluationMultiplier));
|
|
3649
3718
|
break;
|
|
3650
3719
|
}
|
|
3651
3720
|
}
|
|
3652
3721
|
});
|
|
3653
3722
|
};
|
|
3654
3723
|
castRawDataToJsonString = (e) => typeof e == "object" ? JSON.stringify(e) : e;
|
|
3655
|
-
castDataToPlutusData = ({ type: e, content: t }) => e === "Mesh" ?
|
|
3724
|
+
castDataToPlutusData = ({ type: e, content: t }) => e === "Mesh" ? Z(t) : e === "CBOR" ? n.PlutusData.from_hex(t) : n.PlutusData.from_json(t, n.PlutusDatumSchema.DetailedSchema);
|
|
3656
3725
|
}
|
|
3657
|
-
class
|
|
3726
|
+
class Qr extends tr {
|
|
3658
3727
|
_fetcher;
|
|
3659
3728
|
_submitter;
|
|
3660
3729
|
_evaluator;
|
|
3661
3730
|
queriedTxHashes = /* @__PURE__ */ new Set();
|
|
3662
3731
|
queriedUTxOs = {};
|
|
3663
|
-
constructor({ fetcher: e, submitter: t, evaluator: s, isHydra:
|
|
3664
|
-
super(), e && (this._fetcher = e), t && (this._submitter = t), s && (this._evaluator = s),
|
|
3732
|
+
constructor({ fetcher: e, submitter: t, evaluator: s, isHydra: a = !1 }) {
|
|
3733
|
+
super(), e && (this._fetcher = e), t && (this._submitter = t), s && (this._evaluator = s), a && (this.isHydra = !0);
|
|
3665
3734
|
}
|
|
3666
3735
|
complete = async (e) => {
|
|
3667
3736
|
e ? this.meshTxBuilderBody = e : this.queueAllLastItem();
|
|
3668
|
-
const { inputs: t, collaterals: s } = this.meshTxBuilderBody,
|
|
3669
|
-
if (console.log("Incomplete UTxO",
|
|
3670
|
-
this.completeTxInformation(
|
|
3737
|
+
const { inputs: t, collaterals: s } = this.meshTxBuilderBody, a = [...t, ...s].filter((i) => !this.isInputComplete(i));
|
|
3738
|
+
if (console.log("Incomplete UTxO", a), await this.queryAllTxInfo(a), console.log("Incomplete UTxO", a), a.forEach((i) => {
|
|
3739
|
+
this.completeTxInformation(i);
|
|
3671
3740
|
}), this.completeSync(e), this._evaluator) {
|
|
3672
|
-
const
|
|
3673
|
-
this.updateRedeemer(this.meshTxBuilderBody,
|
|
3741
|
+
const i = await this._evaluator.evaluateTx(this.txHex);
|
|
3742
|
+
this.updateRedeemer(this.meshTxBuilderBody, i), this.completeSync(e);
|
|
3674
3743
|
}
|
|
3675
3744
|
return this;
|
|
3676
3745
|
};
|
|
@@ -3688,29 +3757,29 @@ class Tr extends er {
|
|
|
3688
3757
|
const t = [];
|
|
3689
3758
|
if (e.length > 0 && !this._fetcher)
|
|
3690
3759
|
throw Error("Transaction information is incomplete while no fetcher instance is provided");
|
|
3691
|
-
for (let
|
|
3692
|
-
const
|
|
3693
|
-
this.isInputInfoComplete(
|
|
3760
|
+
for (let a = 0; a < e.length; a++) {
|
|
3761
|
+
const i = e[a];
|
|
3762
|
+
this.isInputInfoComplete(i) || t.push(this.getUTxOInfo(i.txIn.txHash)), i.type === "Script" && ((s = i.scriptTxIn.scriptSource) == null ? void 0 : s.type) === "Inline" && !this.isRefScriptInfoComplete(i) && t.push(this.getUTxOInfo(i.scriptTxIn.scriptSource.txInInfo.txHash));
|
|
3694
3763
|
}
|
|
3695
3764
|
return Promise.all(t);
|
|
3696
3765
|
};
|
|
3697
3766
|
completeTxInformation = (e) => {
|
|
3698
3767
|
var t;
|
|
3699
3768
|
if (!this.isInputInfoComplete(e)) {
|
|
3700
|
-
const s = this.queriedUTxOs[e.txIn.txHash],
|
|
3701
|
-
if (!
|
|
3769
|
+
const s = this.queriedUTxOs[e.txIn.txHash], a = s == null ? void 0 : s.find((c) => c.input.outputIndex === e.txIn.txIndex), i = a == null ? void 0 : a.output.amount, o = a == null ? void 0 : a.output.address;
|
|
3770
|
+
if (!i || i.length === 0)
|
|
3702
3771
|
throw Error(`Couldn't find value information for ${e.txIn.txHash}#${e.txIn.txIndex}`);
|
|
3703
|
-
if (e.txIn.amount =
|
|
3772
|
+
if (e.txIn.amount = i, e.type === "PubKey") {
|
|
3704
3773
|
if (!o || o === "")
|
|
3705
3774
|
throw Error(`Couldn't find address information for ${e.txIn.txHash}#${e.txIn.txIndex}`);
|
|
3706
3775
|
e.txIn.address = o;
|
|
3707
3776
|
}
|
|
3708
3777
|
}
|
|
3709
3778
|
if (e.type === "Script" && ((t = e.scriptTxIn.scriptSource) == null ? void 0 : t.type) == "Inline" && !this.isRefScriptInfoComplete(e)) {
|
|
3710
|
-
const s = e.scriptTxIn.scriptSource.txInInfo,
|
|
3711
|
-
if (!
|
|
3779
|
+
const s = e.scriptTxIn.scriptSource.txInInfo, i = this.queriedUTxOs[s.txHash].find((o) => o.input.outputIndex === s.txIndex);
|
|
3780
|
+
if (!i)
|
|
3712
3781
|
throw Error(`Couldn't find script reference utxo for ${s.txHash}#${s.txIndex}`);
|
|
3713
|
-
s.spendingScriptHash =
|
|
3782
|
+
s.spendingScriptHash = i == null ? void 0 : i.output.scriptHash;
|
|
3714
3783
|
}
|
|
3715
3784
|
};
|
|
3716
3785
|
isInputComplete = (e) => e.type === "PubKey" ? this.isInputInfoComplete(e) : e.type === "Script" ? this.isInputInfoComplete(e) && this.isRefScriptInfoComplete(e) : !0;
|
|
@@ -3724,47 +3793,47 @@ class Tr extends er {
|
|
|
3724
3793
|
return !((t == null ? void 0 : t.type) === "Inline" && !((s = t.txInInfo) != null && s.spendingScriptHash));
|
|
3725
3794
|
};
|
|
3726
3795
|
}
|
|
3727
|
-
class
|
|
3796
|
+
class S {
|
|
3728
3797
|
_networkId;
|
|
3729
3798
|
_encryptedSecret;
|
|
3730
3799
|
constructor(e, t) {
|
|
3731
3800
|
this._networkId = e, this._encryptedSecret = t;
|
|
3732
3801
|
}
|
|
3733
3802
|
getAccount(e, t) {
|
|
3734
|
-
return this.accountContext(e, t, (s,
|
|
3735
|
-
const
|
|
3803
|
+
return this.accountContext(e, t, (s, a) => {
|
|
3804
|
+
const i = ye(this._networkId, s.to_public().hash(), a.to_public().hash()).to_address().to_bech32(), o = xe(this._networkId, s.to_public().hash()).to_address().to_bech32(), c = Ot(this._networkId, a.to_public().hash()).to_address().to_bech32();
|
|
3736
3805
|
return {
|
|
3737
|
-
baseAddress:
|
|
3806
|
+
baseAddress: i,
|
|
3738
3807
|
enterpriseAddress: o,
|
|
3739
3808
|
rewardAddress: c
|
|
3740
3809
|
};
|
|
3741
3810
|
});
|
|
3742
3811
|
}
|
|
3743
|
-
signData(e, t, s,
|
|
3812
|
+
signData(e, t, s, a) {
|
|
3744
3813
|
try {
|
|
3745
|
-
return this.accountContext(e, t, (
|
|
3746
|
-
const c = { payload:
|
|
3747
|
-
address:
|
|
3748
|
-
key: s.startsWith("stake") ? o :
|
|
3749
|
-
}, { coseSign1: d, coseKey: l } =
|
|
3814
|
+
return this.accountContext(e, t, (i, o) => {
|
|
3815
|
+
const c = { payload: a }, u = {
|
|
3816
|
+
address: S.resolveAddress(this._networkId, s, i, o),
|
|
3817
|
+
key: s.startsWith("stake") ? o : i
|
|
3818
|
+
}, { coseSign1: d, coseKey: l } = ms(c, u);
|
|
3750
3819
|
return { signature: d, key: l };
|
|
3751
3820
|
});
|
|
3752
|
-
} catch (
|
|
3753
|
-
throw new Error(`An error occurred during signData: ${
|
|
3821
|
+
} catch (i) {
|
|
3822
|
+
throw new Error(`An error occurred during signData: ${i}.`);
|
|
3754
3823
|
}
|
|
3755
3824
|
}
|
|
3756
|
-
signTx(e, t, s,
|
|
3825
|
+
signTx(e, t, s, a, i) {
|
|
3757
3826
|
try {
|
|
3758
|
-
const o =
|
|
3827
|
+
const o = Fe(Ws(a));
|
|
3759
3828
|
return this.accountContext(e, t, (c, u) => {
|
|
3760
|
-
const d =
|
|
3761
|
-
return
|
|
3762
|
-
if (
|
|
3763
|
-
d.add(
|
|
3764
|
-
else if (
|
|
3765
|
-
d.add(
|
|
3766
|
-
else if (
|
|
3767
|
-
throw new Error(`Missing key witness for: ${
|
|
3829
|
+
const d = n.Vkeywitnesses.new();
|
|
3830
|
+
return S.resolveSigners(a, s, c.to_public().hash().to_hex()).forEach((m) => {
|
|
3831
|
+
if (m === c.to_public().hash().to_hex())
|
|
3832
|
+
d.add(n.make_vkey_witness(o, c));
|
|
3833
|
+
else if (m === u.to_public().hash().to_hex())
|
|
3834
|
+
d.add(n.make_vkey_witness(o, u));
|
|
3835
|
+
else if (i === !1)
|
|
3836
|
+
throw new Error(`Missing key witness for: ${m}`);
|
|
3768
3837
|
}), d;
|
|
3769
3838
|
});
|
|
3770
3839
|
} catch (o) {
|
|
@@ -3772,159 +3841,159 @@ class B {
|
|
|
3772
3841
|
}
|
|
3773
3842
|
}
|
|
3774
3843
|
static encryptMnemonic(e, t) {
|
|
3775
|
-
const s =
|
|
3776
|
-
return
|
|
3844
|
+
const s = Se(e.join(" ")), a = Le(s), i = k(a.as_bytes());
|
|
3845
|
+
return a.free(), S.encrypt(i, t);
|
|
3777
3846
|
}
|
|
3778
3847
|
static encryptPrivateKey(e, t) {
|
|
3779
|
-
const s =
|
|
3780
|
-
return s.free(),
|
|
3848
|
+
const s = n.Bip32PrivateKey.from_bech32(e), a = k(s.as_bytes());
|
|
3849
|
+
return s.free(), S.encrypt(a, t);
|
|
3781
3850
|
}
|
|
3782
3851
|
static encryptSigningKeys(e, t, s) {
|
|
3783
|
-
const
|
|
3784
|
-
return [
|
|
3852
|
+
const a = S.encrypt(e.slice(4), s), i = S.encrypt(t.slice(4), s);
|
|
3853
|
+
return [a, i];
|
|
3785
3854
|
}
|
|
3786
3855
|
static generateMnemonic(e = 256) {
|
|
3787
3856
|
return ze(e).split(" ");
|
|
3788
3857
|
}
|
|
3789
3858
|
accountContext(e, t, s) {
|
|
3790
|
-
const { paymentKey:
|
|
3791
|
-
return
|
|
3859
|
+
const { paymentKey: a, stakeKey: i } = S.resolveKeys(e, t, this._encryptedSecret), o = s(a, i);
|
|
3860
|
+
return a.free(), i.free(), o;
|
|
3792
3861
|
}
|
|
3793
3862
|
static decrypt(e, t) {
|
|
3794
3863
|
try {
|
|
3795
|
-
return
|
|
3864
|
+
return n.decrypt_with_password(b(t), e);
|
|
3796
3865
|
} catch {
|
|
3797
3866
|
throw new Error("The password is incorrect.");
|
|
3798
3867
|
}
|
|
3799
3868
|
}
|
|
3800
3869
|
static encrypt(e, t) {
|
|
3801
|
-
const s =
|
|
3802
|
-
return
|
|
3803
|
-
}
|
|
3804
|
-
static resolveAddress(e, t, s,
|
|
3805
|
-
const
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3870
|
+
const s = Be("0123456789abcdef"), a = s(64), i = s(24);
|
|
3871
|
+
return n.encrypt_with_password(b(t), a, i, e);
|
|
3872
|
+
}
|
|
3873
|
+
static resolveAddress(e, t, s, a) {
|
|
3874
|
+
const i = [
|
|
3875
|
+
ye(e, s.to_public().hash(), a.to_public().hash()),
|
|
3876
|
+
xe(e, s.to_public().hash()),
|
|
3877
|
+
Ot(e, a.to_public().hash())
|
|
3809
3878
|
].find((o) => o.to_address().to_bech32() === t);
|
|
3810
|
-
if (
|
|
3811
|
-
return
|
|
3879
|
+
if (i !== void 0)
|
|
3880
|
+
return i.to_address();
|
|
3812
3881
|
throw new Error(`Address: ${t} doesn't belong to this account.`);
|
|
3813
3882
|
}
|
|
3814
3883
|
static resolveKeys(e, t, s) {
|
|
3815
3884
|
if (typeof s == "string") {
|
|
3816
|
-
const o =
|
|
3817
|
-
return
|
|
3885
|
+
const o = S.decrypt(s, t);
|
|
3886
|
+
return Ms(o, e);
|
|
3818
3887
|
}
|
|
3819
|
-
const
|
|
3888
|
+
const a = S.decrypt(s[0], t), i = S.decrypt(s[1], t);
|
|
3820
3889
|
return {
|
|
3821
|
-
paymentKey:
|
|
3822
|
-
stakeKey:
|
|
3890
|
+
paymentKey: n.PrivateKey.from_hex(a),
|
|
3891
|
+
stakeKey: n.PrivateKey.from_hex(i)
|
|
3823
3892
|
};
|
|
3824
3893
|
}
|
|
3825
3894
|
static resolveSigners(e, t, s) {
|
|
3826
|
-
const
|
|
3827
|
-
const u = (f,
|
|
3828
|
-
var ft, lt,
|
|
3829
|
-
if (f === void 0 ||
|
|
3830
|
-
return
|
|
3831
|
-
const
|
|
3832
|
-
switch (
|
|
3833
|
-
case
|
|
3834
|
-
const
|
|
3895
|
+
const a = (c) => {
|
|
3896
|
+
const u = (f, C = [], w = 0) => {
|
|
3897
|
+
var ft, lt, Jt, Wt, jt;
|
|
3898
|
+
if (f === void 0 || w >= f.len())
|
|
3899
|
+
return C;
|
|
3900
|
+
const D = f.get(w), P = new Array();
|
|
3901
|
+
switch (D.kind()) {
|
|
3902
|
+
case n.CertificateKind.StakeDeregistration: {
|
|
3903
|
+
const B = (ft = D.as_stake_deregistration()) == null ? void 0 : ft.stake_credential(), q = (B == null ? void 0 : B.kind()) === n.StakeCredKind.Key ? B.to_keyhash() : void 0;
|
|
3835
3904
|
q && P.push(q.to_hex());
|
|
3836
3905
|
break;
|
|
3837
3906
|
}
|
|
3838
|
-
case
|
|
3839
|
-
const
|
|
3907
|
+
case n.CertificateKind.StakeDelegation: {
|
|
3908
|
+
const B = (lt = D.as_stake_delegation()) == null ? void 0 : lt.stake_credential(), q = (B == null ? void 0 : B.kind()) === n.StakeCredKind.Key ? B.to_keyhash() : void 0;
|
|
3840
3909
|
q && P.push(q.to_hex());
|
|
3841
3910
|
break;
|
|
3842
3911
|
}
|
|
3843
|
-
case
|
|
3844
|
-
const
|
|
3845
|
-
P.push(...l(
|
|
3912
|
+
case n.CertificateKind.PoolRegistration: {
|
|
3913
|
+
const B = (Jt = D.as_pool_registration()) == null ? void 0 : Jt.pool_params().pool_owners();
|
|
3914
|
+
P.push(...l(B));
|
|
3846
3915
|
break;
|
|
3847
3916
|
}
|
|
3848
|
-
case
|
|
3849
|
-
const
|
|
3850
|
-
|
|
3917
|
+
case n.CertificateKind.PoolRetirement: {
|
|
3918
|
+
const B = (Wt = D.as_pool_retirement()) == null ? void 0 : Wt.pool_keyhash();
|
|
3919
|
+
B && P.push(B.to_hex());
|
|
3851
3920
|
break;
|
|
3852
3921
|
}
|
|
3853
|
-
case
|
|
3854
|
-
const
|
|
3855
|
-
if (
|
|
3856
|
-
for (let q = 0; q <
|
|
3857
|
-
const
|
|
3858
|
-
|
|
3922
|
+
case n.CertificateKind.MoveInstantaneousRewardsCert: {
|
|
3923
|
+
const B = (jt = D.as_move_instantaneous_rewards_cert()) == null ? void 0 : jt.move_instantaneous_reward().as_to_stake_creds();
|
|
3924
|
+
if (B)
|
|
3925
|
+
for (let q = 0; q < B.len(); q += 1) {
|
|
3926
|
+
const Xt = B.keys().get(q), Zt = Xt.kind() === n.StakeCredKind.Key ? Xt.to_keyhash() : void 0;
|
|
3927
|
+
Zt && P.push(Zt.to_hex());
|
|
3859
3928
|
}
|
|
3860
3929
|
break;
|
|
3861
3930
|
}
|
|
3862
3931
|
}
|
|
3863
|
-
return u(f, [...
|
|
3864
|
-
}, d = (f,
|
|
3865
|
-
if (f === void 0 ||
|
|
3866
|
-
return
|
|
3867
|
-
const
|
|
3868
|
-
return d(f, [...
|
|
3869
|
-
}, l = (f,
|
|
3870
|
-
if (f === void 0 ||
|
|
3871
|
-
return
|
|
3872
|
-
const
|
|
3873
|
-
return
|
|
3874
|
-
},
|
|
3932
|
+
return u(f, [...C, ...P], w + 1);
|
|
3933
|
+
}, d = (f, C = [], w = 0) => {
|
|
3934
|
+
if (f === void 0 || w >= f.len())
|
|
3935
|
+
return C;
|
|
3936
|
+
const D = f.get(w).index(), P = f.get(w).transaction_id(), ft = t.find((lt) => lt.input.outputIndex === D && lt.input.txHash === P.to_hex()) !== void 0 ? s : "OUR_PRINCESS_IS_IN_ANOTHER_CASTLE";
|
|
3937
|
+
return d(f, [...C, ft], w + 1);
|
|
3938
|
+
}, l = (f, C = [], w = 0) => f === void 0 || w >= f.len() ? C : l(f, [...C, f.get(w).to_hex()], w + 1), m = (f, C = [], w = 0) => {
|
|
3939
|
+
if (f === void 0 || w >= f.len())
|
|
3940
|
+
return C;
|
|
3941
|
+
const D = f.keys().get(w).payment_cred(), P = D.kind() === n.StakeCredKind.Key ? D.to_keyhash() : void 0;
|
|
3942
|
+
return m(f, P ? [...C, P.to_hex()] : C, w + 1);
|
|
3943
|
+
}, g = c.certs(), A = c.collateral(), I = c.inputs(), x = c.required_signers(), v = c.withdrawals();
|
|
3875
3944
|
return [
|
|
3876
|
-
...u(
|
|
3877
|
-
...d(
|
|
3878
|
-
...d(
|
|
3879
|
-
...l(
|
|
3880
|
-
...
|
|
3945
|
+
...u(g),
|
|
3946
|
+
...d(A),
|
|
3947
|
+
...d(I),
|
|
3948
|
+
...l(x),
|
|
3949
|
+
...m(v)
|
|
3881
3950
|
];
|
|
3882
|
-
},
|
|
3883
|
-
const u = (l,
|
|
3884
|
-
var
|
|
3951
|
+
}, i = (c) => {
|
|
3952
|
+
const u = (l, m = []) => {
|
|
3953
|
+
var g, A, I, x;
|
|
3885
3954
|
if (l)
|
|
3886
|
-
for (let
|
|
3887
|
-
const f = l.get(
|
|
3955
|
+
for (let v = 0; v < l.len(); v += 1) {
|
|
3956
|
+
const f = l.get(v);
|
|
3888
3957
|
switch (f.kind()) {
|
|
3889
|
-
case
|
|
3890
|
-
const
|
|
3891
|
-
return
|
|
3958
|
+
case n.NativeScriptKind.ScriptPubkey: {
|
|
3959
|
+
const C = (g = f.as_script_pubkey()) == null ? void 0 : g.addr_keyhash().to_hex();
|
|
3960
|
+
return C ? [...m, C] : m;
|
|
3892
3961
|
}
|
|
3893
|
-
case
|
|
3894
|
-
return u((
|
|
3895
|
-
case
|
|
3896
|
-
return u((
|
|
3897
|
-
case
|
|
3898
|
-
return u((
|
|
3962
|
+
case n.NativeScriptKind.ScriptAll:
|
|
3963
|
+
return u((A = f.as_script_all()) == null ? void 0 : A.native_scripts(), m);
|
|
3964
|
+
case n.NativeScriptKind.ScriptAny:
|
|
3965
|
+
return u((I = f.as_script_any()) == null ? void 0 : I.native_scripts(), m);
|
|
3966
|
+
case n.NativeScriptKind.ScriptNOfK:
|
|
3967
|
+
return u((x = f.as_script_n_of_k()) == null ? void 0 : x.native_scripts(), m);
|
|
3899
3968
|
}
|
|
3900
3969
|
}
|
|
3901
|
-
return
|
|
3970
|
+
return m;
|
|
3902
3971
|
}, d = c.native_scripts();
|
|
3903
3972
|
return [
|
|
3904
3973
|
...u(d)
|
|
3905
3974
|
];
|
|
3906
|
-
}, o =
|
|
3975
|
+
}, o = O(e);
|
|
3907
3976
|
return /* @__PURE__ */ new Set([
|
|
3908
|
-
...
|
|
3909
|
-
...
|
|
3977
|
+
...a(o.body()),
|
|
3978
|
+
...i(o.witness_set())
|
|
3910
3979
|
]);
|
|
3911
3980
|
}
|
|
3912
3981
|
}
|
|
3913
3982
|
const N = "MARI0TIME";
|
|
3914
|
-
class
|
|
3983
|
+
class vr {
|
|
3915
3984
|
_fetcher;
|
|
3916
3985
|
_submitter;
|
|
3917
3986
|
_wallet;
|
|
3918
3987
|
constructor(e) {
|
|
3919
3988
|
switch (this._fetcher = e.fetcher, this._submitter = e.submitter, e.key.type) {
|
|
3920
3989
|
case "mnemonic":
|
|
3921
|
-
this._wallet = new
|
|
3990
|
+
this._wallet = new S(e.networkId, S.encryptMnemonic(e.key.words, N));
|
|
3922
3991
|
break;
|
|
3923
3992
|
case "root":
|
|
3924
|
-
this._wallet = new
|
|
3993
|
+
this._wallet = new S(e.networkId, S.encryptPrivateKey(e.key.bech32, N));
|
|
3925
3994
|
break;
|
|
3926
3995
|
case "cli":
|
|
3927
|
-
this._wallet = new
|
|
3996
|
+
this._wallet = new S(e.networkId, S.encryptSigningKeys(e.key.payment, e.key.stake ?? "f0".repeat(34), N));
|
|
3928
3997
|
}
|
|
3929
3998
|
}
|
|
3930
3999
|
getBaseAddress(e = 0) {
|
|
@@ -3940,42 +4009,42 @@ class Ur {
|
|
|
3940
4009
|
const t = this._wallet.getAccount(e, N);
|
|
3941
4010
|
return K(t.enterpriseAddress);
|
|
3942
4011
|
}
|
|
3943
|
-
getUsedCollateral(e =
|
|
4012
|
+
getUsedCollateral(e = T.maxCollateralInputs) {
|
|
3944
4013
|
throw new Error("getUsedCollateral not implemented.");
|
|
3945
4014
|
}
|
|
3946
4015
|
async getUsedUTxOs(e = 0) {
|
|
3947
4016
|
const t = this._wallet.getAccount(e, N);
|
|
3948
|
-
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((
|
|
4017
|
+
return (await this._fetcher.fetchAddressUTxOs(t.enterpriseAddress)).map((a) => M(a));
|
|
3949
4018
|
}
|
|
3950
4019
|
signData(e, t, s = 0) {
|
|
3951
4020
|
try {
|
|
3952
4021
|
return this._wallet.signData(s, N, e, t);
|
|
3953
|
-
} catch (
|
|
3954
|
-
throw new Error(`[AppWallet] An error occurred during signData: ${
|
|
4022
|
+
} catch (a) {
|
|
4023
|
+
throw new Error(`[AppWallet] An error occurred during signData: ${a}.`);
|
|
3955
4024
|
}
|
|
3956
4025
|
}
|
|
3957
4026
|
async signTx(e, t = !1, s = 0) {
|
|
3958
4027
|
try {
|
|
3959
|
-
const
|
|
3960
|
-
return u.set_vkeys(d),
|
|
3961
|
-
} catch (
|
|
3962
|
-
throw new Error(`[AppWallet] An error occurred during signTx: ${
|
|
4028
|
+
const a = this._wallet.getAccount(s, N), i = await this._fetcher.fetchAddressUTxOs(a.enterpriseAddress), o = this._wallet.signTx(s, N, i, e, t), c = O(e), u = c.witness_set(), d = $e(u, o);
|
|
4029
|
+
return u.set_vkeys(d), n.Transaction.new(c.body(), u, c.auxiliary_data()).to_hex();
|
|
4030
|
+
} catch (a) {
|
|
4031
|
+
throw new Error(`[AppWallet] An error occurred during signTx: ${a}.`);
|
|
3963
4032
|
}
|
|
3964
4033
|
}
|
|
3965
4034
|
submitTx(e) {
|
|
3966
4035
|
return this._submitter.submitTx(e);
|
|
3967
4036
|
}
|
|
3968
4037
|
static brew(e = 256) {
|
|
3969
|
-
return
|
|
4038
|
+
return S.generateMnemonic(e);
|
|
3970
4039
|
}
|
|
3971
4040
|
}
|
|
3972
|
-
class
|
|
4041
|
+
class Vt {
|
|
3973
4042
|
_walletInstance;
|
|
3974
4043
|
constructor(e) {
|
|
3975
4044
|
this._walletInstance = e;
|
|
3976
4045
|
}
|
|
3977
4046
|
static getInstalledWallets() {
|
|
3978
|
-
return window.cardano === void 0 ? [] :
|
|
4047
|
+
return window.cardano === void 0 ? [] : se.filter((e) => window.cardano[e] !== void 0).map((e) => ({
|
|
3979
4048
|
name: window.cardano[e].name,
|
|
3980
4049
|
icon: window.cardano[e].icon,
|
|
3981
4050
|
version: window.cardano[e].apiVersion
|
|
@@ -3983,9 +4052,9 @@ class Ot {
|
|
|
3983
4052
|
}
|
|
3984
4053
|
static async enable(e) {
|
|
3985
4054
|
try {
|
|
3986
|
-
const t = await
|
|
4055
|
+
const t = await Vt.resolveInstance(e);
|
|
3987
4056
|
if (t !== void 0)
|
|
3988
|
-
return new
|
|
4057
|
+
return new Vt(t);
|
|
3989
4058
|
throw new Error(`Couldn't create an instance of wallet: ${e}`);
|
|
3990
4059
|
} catch (t) {
|
|
3991
4060
|
throw new Error(`[BrowserWallet] An error occurred during enable: ${JSON.stringify(t)}.`);
|
|
@@ -3993,38 +4062,38 @@ class Ot {
|
|
|
3993
4062
|
}
|
|
3994
4063
|
async getBalance() {
|
|
3995
4064
|
const e = await this._walletInstance.getBalance();
|
|
3996
|
-
return
|
|
4065
|
+
return Ye(Gs(e));
|
|
3997
4066
|
}
|
|
3998
4067
|
async getChangeAddress() {
|
|
3999
4068
|
const e = await this._walletInstance.getChangeAddress();
|
|
4000
|
-
return
|
|
4069
|
+
return at(e).to_bech32();
|
|
4001
4070
|
}
|
|
4002
|
-
async getCollateral(e =
|
|
4071
|
+
async getCollateral(e = T.maxCollateralInputs) {
|
|
4003
4072
|
return (await this.getUsedCollateral(e)).map((s) => vt(s));
|
|
4004
4073
|
}
|
|
4005
4074
|
getNetworkId() {
|
|
4006
4075
|
return this._walletInstance.getNetworkId();
|
|
4007
4076
|
}
|
|
4008
4077
|
async getRewardAddresses() {
|
|
4009
|
-
return (await this._walletInstance.getRewardAddresses()).map((t) =>
|
|
4078
|
+
return (await this._walletInstance.getRewardAddresses()).map((t) => at(t).to_bech32());
|
|
4010
4079
|
}
|
|
4011
4080
|
async getUnusedAddresses() {
|
|
4012
|
-
return (await this._walletInstance.getUnusedAddresses()).map((t) =>
|
|
4081
|
+
return (await this._walletInstance.getUnusedAddresses()).map((t) => at(t).to_bech32());
|
|
4013
4082
|
}
|
|
4014
4083
|
async getUsedAddresses() {
|
|
4015
|
-
return (await this._walletInstance.getUsedAddresses()).map((t) =>
|
|
4084
|
+
return (await this._walletInstance.getUsedAddresses()).map((t) => at(t).to_bech32());
|
|
4016
4085
|
}
|
|
4017
|
-
async getUtxos() {
|
|
4018
|
-
return (await this.getUsedUTxOs()).map((
|
|
4086
|
+
async getUtxos(e = void 0) {
|
|
4087
|
+
return (await this.getUsedUTxOs(e)).map((s) => vt(s));
|
|
4019
4088
|
}
|
|
4020
4089
|
signData(e, t) {
|
|
4021
4090
|
const s = K(e).to_hex();
|
|
4022
|
-
return this._walletInstance.signData(s,
|
|
4091
|
+
return this._walletInstance.signData(s, b(t));
|
|
4023
4092
|
}
|
|
4024
4093
|
async signTx(e, t = !1) {
|
|
4025
4094
|
try {
|
|
4026
|
-
const s =
|
|
4027
|
-
return
|
|
4095
|
+
const s = O(e), a = s.witness_set(), i = await this._walletInstance.signTx(e, t), o = Ls(i).vkeys() ?? n.Vkeywitnesses.new(), c = $e(a, o);
|
|
4096
|
+
return a.set_vkeys(c), k(n.Transaction.new(s.body(), a, s.auxiliary_data()).to_bytes());
|
|
4028
4097
|
} catch (s) {
|
|
4029
4098
|
throw new Error(`[BrowserWallet] An error occurred during signTx: ${JSON.stringify(s)}.`);
|
|
4030
4099
|
}
|
|
@@ -4034,22 +4103,23 @@ class Ot {
|
|
|
4034
4103
|
}
|
|
4035
4104
|
async getUsedAddress() {
|
|
4036
4105
|
const e = await this._walletInstance.getUsedAddresses();
|
|
4037
|
-
return
|
|
4106
|
+
return at(e[0]);
|
|
4038
4107
|
}
|
|
4039
|
-
async getUsedCollateral(e =
|
|
4040
|
-
return (await this._walletInstance.experimental.getCollateral() ?? []).map((s) =>
|
|
4108
|
+
async getUsedCollateral(e = T.maxCollateralInputs) {
|
|
4109
|
+
return (await this._walletInstance.experimental.getCollateral() ?? []).map((s) => fe(s)).slice(0, e);
|
|
4041
4110
|
}
|
|
4042
|
-
async getUsedUTxOs() {
|
|
4043
|
-
|
|
4111
|
+
async getUsedUTxOs(e = void 0) {
|
|
4112
|
+
const t = e ? G(e).to_hex() : void 0;
|
|
4113
|
+
return (await this._walletInstance.getUtxos(t) ?? []).map((a) => fe(a));
|
|
4044
4114
|
}
|
|
4045
4115
|
async getAssets() {
|
|
4046
4116
|
return (await this.getBalance()).filter((t) => t.unit !== "lovelace").map((t) => {
|
|
4047
|
-
const s = t.unit.slice(0,
|
|
4117
|
+
const s = t.unit.slice(0, R), a = t.unit.slice(R), i = Js(s, a);
|
|
4048
4118
|
return {
|
|
4049
4119
|
unit: t.unit,
|
|
4050
4120
|
policyId: s,
|
|
4051
|
-
assetName:
|
|
4052
|
-
fingerprint:
|
|
4121
|
+
assetName: zt(a),
|
|
4122
|
+
fingerprint: i,
|
|
4053
4123
|
quantity: t.quantity
|
|
4054
4124
|
};
|
|
4055
4125
|
});
|
|
@@ -4063,118 +4133,52 @@ class Ot {
|
|
|
4063
4133
|
}
|
|
4064
4134
|
async getPolicyIds() {
|
|
4065
4135
|
const e = await this.getBalance();
|
|
4066
|
-
return Array.from(new Set(e.map((t) => t.unit.slice(0,
|
|
4136
|
+
return Array.from(new Set(e.map((t) => t.unit.slice(0, R)))).filter((t) => t !== "lovelace");
|
|
4067
4137
|
}
|
|
4068
4138
|
static resolveInstance(e) {
|
|
4069
4139
|
if (window.cardano === void 0)
|
|
4070
4140
|
return;
|
|
4071
|
-
const t =
|
|
4141
|
+
const t = se.map((s) => window.cardano[s]).filter((s) => s !== void 0).find((s) => s.name.toLowerCase() === e.toLowerCase());
|
|
4072
4142
|
return t == null ? void 0 : t.enable();
|
|
4073
4143
|
}
|
|
4074
4144
|
}
|
|
4075
|
-
const $e = "http://localhost:4000/", sr = "http://localhost:5000/", rr = `${$e}access`, nr = `${$e}transaction/signtx`;
|
|
4076
|
-
class Pr {
|
|
4077
|
-
static getAxiosInstance() {
|
|
4078
|
-
return G.create({
|
|
4079
|
-
baseURL: sr,
|
|
4080
|
-
withCredentials: !0
|
|
4081
|
-
});
|
|
4082
|
-
}
|
|
4083
|
-
static getAppId() {
|
|
4084
|
-
return window.location.hostname;
|
|
4085
|
-
}
|
|
4086
|
-
static async openMinaFrontend(e) {
|
|
4087
|
-
const t = this.getAppId();
|
|
4088
|
-
e.includes("?") ? e = `${e}&appId=${t}` : e = `${e}?appId=${t}`;
|
|
4089
|
-
const s = "left=100,top=100,width=540,height=540", n = window.open(e, "meshWindow", s);
|
|
4090
|
-
return n || console.error("the window did not open", n), await (async () => new Promise((a) => {
|
|
4091
|
-
window.addEventListener("message", async (o) => {
|
|
4092
|
-
o.data.target == "minaWallet" && a(o.data);
|
|
4093
|
-
});
|
|
4094
|
-
}))();
|
|
4095
|
-
}
|
|
4096
|
-
static async get(e, t = {}) {
|
|
4097
|
-
const s = this.getAppId();
|
|
4098
|
-
t = {
|
|
4099
|
-
...t,
|
|
4100
|
-
appId: s
|
|
4101
|
-
};
|
|
4102
|
-
try {
|
|
4103
|
-
return (await this.getAxiosInstance().get(e, {
|
|
4104
|
-
params: t
|
|
4105
|
-
})).data;
|
|
4106
|
-
} catch {
|
|
4107
|
-
console.error("Not logged in");
|
|
4108
|
-
return;
|
|
4109
|
-
}
|
|
4110
|
-
}
|
|
4111
|
-
static async enable() {
|
|
4112
|
-
return await this.get("wallet/getuserwalletsmeta") === void 0 ? await this.openMinaFrontend(rr) : !0;
|
|
4113
|
-
}
|
|
4114
|
-
static async getChangeAddress(e = void 0, t = void 0) {
|
|
4115
|
-
return await this.get("wallet/getchangeaddress", {
|
|
4116
|
-
walletId: e,
|
|
4117
|
-
accountIndex: t
|
|
4118
|
-
});
|
|
4119
|
-
}
|
|
4120
|
-
static async getUtxos(e = void 0, t = void 0) {
|
|
4121
|
-
return await this.get("wallet/getutxo", {
|
|
4122
|
-
walletId: e,
|
|
4123
|
-
accountIndex: t
|
|
4124
|
-
});
|
|
4125
|
-
}
|
|
4126
|
-
static async signTx(e, t = !1) {
|
|
4127
|
-
const s = await this.get("wallet/getuserwalletsmeta");
|
|
4128
|
-
if (console.log("userWalletsMeta", s), s) {
|
|
4129
|
-
const n = await this.openMinaFrontend(`${nr}?unsignedTx=${e}&partialSign=${t}`);
|
|
4130
|
-
if (n instanceof i.Vkeywitnesses) {
|
|
4131
|
-
const a = L(e), o = a.witness_set();
|
|
4132
|
-
o.set_vkeys(n);
|
|
4133
|
-
const c = i.Transaction.new(a.body(), o, a.auxiliary_data()).to_hex();
|
|
4134
|
-
return console.log("signedTx", c), c;
|
|
4135
|
-
}
|
|
4136
|
-
} else
|
|
4137
|
-
return;
|
|
4138
|
-
}
|
|
4139
|
-
}
|
|
4140
4145
|
export {
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
Qr as TangoProvider,
|
|
4146
|
+
vr as AppWallet,
|
|
4147
|
+
yr as BlockfrostProvider,
|
|
4148
|
+
Vt as BrowserWallet,
|
|
4149
|
+
S as EmbeddedWallet,
|
|
4150
|
+
Er as ForgeScript,
|
|
4151
|
+
xr as InfuraProvider,
|
|
4152
|
+
Cr as KoiosProvider,
|
|
4153
|
+
Sr as MaestroProvider,
|
|
4154
|
+
Qr as MeshTxBuilder,
|
|
4155
|
+
wr as OgmiosProvider,
|
|
4156
|
+
Br as TangoProvider,
|
|
4153
4157
|
z as Transaction,
|
|
4154
|
-
|
|
4155
|
-
|
|
4158
|
+
ir as checkSignature,
|
|
4159
|
+
pr as generateNonce,
|
|
4156
4160
|
es as isNetwork,
|
|
4157
4161
|
is as keepRelevant,
|
|
4158
|
-
|
|
4162
|
+
nr as largestFirst,
|
|
4159
4163
|
os as largestFirstMultiAsset,
|
|
4160
4164
|
et as parseAssetUnit,
|
|
4161
4165
|
h as parseHttpError,
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4166
|
+
fr as readPlutusData,
|
|
4167
|
+
_r as readTransaction,
|
|
4168
|
+
or as resolveDataHash,
|
|
4169
|
+
cr as resolveEpochNo,
|
|
4170
|
+
Js as resolveFingerprint,
|
|
4171
|
+
ur as resolveLanguageView,
|
|
4172
|
+
dr as resolveNativeScriptHash,
|
|
4169
4173
|
it as resolvePaymentKeyHash,
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
+
hr as resolvePlutusScriptAddress,
|
|
4175
|
+
lr as resolvePlutusScriptHash,
|
|
4176
|
+
mr as resolvePoolId,
|
|
4177
|
+
gr as resolvePrivateKey,
|
|
4174
4178
|
Ut as resolveRewardAddress,
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4179
|
+
Ar as resolveScriptRef,
|
|
4180
|
+
Ir as resolveSlotNo,
|
|
4181
|
+
gt as resolveStakeKeyHash,
|
|
4182
|
+
Ge as resolveTxFees,
|
|
4183
|
+
Ws as resolveTxHash
|
|
4180
4184
|
};
|