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