@easy1staking/cip113-sdk-ts 0.3.1 → 0.5.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 +22 -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 +38 -0
- package/blueprints/substandards/dummy/v0.2.0/plutus.json +84 -0
- package/blueprints/substandards/freeze-and-seize/v0.1.0/UPSTREAM_PIN.json +36 -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 +134 -17
- package/dist/core/evo-utils.d.ts.map +1 -1
- package/dist/core/evo-utils.js +162 -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 +58 -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 +124 -22
- package/dist/standard/scripts.d.ts.map +1 -1
- package/dist/standard/scripts.js +182 -55
- package/dist/standard/scripts.js.map +1 -1
- package/dist/substandards/dummy/index.d.ts.map +1 -1
- package/dist/substandards/dummy/index.js +470 -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 +314 -41
- package/dist/substandards/freeze-and-seize/index.js.map +1 -1
- package/dist/substandards/freeze-and-seize/scripts.d.ts +2 -1
- package/dist/substandards/freeze-and-seize/scripts.d.ts.map +1 -1
- package/dist/substandards/freeze-and-seize/scripts.js +7 -6
- package/dist/substandards/freeze-and-seize/scripts.js.map +1 -1
- package/dist/substandards/interface.d.ts +111 -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
|
@@ -3,16 +3,61 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* Standard validator titles as they appear in the blueprint.
|
|
6
|
+
*
|
|
7
|
+
* Targets CIP-113 0.5.0-alpha.2 (upstream commit 9db7e06). See PLAN.md D-11.
|
|
8
|
+
*
|
|
9
|
+
* --- The dissolution of programmable_logic_global ------------------------
|
|
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.
|
|
22
|
+
*
|
|
23
|
+
* --- Do not read upstream's CONTRACT_SURFACE_CHANGES.md for these ---------
|
|
24
|
+
*
|
|
25
|
+
* 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.
|
|
6
30
|
*/
|
|
7
31
|
export const STANDARD_VALIDATORS = {
|
|
8
32
|
ALWAYS_FAIL: "always_fail.always_fail.spend",
|
|
9
33
|
PROTOCOL_PARAMS_MINT: "protocol_params_mint.protocol_params_mint.mint",
|
|
10
|
-
PROGRAMMABLE_LOGIC_GLOBAL: "programmable_logic_global.programmable_logic_global.withdraw",
|
|
11
34
|
PROGRAMMABLE_LOGIC_BASE: "programmable_logic_base.programmable_logic_base.spend",
|
|
12
35
|
ISSUANCE_CBOR_HEX_MINT: "issuance_cbor_hex_mint.issuance_cbor_hex_mint.mint",
|
|
13
36
|
ISSUANCE_MINT: "issuance_mint.issuance_mint.mint",
|
|
14
37
|
REGISTRY_MINT: "registry_mint.registry_mint.mint",
|
|
15
38
|
REGISTRY_SPEND: "registry_spend.registry_spend.spend",
|
|
39
|
+
/** PLG's transfer arm, renamed by #110. Withdraw-0. */
|
|
40
|
+
TRANSFER: "transfer.transfer.withdraw",
|
|
41
|
+
/** Seize / clawback, split out of PLG by #110. Withdraw-0. */
|
|
42
|
+
THIRD_PARTY: "third_party.third_party.withdraw",
|
|
43
|
+
/** Now dispatched to directly by PLB, with no PLG hop. Withdraw-0. */
|
|
44
|
+
UNFRACKING: "unfracking.unfracking.withdraw",
|
|
45
|
+
/** Holds the coordination UTxO — the live protocol wiring. Spend. */
|
|
46
|
+
COORDINATION_SPEND: "coordination_spend.coordination_spend.spend",
|
|
47
|
+
/** Reference upgrade authority; the initial `upgrade_cred` target. Withdraw-0. */
|
|
48
|
+
UPGRADE_MULTISIG: "upgrade_multisig.upgrade_multisig.withdraw",
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Validator titles that existed in earlier CIP-113 releases and are GONE.
|
|
52
|
+
*
|
|
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".
|
|
56
|
+
*/
|
|
57
|
+
export const RETIRED_VALIDATORS = {
|
|
58
|
+
"programmable_logic_global.programmable_logic_global.withdraw": "dissolved by upstream #110 — its 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",
|
|
16
61
|
};
|
|
17
62
|
/**
|
|
18
63
|
* Get a validator's compiled code from a blueprint by title.
|
|
@@ -25,6 +70,14 @@ export function getValidatorCode(blueprint, title) {
|
|
|
25
70
|
}
|
|
26
71
|
return validator.compiledCode;
|
|
27
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a validator's un-parameterised script hash from a blueprint by title.
|
|
75
|
+
* This is the hash Aiken stamps in plutus.json — what CIP-171 verifiers
|
|
76
|
+
* reproduce by compiling the source repo at the named commit.
|
|
77
|
+
*/
|
|
78
|
+
export function getValidatorHash(blueprint, title) {
|
|
79
|
+
return getValidator(blueprint, title).hash;
|
|
80
|
+
}
|
|
28
81
|
/**
|
|
29
82
|
* Get a validator entry from a blueprint by title.
|
|
30
83
|
*/
|
|
@@ -40,10 +93,23 @@ export function getValidator(blueprint, title) {
|
|
|
40
93
|
*/
|
|
41
94
|
export function validateStandardBlueprint(blueprint) {
|
|
42
95
|
const titles = blueprint.validators.map((v) => v.title);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
96
|
+
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.
|
|
103
|
+
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.`);
|
|
47
110
|
}
|
|
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(", ")}`);
|
|
48
114
|
}
|
|
49
115
|
//# sourceMappingURL=blueprint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint.js","sourceRoot":"","sources":["../../src/standard/blueprint.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH
|
|
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;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CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,aAAa,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACxE,qBAAqB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,47 +1,149 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Standard script parameterization.
|
|
2
|
+
* Standard script parameterization — CIP-113 0.5.0-alpha.2 (upstream 9db7e06).
|
|
3
3
|
*
|
|
4
|
-
* Replicates the parameterization chain from ProtocolScriptBuilderService.java.
|
|
5
4
|
* Uses Evolution SDK directly for UPLC.applyParamsToScript and ScriptHash.
|
|
6
5
|
*
|
|
7
|
-
* Dependency graph:
|
|
6
|
+
* Dependency graph. Note it is NO LONGER a single chain: upstream #110 removed
|
|
7
|
+
* programmable_logic_global, and PLB is now parameterised by the params-NFT
|
|
8
|
+
* policy rather than by PLG's credential, so everything downstream hangs off
|
|
9
|
+
* `params_policy` in parallel instead of in series.
|
|
8
10
|
*
|
|
9
|
-
* always_fail(nonce)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* always_fail(nonce) -> hash (issuance side only now)
|
|
12
|
+
* coordination_spend(nonce) -> hash NEW: the lock target
|
|
13
|
+
* protocol_params_mint(utxo_ref, coord_hash) -> policy == params_policy
|
|
14
|
+
* |
|
|
15
|
+
* +-- programmable_logic_base(params_policy) -> hash
|
|
16
|
+
* +-- transfer(params_policy) -> hash (PLG's transfer arm, renamed)
|
|
17
|
+
* +-- third_party(params_policy) -> hash NEW: seize / clawback
|
|
18
|
+
* +-- unfracking(params_policy) -> hash
|
|
19
|
+
* +-- registry_spend(params_policy) -> hash
|
|
20
|
+
*
|
|
21
|
+
* issuance_cbor_hex_mint(utxo_ref, always_fail_hash) -> policy
|
|
22
|
+
* registry_mint(utxo_ref, issuance_cbor_hex_cs, registry_spend_cred) -> policy
|
|
23
|
+
* issuance_mint(PLB_cred, registry_node_cs, minting_logic_cred, params_policy)
|
|
24
|
+
* upgrade_multisig(signers, threshold) -> hash (independent)
|
|
25
|
+
*
|
|
26
|
+
* ⚠ PARAMETER TYPES ARE NOT INTERCHANGEABLE and TypeScript cannot tell them
|
|
27
|
+
* apart — every one of these is a hex string at the call site. `params_policy`
|
|
28
|
+
* is a PolicyId (a bare ByteArray); `minting_logic_cred` and friends are
|
|
29
|
+
* Credentials (a constructor-wrapped Script/VerificationKey). Passing a policy
|
|
30
|
+
* where a credential belongs produces a valid script with the wrong hash. The
|
|
31
|
+
* types below come from the blueprint's own parameter schemas, not from
|
|
32
|
+
* upstream's prose docs — see the hazard note in blueprint.ts.
|
|
17
33
|
*/
|
|
18
|
-
import
|
|
34
|
+
import { Data } from "@evolution-sdk/evolution";
|
|
35
|
+
import type { DeploymentParams, HexString, PlutusBlueprint, PlutusScript, PolicyId, ScriptHash, TxInput } from "../types.js";
|
|
19
36
|
export interface StandardScripts {
|
|
20
37
|
alwaysFail(nonce: HexString): PlutusScript;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
38
|
+
/** NEW in 0.5.x — the coordination UTxO's spender; nonce is arbitrary, per deployment. */
|
|
39
|
+
coordinationSpend(nonce: HexString): PlutusScript;
|
|
40
|
+
/** 2nd param is coordination_spend's hash in 0.5.x, always_fail's in 0.3.x. */
|
|
41
|
+
protocolParamsMint(utxoRef: TxInput, coordinationHash: ScriptHash): PlutusScript;
|
|
42
|
+
/** Takes the params-NFT POLICY now, not PLG's credential. */
|
|
43
|
+
programmableLogicBase(paramsPolicy: PolicyId): PlutusScript;
|
|
44
|
+
/** PLG's transfer arm, renamed by #110. */
|
|
45
|
+
transfer(paramsPolicy: PolicyId): PlutusScript;
|
|
46
|
+
/** Seize / clawback, split out of PLG by #110. */
|
|
47
|
+
thirdParty(paramsPolicy: PolicyId): PlutusScript;
|
|
48
|
+
unfracking(paramsPolicy: PolicyId): PlutusScript;
|
|
49
|
+
upgradeMultisig(signers: HexString[], threshold: number | bigint): PlutusScript;
|
|
24
50
|
issuanceCborHexMint(utxoRef: TxInput, alwaysFailHash: ScriptHash): PlutusScript;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
/** Arity 2 -> 3: gained registry_spend's credential. */
|
|
52
|
+
registryMint(utxoRef: TxInput, issuanceCborHexPolicy: PolicyId, registrySpendHash: ScriptHash): PlutusScript;
|
|
53
|
+
registrySpend(paramsPolicy: PolicyId): PlutusScript;
|
|
54
|
+
/** Arity 3 -> 4: gained params_policy. */
|
|
55
|
+
issuanceMint(plbHash: ScriptHash, registryNodePolicy: PolicyId, mintingLogicHash: ScriptHash, paramsPolicy: PolicyId): PlutusScript;
|
|
28
56
|
}
|
|
29
57
|
/**
|
|
30
58
|
* Create standard script builders from a blueprint.
|
|
31
59
|
* Uses Evolution SDK directly for parameterization and hashing.
|
|
32
60
|
*/
|
|
33
|
-
|
|
61
|
+
/**
|
|
62
|
+
* One parameterisation, as it happened. Emitted by {@link createStandardScripts}
|
|
63
|
+
* when a recorder is supplied.
|
|
64
|
+
*
|
|
65
|
+
* Exists so a CIP-171 record can be DERIVED from the same call path that
|
|
66
|
+
* actually parameterises the scripts, rather than hand-maintained alongside it.
|
|
67
|
+
* The record is keyed by the UNAPPLIED hash and its values are in APPLICATION
|
|
68
|
+
* order; both are properties of this call and of nothing else. A second list
|
|
69
|
+
* transcribed by hand would agree with the deployment right up until it did
|
|
70
|
+
* not, and the disagreement would surface as a hash that verifies to nothing.
|
|
71
|
+
*/
|
|
72
|
+
export interface ParameterizationEvent {
|
|
73
|
+
/** Validator title as it appears in the blueprint. */
|
|
74
|
+
title: string;
|
|
75
|
+
/** Blake2b-224 of the UNAPPLIED compiled code — the CIP-171 map key. */
|
|
76
|
+
rawScriptHash: ScriptHash;
|
|
77
|
+
/** Arguments applied, in application order. */
|
|
78
|
+
params: Data.Data[];
|
|
79
|
+
}
|
|
80
|
+
export declare function createStandardScripts(blueprint: PlutusBlueprint, onParameterize?: (event: ParameterizationEvent) => void): StandardScripts;
|
|
81
|
+
/** One derived-vs-deployed script hash comparison. */
|
|
82
|
+
export interface ScriptHashCheck {
|
|
83
|
+
/** Validator name, as it appears in the parameterization chain */
|
|
84
|
+
name: string;
|
|
85
|
+
/** Hash derived from the blueprint + deployment parameters */
|
|
86
|
+
derived: ScriptHash;
|
|
87
|
+
/** Hash recorded in DeploymentParams */
|
|
88
|
+
deployed: ScriptHash;
|
|
89
|
+
}
|
|
90
|
+
/** Thrown when a blueprint does not reproduce its deployment's script hashes. */
|
|
91
|
+
export declare class DeploymentMismatchError extends Error {
|
|
92
|
+
readonly mismatches: ScriptHashCheck[];
|
|
93
|
+
constructor(mismatches: ScriptHashCheck[], blueprintTitle: string);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Derive every parameterizable standard script hash from the blueprint and
|
|
97
|
+
* check it against DeploymentParams. Throws DeploymentMismatchError on any
|
|
98
|
+
* difference; returns the full check list on success.
|
|
99
|
+
*
|
|
100
|
+
* Why this exists: parameterization changes are not always visible to the
|
|
101
|
+
* compiler. Upstream has changed a parameter's *meaning* while keeping its
|
|
102
|
+
* arity and type (protocol_params_mint's `always_fail_hash` became
|
|
103
|
+
* `coordination_addr_hash` in 0.5.0-alpha.1), so a wrong value typechecks,
|
|
104
|
+
* builds, and only fails when the ledger rejects the transaction. This is the
|
|
105
|
+
* check that catches it, and it is why buildDeploymentScripts no longer
|
|
106
|
+
* overwrites derived hashes with deployment values.
|
|
107
|
+
*
|
|
108
|
+
* Not covered: always_fail (its nonce is not carried in DeploymentParams),
|
|
109
|
+
* issuance_mint (parameterized per minting logic), and upgrade_multisig (its
|
|
110
|
+
* signers/threshold are an authority choice, not a derived protocol value).
|
|
111
|
+
* coordination_spend IS covered — DeploymentParams carries its nonce precisely
|
|
112
|
+
* so the lock target can be re-derived rather than trusted.
|
|
113
|
+
*
|
|
114
|
+
* WHERE THIS CHECK HAS VALUE — and where it has none.
|
|
115
|
+
*
|
|
116
|
+
* It is only meaningful when the blueprint and the deployment come from
|
|
117
|
+
* INDEPENDENT sources, so that they can actually disagree: a deployment loaded
|
|
118
|
+
* from disk, a database, or the chain, checked against the blueprint currently
|
|
119
|
+
* bundled. That is the case it catches, and the failure it catches is real —
|
|
120
|
+
* this repo shipped a blueprint swapped in place under an unchanged directory
|
|
121
|
+
* name, with 4 of 8 validator hashes moved.
|
|
122
|
+
*
|
|
123
|
+
* It proves NOTHING at bootstrap time. A deployment script derives the hashes,
|
|
124
|
+
* populates DeploymentParams from those same values, and then asserts against
|
|
125
|
+
* them — a tautology that cannot fail. Do not read a passing assertion inside a
|
|
126
|
+
* bootstrap as evidence that the deployment is correct; assert on LOAD instead.
|
|
127
|
+
*/
|
|
128
|
+
export declare function assertDeploymentScripts(blueprint: PlutusBlueprint, deployment: DeploymentParams): ScriptHashCheck[];
|
|
34
129
|
/**
|
|
35
130
|
* Build resolved standard scripts from deployment params.
|
|
36
131
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
132
|
+
* Every derivable script hash is ASSERTED equal to its DeploymentParams value
|
|
133
|
+
* (see assertDeploymentScripts). Earlier versions silently overwrote the
|
|
134
|
+
* derived hash with the deployment's, which made a wrong parameterization
|
|
135
|
+
* undetectable until submission.
|
|
39
136
|
*/
|
|
40
137
|
export declare function buildDeploymentScripts(blueprint: PlutusBlueprint, deployment: DeploymentParams): ResolvedStandardScripts;
|
|
41
138
|
export interface ResolvedStandardScripts {
|
|
139
|
+
coordinationSpend: PlutusScript;
|
|
42
140
|
protocolParamsMint: PlutusScript;
|
|
43
|
-
programmableLogicGlobal: PlutusScript;
|
|
44
141
|
programmableLogicBase: PlutusScript;
|
|
142
|
+
/** PLG's transfer arm, renamed by #110. */
|
|
143
|
+
transfer: PlutusScript;
|
|
144
|
+
/** Seize / clawback. */
|
|
145
|
+
thirdParty: PlutusScript;
|
|
146
|
+
unfracking: PlutusScript;
|
|
45
147
|
issuanceCborHexMint: PlutusScript;
|
|
46
148
|
registryMint: PlutusScript;
|
|
47
149
|
registrySpend: PlutusScript;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../src/standard/scripts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../src/standard/scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,KAAK,EACV,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,OAAO,EACR,MAAM,aAAa,CAAC;AAarB,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAC3C,0FAA0F;IAC1F,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAClD,+EAA+E;IAC/E,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,UAAU,GAAG,YAAY,CAAC;IACjF,6DAA6D;IAC7D,qBAAqB,CAAC,YAAY,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC5D,2CAA2C;IAC3C,QAAQ,CAAC,YAAY,EAAE,QAAQ,GAAG,YAAY,CAAC;IAC/C,kDAAkD;IAClD,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,YAAY,CAAC;IACjD,UAAU,CAAC,YAAY,EAAE,QAAQ,GAAG,YAAY,CAAC;IACjD,eAAe,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;IAChF,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,GAAG,YAAY,CA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AAE,eAAe,EAC1B,UAAU,EAAE,gBAAgB,GAC3B,uBAAuB,CAmCzB;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,EAAE,YAAY,CAAC;IAChC,kBAAkB,EAAE,YAAY,CAAC;IACjC,qBAAqB,EAAE,YAAY,CAAC;IACpC,2CAA2C;IAC3C,QAAQ,EAAE,YAAY,CAAC;IACvB,wBAAwB;IACxB,UAAU,EAAE,YAAY,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;IACzB,mBAAmB,EAAE,YAAY,CAAC;IAClC,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,YAAY,CAAC;IAC5B,oEAAoE;IACpE,iBAAiB,CAAC,gBAAgB,EAAE,UAAU,GAAG,YAAY,CAAC;CAC/D"}
|
package/dist/standard/scripts.js
CHANGED
|
@@ -1,52 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Standard script parameterization.
|
|
2
|
+
* Standard script parameterization — CIP-113 0.5.0-alpha.2 (upstream 9db7e06).
|
|
3
3
|
*
|
|
4
|
-
* Replicates the parameterization chain from ProtocolScriptBuilderService.java.
|
|
5
4
|
* Uses Evolution SDK directly for UPLC.applyParamsToScript and ScriptHash.
|
|
6
5
|
*
|
|
7
|
-
* Dependency graph:
|
|
6
|
+
* Dependency graph. Note it is NO LONGER a single chain: upstream #110 removed
|
|
7
|
+
* programmable_logic_global, and PLB is now parameterised by the params-NFT
|
|
8
|
+
* policy rather than by PLG's credential, so everything downstream hangs off
|
|
9
|
+
* `params_policy` in parallel instead of in series.
|
|
8
10
|
*
|
|
9
|
-
* always_fail(nonce)
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
11
|
+
* always_fail(nonce) -> hash (issuance side only now)
|
|
12
|
+
* coordination_spend(nonce) -> hash NEW: the lock target
|
|
13
|
+
* protocol_params_mint(utxo_ref, coord_hash) -> policy == params_policy
|
|
14
|
+
* |
|
|
15
|
+
* +-- programmable_logic_base(params_policy) -> hash
|
|
16
|
+
* +-- transfer(params_policy) -> hash (PLG's transfer arm, renamed)
|
|
17
|
+
* +-- third_party(params_policy) -> hash NEW: seize / clawback
|
|
18
|
+
* +-- unfracking(params_policy) -> hash
|
|
19
|
+
* +-- registry_spend(params_policy) -> hash
|
|
20
|
+
*
|
|
21
|
+
* issuance_cbor_hex_mint(utxo_ref, always_fail_hash) -> policy
|
|
22
|
+
* registry_mint(utxo_ref, issuance_cbor_hex_cs, registry_spend_cred) -> policy
|
|
23
|
+
* issuance_mint(PLB_cred, registry_node_cs, minting_logic_cred, params_policy)
|
|
24
|
+
* upgrade_multisig(signers, threshold) -> hash (independent)
|
|
25
|
+
*
|
|
26
|
+
* ⚠ PARAMETER TYPES ARE NOT INTERCHANGEABLE and TypeScript cannot tell them
|
|
27
|
+
* apart — every one of these is a hex string at the call site. `params_policy`
|
|
28
|
+
* is a PolicyId (a bare ByteArray); `minting_logic_cred` and friends are
|
|
29
|
+
* Credentials (a constructor-wrapped Script/VerificationKey). Passing a policy
|
|
30
|
+
* where a credential belongs produces a valid script with the wrong hash. The
|
|
31
|
+
* types below come from the blueprint's own parameter schemas, not from
|
|
32
|
+
* upstream's prose docs — see the hazard note in blueprint.ts.
|
|
17
33
|
*/
|
|
18
34
|
import { Data } from "@evolution-sdk/evolution";
|
|
19
35
|
import { getValidatorCode, STANDARD_VALIDATORS } from "./blueprint.js";
|
|
20
|
-
import { parameterizeScript, outputReference, scriptCredential, } from "../core/evo-utils.js";
|
|
21
|
-
|
|
22
|
-
* Create standard script builders from a blueprint.
|
|
23
|
-
* Uses Evolution SDK directly for parameterization and hashing.
|
|
24
|
-
*/
|
|
25
|
-
export function createStandardScripts(blueprint) {
|
|
36
|
+
import { parameterizeScript, outputReference, scriptCredential, computeScriptHash, } from "../core/evo-utils.js";
|
|
37
|
+
export function createStandardScripts(blueprint, onParameterize) {
|
|
26
38
|
function parameterize(validatorTitle, params) {
|
|
27
39
|
const code = getValidatorCode(blueprint, validatorTitle);
|
|
40
|
+
if (onParameterize) {
|
|
41
|
+
onParameterize({ title: validatorTitle, rawScriptHash: computeScriptHash(code), params });
|
|
42
|
+
}
|
|
28
43
|
return parameterizeScript(code, params);
|
|
29
44
|
}
|
|
30
45
|
return {
|
|
31
46
|
alwaysFail(nonce) {
|
|
32
|
-
return parameterize(STANDARD_VALIDATORS.ALWAYS_FAIL, [
|
|
33
|
-
Data.bytearray(nonce),
|
|
34
|
-
]);
|
|
47
|
+
return parameterize(STANDARD_VALIDATORS.ALWAYS_FAIL, [Data.bytearray(nonce)]);
|
|
35
48
|
},
|
|
36
|
-
|
|
49
|
+
coordinationSpend(nonce) {
|
|
50
|
+
return parameterize(STANDARD_VALIDATORS.COORDINATION_SPEND, [Data.bytearray(nonce)]);
|
|
51
|
+
},
|
|
52
|
+
protocolParamsMint(utxoRef, coordinationHash) {
|
|
37
53
|
return parameterize(STANDARD_VALIDATORS.PROTOCOL_PARAMS_MINT, [
|
|
38
54
|
outputReference(utxoRef),
|
|
39
|
-
Data.bytearray(
|
|
55
|
+
Data.bytearray(coordinationHash),
|
|
40
56
|
]);
|
|
41
57
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
programmableLogicBase(paramsPolicy) {
|
|
59
|
+
// PolicyId — a bare ByteArray. It was scriptCredential(plgHash) before #110.
|
|
60
|
+
return parameterize(STANDARD_VALIDATORS.PROGRAMMABLE_LOGIC_BASE, [
|
|
61
|
+
Data.bytearray(paramsPolicy),
|
|
45
62
|
]);
|
|
46
63
|
},
|
|
47
|
-
|
|
48
|
-
return parameterize(STANDARD_VALIDATORS.
|
|
49
|
-
|
|
64
|
+
transfer(paramsPolicy) {
|
|
65
|
+
return parameterize(STANDARD_VALIDATORS.TRANSFER, [Data.bytearray(paramsPolicy)]);
|
|
66
|
+
},
|
|
67
|
+
thirdParty(paramsPolicy) {
|
|
68
|
+
return parameterize(STANDARD_VALIDATORS.THIRD_PARTY, [Data.bytearray(paramsPolicy)]);
|
|
69
|
+
},
|
|
70
|
+
unfracking(paramsPolicy) {
|
|
71
|
+
return parameterize(STANDARD_VALIDATORS.UNFRACKING, [Data.bytearray(paramsPolicy)]);
|
|
72
|
+
},
|
|
73
|
+
upgradeMultisig(signers, threshold) {
|
|
74
|
+
return parameterize(STANDARD_VALIDATORS.UPGRADE_MULTISIG, [
|
|
75
|
+
Data.list(signers.map((s) => Data.bytearray(s))),
|
|
76
|
+
Data.int(BigInt(threshold)),
|
|
50
77
|
]);
|
|
51
78
|
},
|
|
52
79
|
issuanceCborHexMint(utxoRef, alwaysFailHash) {
|
|
@@ -55,55 +82,155 @@ export function createStandardScripts(blueprint) {
|
|
|
55
82
|
Data.bytearray(alwaysFailHash),
|
|
56
83
|
]);
|
|
57
84
|
},
|
|
58
|
-
registryMint(utxoRef,
|
|
85
|
+
registryMint(utxoRef, issuanceCborHexPolicy, registrySpendHash) {
|
|
59
86
|
return parameterize(STANDARD_VALIDATORS.REGISTRY_MINT, [
|
|
60
87
|
outputReference(utxoRef),
|
|
61
|
-
Data.bytearray(
|
|
88
|
+
Data.bytearray(issuanceCborHexPolicy),
|
|
89
|
+
scriptCredential(registrySpendHash),
|
|
62
90
|
]);
|
|
63
91
|
},
|
|
64
|
-
registrySpend(
|
|
92
|
+
registrySpend(paramsPolicy) {
|
|
65
93
|
return parameterize(STANDARD_VALIDATORS.REGISTRY_SPEND, [
|
|
66
|
-
Data.bytearray(
|
|
94
|
+
Data.bytearray(paramsPolicy),
|
|
67
95
|
]);
|
|
68
96
|
},
|
|
69
|
-
issuanceMint(plbHash,
|
|
97
|
+
issuanceMint(plbHash, registryNodePolicy, mintingLogicHash, paramsPolicy) {
|
|
70
98
|
return parameterize(STANDARD_VALIDATORS.ISSUANCE_MINT, [
|
|
71
99
|
scriptCredential(plbHash),
|
|
72
|
-
Data.bytearray(
|
|
100
|
+
Data.bytearray(registryNodePolicy),
|
|
73
101
|
scriptCredential(mintingLogicHash),
|
|
102
|
+
Data.bytearray(paramsPolicy),
|
|
74
103
|
]);
|
|
75
104
|
},
|
|
76
105
|
};
|
|
77
106
|
}
|
|
107
|
+
/** Thrown when a blueprint does not reproduce its deployment's script hashes. */
|
|
108
|
+
export class DeploymentMismatchError extends Error {
|
|
109
|
+
mismatches;
|
|
110
|
+
constructor(mismatches, blueprintTitle) {
|
|
111
|
+
super(`Blueprint "${blueprintTitle}" does not reproduce this deployment. ` +
|
|
112
|
+
`${mismatches.length} script hash(es) differ:\n` +
|
|
113
|
+
mismatches
|
|
114
|
+
.map((m) => ` ${m.name}: derived ${m.derived}, deployment says ${m.deployed}`)
|
|
115
|
+
.join("\n") +
|
|
116
|
+
`\nThe blueprint and the DeploymentParams describe different protocol instances. ` +
|
|
117
|
+
`Transactions built from this pairing would be rejected at submission.`);
|
|
118
|
+
this.name = "DeploymentMismatchError";
|
|
119
|
+
this.mismatches = mismatches;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Derive every parameterizable standard script hash from the blueprint and
|
|
124
|
+
* check it against DeploymentParams. Throws DeploymentMismatchError on any
|
|
125
|
+
* difference; returns the full check list on success.
|
|
126
|
+
*
|
|
127
|
+
* Why this exists: parameterization changes are not always visible to the
|
|
128
|
+
* compiler. Upstream has changed a parameter's *meaning* while keeping its
|
|
129
|
+
* arity and type (protocol_params_mint's `always_fail_hash` became
|
|
130
|
+
* `coordination_addr_hash` in 0.5.0-alpha.1), so a wrong value typechecks,
|
|
131
|
+
* builds, and only fails when the ledger rejects the transaction. This is the
|
|
132
|
+
* check that catches it, and it is why buildDeploymentScripts no longer
|
|
133
|
+
* overwrites derived hashes with deployment values.
|
|
134
|
+
*
|
|
135
|
+
* Not covered: always_fail (its nonce is not carried in DeploymentParams),
|
|
136
|
+
* issuance_mint (parameterized per minting logic), and upgrade_multisig (its
|
|
137
|
+
* signers/threshold are an authority choice, not a derived protocol value).
|
|
138
|
+
* coordination_spend IS covered — DeploymentParams carries its nonce precisely
|
|
139
|
+
* so the lock target can be re-derived rather than trusted.
|
|
140
|
+
*
|
|
141
|
+
* WHERE THIS CHECK HAS VALUE — and where it has none.
|
|
142
|
+
*
|
|
143
|
+
* It is only meaningful when the blueprint and the deployment come from
|
|
144
|
+
* INDEPENDENT sources, so that they can actually disagree: a deployment loaded
|
|
145
|
+
* from disk, a database, or the chain, checked against the blueprint currently
|
|
146
|
+
* bundled. That is the case it catches, and the failure it catches is real —
|
|
147
|
+
* this repo shipped a blueprint swapped in place under an unchanged directory
|
|
148
|
+
* name, with 4 of 8 validator hashes moved.
|
|
149
|
+
*
|
|
150
|
+
* It proves NOTHING at bootstrap time. A deployment script derives the hashes,
|
|
151
|
+
* populates DeploymentParams from those same values, and then asserts against
|
|
152
|
+
* them — a tautology that cannot fail. Do not read a passing assertion inside a
|
|
153
|
+
* bootstrap as evidence that the deployment is correct; assert on LOAD instead.
|
|
154
|
+
*/
|
|
155
|
+
export function assertDeploymentScripts(blueprint, deployment) {
|
|
156
|
+
const builders = createStandardScripts(blueprint);
|
|
157
|
+
const checks = [
|
|
158
|
+
{
|
|
159
|
+
name: "coordination_spend",
|
|
160
|
+
derived: builders.coordinationSpend(deployment.coordinationNonce).hash,
|
|
161
|
+
deployed: deployment.coordination.scriptHash,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: "protocol_params_mint",
|
|
165
|
+
derived: builders.protocolParamsMint(deployment.protocolParams.txInput, deployment.protocolParams.coordinationScriptHash).hash,
|
|
166
|
+
deployed: deployment.protocolParams.policyId,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "programmable_logic_base",
|
|
170
|
+
derived: builders.programmableLogicBase(deployment.protocolParams.policyId).hash,
|
|
171
|
+
deployed: deployment.programmableLogicBase.scriptHash,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "transfer",
|
|
175
|
+
derived: builders.transfer(deployment.protocolParams.policyId).hash,
|
|
176
|
+
deployed: deployment.transfer.scriptHash,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "third_party",
|
|
180
|
+
derived: builders.thirdParty(deployment.protocolParams.policyId).hash,
|
|
181
|
+
deployed: deployment.thirdParty.scriptHash,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "unfracking",
|
|
185
|
+
derived: builders.unfracking(deployment.protocolParams.policyId).hash,
|
|
186
|
+
deployed: deployment.unfracking.scriptHash,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "issuance_cbor_hex_mint",
|
|
190
|
+
derived: builders.issuanceCborHexMint(deployment.issuance.txInput, deployment.issuance.alwaysFailScriptHash).hash,
|
|
191
|
+
deployed: deployment.issuance.policyId,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: "registry_spend",
|
|
195
|
+
derived: builders.registrySpend(deployment.protocolParams.policyId).hash,
|
|
196
|
+
deployed: deployment.directorySpend.scriptHash,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "registry_mint",
|
|
200
|
+
derived: builders.registryMint(deployment.directoryMint.txInput, deployment.issuance.policyId, deployment.directorySpend.scriptHash).hash,
|
|
201
|
+
deployed: deployment.directoryMint.scriptHash,
|
|
202
|
+
},
|
|
203
|
+
];
|
|
204
|
+
const mismatches = checks.filter((c) => c.derived !== c.deployed);
|
|
205
|
+
if (mismatches.length > 0) {
|
|
206
|
+
throw new DeploymentMismatchError(mismatches, blueprint.preamble.title);
|
|
207
|
+
}
|
|
208
|
+
return checks;
|
|
209
|
+
}
|
|
78
210
|
/**
|
|
79
211
|
* Build resolved standard scripts from deployment params.
|
|
80
212
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
213
|
+
* Every derivable script hash is ASSERTED equal to its DeploymentParams value
|
|
214
|
+
* (see assertDeploymentScripts). Earlier versions silently overwrote the
|
|
215
|
+
* derived hash with the deployment's, which made a wrong parameterization
|
|
216
|
+
* undetectable until submission.
|
|
83
217
|
*/
|
|
84
218
|
export function buildDeploymentScripts(blueprint, deployment) {
|
|
219
|
+
assertDeploymentScripts(blueprint, deployment);
|
|
85
220
|
const builders = createStandardScripts(blueprint);
|
|
86
|
-
const
|
|
87
|
-
protocolParamsMint.hash = deployment.protocolParams.policyId;
|
|
88
|
-
const programmableLogicGlobal = builders.programmableLogicGlobal(deployment.protocolParams.policyId);
|
|
89
|
-
programmableLogicGlobal.hash = deployment.programmableLogicGlobal.scriptHash;
|
|
90
|
-
const programmableLogicBase = builders.programmableLogicBase(deployment.programmableLogicGlobal.scriptHash);
|
|
91
|
-
programmableLogicBase.hash = deployment.programmableLogicBase.scriptHash;
|
|
92
|
-
const issuanceCborHexMint = builders.issuanceCborHexMint(deployment.issuance.txInput, deployment.issuance.alwaysFailScriptHash);
|
|
93
|
-
issuanceCborHexMint.hash = deployment.issuance.policyId;
|
|
94
|
-
const registryMint = builders.registryMint(deployment.directoryMint.txInput, deployment.issuance.policyId);
|
|
95
|
-
registryMint.hash = deployment.directoryMint.scriptHash;
|
|
96
|
-
const registrySpend = builders.registrySpend(deployment.protocolParams.policyId);
|
|
97
|
-
registrySpend.hash = deployment.directorySpend.scriptHash;
|
|
221
|
+
const paramsPolicy = deployment.protocolParams.policyId;
|
|
98
222
|
return {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
programmableLogicBase,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
223
|
+
coordinationSpend: builders.coordinationSpend(deployment.coordinationNonce),
|
|
224
|
+
protocolParamsMint: builders.protocolParamsMint(deployment.protocolParams.txInput, deployment.protocolParams.coordinationScriptHash),
|
|
225
|
+
programmableLogicBase: builders.programmableLogicBase(paramsPolicy),
|
|
226
|
+
transfer: builders.transfer(paramsPolicy),
|
|
227
|
+
thirdParty: builders.thirdParty(paramsPolicy),
|
|
228
|
+
unfracking: builders.unfracking(paramsPolicy),
|
|
229
|
+
issuanceCborHexMint: builders.issuanceCborHexMint(deployment.issuance.txInput, deployment.issuance.alwaysFailScriptHash),
|
|
230
|
+
registryMint: builders.registryMint(deployment.directoryMint.txInput, deployment.issuance.policyId, deployment.directorySpend.scriptHash),
|
|
231
|
+
registrySpend: builders.registrySpend(paramsPolicy),
|
|
105
232
|
buildIssuanceMint(mintingLogicHash) {
|
|
106
|
-
return builders.issuanceMint(deployment.programmableLogicBase.scriptHash, deployment.directoryMint.scriptHash, mintingLogicHash);
|
|
233
|
+
return builders.issuanceMint(deployment.programmableLogicBase.scriptHash, deployment.directoryMint.scriptHash, mintingLogicHash, paramsPolicy);
|
|
107
234
|
},
|
|
108
235
|
};
|
|
109
236
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/standard/scripts.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scripts.js","sourceRoot":"","sources":["../../src/standard/scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAUhD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AA6D9B,MAAM,UAAU,qBAAqB,CACnC,SAA0B,EAC1B,cAAuD;IAEvD,SAAS,YAAY,CAAC,cAAsB,EAAE,MAAmB;QAC/D,MAAM,IAAI,GAAG,gBAAgB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACzD,IAAI,cAAc,EAAE,CAAC;YACnB,cAAc,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,OAAO,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C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C;QACnD,iBAAiB,CAAC,gBAA4B;YAC5C,OAAO,QAAQ,CAAC,YAAY,CAC1B,UAAU,CAAC,qBAAqB,CAAC,UAAU,EAC3C,UAAU,CAAC,aAAa,CAAC,UAAU,EACnC,gBAAgB,EAChB,YAAY,CACb,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/substandards/dummy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/substandards/dummy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EACV,iBAAiB,EASlB,MAAM,iBAAiB,CAAC;AA8CzB,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,SAAS,EAAE,eAAe,CAAC;CAC5B,GAAG,iBAAiB,CA+oBpB"}
|