@easy1staking/cip113-sdk-ts 0.7.0 → 0.10.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.
Files changed (35) hide show
  1. package/README.md +118 -2
  2. package/blueprints/standard/v0.5.0-alpha.3/UPSTREAM_PIN.json +35 -0
  3. package/blueprints/standard/v0.5.0-alpha.3/plutus.json +1126 -0
  4. package/blueprints/standard/v0.5.0-alpha.4/UPSTREAM_PIN.json +36 -0
  5. package/blueprints/standard/v0.5.0-alpha.4/plutus.json +1434 -0
  6. package/dist/core/evo-utils.d.ts +357 -39
  7. package/dist/core/evo-utils.d.ts.map +1 -1
  8. package/dist/core/evo-utils.js +513 -27
  9. package/dist/core/evo-utils.js.map +1 -1
  10. package/dist/core/ledger-order.d.ts +204 -18
  11. package/dist/core/ledger-order.d.ts.map +1 -1
  12. package/dist/core/ledger-order.js +385 -28
  13. package/dist/core/ledger-order.js.map +1 -1
  14. package/dist/index.d.ts +6 -6
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +15 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/standard/blueprint.d.ts +129 -29
  19. package/dist/standard/blueprint.d.ts.map +1 -1
  20. package/dist/standard/blueprint.js +245 -47
  21. package/dist/standard/blueprint.js.map +1 -1
  22. package/dist/standard/scripts.d.ts +189 -75
  23. package/dist/standard/scripts.d.ts.map +1 -1
  24. package/dist/standard/scripts.js +454 -123
  25. package/dist/standard/scripts.js.map +1 -1
  26. package/dist/substandards/dummy/index.d.ts +19 -0
  27. package/dist/substandards/dummy/index.d.ts.map +1 -1
  28. package/dist/substandards/dummy/index.js +322 -73
  29. package/dist/substandards/dummy/index.js.map +1 -1
  30. package/dist/substandards/freeze-and-seize/index.d.ts.map +1 -1
  31. package/dist/substandards/freeze-and-seize/index.js +455 -117
  32. package/dist/substandards/freeze-and-seize/index.js.map +1 -1
  33. package/dist/types.d.ts +161 -48
  34. package/dist/types.d.ts.map +1 -1
  35. package/package.json +2 -1
@@ -5,55 +5,106 @@ import type { PlutusBlueprint, BlueprintValidator, HexString } from "../types.js
5
5
  /**
6
6
  * Standard validator titles as they appear in the blueprint.
7
7
  *
8
- * Targets CIP-113 0.5.0-alpha.2 (upstream commit 9db7e06). See PLAN.md D-11.
8
+ * Targets CIP-113 0.5.0-alpha.4 (upstream commit 7e8a63198c5b240135f1aa2f043ce5d7c046b2c4). See
9
+ * PLAN.md D-11.
9
10
  *
10
- * --- The dissolution of programmable_logic_global ------------------------
11
+ * --- What alpha.4 moved --------------------------------------------------
11
12
  *
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.
13
+ * ADDITIONS ONLY, at the level of titles: 28 -> 34 handlers, and no title this
14
+ * SDK requires was retired. What DID move is arity — `issuance_mint` went from
15
+ * four parameters to two, `upgrade_multisig` from `(signers, threshold)` to a
16
+ * single `utxo_ref` plus one new validator, `issuance_logic`. An arity change
17
+ * is invisible to every title check in this file; see `src/standard/scripts.ts`
18
+ * for the builders that encode it and `test/blueprint-version-guard.test.mjs`
19
+ * for the pin that catches upstream moving it again.
23
20
  *
24
21
  * --- Do not read upstream's CONTRACT_SURFACE_CHANGES.md for these ---------
25
22
  *
26
23
  * 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.
24
+ * it has been WRONG about this repository twice. Once about the params datum in
25
+ * a way that produces malformed transactions (it said 6 fields; the artifact
26
+ * had 7, and one line was phrased as an instruction to build the 6-field
27
+ * shape). Every title, arity and field order here comes from the blueprint
28
+ * itself. See PLAN.md, W-D hazard box.
31
29
  */
32
30
  export declare const STANDARD_VALIDATORS: {
33
31
  readonly ALWAYS_FAIL: "always_fail.always_fail.spend";
34
- readonly PROTOCOL_PARAMS_MINT: "protocol_params_mint.protocol_params_mint.mint";
32
+ /**
33
+ * ⚑ ONE HASH FOR POLICY *AND* ADDRESS. `protocol_params_mint` and
34
+ * `protocol_params_spend` merged into one multi-purpose validator (#118), so
35
+ * the params-NFT policy id and the params address's payment credential are
36
+ * now THE SAME VALUE. Two derivations that used to be independently correct
37
+ * are one; deriving them separately yields a valid-looking address that holds
38
+ * nothing.
39
+ */
40
+ readonly PROTOCOL_PARAMS: "protocol_params.protocol_params.mint";
35
41
  readonly PROGRAMMABLE_LOGIC_BASE: "programmable_logic_base.programmable_logic_base.spend";
36
42
  readonly ISSUANCE_CBOR_HEX_MINT: "issuance_cbor_hex_mint.issuance_cbor_hex_mint.mint";
37
43
  readonly ISSUANCE_MINT: "issuance_mint.issuance_mint.mint";
38
- readonly REGISTRY_MINT: "registry_mint.registry_mint.mint";
39
- readonly REGISTRY_SPEND: "registry_spend.registry_spend.spend";
40
- /** PLG's transfer arm, renamed by #110. Withdraw-0. */
44
+ /** ONE HASH FOR POLICY *AND* ADDRESS — same merge as PROTOCOL_PARAMS (#117). */
45
+ readonly REGISTRY: "registry.registry.mint";
46
+ /**
47
+ * The dispatcher, REINTRODUCED by #117 after #110 dissolved it.
48
+ *
49
+ * ⚠ Its title is identical to the one 0.3.x used, and its ROLE is not: it
50
+ * carries the three delegate hashes as compile-time parameters and every
51
+ * programmable transaction now withdraws through it. Do not read its presence
52
+ * as evidence of any protocol version — see RETIRED_VALIDATORS.
53
+ */
54
+ readonly PROGRAMMABLE_LOGIC_GLOBAL: "programmable_logic_global.programmable_logic_global.withdraw";
55
+ /** Withdraw-0 delegates. Arity 1 -> 3 in alpha.3; the titles did not change. */
41
56
  readonly TRANSFER: "transfer.transfer.withdraw";
42
- /** Seize / clawback, split out of PLG by #110. Withdraw-0. */
43
57
  readonly THIRD_PARTY: "third_party.third_party.withdraw";
44
- /** Now dispatched to directly by PLB, with no PLG hop. Withdraw-0. */
45
58
  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
59
  /** Reference upgrade authority; the initial `upgrade_cred` target. Withdraw-0. */
49
60
  readonly UPGRADE_MULTISIG: "upgrade_multisig.upgrade_multisig.withdraw";
61
+ /**
62
+ * `issuance_logic` — NEW in alpha.4, and the replaceable half of issuance.
63
+ *
64
+ * The params datum's FIELD 1 names its credential (see
65
+ * `ProgrammableLogicGlobalParams.issuanceLogicCred`), and `issuance_mint`
66
+ * dispatches to whatever that field says — so this validator's withdraw-0
67
+ * rides on EVERY mint and EVERY burn.
68
+ *
69
+ * ⚠ Its credential must be REGISTERED before it can withdraw. An unregistered
70
+ * stake credential does not fail with "not registered"; the ledger reports
71
+ * code 3141, *"rewards withdrawals must consume rewards in full"*, which
72
+ * reads as a balance problem. That is how S-11 lost an afternoon on the
73
+ * dispatcher.
74
+ */
75
+ readonly ISSUANCE_LOGIC: "issuance_logic.issuance_logic.withdraw";
50
76
  };
51
77
  /**
52
- * Validator titles that existed in earlier CIP-113 releases and are GONE.
78
+ * The protocol version this SDK builds transactions for.
79
+ *
80
+ * ⚠ SINGLE SOURCE OF TRUTH for the version verdict. A migration flips this one
81
+ * constant; nothing else should encode a target version.
82
+ */
83
+ export declare const TARGET_PROTOCOL_VERSION = "0.5.0-alpha.4";
84
+ /** Upstream commit the target version's blueprint was built from. */
85
+ export declare const TARGET_PROTOCOL_COMMIT = "7e8a631";
86
+ /**
87
+ * Validator titles that existed in an ADJACENT CIP-113 release and are absent
88
+ * from the target one.
53
89
  *
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".
90
+ * THESE ARE HINTS, NEVER A VERSION VERDICT, AND THE DISTINCTION IS THE WHOLE
91
+ * POINT OF THIS BLOCK. This map used to DRIVE the diagnosis: any present title
92
+ * appearing here meant "an EARLIER protocol version". That inference is unsound,
93
+ * and it broke the first time it was tested against reality —
94
+ * `programmable_logic_global` was dissolved by upstream #110 and then
95
+ * REINTRODUCED by #117 as the PLG dispatcher, so a blueprint strictly NEWER
96
+ * than the target was reported as too OLD, sending the reader to hunt for a
97
+ * stale checkout.
98
+ *
99
+ * A symbol's absence tells you nothing about direction, because a symbol can
100
+ * come back. The version comes from the PREAMBLE; these strings only add colour
101
+ * once the direction is already known.
102
+ *
103
+ * ⚠ ALPHA.4 ADDS NOTHING HERE, and that is measured rather than assumed: no
104
+ * alpha.3 title is absent from alpha.4 (28 -> 34 handlers, additions only; the
105
+ * delta is pinned in `test/blueprint-version-guard.test.mjs`). Do not add
106
+ * speculative entries — a title listed here that is also required makes the
107
+ * guard contradict itself, which is the original defect's exact shape.
57
108
  */
58
109
  export declare const RETIRED_VALIDATORS: Record<string, string>;
59
110
  /**
@@ -71,8 +122,57 @@ export declare function getValidatorHash(blueprint: PlutusBlueprint, title: stri
71
122
  * Get a validator entry from a blueprint by title.
72
123
  */
73
124
  export declare function getValidator(blueprint: PlutusBlueprint, title: string): BlueprintValidator;
125
+ /**
126
+ * Compare two semver-ish version strings.
127
+ *
128
+ * Returns a negative number if `a < b`, positive if `a > b`, 0 if equal, and
129
+ * `null` if either string cannot be parsed.
130
+ *
131
+ * ⛔ `null` IS A REAL ANSWER AND MUST NOT BE COERCED TO 0. "I cannot tell which
132
+ * is newer" and "they are the same" are different facts, and collapsing them is
133
+ * how a guard starts reporting a confident direction it never established.
134
+ *
135
+ * Prerelease handling follows semver: a version WITH a prerelease tag sorts
136
+ * BELOW the same core version without one (`0.5.0-alpha.2` < `0.5.0`), and tags
137
+ * compare identifier by identifier, numerically where both sides are numeric.
138
+ * That last rule is what orders `alpha.2` before `alpha.10` — a plain string
139
+ * compare puts them the other way round.
140
+ */
141
+ export declare function compareProtocolVersions(a: string, b: string): number | null;
74
142
  /**
75
143
  * Validate that a blueprint contains all required standard validators.
144
+ *
145
+ * ⛔ THE VERSION VERDICT COMES FROM THE PREAMBLE, NEVER FROM WHICH SYMBOLS ARE
146
+ * PRESENT. The first implementation inferred "this blueprint is OLDER" from the
147
+ * presence of any retired validator title, and reality broke it on first
148
+ * contact: `programmable_logic_global` was removed by upstream #110 and brought
149
+ * BACK by #117 in a new role, so 0.5.0-alpha.3 — strictly newer than the target
150
+ * — was reported as "an earlier protocol version that this SDK no longer
151
+ * supports". The guard fired correctly and named the wrong cause, which is
152
+ * worse than not firing: it sends the reader to look for a stale checkout.
153
+ *
154
+ * A symbol can come back. A version number cannot go backwards.
155
+ *
156
+ * ⛔⛔ AND THE SAME DEFECT CLASS SURVIVED ONE LEVEL UP IN CONTROL FLOW, WHICH IS
157
+ * WHAT THIS ORDERING FIXES. The version comparison used to sit BELOW an early
158
+ * `if (missing.length === 0) return;`, so symbol presence still decided the
159
+ * verdict — it just decided it by returning silently instead of by throwing.
160
+ * alpha.4 retires no title this SDK requires, so a strictly LATER blueprint
161
+ * produced `missing: []` and was ACCEPTED, while
162
+ * `compareProtocolVersions("0.5.0-alpha.4", TARGET_PROTOCOL_VERSION)` was
163
+ * returning `1` the whole time. The comparator was correct; the gate never
164
+ * called it.
165
+ *
166
+ * ⚠ The file's own "newer" fixture could not catch that, and the reason
167
+ * generalises: `NEWER_WITH_SAME_SYMBOL` is built from the alpha.2-shaped v0.3.0
168
+ * artefact, which is ALSO missing titles — so it entered through the
169
+ * missing-title door and only ever exercised the comparator. A fixture that
170
+ * reaches a branch by the wrong route proves nothing about the route that
171
+ * matters.
172
+ *
173
+ * ⇒ THE ORDER BELOW IS LOAD-BEARING: preamble verdict first, `missing` second.
174
+ * Every case that reaches the `missing` branch has already been established to
175
+ * be AT the target version.
76
176
  */
77
177
  export declare function validateStandardBlueprint(blueprint: PlutusBlueprint): void;
78
178
  //# sourceMappingURL=blueprint.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,mBAAmB;;IAG9B;;;;;;;OAOG;;;;;IAOH,kFAAkF;;IAGlF;;;;;;;OAOG;;IAGH,gFAAgF;;;;IAKhF,kFAAkF;;IAGlF;;;;;;;;;;;;;OAaG;;CAEK,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,kBAAkB,CAAC;AAEvD,qEAAqE;AACrE,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAcrD,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,uBAAuB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA2C3E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI,CAmF1E"}
@@ -4,60 +4,116 @@
4
4
  /**
5
5
  * Standard validator titles as they appear in the blueprint.
6
6
  *
7
- * Targets CIP-113 0.5.0-alpha.2 (upstream commit 9db7e06). See PLAN.md D-11.
7
+ * Targets CIP-113 0.5.0-alpha.4 (upstream commit 7e8a63198c5b240135f1aa2f043ce5d7c046b2c4). See
8
+ * PLAN.md D-11.
8
9
  *
9
- * --- The dissolution of programmable_logic_global ------------------------
10
+ * --- What alpha.4 moved --------------------------------------------------
10
11
  *
11
- * Upstream #110 dissolved the PLG coordinator. Its transfer arm was RENAMED
12
- * `transfer`; third-party (seize/clawback) logic moved to a new standalone
13
- * `third_party`; `unfracking` is no longer reached through it. Instead
14
- * `programmable_logic_base` dispatches straight to one of the three.
15
- *
16
- * The practical consequence for this table: the title
17
- * `programmable_logic_global.programmable_logic_global.withdraw` NO LONGER
18
- * EXISTS in any 0.5.x blueprint. Its removal is why validateStandardBlueprint()
19
- * fails closed on the new artifact rather than silently building transactions
20
- * against a validator that is not there — the loud failure is deliberate and
21
- * must not be "fixed" by relaxing the check.
12
+ * ADDITIONS ONLY, at the level of titles: 28 -> 34 handlers, and no title this
13
+ * SDK requires was retired. What DID move is arity — `issuance_mint` went from
14
+ * four parameters to two, `upgrade_multisig` from `(signers, threshold)` to a
15
+ * single `utxo_ref` plus one new validator, `issuance_logic`. An arity change
16
+ * is invisible to every title check in this file; see `src/standard/scripts.ts`
17
+ * for the builders that encode it and `test/blueprint-version-guard.test.mjs`
18
+ * for the pin that catches upstream moving it again.
22
19
  *
23
20
  * --- Do not read upstream's CONTRACT_SURFACE_CHANGES.md for these ---------
24
21
  *
25
22
  * That document contains an SDK impact map naming this repository by path, and
26
- * it is WRONG about the params datum in a way that produces malformed
27
- * transactions (it says 6 fields; the artifact has 7, and one line is phrased
28
- * as an instruction to build the 6-field shape). Every title, arity and field
29
- * order here comes from the blueprint itself. See PLAN.md, W-D hazard box.
23
+ * it has been WRONG about this repository twice. Once about the params datum in
24
+ * a way that produces malformed transactions (it said 6 fields; the artifact
25
+ * had 7, and one line was phrased as an instruction to build the 6-field
26
+ * shape). Every title, arity and field order here comes from the blueprint
27
+ * itself. See PLAN.md, W-D hazard box.
30
28
  */
31
29
  export const STANDARD_VALIDATORS = {
32
30
  ALWAYS_FAIL: "always_fail.always_fail.spend",
33
- PROTOCOL_PARAMS_MINT: "protocol_params_mint.protocol_params_mint.mint",
31
+ /**
32
+ * ⚑ ONE HASH FOR POLICY *AND* ADDRESS. `protocol_params_mint` and
33
+ * `protocol_params_spend` merged into one multi-purpose validator (#118), so
34
+ * the params-NFT policy id and the params address's payment credential are
35
+ * now THE SAME VALUE. Two derivations that used to be independently correct
36
+ * are one; deriving them separately yields a valid-looking address that holds
37
+ * nothing.
38
+ */
39
+ PROTOCOL_PARAMS: "protocol_params.protocol_params.mint",
34
40
  PROGRAMMABLE_LOGIC_BASE: "programmable_logic_base.programmable_logic_base.spend",
35
41
  ISSUANCE_CBOR_HEX_MINT: "issuance_cbor_hex_mint.issuance_cbor_hex_mint.mint",
36
42
  ISSUANCE_MINT: "issuance_mint.issuance_mint.mint",
37
- REGISTRY_MINT: "registry_mint.registry_mint.mint",
38
- REGISTRY_SPEND: "registry_spend.registry_spend.spend",
39
- /** PLG's transfer arm, renamed by #110. Withdraw-0. */
43
+ /** ⚑ ONE HASH FOR POLICY *AND* ADDRESS — same merge as PROTOCOL_PARAMS (#117). */
44
+ REGISTRY: "registry.registry.mint",
45
+ /**
46
+ * The dispatcher, REINTRODUCED by #117 after #110 dissolved it.
47
+ *
48
+ * ⚠ Its title is identical to the one 0.3.x used, and its ROLE is not: it
49
+ * carries the three delegate hashes as compile-time parameters and every
50
+ * programmable transaction now withdraws through it. Do not read its presence
51
+ * as evidence of any protocol version — see RETIRED_VALIDATORS.
52
+ */
53
+ PROGRAMMABLE_LOGIC_GLOBAL: "programmable_logic_global.programmable_logic_global.withdraw",
54
+ /** Withdraw-0 delegates. Arity 1 -> 3 in alpha.3; the titles did not change. */
40
55
  TRANSFER: "transfer.transfer.withdraw",
41
- /** Seize / clawback, split out of PLG by #110. Withdraw-0. */
42
56
  THIRD_PARTY: "third_party.third_party.withdraw",
43
- /** Now dispatched to directly by PLB, with no PLG hop. Withdraw-0. */
44
57
  UNFRACKING: "unfracking.unfracking.withdraw",
45
- /** Holds the coordination UTxO — the live protocol wiring. Spend. */
46
- COORDINATION_SPEND: "coordination_spend.coordination_spend.spend",
47
58
  /** Reference upgrade authority; the initial `upgrade_cred` target. Withdraw-0. */
48
59
  UPGRADE_MULTISIG: "upgrade_multisig.upgrade_multisig.withdraw",
60
+ /**
61
+ * `issuance_logic` — NEW in alpha.4, and the replaceable half of issuance.
62
+ *
63
+ * The params datum's FIELD 1 names its credential (see
64
+ * `ProgrammableLogicGlobalParams.issuanceLogicCred`), and `issuance_mint`
65
+ * dispatches to whatever that field says — so this validator's withdraw-0
66
+ * rides on EVERY mint and EVERY burn.
67
+ *
68
+ * ⚠ Its credential must be REGISTERED before it can withdraw. An unregistered
69
+ * stake credential does not fail with "not registered"; the ledger reports
70
+ * code 3141, *"rewards withdrawals must consume rewards in full"*, which
71
+ * reads as a balance problem. That is how S-11 lost an afternoon on the
72
+ * dispatcher.
73
+ */
74
+ ISSUANCE_LOGIC: "issuance_logic.issuance_logic.withdraw",
49
75
  };
50
76
  /**
51
- * Validator titles that existed in earlier CIP-113 releases and are GONE.
77
+ * The protocol version this SDK builds transactions for.
52
78
  *
53
- * Kept so that loading an old blueprint produces a diagnosis instead of a bare
54
- * "missing required validator", which reads as a corrupt file rather than as
55
- * "this SDK no longer targets that protocol version".
79
+ * SINGLE SOURCE OF TRUTH for the version verdict. A migration flips this one
80
+ * constant; nothing else should encode a target version.
81
+ */
82
+ export const TARGET_PROTOCOL_VERSION = "0.5.0-alpha.4";
83
+ /** Upstream commit the target version's blueprint was built from. */
84
+ export const TARGET_PROTOCOL_COMMIT = "7e8a631";
85
+ /**
86
+ * Validator titles that existed in an ADJACENT CIP-113 release and are absent
87
+ * from the target one.
88
+ *
89
+ * ⛔ THESE ARE HINTS, NEVER A VERSION VERDICT, AND THE DISTINCTION IS THE WHOLE
90
+ * POINT OF THIS BLOCK. This map used to DRIVE the diagnosis: any present title
91
+ * appearing here meant "an EARLIER protocol version". That inference is unsound,
92
+ * and it broke the first time it was tested against reality —
93
+ * `programmable_logic_global` was dissolved by upstream #110 and then
94
+ * REINTRODUCED by #117 as the PLG dispatcher, so a blueprint strictly NEWER
95
+ * than the target was reported as too OLD, sending the reader to hunt for a
96
+ * stale checkout.
97
+ *
98
+ * A symbol's absence tells you nothing about direction, because a symbol can
99
+ * come back. The version comes from the PREAMBLE; these strings only add colour
100
+ * once the direction is already known.
101
+ *
102
+ * ⚠ ALPHA.4 ADDS NOTHING HERE, and that is measured rather than assumed: no
103
+ * alpha.3 title is absent from alpha.4 (28 -> 34 handlers, additions only; the
104
+ * delta is pinned in `test/blueprint-version-guard.test.mjs`). Do not add
105
+ * speculative entries — a title listed here that is also required makes the
106
+ * guard contradict itself, which is the original defect's exact shape.
56
107
  */
57
108
  export const RETIRED_VALIDATORS = {
58
- "programmable_logic_global.programmable_logic_global.withdraw": "dissolved by upstream #110its transfer arm is now `transfer.transfer.withdraw`, " +
59
- "seize/clawback is `third_party.third_party.withdraw`, and unfracking is reached " +
60
- "directly by programmable_logic_base",
109
+ "protocol_params_mint.protocol_params_mint.mint": "merged with protocol_params_spend into `protocol_params` by upstream #118one validator, " +
110
+ "one hash serving as BOTH the params-NFT policy id and the params address's payment credential",
111
+ "protocol_params_spend.protocol_params_spend.spend": "merged into `protocol_params` by upstream #118 (it was itself the #117 rename of " +
112
+ "`coordination_spend`)",
113
+ "coordination_spend.coordination_spend.spend": "renamed `protocol_params_spend` by upstream #117, then merged into `protocol_params` by #118",
114
+ "registry_mint.registry_mint.mint": "merged with registry_spend into `registry` by upstream #117 — one validator, one hash serving " +
115
+ "as BOTH the registry-node policy id and the node address's payment credential",
116
+ "registry_spend.registry_spend.spend": "merged into `registry` by upstream #117",
61
117
  };
62
118
  /**
63
119
  * Get a validator's compiled code from a blueprint by title.
@@ -88,28 +144,170 @@ export function getValidator(blueprint, title) {
88
144
  }
89
145
  return validator;
90
146
  }
147
+ /**
148
+ * Compare two semver-ish version strings.
149
+ *
150
+ * Returns a negative number if `a < b`, positive if `a > b`, 0 if equal, and
151
+ * `null` if either string cannot be parsed.
152
+ *
153
+ * ⛔ `null` IS A REAL ANSWER AND MUST NOT BE COERCED TO 0. "I cannot tell which
154
+ * is newer" and "they are the same" are different facts, and collapsing them is
155
+ * how a guard starts reporting a confident direction it never established.
156
+ *
157
+ * Prerelease handling follows semver: a version WITH a prerelease tag sorts
158
+ * BELOW the same core version without one (`0.5.0-alpha.2` < `0.5.0`), and tags
159
+ * compare identifier by identifier, numerically where both sides are numeric.
160
+ * That last rule is what orders `alpha.2` before `alpha.10` — a plain string
161
+ * compare puts them the other way round.
162
+ */
163
+ export function compareProtocolVersions(a, b) {
164
+ const parse = (v) => {
165
+ const m = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(v.trim());
166
+ if (!m)
167
+ return null;
168
+ return {
169
+ core: [Number(m[1]), Number(m[2]), Number(m[3])],
170
+ pre: m[4] === undefined ? null : m[4].split("."),
171
+ };
172
+ };
173
+ const pa = parse(a);
174
+ const pb = parse(b);
175
+ if (!pa || !pb)
176
+ return null;
177
+ for (let i = 0; i < 3; i++) {
178
+ const d = pa.core[i] - pb.core[i];
179
+ if (d !== 0)
180
+ return d;
181
+ }
182
+ // No prerelease outranks any prerelease.
183
+ if (pa.pre === null && pb.pre === null)
184
+ return 0;
185
+ if (pa.pre === null)
186
+ return 1;
187
+ if (pb.pre === null)
188
+ return -1;
189
+ const n = Math.max(pa.pre.length, pb.pre.length);
190
+ for (let i = 0; i < n; i++) {
191
+ const x = pa.pre[i];
192
+ const y = pb.pre[i];
193
+ if (x === undefined)
194
+ return -1;
195
+ if (y === undefined)
196
+ return 1;
197
+ const xn = /^\d+$/.test(x);
198
+ const yn = /^\d+$/.test(y);
199
+ if (xn && yn) {
200
+ const d = Number(x) - Number(y);
201
+ if (d !== 0)
202
+ return d;
203
+ }
204
+ else if (xn !== yn) {
205
+ // Numeric identifiers always sort below alphanumeric ones.
206
+ return xn ? -1 : 1;
207
+ }
208
+ else if (x !== y) {
209
+ return x < y ? -1 : 1;
210
+ }
211
+ }
212
+ return 0;
213
+ }
91
214
  /**
92
215
  * Validate that a blueprint contains all required standard validators.
216
+ *
217
+ * ⛔ THE VERSION VERDICT COMES FROM THE PREAMBLE, NEVER FROM WHICH SYMBOLS ARE
218
+ * PRESENT. The first implementation inferred "this blueprint is OLDER" from the
219
+ * presence of any retired validator title, and reality broke it on first
220
+ * contact: `programmable_logic_global` was removed by upstream #110 and brought
221
+ * BACK by #117 in a new role, so 0.5.0-alpha.3 — strictly newer than the target
222
+ * — was reported as "an earlier protocol version that this SDK no longer
223
+ * supports". The guard fired correctly and named the wrong cause, which is
224
+ * worse than not firing: it sends the reader to look for a stale checkout.
225
+ *
226
+ * A symbol can come back. A version number cannot go backwards.
227
+ *
228
+ * ⛔⛔ AND THE SAME DEFECT CLASS SURVIVED ONE LEVEL UP IN CONTROL FLOW, WHICH IS
229
+ * WHAT THIS ORDERING FIXES. The version comparison used to sit BELOW an early
230
+ * `if (missing.length === 0) return;`, so symbol presence still decided the
231
+ * verdict — it just decided it by returning silently instead of by throwing.
232
+ * alpha.4 retires no title this SDK requires, so a strictly LATER blueprint
233
+ * produced `missing: []` and was ACCEPTED, while
234
+ * `compareProtocolVersions("0.5.0-alpha.4", TARGET_PROTOCOL_VERSION)` was
235
+ * returning `1` the whole time. The comparator was correct; the gate never
236
+ * called it.
237
+ *
238
+ * ⚠ The file's own "newer" fixture could not catch that, and the reason
239
+ * generalises: `NEWER_WITH_SAME_SYMBOL` is built from the alpha.2-shaped v0.3.0
240
+ * artefact, which is ALSO missing titles — so it entered through the
241
+ * missing-title door and only ever exercised the comparator. A fixture that
242
+ * reaches a branch by the wrong route proves nothing about the route that
243
+ * matters.
244
+ *
245
+ * ⇒ THE ORDER BELOW IS LOAD-BEARING: preamble verdict first, `missing` second.
246
+ * Every case that reaches the `missing` branch has already been established to
247
+ * be AT the target version.
93
248
  */
94
249
  export function validateStandardBlueprint(blueprint) {
95
250
  const titles = blueprint.validators.map((v) => v.title);
96
251
  const missing = Object.entries(STANDARD_VALIDATORS).filter(([, title]) => !titles.includes(title));
97
- if (missing.length === 0)
98
- return;
99
- const label = `${blueprint.preamble.title} v${blueprint.preamble.version}`;
100
- // If the blueprint carries a validator this SDK has retired, it is an OLD
101
- // protocol version, not a damaged file. Say so otherwise the reader spends
102
- // the next hour looking for a corrupt artifact.
252
+ const version = blueprint.preamble.version;
253
+ const label = `${blueprint.preamble.title} v${version}`;
254
+ // `detail` must stay honest in BOTH cases. Emitting
255
+ // "Missing required validator(s): ." with an empty list would be a guard
256
+ // naming a defect it did not find the same failure mode as reporting a
257
+ // direction the comparator never established.
258
+ const detail = missing.length > 0
259
+ ? `Missing required validator(s): ` +
260
+ missing.map(([name, title]) => `${name} (title: "${title}")`).join(", ") + `.`
261
+ : `Every required validator title IS present, which is exactly why this is not a ` +
262
+ `missing-symbol failure: the PROTOCOL VERSION ITSELF is the mismatch.`;
263
+ // Hints, added only once direction is known from the preamble — never used to
264
+ // decide it. See RETIRED_VALIDATORS.
103
265
  const retired = titles.filter((t) => t in RETIRED_VALIDATORS);
104
- if (retired.length > 0) {
105
- throw new Error(`Blueprint "${label}" targets an earlier CIP-113 protocol version that this SDK no ` +
106
- `longer supports. It still declares ${retired.map((t) => `"${t}"`).join(", ")} ` +
107
- retired.map((t) => RETIRED_VALIDATORS[t]).join("; ") +
108
- `. This SDK targets 0.5.0-alpha.2 (upstream 9db7e06); use a blueprint from ` +
109
- `blueprints/standard/v0.5.0-alpha.2/, or an SDK release pinned to the older contracts.`);
266
+ const hint = retired.length > 0
267
+ ? ` It declares ${retired.map((t) => `"${t}"`).join(", ")} ` +
268
+ retired.map((t) => RETIRED_VALIDATORS[t]).join("; ") + `.`
269
+ : "";
270
+ const cmp = compareProtocolVersions(version, TARGET_PROTOCOL_VERSION);
271
+ // THE RULING ON AN UNPARSEABLE PREAMBLE, AND THE REASON, so nobody relaxes
272
+ // it back. This file's doctrine is that the verdict comes from the preamble;
273
+ // a preamble that cannot be read therefore cannot yield a verdict, and
274
+ // accepting-because-the-symbols-look-right is the precise defect fixed above.
275
+ // So an unreadable version is refused EVEN WHEN EVERY REQUIRED TITLE IS
276
+ // PRESENT.
277
+ //
278
+ // ACCEPTED CONSEQUENCE: a fork carrying a non-semver version string ("main",
279
+ // "2026-09-10", a git describe) is now refused. It is refused LOUDLY and the
280
+ // message names the remedy, which is the trade being made — a fork that wants
281
+ // to be usable gives its preamble a semver-parseable version.
282
+ if (cmp === null) {
283
+ throw new Error(`Standard blueprint "${label}" cannot be used: its preamble version could not be ` +
284
+ `parsed, so this SDK cannot establish whether it is behind or ahead of the target ` +
285
+ `${TARGET_PROTOCOL_VERSION} (upstream ${TARGET_PROTOCOL_COMMIT}), and a verdict this ` +
286
+ `SDK cannot establish is not one it will guess. ${detail}${hint} ` +
287
+ `Give the blueprint a semver-parseable preamble version (e.g. "${TARGET_PROTOCOL_VERSION}"), ` +
288
+ `or use one from blueprints/standard/v${TARGET_PROTOCOL_VERSION}/. ` +
289
+ `Present titles: ${titles.join(", ")}`);
290
+ }
291
+ if (cmp < 0) {
292
+ throw new Error(`Blueprint "${label}" targets an EARLIER CIP-113 protocol version than this SDK ` +
293
+ `supports (target ${TARGET_PROTOCOL_VERSION}, upstream ${TARGET_PROTOCOL_COMMIT}). ` +
294
+ `${detail}${hint} Use a blueprint from blueprints/standard/v${TARGET_PROTOCOL_VERSION}/, ` +
295
+ `or an SDK release pinned to the older contracts.`);
110
296
  }
111
- throw new Error(`Standard blueprint "${label}" is missing required validator(s): ` +
112
- missing.map(([name, title]) => `${name} (title: "${title}")`).join(", ") +
113
- `. Present titles: ${titles.join(", ")}`);
297
+ if (cmp > 0) {
298
+ throw new Error(`Blueprint "${label}" targets a LATER CIP-113 protocol version than this SDK supports ` +
299
+ `(target ${TARGET_PROTOCOL_VERSION}, upstream ${TARGET_PROTOCOL_COMMIT}). This is not a ` +
300
+ `stale or corrupt file — the SDK has not been migrated to it yet. ${detail}${hint} ` +
301
+ `Upgrade the SDK, or pin the blueprint to v${TARGET_PROTOCOL_VERSION}.`);
302
+ }
303
+ // At the target version, with every required title present: usable.
304
+ if (missing.length === 0)
305
+ return;
306
+ // Same version, still missing validators: the artifact does not match what
307
+ // this version is supposed to contain. Neither older nor newer explains it.
308
+ throw new Error(`Standard blueprint "${label}" declares this SDK's target version ` +
309
+ `(${TARGET_PROTOCOL_VERSION}) but does not contain the validators that version should ` +
310
+ `have — the artifact does not match its own version string. ${detail}${hint} ` +
311
+ `Present titles: ${titles.join(", ")}`);
114
312
  }
115
313
  //# sourceMappingURL=blueprint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blueprint.js","sourceRoot":"","sources":["../../src/standard/blueprint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,+BAA+B;IAC5C,oBAAoB,EAAE,gDAAgD;IACtE,uBAAuB,EAAE,uDAAuD;IAChF,sBAAsB,EAAE,oDAAoD;IAC5E,aAAa,EAAE,kCAAkC;IACjD,aAAa,EAAE,kCAAkC;IACjD,cAAc,EAAE,qCAAqC;IAErD,uDAAuD;IACvD,QAAQ,EAAE,4BAA4B;IACtC,8DAA8D;IAC9D,WAAW,EAAE,kCAAkC;IAC/C,sEAAsE;IACtE,UAAU,EAAE,gCAAgC;IAC5C,qEAAqE;IACrE,kBAAkB,EAAE,6CAA6C;IACjE,kFAAkF;IAClF,gBAAgB,EAAE,4CAA4C;CACtD,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,8DAA8D,EAC5D,qFAAqF;QACrF,kFAAkF;QAClF,qCAAqC;CACxC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAA0B,EAC1B,KAAa;IAEb,MAAM,SAAS,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IACtE,IAAI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