@easy1staking/cip113-sdk-ts 0.3.1 → 0.4.0
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/README.md +20 -0
- package/blueprints/standard/v0.3.0/UPSTREAM_PIN.json +30 -0
- package/blueprints/standard/v0.5.0-alpha.2/UPSTREAM_PIN.json +33 -0
- package/blueprints/standard/v0.5.0-alpha.2/plutus.json +1010 -0
- package/blueprints/substandards/dummy/v0.1.0/UPSTREAM_PIN.json +29 -0
- package/blueprints/substandards/dummy/v0.2.0/UPSTREAM_PIN.json +36 -0
- package/blueprints/substandards/dummy/v0.2.0/plutus.json +84 -0
- package/blueprints/substandards/freeze-and-seize/v0.1.0/UPSTREAM_PIN.json +35 -0
- package/dist/core/cip171.d.ts +149 -0
- package/dist/core/cip171.d.ts.map +1 -0
- package/dist/core/cip171.js +284 -0
- package/dist/core/cip171.js.map +1 -0
- package/dist/core/evo-utils.d.ts +125 -17
- package/dist/core/evo-utils.d.ts.map +1 -1
- package/dist/core/evo-utils.js +149 -21
- package/dist/core/evo-utils.js.map +1 -1
- package/dist/core/ledger-order.d.ts +109 -0
- package/dist/core/ledger-order.d.ts.map +1 -0
- package/dist/core/ledger-order.js +185 -0
- package/dist/core/ledger-order.js.map +1 -0
- package/dist/core/registry.d.ts +16 -3
- package/dist/core/registry.d.ts.map +1 -1
- package/dist/core/registry.js +18 -9
- package/dist/core/registry.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -16
- package/dist/index.js.map +1 -1
- package/dist/standard/blueprint.d.ts +48 -1
- package/dist/standard/blueprint.d.ts.map +1 -1
- package/dist/standard/blueprint.js +71 -5
- package/dist/standard/blueprint.js.map +1 -1
- package/dist/standard/scripts.d.ts +76 -27
- package/dist/standard/scripts.d.ts.map +1 -1
- package/dist/standard/scripts.js +177 -49
- package/dist/standard/scripts.js.map +1 -1
- package/dist/substandards/dummy/index.d.ts.map +1 -1
- package/dist/substandards/dummy/index.js +443 -26
- package/dist/substandards/dummy/index.js.map +1 -1
- package/dist/substandards/freeze-and-seize/index.d.ts.map +1 -1
- package/dist/substandards/freeze-and-seize/index.js +283 -41
- package/dist/substandards/freeze-and-seize/index.js.map +1 -1
- package/dist/substandards/interface.d.ts +93 -1
- package/dist/substandards/interface.d.ts.map +1 -1
- package/dist/types.d.ts +87 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ledger ordering, and the redeemer indices that depend on it.
|
|
3
|
+
*
|
|
4
|
+
* CIP-113 0.5.0-alpha.2 moved several lookups from "scan the transaction" to
|
|
5
|
+
* "the builder tells the validator where to look". That is cheaper on chain and
|
|
6
|
+
* strictly more dangerous off it: an index is a plain integer, so a wrong one
|
|
7
|
+
* typechecks, encodes, builds, and fails ONLY when the ledger runs the script.
|
|
8
|
+
* Nothing in this repository's other guards can see it.
|
|
9
|
+
*
|
|
10
|
+
* Two orderings matter, and they are NOT the same rule.
|
|
11
|
+
*
|
|
12
|
+
* --- Reference inputs -----------------------------------------------------
|
|
13
|
+
*
|
|
14
|
+
* Ordered by (transaction id, output index): bytewise on the id, then numeric
|
|
15
|
+
* on the index. `params_idx` is the protocol-params UTxO's position in that
|
|
16
|
+
* ordering, over the COMPLETE reference-input set.
|
|
17
|
+
*
|
|
18
|
+
* --- Withdrawals ----------------------------------------------------------
|
|
19
|
+
*
|
|
20
|
+
* NOT bytewise on the reward address, and NOT insertion order.
|
|
21
|
+
*
|
|
22
|
+
* EVERY SCRIPT CREDENTIAL SORTS BEFORE EVERY KEY CREDENTIAL, then bytewise by
|
|
23
|
+
* hash within each kind. The reason is a Haskell detail with an on-chain
|
|
24
|
+
* consequence: cardano-ledger's `Credential` is
|
|
25
|
+
*
|
|
26
|
+
* data Credential kr c = ScriptHashObj !(ScriptHash c) | KeyHashObj !(KeyHash kr c)
|
|
27
|
+
*
|
|
28
|
+
* with a derived `Ord`, and a derived `Ord` on a sum type compares constructor
|
|
29
|
+
* position first. `ScriptHashObj` is declared first, so it sorts first. The
|
|
30
|
+
* withdrawals map is keyed by `RewardAccount`, which orders by network then
|
|
31
|
+
* credential, and Plutus hands the script that map in that order.
|
|
32
|
+
*
|
|
33
|
+
* ⚠ THIS IS THE OPPOSITE OF WHAT THE SERIALISED BYTES SUGGEST, which is the
|
|
34
|
+
* trap. A reward account's header byte encodes key-stake as 0xE0|network and
|
|
35
|
+
* script-stake as 0xF0|network, so sorting the ENCODED addresses puts key
|
|
36
|
+
* credentials first — the exact reverse of the order the script sees. Deriving
|
|
37
|
+
* this ordering from the wire format is a natural mistake that produces a
|
|
38
|
+
* `wdrl_idx` that is wrong only when both kinds are present.
|
|
39
|
+
*
|
|
40
|
+
* PROVENANCE: DERIVED from cardano-ledger's constructor order and corroborated
|
|
41
|
+
* by upstream's own integration guide (documentation/09 › Withdrawal indices),
|
|
42
|
+
* which cites the same `Ord` derivation. NOT yet OBSERVED on chain by us — that
|
|
43
|
+
* happens in T-D08, and until then this is reasoned, not booted.
|
|
44
|
+
*/
|
|
45
|
+
import { Data } from "@evolution-sdk/evolution";
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// Reference inputs
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/**
|
|
50
|
+
* Compare two hex strings as the bytes they encode.
|
|
51
|
+
*
|
|
52
|
+
* Two separate things are going on here; only one of them was a live bug.
|
|
53
|
+
*
|
|
54
|
+
* CASE NORMALISATION — this one was real. Hex case is presentation: a tx id is
|
|
55
|
+
* bytes, and providers differ on which spelling they hand you. Comparing raw
|
|
56
|
+
* strings makes "ab…" and "AB…" neither equal nor consistently ordered, so one
|
|
57
|
+
* reference input can occupy two different positions depending on who fetched
|
|
58
|
+
* it. MEASURED: `localeCompare` orders "0a" BEFORE "0A" while the bytes order
|
|
59
|
+
* it after, so the two disagree in direction, not merely in strictness.
|
|
60
|
+
*
|
|
61
|
+
* NOT `localeCompare` — this one is defensive. It is a collation comparison,
|
|
62
|
+
* not a byte comparison. MEASURED in this environment: over all 240 ordered
|
|
63
|
+
* pairs of lowercase hex digits it agrees with byte order exactly, so replacing
|
|
64
|
+
* it changes nothing observable HERE. It is avoided because that agreement is a
|
|
65
|
+
* property of the current ICU data rather than of the language, and because the
|
|
66
|
+
* only failure mode of getting it wrong is a transaction that fails on chain.
|
|
67
|
+
* Upstream's sample code (documentation/09) uses `localeCompare` on unnormalised
|
|
68
|
+
* hex and therefore carries the case bug.
|
|
69
|
+
*/
|
|
70
|
+
function compareHex(a, b) {
|
|
71
|
+
const x = a.toLowerCase();
|
|
72
|
+
const y = b.toLowerCase();
|
|
73
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
74
|
+
}
|
|
75
|
+
/** Ledger order for transaction inputs: by tx id, then by output index. */
|
|
76
|
+
export function compareTxInputs(a, b) {
|
|
77
|
+
const h = compareHex(a.txHash, b.txHash);
|
|
78
|
+
return h !== 0 ? h : a.outputIndex - b.outputIndex;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Position of `target` in the ledger-sorted reference inputs.
|
|
82
|
+
*
|
|
83
|
+
* Throws rather than returning -1: a missing reference input is a builder bug,
|
|
84
|
+
* and -1 encodes as a valid integer that fails obscurely on chain.
|
|
85
|
+
*/
|
|
86
|
+
export function referenceInputIndexOf(all, target) {
|
|
87
|
+
const idx = [...all]
|
|
88
|
+
.sort(compareTxInputs)
|
|
89
|
+
.findIndex((i) => compareTxInputs(i, target) === 0);
|
|
90
|
+
if (idx < 0) {
|
|
91
|
+
throw new Error(`Reference input ${target.txHash}#${target.outputIndex} is not in the reference-input ` +
|
|
92
|
+
`set (${all.length} entries). The index must be computed over the COMPLETE set, ` +
|
|
93
|
+
`after the builder has added every reference input.`);
|
|
94
|
+
}
|
|
95
|
+
return idx;
|
|
96
|
+
}
|
|
97
|
+
/** Ledger order: every script credential before every key credential. */
|
|
98
|
+
export function compareWithdrawalKeys(a, b) {
|
|
99
|
+
if (a.isScript !== b.isScript)
|
|
100
|
+
return a.isScript ? -1 : 1;
|
|
101
|
+
return compareHex(a.hash, b.hash);
|
|
102
|
+
}
|
|
103
|
+
/** Sort withdrawal keys into the order the script sees. Does not mutate. */
|
|
104
|
+
export function sortWithdrawalKeys(keys) {
|
|
105
|
+
return [...keys].sort(compareWithdrawalKeys);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Position of `target` in the ledger-ordered withdrawal map.
|
|
109
|
+
*
|
|
110
|
+
* `all` MUST be the complete withdrawal set of the final transaction. Any extra
|
|
111
|
+
* withdrawal — a second substandard script, or a key-hash reward withdrawal a
|
|
112
|
+
* wallet adds during balancing — occupies a slot and shifts every position
|
|
113
|
+
* after it. Compute this last.
|
|
114
|
+
*/
|
|
115
|
+
export function withdrawalIndexOf(all, target) {
|
|
116
|
+
const idx = sortWithdrawalKeys(all).findIndex((w) => compareWithdrawalKeys(w, target) === 0);
|
|
117
|
+
if (idx < 0) {
|
|
118
|
+
throw new Error(`Withdrawal ${target.isScript ? "script" : "key"} credential ${target.hash} is not in ` +
|
|
119
|
+
`the withdrawal set (${all.length} entries). programmable_logic_base resolves the ` +
|
|
120
|
+
`entry at wdrl_idx and requires it to equal the delegate credential from the ` +
|
|
121
|
+
`protocol-params datum, so a missing entry cannot authorise anything.`);
|
|
122
|
+
}
|
|
123
|
+
return idx;
|
|
124
|
+
}
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// BaseSpendRedeemer — programmable_logic_base.spend
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
/**
|
|
129
|
+
* Which delegate programmable_logic_base dispatches to.
|
|
130
|
+
*
|
|
131
|
+
* Constructor indices are the on-chain contract: 0/1/2. Exactly one framework
|
|
132
|
+
* delegate may be invoked per transaction.
|
|
133
|
+
*/
|
|
134
|
+
export const BaseSpendVia = {
|
|
135
|
+
TRANSFER: 0n,
|
|
136
|
+
THIRD_PARTY: 1n,
|
|
137
|
+
UNFRACKING: 2n,
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Build a BaseSpendRedeemer.
|
|
141
|
+
*
|
|
142
|
+
* Replaces the untyped redeemer of 0.3.x and the bare `Int` of #109. Every
|
|
143
|
+
* programmable_logic_base input in the transaction needs one.
|
|
144
|
+
*/
|
|
145
|
+
export function baseSpendRedeemer(via, paramsIdx, wdrlIdx) {
|
|
146
|
+
if (!Number.isInteger(paramsIdx) || paramsIdx < 0) {
|
|
147
|
+
throw new Error(`baseSpendRedeemer: params_idx must be a non-negative integer, got ${paramsIdx}`);
|
|
148
|
+
}
|
|
149
|
+
if (!Number.isInteger(wdrlIdx) || wdrlIdx < 0) {
|
|
150
|
+
throw new Error(`baseSpendRedeemer: wdrl_idx must be a non-negative integer, got ${wdrlIdx}`);
|
|
151
|
+
}
|
|
152
|
+
return Data.constr(BaseSpendVia[via], [
|
|
153
|
+
Data.int(BigInt(paramsIdx)),
|
|
154
|
+
Data.int(BigInt(wdrlIdx)),
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* `transfer`'s TransferRedeemer { params_idx, proofs }.
|
|
159
|
+
*
|
|
160
|
+
* Single constructor 0, same field order as the old `TransferAct` with
|
|
161
|
+
* `params_idx` prepended — so an old encoder's output is NOT compatible.
|
|
162
|
+
*/
|
|
163
|
+
export function transferRedeemer(paramsIdx, proofs) {
|
|
164
|
+
return Data.constr(0n, [
|
|
165
|
+
Data.int(BigInt(paramsIdx)),
|
|
166
|
+
Data.list(proofs.map((p) => Data.constr(p.type === "exists" ? 0n : 1n, [Data.int(BigInt(p.nodeIdx))]))),
|
|
167
|
+
]);
|
|
168
|
+
}
|
|
169
|
+
/** `third_party`'s ThirdPartyRedeemer { params_idx, registry_node_idx, outputs_start_idx }. */
|
|
170
|
+
export function thirdPartyRedeemer(paramsIdx, registryNodeIdx, outputsStartIdx) {
|
|
171
|
+
return Data.constr(0n, [
|
|
172
|
+
Data.int(BigInt(paramsIdx)),
|
|
173
|
+
Data.int(BigInt(registryNodeIdx)),
|
|
174
|
+
Data.int(BigInt(outputsStartIdx)),
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
/** `unfracking`'s UnfrackingRedeemer { params_idx, registry_node_idx, outputs_start_idx }. */
|
|
178
|
+
export function unfrackingRedeemer(paramsIdx, registryNodeIdx, outputsStartIdx) {
|
|
179
|
+
return Data.constr(0n, [
|
|
180
|
+
Data.int(BigInt(paramsIdx)),
|
|
181
|
+
Data.int(BigInt(registryNodeIdx)),
|
|
182
|
+
Data.int(BigInt(outputsStartIdx)),
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=ledger-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ledger-order.js","sourceRoot":"","sources":["../../src/core/ledger-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGhD,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,UAAU,CAAC,CAAY,EAAE,CAAY;IAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,CAAU,EAAE,CAAU;IACpD,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,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voUTxO } from "@evolution-sdk/evolution";
|
|
7
7
|
import type { PolicyId, TxInput } from "../types.js";
|
|
8
8
|
/**
|
|
9
|
-
* Sort transaction inputs
|
|
10
|
-
*
|
|
9
|
+
* Sort transaction inputs into the ledger's canonical order: by transaction id,
|
|
10
|
+
* then by output index.
|
|
11
|
+
*
|
|
12
|
+
* Delegates to `compareTxInputs` so there is ONE definition of the ledger's
|
|
13
|
+
* input ordering in this SDK. This previously compared transaction ids with
|
|
14
|
+
* `String.localeCompare`, which is a COLLATION comparison, not a byte
|
|
15
|
+
* comparison — it consults locale and ICU rules and is not guaranteed to agree
|
|
16
|
+
* with byte order even on lowercase hex. It happened to agree in practice,
|
|
17
|
+
* which is exactly why it survived: the failure it would cause is a wrong
|
|
18
|
+
* reference-input index, and a wrong index fails only on chain.
|
|
11
19
|
*/
|
|
12
20
|
export declare function sortTxInputs<T extends TxInput>(inputs: T[]): T[];
|
|
13
21
|
/**
|
|
14
|
-
* Find the index of a TxInput in
|
|
22
|
+
* Find the index of a TxInput in an ALREADY-SORTED list of reference inputs.
|
|
23
|
+
*
|
|
24
|
+
* ⚠ The caller owns the precondition. Passing an unsorted list returns a
|
|
25
|
+
* plausible integer that is silently wrong, and the transaction fails only on
|
|
26
|
+
* chain. Prefer `referenceInputIndexOf`, which sorts internally and cannot be
|
|
27
|
+
* misused this way.
|
|
15
28
|
*/
|
|
16
29
|
export declare function findRefInputIndex(sortedRefInputs: TxInput[], target: TxInput): number;
|
|
17
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAW,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAW,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAa9D;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,eAAe,EAAE,OAAO,EAAE,EAC1B,MAAM,EAAE,OAAO,GACd,MAAM,CAUR;AAMD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,EACrB,aAAa,EAAE,QAAQ,GACtB,OAAO,CAAC,IAAI,GAAG,SAAS,CAM1B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,EACrB,aAAa,EAAE,QAAQ,GACtB,OAAO,CAAC,IAAI,GAAG,SAAS,CAS1B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG,OAAO,CAKzD"}
|
package/dist/core/registry.js
CHANGED
|
@@ -4,23 +4,32 @@
|
|
|
4
4
|
* Uses Evolution SDK types directly — no adapter abstraction.
|
|
5
5
|
*/
|
|
6
6
|
import { extractConstrBytesField, getInlineDatum, utxoTxHash, utxoOutputIndex, } from "./evo-utils.js";
|
|
7
|
+
import { compareTxInputs } from "./ledger-order.js";
|
|
7
8
|
// ---------------------------------------------------------------------------
|
|
8
9
|
// Transaction input sorting (matches Cardano ledger canonical order)
|
|
9
10
|
// ---------------------------------------------------------------------------
|
|
10
11
|
/**
|
|
11
|
-
* Sort transaction inputs
|
|
12
|
-
*
|
|
12
|
+
* Sort transaction inputs into the ledger's canonical order: by transaction id,
|
|
13
|
+
* then by output index.
|
|
14
|
+
*
|
|
15
|
+
* Delegates to `compareTxInputs` so there is ONE definition of the ledger's
|
|
16
|
+
* input ordering in this SDK. This previously compared transaction ids with
|
|
17
|
+
* `String.localeCompare`, which is a COLLATION comparison, not a byte
|
|
18
|
+
* comparison — it consults locale and ICU rules and is not guaranteed to agree
|
|
19
|
+
* with byte order even on lowercase hex. It happened to agree in practice,
|
|
20
|
+
* which is exactly why it survived: the failure it would cause is a wrong
|
|
21
|
+
* reference-input index, and a wrong index fails only on chain.
|
|
13
22
|
*/
|
|
14
23
|
export function sortTxInputs(inputs) {
|
|
15
|
-
return [...inputs].sort(
|
|
16
|
-
const hashCmp = a.txHash.localeCompare(b.txHash);
|
|
17
|
-
if (hashCmp !== 0)
|
|
18
|
-
return hashCmp;
|
|
19
|
-
return a.outputIndex - b.outputIndex;
|
|
20
|
-
});
|
|
24
|
+
return [...inputs].sort(compareTxInputs);
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
|
-
* Find the index of a TxInput in
|
|
27
|
+
* Find the index of a TxInput in an ALREADY-SORTED list of reference inputs.
|
|
28
|
+
*
|
|
29
|
+
* ⚠ The caller owns the precondition. Passing an unsorted list returns a
|
|
30
|
+
* plausible integer that is silently wrong, and the transaction fails only on
|
|
31
|
+
* chain. Prefer `referenceInputIndexOf`, which sorts internally and cannot be
|
|
32
|
+
* misused this way.
|
|
24
33
|
*/
|
|
25
34
|
export function findRefInputIndex(sortedRefInputs, target) {
|
|
26
35
|
const idx = sortedRefInputs.findIndex((ri) => ri.txHash === target.txHash && ri.outputIndex === target.outputIndex);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/core/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,uBAAuB,EACvB,cAAc,EACd,UAAU,EACV,eAAe,GAChB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../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B,CAC9B,KAAqB,EACrB,aAAuB;IAEvB,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACzB,MAAM,GAAG,GAAG,uBAAuB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,uBAAuB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,GAAG,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC;QAC1D,OAAO,GAAG,GAAG,aAAa,IAAI,aAAa,GAAG,IAAI,CAAC;IACrD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,IAAkB;IAC9C,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC;QACxB,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC;KACnC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
import type { DeploymentParams, PlutusBlueprint } from "./types.js";
|
|
25
|
-
import type { EvoClient, SubstandardPlugin, RegisterParams, MintParams, BurnParams, TransferParams, FreezeParams, UnfreezeParams, SeizeParams, InitComplianceParams, UnsignedTx } from "./substandards/interface.js";
|
|
25
|
+
import type { EvoClient, SubstandardPlugin, RegisterParams, MintParams, BurnParams, TransferParams, ThirdPartyTransferParams, FreezeParams, UnfreezeParams, SeizeParams, InitComplianceParams, UnsignedTx } from "./substandards/interface.js";
|
|
26
26
|
import { type ResolvedStandardScripts } from "./standard/scripts.js";
|
|
27
27
|
export interface CIP113Config {
|
|
28
28
|
/** Evolution SDK client (ReadOnlyClient or SigningClient) */
|
|
@@ -36,6 +36,14 @@ export interface CIP113Config {
|
|
|
36
36
|
substandards?: SubstandardPlugin[];
|
|
37
37
|
/** Check if a stake address is registered on-chain. Used by compliance init to avoid re-registering. */
|
|
38
38
|
checkStakeRegistration?: (stakeAddress: string) => Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Optional transaction evaluator, passed through to substandards.
|
|
41
|
+
*
|
|
42
|
+
* Without one the client's default provider evaluates, and Kupmios reports a
|
|
43
|
+
* bare "evaluateTx failed" naming neither the script nor the reason. An Ogmios
|
|
44
|
+
* evaluator returns the validator's trace list instead.
|
|
45
|
+
*/
|
|
46
|
+
evaluator?: unknown;
|
|
39
47
|
}
|
|
40
48
|
export interface CIP113Protocol {
|
|
41
49
|
/** The resolved standard scripts (cached, reusable) */
|
|
@@ -52,6 +60,14 @@ export interface CIP113Protocol {
|
|
|
52
60
|
burn(params: BurnParams): Promise<UnsignedTx>;
|
|
53
61
|
/** Transfer tokens */
|
|
54
62
|
transfer(params: TransferParams): Promise<UnsignedTx>;
|
|
63
|
+
/**
|
|
64
|
+
* Administrative transfer: move a holder's tokens without their signature.
|
|
65
|
+
*
|
|
66
|
+
* Requires an explicit `substandardId` — unlike mint/burn/transfer there is no
|
|
67
|
+
* try-all fallback here. Guessing which substandard should be allowed to seize
|
|
68
|
+
* someone's tokens is not a convenience worth having.
|
|
69
|
+
*/
|
|
70
|
+
thirdPartyTransfer(params: ThirdPartyTransferParams): Promise<UnsignedTx>;
|
|
55
71
|
compliance: {
|
|
56
72
|
/** Initialize compliance infrastructure (e.g., blacklist) */
|
|
57
73
|
init(substandardId: string, params: InitComplianceParams): Promise<UnsignedTx>;
|
|
@@ -80,12 +96,20 @@ export declare const CIP113: {
|
|
|
80
96
|
};
|
|
81
97
|
export type { EvoClient, SubstandardPlugin, SubstandardFactory, SubstandardContext, RegisterParams, MintParams, BurnParams, TransferParams, FreezeParams, UnfreezeParams, SeizeParams, InitComplianceParams, UnsignedTx, CIP68MetadataInput, } from "./substandards/interface.js";
|
|
82
98
|
export type { DeploymentParams, PlutusBlueprint, PlutusScript, TxInput, UTxO, Network, PolicyId, ScriptHash, HexString, Assets, } from "./types.js";
|
|
83
|
-
export { buildEvoScript, computeScriptHash, parameterizeScript, scriptAddress, rewardAddress, baseAddress, stakingCredentialHash, paymentCredentialHash, stringToHex, MAX_NEXT, voidData, outputReference, scriptCredential, keyCredential, labeledAssetName, stripCIP67Label, hasCIP67Label, buildCIP68FTDatum, } from "./core/evo-utils.js";
|
|
99
|
+
export { buildEvoScript, computeScriptHash, parameterizeScript, scriptAddress, rewardAddress, baseAddress, stakingCredentialHash, paymentCredentialHash, getInlineDatum, REGISTRY_NODE_MIN_ADA, stringToHex, MAX_NEXT, voidData, outputReference, scriptCredential, keyCredential, labeledAssetName, stripCIP67Label, hasCIP67Label, buildCIP68FTDatum, } from "./core/evo-utils.js";
|
|
84
100
|
export { sortTxInputs, findRefInputIndex } from "./core/registry.js";
|
|
101
|
+
export { mintAssetsFromMap, outputAssets } from "./core/evo-utils.js";
|
|
102
|
+
export { registryNodeDatum, decodeRegistryNode, registryInitRedeemer, registryInsertRedeemer, mintingProofRefInput, mintingProofOutputIndex, protocolParamsDatum, decodeProtocolParams, } from "./core/evo-utils.js";
|
|
103
|
+
export type { RegistryNodeData, ProtocolParamsData, Cip113Credential, } from "./core/evo-utils.js";
|
|
104
|
+
export { assertDeploymentScripts, DeploymentMismatchError, createStandardScripts, type ScriptHashCheck, type StandardScripts, } from "./standard/scripts.js";
|
|
105
|
+
export { CIP171_METADATA_LABEL, CIP171_MAX_CHUNK_BYTES, CompilerType, buildCip171PlutusData, buildCip171Metadatum, chunkBytes, decodeCip171Metadatum, decodeCip171PlutusData, } from "./core/cip171.js";
|
|
106
|
+
export type { Cip171Record, Cip171ScriptEntry, } from "./core/cip171.js";
|
|
85
107
|
export { addressHexToBech32 } from "./provider/address-utils.js";
|
|
86
108
|
export { assembleSignedTx } from "./provider/tx-utils.js";
|
|
87
109
|
export type { FESDeploymentParams } from "./substandards/freeze-and-seize/types.js";
|
|
88
110
|
export { preview as previewChain, preprod as preprodChain, mainnet as mainnetChain, Address as EvoAddress, Assets as EvoAssets, TransactionHash as EvoTransactionHash, Transaction as EvoTransaction, TransactionWitnessSet as EvoTransactionWitnessSet, Data as EvoData, } from "@evolution-sdk/evolution";
|
|
89
111
|
import { Client } from "@evolution-sdk/evolution";
|
|
90
112
|
export declare const evoClient: (chain?: import("@evolution-sdk/evolution").Chain) => Client.ClientAssembly;
|
|
113
|
+
export { compareTxInputs, referenceInputIndexOf, compareWithdrawalKeys, sortWithdrawalKeys, withdrawalIndexOf, BaseSpendVia, baseSpendRedeemer, transferRedeemer, thirdPartyRedeemer, unfrackingRedeemer, } from "./core/ledger-order.js";
|
|
114
|
+
export type { WithdrawalKey, BaseSpendVariant, RegistryProofRef } from "./core/ledger-order.js";
|
|
91
115
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAY,MAAM,YAAY,CAAC;AAC9E,OAAO,KAAK,EACV,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAA0B,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAM7F,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,MAAM,EAAE,SAAS,CAAC;IAElB,sCAAsC;IACtC,QAAQ,EAAE;QACR,SAAS,EAAE,eAAe,CAAC;QAC3B,UAAU,EAAE,gBAAgB,CAAC;KAC9B,CAAC;IAEF,sCAAsC;IACtC,YAAY,CAAC,EAAE,iBAAiB,EAAE,CA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E,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAGpF,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,OAAO,IAAI,YAAY,EACvB,OAAO,IAAI,YAAY,EACvB,OAAO,IAAI,UAAU,EACrB,MAAM,IAAI,SAAS,EACnB,eAAe,IAAI,kBAAkB,EACrC,WAAW,IAAI,cAAc,EAC7B,qBAAqB,IAAI,wBAAwB,EACjD,IAAI,IAAI,OAAO,GAChB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,eAAO,MAAM,SAAS,6EAAc,CAAC;AAMrC,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,7 @@ export const CIP113 = {
|
|
|
45
45
|
client: config.client,
|
|
46
46
|
standardScripts: scripts,
|
|
47
47
|
deployment: config.standard.deployment,
|
|
48
|
+
evaluator: config.evaluator,
|
|
48
49
|
network: config.client.chain.id === 1 ? "mainnet" : "preprod",
|
|
49
50
|
checkStakeRegistration: config.checkStakeRegistration,
|
|
50
51
|
};
|
|
@@ -86,6 +87,20 @@ export const CIP113 = {
|
|
|
86
87
|
async register(substandardId, params) {
|
|
87
88
|
return requireSubstandard(substandardId).register(params);
|
|
88
89
|
},
|
|
90
|
+
async thirdPartyTransfer(params) {
|
|
91
|
+
if (!params.substandardId) {
|
|
92
|
+
throw new Error("thirdPartyTransfer requires an explicit substandardId. There is deliberately no " +
|
|
93
|
+
"try-all fallback: this operation moves someone else's tokens without their " +
|
|
94
|
+
"signature, and selecting the authority by trial is not acceptable for that.");
|
|
95
|
+
}
|
|
96
|
+
const plugin = requireSubstandard(params.substandardId);
|
|
97
|
+
if (!plugin.thirdPartyTransfer) {
|
|
98
|
+
throw new Error(`Substandard "${params.substandardId}" does not support third-party transfers. ` +
|
|
99
|
+
`Implementing it is a claim that the substandard has an administrative authority ` +
|
|
100
|
+
`and has wired its registry node's third_party_transfer_logic_script accordingly.`);
|
|
101
|
+
}
|
|
102
|
+
return plugin.thirdPartyTransfer(params);
|
|
103
|
+
},
|
|
89
104
|
async mint(params) {
|
|
90
105
|
if (params.substandardId) {
|
|
91
106
|
return requireSubstandard(params.substandardId).mint(params);
|
|
@@ -113,25 +128,40 @@ export const CIP113 = {
|
|
|
113
128
|
return plugin.initCompliance(params);
|
|
114
129
|
},
|
|
115
130
|
async freeze(params) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
// Explicit routing, NO try-all. Two reasons, and the second is the one
|
|
132
|
+
// that cost time: an administrative operation must not pick its own
|
|
133
|
+
// authority by trial; and a fallback CONVERTS A REAL VALIDATOR FAILURE
|
|
134
|
+
// INTO "no substandard can handle this", which is a different category
|
|
135
|
+
// of fault and sends the reader somewhere else entirely.
|
|
136
|
+
const plugin = requireSubstandard(params.substandardId);
|
|
137
|
+
if (!plugin.freeze) {
|
|
138
|
+
throw new Error(`Substandard "${params.substandardId}" does not support freeze.`);
|
|
139
|
+
}
|
|
140
|
+
return plugin.freeze(params);
|
|
121
141
|
},
|
|
122
142
|
async unfreeze(params) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
143
|
+
// Explicit routing, NO try-all. Two reasons, and the second is the one
|
|
144
|
+
// that cost time: an administrative operation must not pick its own
|
|
145
|
+
// authority by trial; and a fallback CONVERTS A REAL VALIDATOR FAILURE
|
|
146
|
+
// INTO "no substandard can handle this", which is a different category
|
|
147
|
+
// of fault and sends the reader somewhere else entirely.
|
|
148
|
+
const plugin = requireSubstandard(params.substandardId);
|
|
149
|
+
if (!plugin.unfreeze) {
|
|
150
|
+
throw new Error(`Substandard "${params.substandardId}" does not support unfreeze.`);
|
|
151
|
+
}
|
|
152
|
+
return plugin.unfreeze(params);
|
|
128
153
|
},
|
|
129
154
|
async seize(params) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
155
|
+
// Explicit routing, NO try-all. Two reasons, and the second is the one
|
|
156
|
+
// that cost time: an administrative operation must not pick its own
|
|
157
|
+
// authority by trial; and a fallback CONVERTS A REAL VALIDATOR FAILURE
|
|
158
|
+
// INTO "no substandard can handle this", which is a different category
|
|
159
|
+
// of fault and sends the reader somewhere else entirely.
|
|
160
|
+
const plugin = requireSubstandard(params.substandardId);
|
|
161
|
+
if (!plugin.seize) {
|
|
162
|
+
throw new Error(`Substandard "${params.substandardId}" does not support seize.`);
|
|
163
|
+
}
|
|
164
|
+
return plugin.seize(params);
|
|
135
165
|
},
|
|
136
166
|
},
|
|
137
167
|
registerSubstandard(plugin) {
|
|
@@ -147,8 +177,12 @@ export const CIP113 = {
|
|
|
147
177
|
};
|
|
148
178
|
},
|
|
149
179
|
};
|
|
150
|
-
export { buildEvoScript, computeScriptHash, parameterizeScript, scriptAddress, rewardAddress, baseAddress, stakingCredentialHash, paymentCredentialHash, stringToHex, MAX_NEXT, voidData, outputReference, scriptCredential, keyCredential, labeledAssetName, stripCIP67Label, hasCIP67Label, buildCIP68FTDatum, } from "./core/evo-utils.js";
|
|
180
|
+
export { buildEvoScript, computeScriptHash, parameterizeScript, scriptAddress, rewardAddress, baseAddress, stakingCredentialHash, paymentCredentialHash, getInlineDatum, REGISTRY_NODE_MIN_ADA, stringToHex, MAX_NEXT, voidData, outputReference, scriptCredential, keyCredential, labeledAssetName, stripCIP67Label, hasCIP67Label, buildCIP68FTDatum, } from "./core/evo-utils.js";
|
|
151
181
|
export { sortTxInputs, findRefInputIndex } from "./core/registry.js";
|
|
182
|
+
export { mintAssetsFromMap, outputAssets } from "./core/evo-utils.js";
|
|
183
|
+
export { registryNodeDatum, decodeRegistryNode, registryInitRedeemer, registryInsertRedeemer, mintingProofRefInput, mintingProofOutputIndex, protocolParamsDatum, decodeProtocolParams, } from "./core/evo-utils.js";
|
|
184
|
+
export { assertDeploymentScripts, DeploymentMismatchError, createStandardScripts, } from "./standard/scripts.js";
|
|
185
|
+
export { CIP171_METADATA_LABEL, CIP171_MAX_CHUNK_BYTES, CompilerType, buildCip171PlutusData, buildCip171Metadatum, chunkBytes, decodeCip171Metadatum, decodeCip171PlutusData, } from "./core/cip171.js";
|
|
152
186
|
export { addressHexToBech32 } from "./provider/address-utils.js";
|
|
153
187
|
export { assembleSignedTx } from "./provider/tx-utils.js";
|
|
154
188
|
// Re-export Evolution SDK essentials so consumers don't need a direct dependency
|
|
@@ -156,4 +190,8 @@ export { preview as previewChain, preprod as preprodChain, mainnet as mainnetCha
|
|
|
156
190
|
// Re-export Client.make as evoClient for convenience
|
|
157
191
|
import { Client } from "@evolution-sdk/evolution";
|
|
158
192
|
export const evoClient = Client.make;
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
// Ledger ordering and 0.5.x redeemers (T-D04)
|
|
195
|
+
// ---------------------------------------------------------------------------
|
|
196
|
+
export { compareTxInputs, referenceInputIndexOf, compareWithdrawalKeys, sortWithdrawalKeys, withdrawalIndexOf, BaseSpendVia, baseSpendRedeemer, transferRedeemer, thirdPartyRedeemer, unfrackingRedeemer, } from "./core/ledger-order.js";
|
|
159
197
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"index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
|
4
4
|
import type { PlutusBlueprint, BlueprintValidator, HexString } from "../types.js";
|
|
5
5
|
/**
|
|
6
6
|
* Standard validator titles as they appear in the blueprint.
|
|
7
|
+
*
|
|
8
|
+
* Targets CIP-113 0.5.0-alpha.2 (upstream commit 9db7e06). See PLAN.md D-11.
|
|
9
|
+
*
|
|
10
|
+
* --- The dissolution of programmable_logic_global ------------------------
|
|
11
|
+
*
|
|
12
|
+
* Upstream #110 dissolved the PLG coordinator. Its transfer arm was RENAMED
|
|
13
|
+
* `transfer`; third-party (seize/clawback) logic moved to a new standalone
|
|
14
|
+
* `third_party`; `unfracking` is no longer reached through it. Instead
|
|
15
|
+
* `programmable_logic_base` dispatches straight to one of the three.
|
|
16
|
+
*
|
|
17
|
+
* The practical consequence for this table: the title
|
|
18
|
+
* `programmable_logic_global.programmable_logic_global.withdraw` NO LONGER
|
|
19
|
+
* EXISTS in any 0.5.x blueprint. Its removal is why validateStandardBlueprint()
|
|
20
|
+
* fails closed on the new artifact rather than silently building transactions
|
|
21
|
+
* against a validator that is not there — the loud failure is deliberate and
|
|
22
|
+
* must not be "fixed" by relaxing the check.
|
|
23
|
+
*
|
|
24
|
+
* --- Do not read upstream's CONTRACT_SURFACE_CHANGES.md for these ---------
|
|
25
|
+
*
|
|
26
|
+
* That document contains an SDK impact map naming this repository by path, and
|
|
27
|
+
* it is WRONG about the params datum in a way that produces malformed
|
|
28
|
+
* transactions (it says 6 fields; the artifact has 7, and one line is phrased
|
|
29
|
+
* as an instruction to build the 6-field shape). Every title, arity and field
|
|
30
|
+
* order here comes from the blueprint itself. See PLAN.md, W-D hazard box.
|
|
7
31
|
*/
|
|
8
32
|
export declare const STANDARD_VALIDATORS: {
|
|
9
33
|
readonly ALWAYS_FAIL: "always_fail.always_fail.spend";
|
|
10
34
|
readonly PROTOCOL_PARAMS_MINT: "protocol_params_mint.protocol_params_mint.mint";
|
|
11
|
-
readonly PROGRAMMABLE_LOGIC_GLOBAL: "programmable_logic_global.programmable_logic_global.withdraw";
|
|
12
35
|
readonly PROGRAMMABLE_LOGIC_BASE: "programmable_logic_base.programmable_logic_base.spend";
|
|
13
36
|
readonly ISSUANCE_CBOR_HEX_MINT: "issuance_cbor_hex_mint.issuance_cbor_hex_mint.mint";
|
|
14
37
|
readonly ISSUANCE_MINT: "issuance_mint.issuance_mint.mint";
|
|
15
38
|
readonly REGISTRY_MINT: "registry_mint.registry_mint.mint";
|
|
16
39
|
readonly REGISTRY_SPEND: "registry_spend.registry_spend.spend";
|
|
40
|
+
/** PLG's transfer arm, renamed by #110. Withdraw-0. */
|
|
41
|
+
readonly TRANSFER: "transfer.transfer.withdraw";
|
|
42
|
+
/** Seize / clawback, split out of PLG by #110. Withdraw-0. */
|
|
43
|
+
readonly THIRD_PARTY: "third_party.third_party.withdraw";
|
|
44
|
+
/** Now dispatched to directly by PLB, with no PLG hop. Withdraw-0. */
|
|
45
|
+
readonly UNFRACKING: "unfracking.unfracking.withdraw";
|
|
46
|
+
/** Holds the coordination UTxO — the live protocol wiring. Spend. */
|
|
47
|
+
readonly COORDINATION_SPEND: "coordination_spend.coordination_spend.spend";
|
|
48
|
+
/** Reference upgrade authority; the initial `upgrade_cred` target. Withdraw-0. */
|
|
49
|
+
readonly UPGRADE_MULTISIG: "upgrade_multisig.upgrade_multisig.withdraw";
|
|
17
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Validator titles that existed in earlier CIP-113 releases and are GONE.
|
|
53
|
+
*
|
|
54
|
+
* Kept so that loading an old blueprint produces a diagnosis instead of a bare
|
|
55
|
+
* "missing required validator", which reads as a corrupt file rather than as
|
|
56
|
+
* "this SDK no longer targets that protocol version".
|
|
57
|
+
*/
|
|
58
|
+
export declare const RETIRED_VALIDATORS: Record<string, string>;
|
|
18
59
|
/**
|
|
19
60
|
* Get a validator's compiled code from a blueprint by title.
|
|
20
61
|
* Throws if the validator is not found.
|
|
21
62
|
*/
|
|
22
63
|
export declare function getValidatorCode(blueprint: PlutusBlueprint, title: string): HexString;
|
|
64
|
+
/**
|
|
65
|
+
* Get a validator's un-parameterised script hash from a blueprint by title.
|
|
66
|
+
* This is the hash Aiken stamps in plutus.json — what CIP-171 verifiers
|
|
67
|
+
* reproduce by compiling the source repo at the named commit.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getValidatorHash(blueprint: PlutusBlueprint, title: string): HexString;
|
|
23
70
|
/**
|
|
24
71
|
* Get a validator entry from a blueprint by title.
|
|
25
72
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../src/standard/blueprint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../../src/standard/blueprint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;IAS9B,uDAAuD;;IAEvD,8DAA8D;;IAE9D,sEAAsE;;IAEtE,qEAAqE;;IAErE,kFAAkF;;CAE1E,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKrD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,MAAM,GACZ,SAAS,CAQX;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,MAAM,GACZ,SAAS,CAEX;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,MAAM,GACZ,kBAAkB,CAQpB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CA4B1E"}
|