@bsv/dpp-core 0.3.0-beta.7 → 0.3.0-beta.8
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 +6 -5
- package/dist/acceptance.d.ts +2 -2
- package/dist/acceptance.d.ts.map +1 -1
- package/dist/acceptance.js.map +1 -1
- package/dist/carrier.d.ts +27 -0
- package/dist/carrier.d.ts.map +1 -0
- package/dist/carrier.js +39 -0
- package/dist/carrier.js.map +1 -0
- package/dist/codec.d.ts +57 -22
- package/dist/codec.d.ts.map +1 -1
- package/dist/codec.js +154 -21
- package/dist/codec.js.map +1 -1
- package/dist/constants.d.ts +15 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +33 -1
- package/dist/constants.js.map +1 -1
- package/dist/did.d.ts +7 -2
- package/dist/did.d.ts.map +1 -1
- package/dist/did.js +2 -2
- package/dist/did.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.d.ts.map +1 -1
- package/dist/evidence.js +10 -2
- package/dist/evidence.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/signatures.d.ts +10 -2
- package/dist/signatures.d.ts.map +1 -1
- package/dist/signatures.js +25 -7
- package/dist/signatures.js.map +1 -1
- package/dist/transition.d.ts +4 -1
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +18 -9
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +32 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/verifyChain.d.ts +5 -1
- package/dist/verifyChain.d.ts.map +1 -1
- package/dist/verifyChain.js +12 -6
- package/dist/verifyChain.js.map +1 -1
- package/package.json +1 -1
- package/schemas/verification-report.schema.json +3 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Experimental prerelease:** For implementation and interoperability testing. APIs may change significantly before a stable release. Pin exact package versions and retain your lockfile. This package is not declared production-ready. Package versions are separate from the specification, wire-format and frozen profile versions they implement.
|
|
4
4
|
|
|
5
|
-
The DPP standard's reference implementation for record versions 1 and
|
|
5
|
+
The DPP standard's reference implementation for record versions 1, 2 and 3, the
|
|
6
6
|
attestation rail and the verification report, and the only place in this
|
|
7
7
|
repository the standard's rules are implemented. Everything else in the
|
|
8
8
|
reference implementation imports it: the overlay topic manager admits outputs
|
|
@@ -21,7 +21,7 @@ rather than rewritten.
|
|
|
21
21
|
This is a pre-1.0 candidate. Install the exact published versions from npm:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
24
|
-
npm install --save-exact @bsv/dpp-core@0.3.0-beta.
|
|
24
|
+
npm install --save-exact @bsv/dpp-core@0.3.0-beta.8 @bsv/sdk@2.8.10
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
Node >=22 and ECMAScript modules are supported. Browser use of the runtime is untested. No source checkout or build of this package is needed after installation.
|
|
@@ -56,9 +56,10 @@ specifier anything needs:
|
|
|
56
56
|
|
|
57
57
|
| Module | What it owns |
|
|
58
58
|
|---|---|
|
|
59
|
-
| `codec.ts` | The 14-field version 1 layout and the 17-field version 2 layout, selected by field count: encode and decode per `spec/record-model.md` §3 and `spec/record-model-v2.md` §3 |
|
|
60
|
-
| `signatures.ts` | The canonical signature preimages: unframed for version 1 (§5), framed and domain-tagged for version 2 (`record-model-v2.md` §5) |
|
|
61
|
-
| `transition.ts` | Which operation may change what, state by state, for
|
|
59
|
+
| `codec.ts` | The 14-field version 1 layout and the 17-field version 2 layout, selected by field count: encode and decode per `spec/record-model.md` §3 and `spec/record-model-v2.md` §3; and the version 3 token prefix of `spec/token-carrier.md` §2 and §3, read and built with the body: `parseDppOutput` returns the `carrier` of a carried state beside the state and the locking key, and `buildLockingScript` derives the prefix from the state or takes one as its optional third argument |
|
|
60
|
+
| `signatures.ts` | The canonical signature preimages: unframed for version 1 (§5), framed and domain-tagged for version 2 (`record-model-v2.md` §5), the same framing under the version 3 tags and `[1, 'dpp token v3']` for a carried state (`token-carrier.md` §4) |
|
|
61
|
+
| `transition.ts` | Which operation may change what, state by state, for every version: the version 2 control proof, the terminal `RETIRE`, the single upgrade transition, and for version 3 a carried state behind a carried state only |
|
|
62
|
+
| `carrier.ts` | The carrier invariants of `spec/token-carrier.md` §6 that need the transaction and the lineage: `checkCarrier` holds the prefix's role to the state's position and its token id to the lineage genesis, and `tokenIdOf` gives a lineage's token id in display form, `<deploy txid>_0` |
|
|
62
63
|
| `owner.ts` | The owner and controller key, the linkage scalar, the owner-signed transfer of version 1 and the control proof of version 2 |
|
|
63
64
|
| `acceptance.ts` | The managed acceptance record `dpp-managed-acceptance@1` (`spec/managed-custody.md` §3): inspect, sign, commit and bind to the `TRANSFER` |
|
|
64
65
|
| `verifyChain.ts` | Chain verification from genesis, including SPV inclusion; `inspectChain` is the same loop reported finding by finding |
|
package/dist/acceptance.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MANAGED_CUSTODY_PROFILE } from './constants.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Outpoint, SeventeenFieldState } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The managed acceptance record (`spec/managed-custody.md` §3): the evidence a
|
|
5
5
|
* custodian retains that the current holder offered a transfer and the
|
|
@@ -94,7 +94,7 @@ export declare function inspectManagedAcceptance(value: unknown, options?: {
|
|
|
94
94
|
* destination the recipient accepted, the holder who offered as the actor,
|
|
95
95
|
* and the record's own commitment in field 15. Every mismatch is named.
|
|
96
96
|
*/
|
|
97
|
-
export declare function bindAcceptanceToState(record: ManagedAcceptanceRecord, state:
|
|
97
|
+
export declare function bindAcceptanceToState(record: ManagedAcceptanceRecord, state: SeventeenFieldState): AcceptanceFailure[];
|
|
98
98
|
/** Sign a claim as the custodian. The signer's key must be `claim.custodian`; the result is checked before it is returned. */
|
|
99
99
|
export declare function signManagedAcceptance(claim: ManagedAcceptanceClaim, signer: AcceptanceSigner): Promise<ManagedAcceptanceRecord>;
|
|
100
100
|
//# sourceMappingURL=acceptance.d.ts.map
|
package/dist/acceptance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"acceptance.d.ts","sourceRoot":"","sources":["../src/acceptance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,yBAAyB,EAAG,0BAAmC,CAAA;AAC5E,OAAO,EAAE,uBAAuB,EAAE,CAAA;AAElC,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,iBAAiB,CAAA;AAE7D,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,EAAE,OAAO,yBAAyB,CAAA;IAClD,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,cAAc,EAAE,QAAQ,CAAA;IACxB,gFAAgF;IAChF,mBAAmB,EAAE,QAAQ,CAAA;IAC7B,kLAAkL;IAClL,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE;QACL,wFAAwF;QACxF,iBAAiB,EAAE,MAAM,CAAA;QACzB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,MAAM,CAAA;QACjB,SAAS,EAAE,cAAc,CAAA;QACzB,mJAAmJ;QACnJ,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,CAAA;IACD,UAAU,EAAE;QACV,8EAA8E;QAC9E,oBAAoB,EAAE,MAAM,CAAA;QAC5B,iFAAiF;QACjF,cAAc,EAAE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CAAC,CAAA;IACpH,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,IAAI,CAAC,4DAA4D,CAAC,CAAA;IACxI,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,8HAA8H;AAC9H,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,KAA6B,EAAE,MAAwB;IACjG,MAAM,QAAQ,GAAwB,EAAE,CAAA;IACxC,+GAA+G;IAC/G,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACtG,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAA;IAC/D,MAAM,MAAM,GAA4B,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAA;IACjF,MAAM,UAAU,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAA;IACnD,IAAI,UAAU,CAAC,cAAc,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;IACtH,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CarrierPrefix, Outpoint } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The carrier invariants (`spec/token-carrier.md` §6) that need the
|
|
4
|
+
* transaction and the lineage rather than the body alone: which role the
|
|
5
|
+
* prefix claims against which position the state holds, and which token the
|
|
6
|
+
* prefix names against the lineage's genesis. The codec has already held the
|
|
7
|
+
* prefix to its shape (the 32-byte id, the one-unit amount, no payload); the
|
|
8
|
+
* body rules run after these, under `checkTransition`. Returns null when the
|
|
9
|
+
* state passes, otherwise the reason; the fixtures pin these strings.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CARRIER_REFUSALS: {
|
|
12
|
+
readonly genesisNotAtOutputZero: 'a genesis is a deploy at output 0';
|
|
13
|
+
readonly genesisCarriesTokenId: 'a genesis carries an empty token id';
|
|
14
|
+
readonly stateNotValue: 'a state after genesis carries the lineage token id';
|
|
15
|
+
readonly tokenIdMismatch: 'the token id names the lineage genesis';
|
|
16
|
+
readonly genesisUnknown: 'the token id cannot be checked without the chain genesis';
|
|
17
|
+
};
|
|
18
|
+
/** Where a carried state sits: whether it is the genesis, which output it is, and the lineage genesis when known. */
|
|
19
|
+
export interface CarrierPosition {
|
|
20
|
+
genesis: boolean;
|
|
21
|
+
outputIndex: number;
|
|
22
|
+
lineageGenesis?: Outpoint;
|
|
23
|
+
}
|
|
24
|
+
export declare function checkCarrier(carrier: CarrierPrefix, position: CarrierPosition): string | null;
|
|
25
|
+
/** The display form of a lineage's token id: the deploy txid and the implied index (`spec/token-carrier.md` §3). */
|
|
26
|
+
export declare function tokenIdOf(lineageGenesis: Outpoint): string;
|
|
27
|
+
//# sourceMappingURL=carrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.d.ts","sourceRoot":"","sources":["../src/carrier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEzD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;aAC3B,sBAAsB,EAAE,mCAAmC;aAC3D,qBAAqB,EAAE,qCAAqC;aAC5D,aAAa,EAAE,oDAAoD;aACnE,eAAe,EAAE,wCAAwC;aACzD,cAAc,EAAE,0DAA0D;CAClE,CAAA;AAEV,qHAAqH;AACrH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,QAAQ,CAAA;CAC1B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAY7F;AAED,oHAAoH;AACpH,wBAAgB,SAAS,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,CAE1D"}
|
package/dist/carrier.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CARRIER_DEPLOY_OUTPUT_INDEX } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* The carrier invariants (`spec/token-carrier.md` §6) that need the
|
|
4
|
+
* transaction and the lineage rather than the body alone: which role the
|
|
5
|
+
* prefix claims against which position the state holds, and which token the
|
|
6
|
+
* prefix names against the lineage's genesis. The codec has already held the
|
|
7
|
+
* prefix to its shape (the 32-byte id, the one-unit amount, no payload); the
|
|
8
|
+
* body rules run after these, under `checkTransition`. Returns null when the
|
|
9
|
+
* state passes, otherwise the reason; the fixtures pin these strings.
|
|
10
|
+
*/
|
|
11
|
+
export const CARRIER_REFUSALS = {
|
|
12
|
+
genesisNotAtOutputZero: 'a genesis is a deploy at output 0',
|
|
13
|
+
genesisCarriesTokenId: 'a genesis carries an empty token id',
|
|
14
|
+
stateNotValue: 'a state after genesis carries the lineage token id',
|
|
15
|
+
tokenIdMismatch: 'the token id names the lineage genesis',
|
|
16
|
+
genesisUnknown: 'the token id cannot be checked without the chain genesis',
|
|
17
|
+
};
|
|
18
|
+
export function checkCarrier(carrier, position) {
|
|
19
|
+
if (position.genesis) {
|
|
20
|
+
if (carrier.role !== 'deploy')
|
|
21
|
+
return CARRIER_REFUSALS.genesisCarriesTokenId;
|
|
22
|
+
if (position.outputIndex !== CARRIER_DEPLOY_OUTPUT_INDEX)
|
|
23
|
+
return CARRIER_REFUSALS.genesisNotAtOutputZero;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
if (carrier.role !== 'value' || carrier.tokenId == null)
|
|
27
|
+
return CARRIER_REFUSALS.stateNotValue;
|
|
28
|
+
if (position.lineageGenesis == null)
|
|
29
|
+
return CARRIER_REFUSALS.genesisUnknown;
|
|
30
|
+
if (position.lineageGenesis.outputIndex !== CARRIER_DEPLOY_OUTPUT_INDEX || carrier.tokenId !== position.lineageGenesis.txid) {
|
|
31
|
+
return CARRIER_REFUSALS.tokenIdMismatch;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
/** The display form of a lineage's token id: the deploy txid and the implied index (`spec/token-carrier.md` §3). */
|
|
36
|
+
export function tokenIdOf(lineageGenesis) {
|
|
37
|
+
return `${lineageGenesis.txid}_${CARRIER_DEPLOY_OUTPUT_INDEX}`;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=carrier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carrier.js","sourceRoot":"","sources":["../src/carrier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAA;AAG5D;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,sBAAsB,EAAE,mCAAmC;IAC3D,qBAAqB,EAAE,qCAAqC;IAC5D,aAAa,EAAE,oDAAoD;IACnE,eAAe,EAAE,wCAAwC;IACzD,cAAc,EAAE,0DAA0D;CAClE,CAAA;AASV,MAAM,UAAU,YAAY,CAAC,OAAsB,EAAE,QAAyB;IAC5E,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,gBAAgB,CAAC,qBAAqB,CAAA;QAC5E,IAAI,QAAQ,CAAC,WAAW,KAAK,2BAA2B;YAAE,OAAO,gBAAgB,CAAC,sBAAsB,CAAA;QACxG,OAAO,IAAI,CAAA;IACb,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,IAAI;QAAE,OAAO,gBAAgB,CAAC,aAAa,CAAA;IAC9F,IAAI,QAAQ,CAAC,cAAc,IAAI,IAAI;QAAE,OAAO,gBAAgB,CAAC,cAAc,CAAA;IAC3E,IAAI,QAAQ,CAAC,cAAc,CAAC,WAAW,KAAK,2BAA2B,IAAI,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC5H,OAAO,gBAAgB,CAAC,eAAe,CAAA;IACzC,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,SAAS,CAAC,cAAwB;IAChD,OAAO,GAAG,cAAc,CAAC,IAAI,IAAI,2BAA2B,EAAE,CAAA;AAChE,CAAC"}
|
package/dist/codec.d.ts
CHANGED
|
@@ -1,45 +1,80 @@
|
|
|
1
|
-
import { LockingScript, PublicKey } from '@bsv/sdk';
|
|
2
|
-
import type { DppState, DppStateData, DppStateDataV2, DppStateV1, DppStateV2, Outpoint } from './types.js';
|
|
1
|
+
import { LockingScript, PublicKey, type ScriptChunk } from '@bsv/sdk';
|
|
2
|
+
import type { CarrierPrefix, DppState, DppStateData, DppStateDataV2, DppStateDataV3, DppStateV1, DppStateV2, DppStateV3, Outpoint, SeventeenFieldData } from './types.js';
|
|
3
3
|
/** Thrown when a script does not carry a well-formed DPP output of a version this reader decodes. */
|
|
4
4
|
export declare class DppFormatError extends Error {
|
|
5
5
|
constructor(message: string);
|
|
6
6
|
}
|
|
7
|
-
/** Whether signable content, of
|
|
7
|
+
/** Whether signable content, of any version, is version 2. */
|
|
8
8
|
export declare function isV2Data(d: object): d is DppStateDataV2;
|
|
9
|
+
/** Whether signable content, of any version, is version 3: the carried body (`spec/token-carrier.md`). */
|
|
10
|
+
export declare function isV3Data(d: object): d is DppStateDataV3;
|
|
11
|
+
/** Whether signable content carries the seventeen-field layout, under version 2 or version 3. */
|
|
12
|
+
export declare function isSeventeenFieldData(d: object): d is SeventeenFieldData;
|
|
9
13
|
/** Fields 1–12 (the signable content) of a version 1 state as raw wire bytes, in standard order. */
|
|
10
14
|
export declare function dataFields(d: DppStateData): number[][];
|
|
11
15
|
/** An outpoint as the version 2 fields 12 and 13 carry it: 32 txid bytes in display order, then a big-endian uint32 index. */
|
|
12
16
|
export declare function outpointFieldBytes(outpoint: Outpoint | null): number[];
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Fields 1–15 (the signable content) of a seventeen-field state as raw wire
|
|
19
|
+
* bytes, in standard order. The version string is the data's own: `2` for a
|
|
20
|
+
* version 2 state, `3` for a carried version 3 body (`spec/token-carrier.md` §4).
|
|
21
|
+
*/
|
|
22
|
+
export declare function dataFieldsV2(d: SeventeenFieldData): number[][];
|
|
23
|
+
/** All fields of a state as raw wire bytes: 14 for version 1, 17 for versions 2 and 3. */
|
|
16
24
|
export declare function stateToFields(s: DppState): number[][];
|
|
25
|
+
/** The 32 token id bytes a value output pushes: the deploy txid in internal byte order (`spec/token-carrier.md` §3). */
|
|
26
|
+
export declare function tokenIdWireBytes(deployTxid: string): number[];
|
|
27
|
+
/** The display form of a token id read from the wire: the deploy txid in display order. */
|
|
28
|
+
export declare function tokenIdFromWireBytes(bytes: readonly number[]): string;
|
|
29
|
+
/**
|
|
30
|
+
* The token prefix of a carried state (`spec/token-carrier.md` §2, §3): the
|
|
31
|
+
* token id or OP_0, the amount of one unit as OP_1, and OP_2DROP. No payload
|
|
32
|
+
* is written; the body's first chunk is a 33-byte push followed by
|
|
33
|
+
* OP_CHECKSIG, which the prefix's encoder rule says can never be read as one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function carrierPrefixChunks(carrier: CarrierPrefix): ScriptChunk[];
|
|
36
|
+
/**
|
|
37
|
+
* The prefix a version 3 state is carried behind, read from the state itself:
|
|
38
|
+
* a genesis (no predecessor) is the deploy; every later state is a value
|
|
39
|
+
* output naming the lineage genesis as its token id, which the verifier holds
|
|
40
|
+
* field 12 to (`spec/token-carrier.md` §5). The genesis outpoint's index is 0
|
|
41
|
+
* because a deploy is output 0 of its transaction; a state naming another
|
|
42
|
+
* index cannot be carried, and the builder says so rather than guessing.
|
|
43
|
+
*/
|
|
44
|
+
export declare function carrierPrefixFor(state: Pick<DppStateDataV3, 'previousTxid' | 'lineageGenesis'>): CarrierPrefix;
|
|
17
45
|
/**
|
|
18
46
|
* Build the DPP locking script: <33-byte key> OP_CHECKSIG <fields> drops.
|
|
19
47
|
* Custody-neutral (`spec/record-model.md` §2): the locking key may be treasury-derived or user-held.
|
|
20
48
|
* The drop tail is one OP_2DROP per pair of fields and one OP_DROP for an odd
|
|
21
|
-
* field left over: seven OP_2DROP for version 1, eight and an OP_DROP for
|
|
49
|
+
* field left over: seven OP_2DROP for version 1, eight and an OP_DROP for
|
|
50
|
+
* versions 2 and 3. A version 3 body is carried behind its token prefix
|
|
51
|
+
* (`spec/token-carrier.md` §2), derived from the state unless `carrier`
|
|
52
|
+
* names one, which a fixture does to pin what a reader refuses.
|
|
22
53
|
*/
|
|
23
|
-
export declare function buildLockingScript(state: DppState, lockingPublicKey: PublicKey | string): LockingScript;
|
|
54
|
+
export declare function buildLockingScript(state: DppState, lockingPublicKey: PublicKey | string, carrier?: CarrierPrefix): LockingScript;
|
|
24
55
|
/** Validate and type raw version 1 fields per `spec/record-model.md` §2-§3. Throws DppFormatError. */
|
|
25
56
|
export declare function fieldsToState(fields: number[][]): DppStateV1;
|
|
26
57
|
/** Validate and type raw version 2 fields per `spec/record-model-v2.md` §2-§3. Throws DppFormatError. */
|
|
27
58
|
export declare function fieldsToStateV2(fields: number[][]): DppStateV2;
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
* field must agree with the count, and any other count or version is refused by
|
|
33
|
-
* name so an older reader meeting a newer state fails clearly rather than
|
|
34
|
-
* guessing.
|
|
35
|
-
*/
|
|
36
|
-
export declare function parseDppOutput(script: LockingScript): {
|
|
59
|
+
/** Validate and type the raw fields of a carried version 3 body per `spec/token-carrier.md` §4. Throws DppFormatError. */
|
|
60
|
+
export declare function fieldsToStateV3(fields: number[][]): DppStateV3;
|
|
61
|
+
/** What a parsed output yields: the state, the locking key, and the token prefix when the state is carried. */
|
|
62
|
+
export interface ParsedDppOutput {
|
|
37
63
|
state: DppState;
|
|
38
64
|
lockingPublicKey: PublicKey;
|
|
39
|
-
|
|
65
|
+
/** Present for a version 3 state, which is always carried; absent for versions 1 and 2, which never are. */
|
|
66
|
+
carrier?: CarrierPrefix;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Parse a DPP output script of any version. Throws DppFormatError when the
|
|
70
|
+
* script is not a well-formed DPP output. A bare body is read by field count
|
|
71
|
+
* (fourteen fields for version 1, seventeen for version 2) and the version
|
|
72
|
+
* field must agree with the count. A body behind a token prefix is version 3,
|
|
73
|
+
* read under the version 2 rules with the version 3 string; a version 2 body
|
|
74
|
+
* behind a prefix and a version 3 body without one are refused by name, so an
|
|
75
|
+
* older reader meeting a newer state fails clearly rather than guessing.
|
|
76
|
+
*/
|
|
77
|
+
export declare function parseDppOutput(script: LockingScript): ParsedDppOutput;
|
|
40
78
|
/** Non-throwing variant of parseDppOutput, for scanning arbitrary outputs. */
|
|
41
|
-
export declare function tryParseDppOutput(script: LockingScript):
|
|
42
|
-
state: DppState;
|
|
43
|
-
lockingPublicKey: PublicKey;
|
|
44
|
-
} | null;
|
|
79
|
+
export declare function tryParseDppOutput(script: LockingScript): ParsedDppOutput | null;
|
|
45
80
|
//# sourceMappingURL=codec.d.ts.map
|
package/dist/codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"codec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ENT_OPS, OUTPOINT_FIELD_BYTES, PROTOCOL_MARKER, STANDARD_VERSION, STANDARD_VERSION_V2, } from './constants.js';
|
|
2
|
+
import { CARRIER_AMOUNT, CARRIER_TOKEN_ID_BYTES, DPP_OPS, DPP_OPS_V2, FIELD_COUNT, FIELD_COUNT_V2, MAX_ACTOR_KEY_ID_BYTES, MAX_EVENT_DATA_BYTES_V2, MAX_PASSPORT_ID_BYTES, MAX_PAYLOAD_PUBLIC_BYTES_V2, NO_EVENT_OPS, OUTPOINT_FIELD_BYTES, PROTOCOL_MARKER, STANDARD_VERSION, STANDARD_VERSION_V2, STANDARD_VERSION_V3, } from './constants.js';
|
|
3
3
|
/** Thrown when a script does not carry a well-formed DPP output of a version this reader decodes. */
|
|
4
4
|
export class DppFormatError extends Error {
|
|
5
5
|
constructor(message) {
|
|
@@ -48,10 +48,18 @@ function chunkToField(chunk) {
|
|
|
48
48
|
return [0x81];
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
|
-
/** Whether signable content, of
|
|
51
|
+
/** Whether signable content, of any version, is version 2. */
|
|
52
52
|
export function isV2Data(d) {
|
|
53
53
|
return d.version === STANDARD_VERSION_V2;
|
|
54
54
|
}
|
|
55
|
+
/** Whether signable content, of any version, is version 3: the carried body (`spec/token-carrier.md`). */
|
|
56
|
+
export function isV3Data(d) {
|
|
57
|
+
return d.version === STANDARD_VERSION_V3;
|
|
58
|
+
}
|
|
59
|
+
/** Whether signable content carries the seventeen-field layout, under version 2 or version 3. */
|
|
60
|
+
export function isSeventeenFieldData(d) {
|
|
61
|
+
return isV2Data(d) || isV3Data(d);
|
|
62
|
+
}
|
|
55
63
|
/** Fields 1–12 (the signable content) of a version 1 state as raw wire bytes, in standard order. */
|
|
56
64
|
export function dataFields(d) {
|
|
57
65
|
return [
|
|
@@ -82,12 +90,16 @@ export function outpointFieldBytes(outpoint) {
|
|
|
82
90
|
}
|
|
83
91
|
return [...txid, (index >>> 24) & 0xff, (index >>> 16) & 0xff, (index >>> 8) & 0xff, index & 0xff];
|
|
84
92
|
}
|
|
85
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Fields 1–15 (the signable content) of a seventeen-field state as raw wire
|
|
95
|
+
* bytes, in standard order. The version string is the data's own: `2` for a
|
|
96
|
+
* version 2 state, `3` for a carried version 3 body (`spec/token-carrier.md` §4).
|
|
97
|
+
*/
|
|
86
98
|
export function dataFieldsV2(d) {
|
|
87
99
|
const predecessor = d.previousTxid === '' ? null : { txid: d.previousTxid, outputIndex: d.previousOutputIndex ?? -1 };
|
|
88
100
|
return [
|
|
89
101
|
Utils.toArray(PROTOCOL_MARKER, 'utf8'),
|
|
90
|
-
Utils.toArray(
|
|
102
|
+
Utils.toArray(d.version, 'utf8'),
|
|
91
103
|
Utils.toArray(d.passportId, 'utf8'),
|
|
92
104
|
Utils.toArray(d.op, 'utf8'),
|
|
93
105
|
Utils.toArray(d.timestamp, 'utf8'),
|
|
@@ -103,24 +115,71 @@ export function dataFieldsV2(d) {
|
|
|
103
115
|
Utils.toArray(d.authorisationCommitment, 'hex'),
|
|
104
116
|
];
|
|
105
117
|
}
|
|
106
|
-
/** All fields of a state as raw wire bytes: 14 for version 1, 17 for
|
|
118
|
+
/** All fields of a state as raw wire bytes: 14 for version 1, 17 for versions 2 and 3. */
|
|
107
119
|
export function stateToFields(s) {
|
|
108
|
-
const data = s.version ===
|
|
120
|
+
const data = s.version === STANDARD_VERSION ? dataFields(s) : dataFieldsV2(s);
|
|
109
121
|
return [...data, [...s.userSignature], [...s.serverSignature]];
|
|
110
122
|
}
|
|
123
|
+
/** The 32 token id bytes a value output pushes: the deploy txid in internal byte order (`spec/token-carrier.md` §3). */
|
|
124
|
+
export function tokenIdWireBytes(deployTxid) {
|
|
125
|
+
const bytes = Utils.toArray(deployTxid, 'hex');
|
|
126
|
+
if (bytes.length !== CARRIER_TOKEN_ID_BYTES)
|
|
127
|
+
throw new DppFormatError('a token id is the 32-byte deploy txid');
|
|
128
|
+
return bytes.reverse();
|
|
129
|
+
}
|
|
130
|
+
/** The display form of a token id read from the wire: the deploy txid in display order. */
|
|
131
|
+
export function tokenIdFromWireBytes(bytes) {
|
|
132
|
+
if (bytes.length !== CARRIER_TOKEN_ID_BYTES)
|
|
133
|
+
throw new DppFormatError('a token id is the 32-byte deploy txid');
|
|
134
|
+
return Utils.toHex([...bytes].reverse());
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* The token prefix of a carried state (`spec/token-carrier.md` §2, §3): the
|
|
138
|
+
* token id or OP_0, the amount of one unit as OP_1, and OP_2DROP. No payload
|
|
139
|
+
* is written; the body's first chunk is a 33-byte push followed by
|
|
140
|
+
* OP_CHECKSIG, which the prefix's encoder rule says can never be read as one.
|
|
141
|
+
*/
|
|
142
|
+
export function carrierPrefixChunks(carrier) {
|
|
143
|
+
const id = carrier.role === 'deploy' || carrier.tokenId == null
|
|
144
|
+
? { op: 0 }
|
|
145
|
+
: { op: CARRIER_TOKEN_ID_BYTES, data: tokenIdWireBytes(carrier.tokenId) };
|
|
146
|
+
return [id, { op: 0x50 + CARRIER_AMOUNT }, { op: OP.OP_2DROP }];
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* The prefix a version 3 state is carried behind, read from the state itself:
|
|
150
|
+
* a genesis (no predecessor) is the deploy; every later state is a value
|
|
151
|
+
* output naming the lineage genesis as its token id, which the verifier holds
|
|
152
|
+
* field 12 to (`spec/token-carrier.md` §5). The genesis outpoint's index is 0
|
|
153
|
+
* because a deploy is output 0 of its transaction; a state naming another
|
|
154
|
+
* index cannot be carried, and the builder says so rather than guessing.
|
|
155
|
+
*/
|
|
156
|
+
export function carrierPrefixFor(state) {
|
|
157
|
+
if (state.previousTxid === '')
|
|
158
|
+
return { role: 'deploy', tokenId: null };
|
|
159
|
+
if (state.lineageGenesis == null)
|
|
160
|
+
throw new DppFormatError('a carried state after the genesis names its lineage genesis');
|
|
161
|
+
if (state.lineageGenesis.outputIndex !== 0)
|
|
162
|
+
throw new DppFormatError('a carried lineage begins at output 0 of its deploy');
|
|
163
|
+
return { role: 'value', tokenId: state.lineageGenesis.txid };
|
|
164
|
+
}
|
|
111
165
|
/**
|
|
112
166
|
* Build the DPP locking script: <33-byte key> OP_CHECKSIG <fields> drops.
|
|
113
167
|
* Custody-neutral (`spec/record-model.md` §2): the locking key may be treasury-derived or user-held.
|
|
114
168
|
* The drop tail is one OP_2DROP per pair of fields and one OP_DROP for an odd
|
|
115
|
-
* field left over: seven OP_2DROP for version 1, eight and an OP_DROP for
|
|
169
|
+
* field left over: seven OP_2DROP for version 1, eight and an OP_DROP for
|
|
170
|
+
* versions 2 and 3. A version 3 body is carried behind its token prefix
|
|
171
|
+
* (`spec/token-carrier.md` §2), derived from the state unless `carrier`
|
|
172
|
+
* names one, which a fixture does to pin what a reader refuses.
|
|
116
173
|
*/
|
|
117
|
-
export function buildLockingScript(state, lockingPublicKey) {
|
|
174
|
+
export function buildLockingScript(state, lockingPublicKey, carrier) {
|
|
118
175
|
const pub = typeof lockingPublicKey === 'string'
|
|
119
176
|
? PublicKey.fromString(lockingPublicKey)
|
|
120
177
|
: lockingPublicKey;
|
|
121
178
|
const pubBytes = pub.encode(true);
|
|
122
179
|
const fields = stateToFields(state);
|
|
180
|
+
const prefix = state.version === STANDARD_VERSION_V3 ? carrierPrefixChunks(carrier ?? carrierPrefixFor(state)) : [];
|
|
123
181
|
const chunks = [
|
|
182
|
+
...prefix,
|
|
124
183
|
{ op: pubBytes.length, data: pubBytes },
|
|
125
184
|
{ op: OP.OP_CHECKSIG },
|
|
126
185
|
...fields.map(minimalChunk),
|
|
@@ -324,6 +383,20 @@ export function fieldsToState(fields) {
|
|
|
324
383
|
}
|
|
325
384
|
/** Validate and type raw version 2 fields per `spec/record-model-v2.md` §2-§3. Throws DppFormatError. */
|
|
326
385
|
export function fieldsToStateV2(fields) {
|
|
386
|
+
return seventeenFieldsToState(fields, STANDARD_VERSION_V2);
|
|
387
|
+
}
|
|
388
|
+
/** Validate and type the raw fields of a carried version 3 body per `spec/token-carrier.md` §4. Throws DppFormatError. */
|
|
389
|
+
export function fieldsToStateV3(fields) {
|
|
390
|
+
return seventeenFieldsToState(fields, STANDARD_VERSION_V3);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* The seventeen-field reader both versions share. The version the caller
|
|
394
|
+
* expects is the layout's: version 2 for a bare body, version 3 for a body
|
|
395
|
+
* read from behind a token prefix. The other version's string is refused by
|
|
396
|
+
* name, because one version has one layout: a version 2 body is never
|
|
397
|
+
* carried and a version 3 body is never bare.
|
|
398
|
+
*/
|
|
399
|
+
function seventeenFieldsToState(fields, expectedVersion) {
|
|
327
400
|
if (fields.length !== FIELD_COUNT_V2) {
|
|
328
401
|
throw new DppFormatError(`expected ${FIELD_COUNT_V2} fields, found ${fields.length}`);
|
|
329
402
|
}
|
|
@@ -333,10 +406,14 @@ export function fieldsToStateV2(fields) {
|
|
|
333
406
|
throw new DppFormatError(`protocol_marker must be "${PROTOCOL_MARKER}"`);
|
|
334
407
|
}
|
|
335
408
|
const version = Utils.toUTF8(fields[1]);
|
|
336
|
-
if (version !==
|
|
409
|
+
if (version !== expectedVersion) {
|
|
337
410
|
throw new DppFormatError(version === STANDARD_VERSION
|
|
338
411
|
? `version "${STANDARD_VERSION}" is carried by the ${FIELD_COUNT}-field layout, not the ${FIELD_COUNT_V2}-field one`
|
|
339
|
-
:
|
|
412
|
+
: version === STANDARD_VERSION_V3
|
|
413
|
+
? `version "${STANDARD_VERSION_V3}" is carried behind a token prefix`
|
|
414
|
+
: version === STANDARD_VERSION_V2
|
|
415
|
+
? `version "${STANDARD_VERSION_V2}" is not carried behind a token prefix`
|
|
416
|
+
: `unsupported standard version "${version}"`);
|
|
340
417
|
}
|
|
341
418
|
const passportId = passportIdField(fields[2]);
|
|
342
419
|
const op = Utils.toUTF8(fields[3]);
|
|
@@ -377,7 +454,7 @@ export function fieldsToStateV2(fields) {
|
|
|
377
454
|
throw new DppFormatError('publisher_signature must be present');
|
|
378
455
|
return {
|
|
379
456
|
protocolMarker: marker,
|
|
380
|
-
version:
|
|
457
|
+
version: expectedVersion,
|
|
381
458
|
passportId,
|
|
382
459
|
op,
|
|
383
460
|
timestamp,
|
|
@@ -396,24 +473,74 @@ export function fieldsToStateV2(fields) {
|
|
|
396
473
|
serverSignature,
|
|
397
474
|
};
|
|
398
475
|
}
|
|
476
|
+
const isPushChunk = (c) => c.op === 0 || (c.op >= 1 && c.op <= 0x4e) || c.op === 0x4f || (c.op >= 0x51 && c.op <= 0x60);
|
|
477
|
+
/**
|
|
478
|
+
* Read the BRC-162 token prefix a carried state begins with
|
|
479
|
+
* (`spec/token-carrier.md` §2, §3), or report that the script carries none.
|
|
480
|
+
* A script whose first chunk is a 33-byte push is a bare body and is read as
|
|
481
|
+
* one; a first chunk of OP_0 or a 32- or 36-byte push is a prefix attempt
|
|
482
|
+
* and is held to the carrier's rules: the id is the 32-byte deploy txid, the
|
|
483
|
+
* amount is one unit as OP_1, then OP_2DROP, then no payload except an empty
|
|
484
|
+
* slot on a deploy. Returns the prefix and the index the body starts at.
|
|
485
|
+
*/
|
|
486
|
+
function readCarrierPrefix(chunks) {
|
|
487
|
+
const first = chunks[0];
|
|
488
|
+
if (first == null)
|
|
489
|
+
return null;
|
|
490
|
+
const idLength = first.data?.length ?? 0;
|
|
491
|
+
const prefixAttempt = first.op === 0 || idLength === CARRIER_TOKEN_ID_BYTES || idLength === 36;
|
|
492
|
+
if (!prefixAttempt)
|
|
493
|
+
return null;
|
|
494
|
+
if (chunks.length < 3)
|
|
495
|
+
throw new DppFormatError('not a DPP output: malformed token prefix');
|
|
496
|
+
if (idLength === 36)
|
|
497
|
+
throw new DppFormatError('the token id is the 32-byte deploy txid');
|
|
498
|
+
const amount = chunks[1];
|
|
499
|
+
if (amount.op !== 0x50 + CARRIER_AMOUNT) {
|
|
500
|
+
if (amount.data?.length === 1 && amount.data[0] === CARRIER_AMOUNT) {
|
|
501
|
+
throw new DppFormatError('the token amount is a minimally encoded script number');
|
|
502
|
+
}
|
|
503
|
+
throw new DppFormatError(`the token amount is ${CARRIER_AMOUNT}`);
|
|
504
|
+
}
|
|
505
|
+
if (chunks[2].op !== OP.OP_2DROP || chunks[2].data !== undefined) {
|
|
506
|
+
throw new DppFormatError('not a DPP output: malformed token prefix');
|
|
507
|
+
}
|
|
508
|
+
const role = first.op === 0 ? 'deploy' : 'value';
|
|
509
|
+
const carrier = { role, tokenId: role === 'deploy' ? null : tokenIdFromWireBytes(first.data) };
|
|
510
|
+
let bodyStart = 3;
|
|
511
|
+
// A payload is one push then OP_DROP right after the OP_2DROP. The body's
|
|
512
|
+
// second chunk is OP_CHECKSIG, so a body is never read as a payload.
|
|
513
|
+
if (chunks.length > 4 && isPushChunk(chunks[3]) && chunks[4].op === OP.OP_DROP && chunks[4].data === undefined) {
|
|
514
|
+
if (role === 'value')
|
|
515
|
+
throw new DppFormatError('a value output carries no payload');
|
|
516
|
+
if (chunks[3].op !== 0)
|
|
517
|
+
throw new DppFormatError('a genesis carries no payload beyond an empty slot');
|
|
518
|
+
bodyStart = 5;
|
|
519
|
+
}
|
|
520
|
+
return { carrier, bodyStart };
|
|
521
|
+
}
|
|
399
522
|
/**
|
|
400
|
-
* Parse a DPP output script of
|
|
401
|
-
* script is not a well-formed DPP output
|
|
402
|
-
*
|
|
403
|
-
* field must agree with the count
|
|
404
|
-
*
|
|
405
|
-
*
|
|
523
|
+
* Parse a DPP output script of any version. Throws DppFormatError when the
|
|
524
|
+
* script is not a well-formed DPP output. A bare body is read by field count
|
|
525
|
+
* (fourteen fields for version 1, seventeen for version 2) and the version
|
|
526
|
+
* field must agree with the count. A body behind a token prefix is version 3,
|
|
527
|
+
* read under the version 2 rules with the version 3 string; a version 2 body
|
|
528
|
+
* behind a prefix and a version 3 body without one are refused by name, so an
|
|
529
|
+
* older reader meeting a newer state fails clearly rather than guessing.
|
|
406
530
|
*/
|
|
407
531
|
export function parseDppOutput(script) {
|
|
408
532
|
const chunks = script.chunks;
|
|
409
|
-
|
|
533
|
+
const prefix = readCarrierPrefix(chunks);
|
|
534
|
+
const start = prefix?.bodyStart ?? 0;
|
|
535
|
+
const key = chunks[start];
|
|
536
|
+
if (chunks.length < start + 2 || key?.data == null || key.data.length !== 33) {
|
|
410
537
|
throw new DppFormatError('not a DPP output: missing 33-byte locking key push');
|
|
411
538
|
}
|
|
412
|
-
if (chunks[1].op !== OP.OP_CHECKSIG) {
|
|
539
|
+
if (chunks[start + 1].op !== OP.OP_CHECKSIG) {
|
|
413
540
|
throw new DppFormatError('not a DPP output: missing OP_CHECKSIG');
|
|
414
541
|
}
|
|
415
542
|
const fields = [];
|
|
416
|
-
let i = 2;
|
|
543
|
+
let i = start + 2;
|
|
417
544
|
for (; i < chunks.length; i++) {
|
|
418
545
|
const op = chunks[i].op;
|
|
419
546
|
if (op === OP.OP_2DROP || op === OP.OP_DROP)
|
|
@@ -438,12 +565,18 @@ export function parseDppOutput(script) {
|
|
|
438
565
|
}
|
|
439
566
|
let lockingPublicKey;
|
|
440
567
|
try {
|
|
441
|
-
lockingPublicKey = PublicKey.fromString(Utils.toHex(
|
|
568
|
+
lockingPublicKey = PublicKey.fromString(Utils.toHex(key.data));
|
|
442
569
|
}
|
|
443
570
|
catch {
|
|
444
571
|
// Keep the documented contract: every refusal is a DppFormatError.
|
|
445
572
|
throw new DppFormatError('not a DPP output: locking key is not a valid public key');
|
|
446
573
|
}
|
|
574
|
+
if (prefix != null) {
|
|
575
|
+
if (fields.length !== FIELD_COUNT_V2) {
|
|
576
|
+
throw new DppFormatError(`a carried body has ${FIELD_COUNT_V2} fields, found ${fields.length}`);
|
|
577
|
+
}
|
|
578
|
+
return { state: fieldsToStateV3(fields), lockingPublicKey, carrier: prefix.carrier };
|
|
579
|
+
}
|
|
447
580
|
const state = fields.length === FIELD_COUNT_V2 ? fieldsToStateV2(fields) : fieldsToState(fields);
|
|
448
581
|
return { state, lockingPublicKey };
|
|
449
582
|
}
|