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