@neuraiproject/neurai-scripts 0.9.0 → 0.9.1
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 +12 -0
- package/dist/index.d.cts +1194 -0
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -634,6 +634,18 @@ consumable; callers import directly from the package root.
|
|
|
634
634
|
|
|
635
635
|
## Version notes
|
|
636
636
|
|
|
637
|
+
### 0.9.1
|
|
638
|
+
|
|
639
|
+
TypeScript declarations for CommonJS. `require()` loads `dist/index.cjs`, but
|
|
640
|
+
the package only published ESM declarations, so a CommonJS file compiled with
|
|
641
|
+
`moduleResolution: "node16"` got `TS1471` and no types. Each condition of
|
|
642
|
+
`exports` now has its own declarations (`import` → `dist/index.d.ts`,
|
|
643
|
+
`require` → `dist/index.d.cts`). No runtime or API change. `npm run
|
|
644
|
+
test:types` compiles ESM, CommonJS and browser consumers against the built
|
|
645
|
+
declarations (NodeNext, Node16, Bundler; `skipLibCheck: false`) and `npm run
|
|
646
|
+
test:package` checks the packed tarball in a clean project, with TypeScript
|
|
647
|
+
4.7 too.
|
|
648
|
+
|
|
637
649
|
### 0.9.0
|
|
638
650
|
|
|
639
651
|
Address types of neurai-key 5 / neurai-create-transaction 0.9.0.
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Neurai chain discriminator: `xna` = mainnet, `xna-test` = testnet/regtest.
|
|
3
|
+
*
|
|
4
|
+
* Only the chain matters here. In neurai-key 5 the label `xna` also names
|
|
5
|
+
* the ECDSA witness v3 address type; parsed P2PKH hashes are formatted as
|
|
6
|
+
* Legacy Base58 (neurai-key `xna-legacy` / `xna-legacy-test`) whatever this
|
|
7
|
+
* label says.
|
|
8
|
+
*
|
|
9
|
+
* This type intentionally appears only on the **parse side** of the API —
|
|
10
|
+
* as an optional argument to the parsers and as a field on the parsed
|
|
11
|
+
* result types. It is **not** part of any builder's input.
|
|
12
|
+
*
|
|
13
|
+
* Rationale: the covenant scriptPubKey bytes do not encode network. A
|
|
14
|
+
* legacy covenant is a fixed sequence of opcodes and a 20-byte PKH; a PQ
|
|
15
|
+
* covenant is opcodes plus a 32-byte commitment and the raw bytes of the
|
|
16
|
+
* payment scriptPubKey. None of those change between `xna` and
|
|
17
|
+
* `xna-test`. What differs across networks is:
|
|
18
|
+
*
|
|
19
|
+
* - The *address encoding* used by the caller (base58 prefix for
|
|
20
|
+
* P2PKH, bech32m HRP for AuthScript), validated by `decodeAddress`
|
|
21
|
+
* when the builder receives an address string.
|
|
22
|
+
* - The *consensus flags* gating the DePIN-Test opcodes; those live on
|
|
23
|
+
* the node, not in the script bytes.
|
|
24
|
+
*
|
|
25
|
+
* So builders take an address string (whose prefix already carries the
|
|
26
|
+
* network) and parsers take an explicit `network` label (so the caller
|
|
27
|
+
* can later format `sellerPubKeyHash` or interpret `paymentScriptPubKey`
|
|
28
|
+
* in the correct context). Keep this split intact when adding new
|
|
29
|
+
* covenants: do not reintroduce `network` into builder params.
|
|
30
|
+
*/
|
|
31
|
+
type Network = 'xna' | 'xna-test';
|
|
32
|
+
type PartialFillExpirationMode = 'height' | 'mtp';
|
|
33
|
+
interface PartialFillExpiration {
|
|
34
|
+
/**
|
|
35
|
+
* Chain context used to decide whether the sale is still active.
|
|
36
|
+
*
|
|
37
|
+
* - `height`: compare against the candidate block height.
|
|
38
|
+
* - `mtp`: compare against the previous block's median time past.
|
|
39
|
+
*/
|
|
40
|
+
mode: PartialFillExpirationMode;
|
|
41
|
+
/**
|
|
42
|
+
* Expiry boundary. Fills are valid only while `value > chainContext`.
|
|
43
|
+
* At exactly this height / MTP, and after it, only the seller cancel branch
|
|
44
|
+
* can spend the order.
|
|
45
|
+
*/
|
|
46
|
+
value: bigint;
|
|
47
|
+
}
|
|
48
|
+
interface PartialFillOrderParams {
|
|
49
|
+
/**
|
|
50
|
+
* Seller destination. Must be a legacy P2PKH address (base58check,
|
|
51
|
+
* "t..." on testnet, "N..." on mainnet). The legacy covenant uses
|
|
52
|
+
* `OP_HASH160 + OP_CHECKSIG` in its cancel branch, so every bech32m
|
|
53
|
+
* address (AuthScript v1 `nc1p…`, PQ v2 `pq1z…` and ECDSA v3 `nq1r…`,
|
|
54
|
+
* whose program is a commitment, not a key hash) is rejected — use
|
|
55
|
+
* `buildPartialFillScriptPQ` for those destinations. The decoded 20-byte
|
|
56
|
+
* PKH is hardcoded into the covenant (cancel branch + payment scriptPubKey).
|
|
57
|
+
*/
|
|
58
|
+
sellerAddress: string;
|
|
59
|
+
/** Name of the asset being sold (e.g. "CAT"). */
|
|
60
|
+
tokenId: string;
|
|
61
|
+
/**
|
|
62
|
+
* Price per single indivisible unit of the asset, expressed in satoshis of
|
|
63
|
+
* XNA. The covenant multiplies this by the filled amount and enforces the
|
|
64
|
+
* XNA output to Alice is `>=` that product.
|
|
65
|
+
*
|
|
66
|
+
* Example: selling at 1 XNA per whole token with `units = 0` (non-divisible)
|
|
67
|
+
* means `unitPriceSats = 100_000_000n`.
|
|
68
|
+
*/
|
|
69
|
+
unitPriceSats: bigint;
|
|
70
|
+
/**
|
|
71
|
+
* Optional sale expiry enforced with OP_CHAINCONTEXT. When set, both buyer
|
|
72
|
+
* fill branches require `expiration.value > current height/MTP`. The seller
|
|
73
|
+
* cancel branch remains available to recover the order.
|
|
74
|
+
*/
|
|
75
|
+
expiration?: PartialFillExpiration;
|
|
76
|
+
}
|
|
77
|
+
interface ParsedPartialFillOrder {
|
|
78
|
+
/** Network the parser was invoked with (used for downstream address formatting). */
|
|
79
|
+
network: Network;
|
|
80
|
+
/**
|
|
81
|
+
* Seller's 20-byte pubkey hash, extracted from the covenant's cancel
|
|
82
|
+
* branch. The caller can base58check-encode this with the network's
|
|
83
|
+
* legacy prefix to recover the seller address when needed.
|
|
84
|
+
*/
|
|
85
|
+
sellerPubKeyHash: Uint8Array;
|
|
86
|
+
/** Asset name parsed from the covenant. */
|
|
87
|
+
tokenId: string;
|
|
88
|
+
/** Unit price parsed from the covenant, in XNA satoshis. */
|
|
89
|
+
unitPriceSats: bigint;
|
|
90
|
+
/** Optional sale expiry parsed from OP_CHAINCONTEXT gates. */
|
|
91
|
+
expiration?: PartialFillExpiration;
|
|
92
|
+
/** Script hex the parser was fed. */
|
|
93
|
+
scriptHex: string;
|
|
94
|
+
}
|
|
95
|
+
interface OrderUtxo {
|
|
96
|
+
txid: string;
|
|
97
|
+
vout: number;
|
|
98
|
+
/** scriptPubKey of the covenant UTXO (the output produced by the seller). */
|
|
99
|
+
scriptPubKeyHex: string;
|
|
100
|
+
/** Cantidad del asset dentro del UTXO covenant. */
|
|
101
|
+
assetAmountRaw: bigint;
|
|
102
|
+
/** Valor XNA del UTXO (normalmente el dust mínimo). */
|
|
103
|
+
valueSats: bigint;
|
|
104
|
+
}
|
|
105
|
+
interface TxInputRef {
|
|
106
|
+
txid: string;
|
|
107
|
+
vout: number;
|
|
108
|
+
sequence?: number;
|
|
109
|
+
scriptSigHex?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Variant of the partial-fill order whose cancel branch validates a
|
|
113
|
+
* post-quantum (ML-DSA-44) signature via `OP_CHECKSIGFROMSTACK`. Requires
|
|
114
|
+
* both `SCRIPT_VERIFY_CHECKSIGFROMSTACK` and NIP-18's
|
|
115
|
+
* `MAX_PQ_SCRIPT_ELEMENT_SIZE` to be active (testnet as of DePIN-Test with
|
|
116
|
+
* NIP-18 deployed; mainnet after fork).
|
|
117
|
+
*/
|
|
118
|
+
interface PartialFillOrderPQParams {
|
|
119
|
+
/**
|
|
120
|
+
* Destination for the XNA payment to the seller: legacy P2PKH
|
|
121
|
+
* (`N.../t...`), generic AuthScript v1 (`nc1p.../tnc1p...`), strict PQ v2
|
|
122
|
+
* (`pq1z.../tpq1z...`) or strict ECDSA v3 (`nq1r.../tnq1r...`). The
|
|
123
|
+
* covenant hardcodes the full scriptPubKey bytes (`OP_1`/`OP_2`/`OP_3`
|
|
124
|
+
* prefix included) either way.
|
|
125
|
+
*/
|
|
126
|
+
paymentAddress: string;
|
|
127
|
+
/**
|
|
128
|
+
* 32-byte commitment to the seller's PQ public key. The script checks
|
|
129
|
+
* `SHA256(pubKey_on_stack) == pubKeyCommitment`. Caller must compute this
|
|
130
|
+
* as SHA256 over the same pubKey bytes that will be pushed on spend
|
|
131
|
+
* (typically 1313 bytes = 1-byte version prefix + 1312-byte ML-DSA-44 key).
|
|
132
|
+
*/
|
|
133
|
+
pubKeyCommitment: Uint8Array;
|
|
134
|
+
/** Asset name being sold. */
|
|
135
|
+
tokenId: string;
|
|
136
|
+
/** Price in XNA satoshis per indivisible unit of the asset. */
|
|
137
|
+
unitPriceSats: bigint;
|
|
138
|
+
/**
|
|
139
|
+
* OP_TXHASH selector byte bound into the script. Default `0xff` (all
|
|
140
|
+
* eight fields). The seller must sign `SHA256(OP_TXHASH(selector))` with
|
|
141
|
+
* their PQ key at cancel time. See
|
|
142
|
+
* `doc/new-opcodes-depin-branch.md` §2.1 for the bit → field mapping.
|
|
143
|
+
*/
|
|
144
|
+
txHashSelector?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Optional sale expiry enforced with OP_CHAINCONTEXT. When set, both buyer
|
|
147
|
+
* fill branches require `expiration.value > current height/MTP`.
|
|
148
|
+
*/
|
|
149
|
+
expiration?: PartialFillExpiration;
|
|
150
|
+
}
|
|
151
|
+
interface ParsedPartialFillOrderPQ extends Omit<PartialFillOrderPQParams, 'paymentAddress'> {
|
|
152
|
+
/** Network the parser was invoked with (used for downstream address formatting). */
|
|
153
|
+
network: Network;
|
|
154
|
+
/** scriptPubKey bytes embedded in the covenant for the payment output. */
|
|
155
|
+
paymentScriptPubKey: Uint8Array;
|
|
156
|
+
scriptHex: string;
|
|
157
|
+
/** Echoes the resolved selector so the caller can assert against a default. */
|
|
158
|
+
txHashSelector: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Minimal byte helpers. A subset of what `neurai-create-transaction` exposes,
|
|
163
|
+
* duplicated here to keep this package free of runtime coupling beyond its
|
|
164
|
+
* declared `dependencies` field. All sizes are little-endian, per Neurai.
|
|
165
|
+
*/
|
|
166
|
+
declare function ensureHex(hex: string, label?: string): string;
|
|
167
|
+
declare function hexToBytes(hex: string): Uint8Array;
|
|
168
|
+
declare function bytesToHex(bytes: Uint8Array): string;
|
|
169
|
+
declare function concatBytes(...parts: Uint8Array[]): Uint8Array;
|
|
170
|
+
declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Minimal CScriptNum encoding (Bitcoin consensus rules).
|
|
174
|
+
*
|
|
175
|
+
* - 0 → empty vector
|
|
176
|
+
* - 1..16 → single opcode OP_1..OP_16 (handled in `pushInt`, not here)
|
|
177
|
+
* - -1 → OP_1NEGATE (handled in `pushInt`)
|
|
178
|
+
* - otherwise: sign-magnitude little-endian, with a sign bit on the last byte
|
|
179
|
+
*/
|
|
180
|
+
declare function encodeScriptNum(value: bigint | number): Uint8Array;
|
|
181
|
+
/**
|
|
182
|
+
* Emit a pushdata opcode followed by the payload. Chooses the shortest
|
|
183
|
+
* valid encoding.
|
|
184
|
+
*
|
|
185
|
+
* Neurai Script caps stack elements at `MAX_SCRIPT_ELEMENT_SIZE = 520`
|
|
186
|
+
* bytes by default, but NIP-18 raises the cap to
|
|
187
|
+
* `MAX_PQ_SCRIPT_ELEMENT_SIZE = 3072` whenever
|
|
188
|
+
* `SCRIPT_VERIFY_CHECKSIGFROMSTACK` is active (testnet today, mainnet once
|
|
189
|
+
* the CSFS fork lands). The builder here emits pushes up to 3072 bytes so
|
|
190
|
+
* it can target either regime; legacy scripts should stay under 520 bytes
|
|
191
|
+
* per push, and the node will reject anything larger if the CSFS flag is
|
|
192
|
+
* not set during evaluation.
|
|
193
|
+
*/
|
|
194
|
+
declare function pushBytes(data: Uint8Array): Uint8Array;
|
|
195
|
+
/**
|
|
196
|
+
* Emit a minimally-encoded integer push. Uses OP_1NEGATE, OP_0 and OP_1..OP_16
|
|
197
|
+
* when available to match how the node's own templates look on the wire.
|
|
198
|
+
*/
|
|
199
|
+
declare function pushInt(value: bigint | number): Uint8Array;
|
|
200
|
+
declare function pushHex(hex: string): Uint8Array;
|
|
201
|
+
/** Fluent assembler for readable script definitions. */
|
|
202
|
+
declare class ScriptBuilder {
|
|
203
|
+
private readonly parts;
|
|
204
|
+
op(...opcodes: number[]): this;
|
|
205
|
+
pushInt(value: bigint | number): this;
|
|
206
|
+
pushBytes(data: Uint8Array): this;
|
|
207
|
+
pushHex(hex: string): this;
|
|
208
|
+
raw(bytes: Uint8Array): this;
|
|
209
|
+
build(): Uint8Array;
|
|
210
|
+
buildHex(): string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Opcode constants for Neurai Script.
|
|
215
|
+
*
|
|
216
|
+
* Covers:
|
|
217
|
+
* - Classic Script opcodes used by covenants.
|
|
218
|
+
* - New opcodes activated in the `DePIN-Test` branch (BIP 119, BIP 347 and
|
|
219
|
+
* Neurai-specific introspection / asset / arithmetic additions).
|
|
220
|
+
*
|
|
221
|
+
* Authority: `src/script/script.h` (enum `opcodetype`) in the Neurai repo.
|
|
222
|
+
* Reference: `doc/new-opcodes-depin-branch.md`.
|
|
223
|
+
*
|
|
224
|
+
* Disabled in consensus and intentionally omitted: OP_SUBSTR, OP_LEFT,
|
|
225
|
+
* OP_RIGHT, OP_INVERT, OP_AND, OP_OR, OP_XOR, OP_2MUL, OP_2DIV, OP_LSHIFT,
|
|
226
|
+
* OP_RSHIFT. Also omitted: OP_VER / OP_VERIF / OP_VERNOTIF (reserved), the
|
|
227
|
+
* template-matching pseudo-opcodes (OP_SMALLINTEGER, OP_PUBKEYS,
|
|
228
|
+
* OP_PUBKEYHASH, OP_PUBKEY) and OP_INVALIDOPCODE.
|
|
229
|
+
*/
|
|
230
|
+
declare const OP_0 = 0;
|
|
231
|
+
declare const OP_FALSE = 0;
|
|
232
|
+
declare const OP_PUSHDATA1 = 76;
|
|
233
|
+
declare const OP_PUSHDATA2 = 77;
|
|
234
|
+
declare const OP_PUSHDATA4 = 78;
|
|
235
|
+
declare const OP_1NEGATE = 79;
|
|
236
|
+
declare const OP_RESERVED = 80;
|
|
237
|
+
declare const OP_1 = 81;
|
|
238
|
+
declare const OP_TRUE = 81;
|
|
239
|
+
declare const OP_2 = 82;
|
|
240
|
+
declare const OP_3 = 83;
|
|
241
|
+
declare const OP_4 = 84;
|
|
242
|
+
declare const OP_5 = 85;
|
|
243
|
+
declare const OP_6 = 86;
|
|
244
|
+
declare const OP_7 = 87;
|
|
245
|
+
declare const OP_8 = 88;
|
|
246
|
+
declare const OP_9 = 89;
|
|
247
|
+
declare const OP_10 = 90;
|
|
248
|
+
declare const OP_11 = 91;
|
|
249
|
+
declare const OP_12 = 92;
|
|
250
|
+
declare const OP_13 = 93;
|
|
251
|
+
declare const OP_14 = 94;
|
|
252
|
+
declare const OP_15 = 95;
|
|
253
|
+
declare const OP_16 = 96;
|
|
254
|
+
declare const OP_NOP = 97;
|
|
255
|
+
declare const OP_IF = 99;
|
|
256
|
+
declare const OP_NOTIF = 100;
|
|
257
|
+
declare const OP_ELSE = 103;
|
|
258
|
+
declare const OP_ENDIF = 104;
|
|
259
|
+
declare const OP_VERIFY = 105;
|
|
260
|
+
declare const OP_RETURN = 106;
|
|
261
|
+
declare const OP_TOALTSTACK = 107;
|
|
262
|
+
declare const OP_FROMALTSTACK = 108;
|
|
263
|
+
declare const OP_2DROP = 109;
|
|
264
|
+
declare const OP_2DUP = 110;
|
|
265
|
+
declare const OP_3DUP = 111;
|
|
266
|
+
declare const OP_2OVER = 112;
|
|
267
|
+
declare const OP_2ROT = 113;
|
|
268
|
+
declare const OP_2SWAP = 114;
|
|
269
|
+
declare const OP_IFDUP = 115;
|
|
270
|
+
declare const OP_DEPTH = 116;
|
|
271
|
+
declare const OP_DROP = 117;
|
|
272
|
+
declare const OP_DUP = 118;
|
|
273
|
+
declare const OP_NIP = 119;
|
|
274
|
+
declare const OP_OVER = 120;
|
|
275
|
+
declare const OP_PICK = 121;
|
|
276
|
+
declare const OP_ROLL = 122;
|
|
277
|
+
declare const OP_ROT = 123;
|
|
278
|
+
declare const OP_SWAP = 124;
|
|
279
|
+
declare const OP_TUCK = 125;
|
|
280
|
+
declare const OP_SIZE = 130;
|
|
281
|
+
declare const OP_EQUAL = 135;
|
|
282
|
+
declare const OP_EQUALVERIFY = 136;
|
|
283
|
+
declare const OP_1ADD = 139;
|
|
284
|
+
declare const OP_1SUB = 140;
|
|
285
|
+
declare const OP_NEGATE = 143;
|
|
286
|
+
declare const OP_ABS = 144;
|
|
287
|
+
declare const OP_NOT = 145;
|
|
288
|
+
declare const OP_0NOTEQUAL = 146;
|
|
289
|
+
declare const OP_ADD = 147;
|
|
290
|
+
declare const OP_SUB = 148;
|
|
291
|
+
declare const OP_MUL = 149;
|
|
292
|
+
declare const OP_DIV = 150;
|
|
293
|
+
declare const OP_MOD = 151;
|
|
294
|
+
declare const OP_BOOLAND = 154;
|
|
295
|
+
declare const OP_BOOLOR = 155;
|
|
296
|
+
declare const OP_NUMEQUAL = 156;
|
|
297
|
+
declare const OP_NUMEQUALVERIFY = 157;
|
|
298
|
+
declare const OP_NUMNOTEQUAL = 158;
|
|
299
|
+
declare const OP_LESSTHAN = 159;
|
|
300
|
+
declare const OP_GREATERTHAN = 160;
|
|
301
|
+
declare const OP_LESSTHANOREQUAL = 161;
|
|
302
|
+
declare const OP_GREATERTHANOREQUAL = 162;
|
|
303
|
+
declare const OP_MIN = 163;
|
|
304
|
+
declare const OP_MAX = 164;
|
|
305
|
+
declare const OP_WITHIN = 165;
|
|
306
|
+
declare const OP_RIPEMD160 = 166;
|
|
307
|
+
declare const OP_SHA1 = 167;
|
|
308
|
+
declare const OP_SHA256 = 168;
|
|
309
|
+
declare const OP_HASH160 = 169;
|
|
310
|
+
declare const OP_HASH256 = 170;
|
|
311
|
+
declare const OP_CODESEPARATOR = 171;
|
|
312
|
+
declare const OP_CHECKSIG = 172;
|
|
313
|
+
declare const OP_CHECKSIGVERIFY = 173;
|
|
314
|
+
declare const OP_CHECKMULTISIG = 174;
|
|
315
|
+
declare const OP_CHECKMULTISIGVERIFY = 175;
|
|
316
|
+
declare const OP_KECCAK256 = 186;
|
|
317
|
+
declare const OP_BLAKE2B = 187;
|
|
318
|
+
declare const OP_BLAKE3 = 200;
|
|
319
|
+
declare const OP_POSEIDON = 201;
|
|
320
|
+
declare const OP_SHA3_256 = 202;
|
|
321
|
+
declare const OP_SHA512 = 203;
|
|
322
|
+
declare const OP_CHECKSIG_ED25519 = 221;
|
|
323
|
+
declare const OP_CHECKSIGADD = 222;
|
|
324
|
+
declare const OP_NOP1 = 176;
|
|
325
|
+
declare const OP_NOP9 = 184;
|
|
326
|
+
declare const OP_NOP10 = 185;
|
|
327
|
+
declare const OP_CHECKLOCKTIMEVERIFY = 177;
|
|
328
|
+
declare const OP_CHECKSEQUENCEVERIFY = 178;
|
|
329
|
+
declare const OP_CHECKTEMPLATEVERIFY = 179;
|
|
330
|
+
declare const OP_CHECKSIGFROMSTACK = 180;
|
|
331
|
+
declare const OP_TXHASH = 181;
|
|
332
|
+
declare const OP_TXFIELD = 182;
|
|
333
|
+
declare const OP_TXLOCKTIME = 197;
|
|
334
|
+
declare const OP_OUTPUTVALUE = 204;
|
|
335
|
+
declare const OP_OUTPUTSCRIPT = 205;
|
|
336
|
+
declare const OP_INPUTCOUNT = 208;
|
|
337
|
+
declare const OP_OUTPUTCOUNT = 209;
|
|
338
|
+
declare const OP_OUTPUTASSETFIELD = 206;
|
|
339
|
+
declare const OP_INPUTASSETFIELD = 207;
|
|
340
|
+
declare const OP_XNA_ASSET = 192;
|
|
341
|
+
declare const OP_REFINPUTFIELD = 210;
|
|
342
|
+
declare const OP_REFINPUTASSETFIELD = 211;
|
|
343
|
+
declare const OP_REFINPUTCOUNT = 212;
|
|
344
|
+
declare const OP_OUTPUTAUTHCOMMITMENT = 213;
|
|
345
|
+
declare const OP_INPUTVALUE = 214;
|
|
346
|
+
declare const OP_CHAINCONTEXT = 215;
|
|
347
|
+
declare const CHAINCONTEXT_HEIGHT = 1;
|
|
348
|
+
declare const CHAINCONTEXT_MTP = 2;
|
|
349
|
+
declare const CHAINCONTEXT_CHAIN_ID = 3;
|
|
350
|
+
declare const OP_CHECKMERKLEINCLUSION = 193;
|
|
351
|
+
declare const OP_CAT = 126;
|
|
352
|
+
declare const OP_SPLIT = 183;
|
|
353
|
+
declare const OP_REVERSEBYTES = 188;
|
|
354
|
+
declare const TXFIELD_VALUE = 1;
|
|
355
|
+
declare const TXFIELD_AUTHSCRIPT_COMMITMENT = 2;
|
|
356
|
+
declare const TXFIELD_SCRIPTPUBKEY = 3;
|
|
357
|
+
declare const TXHASH_VERSION = 1;
|
|
358
|
+
declare const TXHASH_LOCKTIME = 2;
|
|
359
|
+
declare const TXHASH_INPUT_PREVOUTS = 4;
|
|
360
|
+
declare const TXHASH_INPUT_SEQUENCES = 8;
|
|
361
|
+
declare const TXHASH_OUTPUTS = 16;
|
|
362
|
+
declare const TXHASH_CURRENT_PREVOUT = 32;
|
|
363
|
+
declare const TXHASH_CURRENT_SEQUENCE = 64;
|
|
364
|
+
declare const TXHASH_CURRENT_INDEX = 128;
|
|
365
|
+
declare const TXHASH_ALL = 255;
|
|
366
|
+
declare const ASSETFIELD_NAME = 1;
|
|
367
|
+
declare const ASSETFIELD_AMOUNT = 2;
|
|
368
|
+
declare const ASSETFIELD_UNITS = 3;
|
|
369
|
+
declare const ASSETFIELD_REISSUABLE = 4;
|
|
370
|
+
declare const ASSETFIELD_HAS_IPFS = 5;
|
|
371
|
+
declare const ASSETFIELD_IPFS_HASH = 6;
|
|
372
|
+
declare const ASSETFIELD_TYPE = 7;
|
|
373
|
+
|
|
374
|
+
declare const opcodes_d_ASSETFIELD_AMOUNT: typeof ASSETFIELD_AMOUNT;
|
|
375
|
+
declare const opcodes_d_ASSETFIELD_HAS_IPFS: typeof ASSETFIELD_HAS_IPFS;
|
|
376
|
+
declare const opcodes_d_ASSETFIELD_IPFS_HASH: typeof ASSETFIELD_IPFS_HASH;
|
|
377
|
+
declare const opcodes_d_ASSETFIELD_NAME: typeof ASSETFIELD_NAME;
|
|
378
|
+
declare const opcodes_d_ASSETFIELD_REISSUABLE: typeof ASSETFIELD_REISSUABLE;
|
|
379
|
+
declare const opcodes_d_ASSETFIELD_TYPE: typeof ASSETFIELD_TYPE;
|
|
380
|
+
declare const opcodes_d_ASSETFIELD_UNITS: typeof ASSETFIELD_UNITS;
|
|
381
|
+
declare const opcodes_d_CHAINCONTEXT_CHAIN_ID: typeof CHAINCONTEXT_CHAIN_ID;
|
|
382
|
+
declare const opcodes_d_CHAINCONTEXT_HEIGHT: typeof CHAINCONTEXT_HEIGHT;
|
|
383
|
+
declare const opcodes_d_CHAINCONTEXT_MTP: typeof CHAINCONTEXT_MTP;
|
|
384
|
+
declare const opcodes_d_OP_0: typeof OP_0;
|
|
385
|
+
declare const opcodes_d_OP_0NOTEQUAL: typeof OP_0NOTEQUAL;
|
|
386
|
+
declare const opcodes_d_OP_1: typeof OP_1;
|
|
387
|
+
declare const opcodes_d_OP_10: typeof OP_10;
|
|
388
|
+
declare const opcodes_d_OP_11: typeof OP_11;
|
|
389
|
+
declare const opcodes_d_OP_12: typeof OP_12;
|
|
390
|
+
declare const opcodes_d_OP_13: typeof OP_13;
|
|
391
|
+
declare const opcodes_d_OP_14: typeof OP_14;
|
|
392
|
+
declare const opcodes_d_OP_15: typeof OP_15;
|
|
393
|
+
declare const opcodes_d_OP_16: typeof OP_16;
|
|
394
|
+
declare const opcodes_d_OP_1ADD: typeof OP_1ADD;
|
|
395
|
+
declare const opcodes_d_OP_1NEGATE: typeof OP_1NEGATE;
|
|
396
|
+
declare const opcodes_d_OP_1SUB: typeof OP_1SUB;
|
|
397
|
+
declare const opcodes_d_OP_2: typeof OP_2;
|
|
398
|
+
declare const opcodes_d_OP_2DROP: typeof OP_2DROP;
|
|
399
|
+
declare const opcodes_d_OP_2DUP: typeof OP_2DUP;
|
|
400
|
+
declare const opcodes_d_OP_2OVER: typeof OP_2OVER;
|
|
401
|
+
declare const opcodes_d_OP_2ROT: typeof OP_2ROT;
|
|
402
|
+
declare const opcodes_d_OP_2SWAP: typeof OP_2SWAP;
|
|
403
|
+
declare const opcodes_d_OP_3: typeof OP_3;
|
|
404
|
+
declare const opcodes_d_OP_3DUP: typeof OP_3DUP;
|
|
405
|
+
declare const opcodes_d_OP_4: typeof OP_4;
|
|
406
|
+
declare const opcodes_d_OP_5: typeof OP_5;
|
|
407
|
+
declare const opcodes_d_OP_6: typeof OP_6;
|
|
408
|
+
declare const opcodes_d_OP_7: typeof OP_7;
|
|
409
|
+
declare const opcodes_d_OP_8: typeof OP_8;
|
|
410
|
+
declare const opcodes_d_OP_9: typeof OP_9;
|
|
411
|
+
declare const opcodes_d_OP_ABS: typeof OP_ABS;
|
|
412
|
+
declare const opcodes_d_OP_ADD: typeof OP_ADD;
|
|
413
|
+
declare const opcodes_d_OP_BLAKE2B: typeof OP_BLAKE2B;
|
|
414
|
+
declare const opcodes_d_OP_BLAKE3: typeof OP_BLAKE3;
|
|
415
|
+
declare const opcodes_d_OP_BOOLAND: typeof OP_BOOLAND;
|
|
416
|
+
declare const opcodes_d_OP_BOOLOR: typeof OP_BOOLOR;
|
|
417
|
+
declare const opcodes_d_OP_CAT: typeof OP_CAT;
|
|
418
|
+
declare const opcodes_d_OP_CHAINCONTEXT: typeof OP_CHAINCONTEXT;
|
|
419
|
+
declare const opcodes_d_OP_CHECKLOCKTIMEVERIFY: typeof OP_CHECKLOCKTIMEVERIFY;
|
|
420
|
+
declare const opcodes_d_OP_CHECKMERKLEINCLUSION: typeof OP_CHECKMERKLEINCLUSION;
|
|
421
|
+
declare const opcodes_d_OP_CHECKMULTISIG: typeof OP_CHECKMULTISIG;
|
|
422
|
+
declare const opcodes_d_OP_CHECKMULTISIGVERIFY: typeof OP_CHECKMULTISIGVERIFY;
|
|
423
|
+
declare const opcodes_d_OP_CHECKSEQUENCEVERIFY: typeof OP_CHECKSEQUENCEVERIFY;
|
|
424
|
+
declare const opcodes_d_OP_CHECKSIG: typeof OP_CHECKSIG;
|
|
425
|
+
declare const opcodes_d_OP_CHECKSIGADD: typeof OP_CHECKSIGADD;
|
|
426
|
+
declare const opcodes_d_OP_CHECKSIGFROMSTACK: typeof OP_CHECKSIGFROMSTACK;
|
|
427
|
+
declare const opcodes_d_OP_CHECKSIGVERIFY: typeof OP_CHECKSIGVERIFY;
|
|
428
|
+
declare const opcodes_d_OP_CHECKSIG_ED25519: typeof OP_CHECKSIG_ED25519;
|
|
429
|
+
declare const opcodes_d_OP_CHECKTEMPLATEVERIFY: typeof OP_CHECKTEMPLATEVERIFY;
|
|
430
|
+
declare const opcodes_d_OP_CODESEPARATOR: typeof OP_CODESEPARATOR;
|
|
431
|
+
declare const opcodes_d_OP_DEPTH: typeof OP_DEPTH;
|
|
432
|
+
declare const opcodes_d_OP_DIV: typeof OP_DIV;
|
|
433
|
+
declare const opcodes_d_OP_DROP: typeof OP_DROP;
|
|
434
|
+
declare const opcodes_d_OP_DUP: typeof OP_DUP;
|
|
435
|
+
declare const opcodes_d_OP_ELSE: typeof OP_ELSE;
|
|
436
|
+
declare const opcodes_d_OP_ENDIF: typeof OP_ENDIF;
|
|
437
|
+
declare const opcodes_d_OP_EQUAL: typeof OP_EQUAL;
|
|
438
|
+
declare const opcodes_d_OP_EQUALVERIFY: typeof OP_EQUALVERIFY;
|
|
439
|
+
declare const opcodes_d_OP_FALSE: typeof OP_FALSE;
|
|
440
|
+
declare const opcodes_d_OP_FROMALTSTACK: typeof OP_FROMALTSTACK;
|
|
441
|
+
declare const opcodes_d_OP_GREATERTHAN: typeof OP_GREATERTHAN;
|
|
442
|
+
declare const opcodes_d_OP_GREATERTHANOREQUAL: typeof OP_GREATERTHANOREQUAL;
|
|
443
|
+
declare const opcodes_d_OP_HASH160: typeof OP_HASH160;
|
|
444
|
+
declare const opcodes_d_OP_HASH256: typeof OP_HASH256;
|
|
445
|
+
declare const opcodes_d_OP_IF: typeof OP_IF;
|
|
446
|
+
declare const opcodes_d_OP_IFDUP: typeof OP_IFDUP;
|
|
447
|
+
declare const opcodes_d_OP_INPUTASSETFIELD: typeof OP_INPUTASSETFIELD;
|
|
448
|
+
declare const opcodes_d_OP_INPUTCOUNT: typeof OP_INPUTCOUNT;
|
|
449
|
+
declare const opcodes_d_OP_INPUTVALUE: typeof OP_INPUTVALUE;
|
|
450
|
+
declare const opcodes_d_OP_KECCAK256: typeof OP_KECCAK256;
|
|
451
|
+
declare const opcodes_d_OP_LESSTHAN: typeof OP_LESSTHAN;
|
|
452
|
+
declare const opcodes_d_OP_LESSTHANOREQUAL: typeof OP_LESSTHANOREQUAL;
|
|
453
|
+
declare const opcodes_d_OP_MAX: typeof OP_MAX;
|
|
454
|
+
declare const opcodes_d_OP_MIN: typeof OP_MIN;
|
|
455
|
+
declare const opcodes_d_OP_MOD: typeof OP_MOD;
|
|
456
|
+
declare const opcodes_d_OP_MUL: typeof OP_MUL;
|
|
457
|
+
declare const opcodes_d_OP_NEGATE: typeof OP_NEGATE;
|
|
458
|
+
declare const opcodes_d_OP_NIP: typeof OP_NIP;
|
|
459
|
+
declare const opcodes_d_OP_NOP: typeof OP_NOP;
|
|
460
|
+
declare const opcodes_d_OP_NOP1: typeof OP_NOP1;
|
|
461
|
+
declare const opcodes_d_OP_NOP10: typeof OP_NOP10;
|
|
462
|
+
declare const opcodes_d_OP_NOP9: typeof OP_NOP9;
|
|
463
|
+
declare const opcodes_d_OP_NOT: typeof OP_NOT;
|
|
464
|
+
declare const opcodes_d_OP_NOTIF: typeof OP_NOTIF;
|
|
465
|
+
declare const opcodes_d_OP_NUMEQUAL: typeof OP_NUMEQUAL;
|
|
466
|
+
declare const opcodes_d_OP_NUMEQUALVERIFY: typeof OP_NUMEQUALVERIFY;
|
|
467
|
+
declare const opcodes_d_OP_NUMNOTEQUAL: typeof OP_NUMNOTEQUAL;
|
|
468
|
+
declare const opcodes_d_OP_OUTPUTASSETFIELD: typeof OP_OUTPUTASSETFIELD;
|
|
469
|
+
declare const opcodes_d_OP_OUTPUTAUTHCOMMITMENT: typeof OP_OUTPUTAUTHCOMMITMENT;
|
|
470
|
+
declare const opcodes_d_OP_OUTPUTCOUNT: typeof OP_OUTPUTCOUNT;
|
|
471
|
+
declare const opcodes_d_OP_OUTPUTSCRIPT: typeof OP_OUTPUTSCRIPT;
|
|
472
|
+
declare const opcodes_d_OP_OUTPUTVALUE: typeof OP_OUTPUTVALUE;
|
|
473
|
+
declare const opcodes_d_OP_OVER: typeof OP_OVER;
|
|
474
|
+
declare const opcodes_d_OP_PICK: typeof OP_PICK;
|
|
475
|
+
declare const opcodes_d_OP_POSEIDON: typeof OP_POSEIDON;
|
|
476
|
+
declare const opcodes_d_OP_PUSHDATA1: typeof OP_PUSHDATA1;
|
|
477
|
+
declare const opcodes_d_OP_PUSHDATA2: typeof OP_PUSHDATA2;
|
|
478
|
+
declare const opcodes_d_OP_PUSHDATA4: typeof OP_PUSHDATA4;
|
|
479
|
+
declare const opcodes_d_OP_REFINPUTASSETFIELD: typeof OP_REFINPUTASSETFIELD;
|
|
480
|
+
declare const opcodes_d_OP_REFINPUTCOUNT: typeof OP_REFINPUTCOUNT;
|
|
481
|
+
declare const opcodes_d_OP_REFINPUTFIELD: typeof OP_REFINPUTFIELD;
|
|
482
|
+
declare const opcodes_d_OP_RESERVED: typeof OP_RESERVED;
|
|
483
|
+
declare const opcodes_d_OP_RETURN: typeof OP_RETURN;
|
|
484
|
+
declare const opcodes_d_OP_REVERSEBYTES: typeof OP_REVERSEBYTES;
|
|
485
|
+
declare const opcodes_d_OP_RIPEMD160: typeof OP_RIPEMD160;
|
|
486
|
+
declare const opcodes_d_OP_ROLL: typeof OP_ROLL;
|
|
487
|
+
declare const opcodes_d_OP_ROT: typeof OP_ROT;
|
|
488
|
+
declare const opcodes_d_OP_SHA1: typeof OP_SHA1;
|
|
489
|
+
declare const opcodes_d_OP_SHA256: typeof OP_SHA256;
|
|
490
|
+
declare const opcodes_d_OP_SHA3_256: typeof OP_SHA3_256;
|
|
491
|
+
declare const opcodes_d_OP_SHA512: typeof OP_SHA512;
|
|
492
|
+
declare const opcodes_d_OP_SIZE: typeof OP_SIZE;
|
|
493
|
+
declare const opcodes_d_OP_SPLIT: typeof OP_SPLIT;
|
|
494
|
+
declare const opcodes_d_OP_SUB: typeof OP_SUB;
|
|
495
|
+
declare const opcodes_d_OP_SWAP: typeof OP_SWAP;
|
|
496
|
+
declare const opcodes_d_OP_TOALTSTACK: typeof OP_TOALTSTACK;
|
|
497
|
+
declare const opcodes_d_OP_TRUE: typeof OP_TRUE;
|
|
498
|
+
declare const opcodes_d_OP_TUCK: typeof OP_TUCK;
|
|
499
|
+
declare const opcodes_d_OP_TXFIELD: typeof OP_TXFIELD;
|
|
500
|
+
declare const opcodes_d_OP_TXHASH: typeof OP_TXHASH;
|
|
501
|
+
declare const opcodes_d_OP_TXLOCKTIME: typeof OP_TXLOCKTIME;
|
|
502
|
+
declare const opcodes_d_OP_VERIFY: typeof OP_VERIFY;
|
|
503
|
+
declare const opcodes_d_OP_WITHIN: typeof OP_WITHIN;
|
|
504
|
+
declare const opcodes_d_OP_XNA_ASSET: typeof OP_XNA_ASSET;
|
|
505
|
+
declare const opcodes_d_TXFIELD_AUTHSCRIPT_COMMITMENT: typeof TXFIELD_AUTHSCRIPT_COMMITMENT;
|
|
506
|
+
declare const opcodes_d_TXFIELD_SCRIPTPUBKEY: typeof TXFIELD_SCRIPTPUBKEY;
|
|
507
|
+
declare const opcodes_d_TXFIELD_VALUE: typeof TXFIELD_VALUE;
|
|
508
|
+
declare const opcodes_d_TXHASH_ALL: typeof TXHASH_ALL;
|
|
509
|
+
declare const opcodes_d_TXHASH_CURRENT_INDEX: typeof TXHASH_CURRENT_INDEX;
|
|
510
|
+
declare const opcodes_d_TXHASH_CURRENT_PREVOUT: typeof TXHASH_CURRENT_PREVOUT;
|
|
511
|
+
declare const opcodes_d_TXHASH_CURRENT_SEQUENCE: typeof TXHASH_CURRENT_SEQUENCE;
|
|
512
|
+
declare const opcodes_d_TXHASH_INPUT_PREVOUTS: typeof TXHASH_INPUT_PREVOUTS;
|
|
513
|
+
declare const opcodes_d_TXHASH_INPUT_SEQUENCES: typeof TXHASH_INPUT_SEQUENCES;
|
|
514
|
+
declare const opcodes_d_TXHASH_LOCKTIME: typeof TXHASH_LOCKTIME;
|
|
515
|
+
declare const opcodes_d_TXHASH_OUTPUTS: typeof TXHASH_OUTPUTS;
|
|
516
|
+
declare const opcodes_d_TXHASH_VERSION: typeof TXHASH_VERSION;
|
|
517
|
+
declare namespace opcodes_d {
|
|
518
|
+
export {
|
|
519
|
+
opcodes_d_ASSETFIELD_AMOUNT as ASSETFIELD_AMOUNT,
|
|
520
|
+
opcodes_d_ASSETFIELD_HAS_IPFS as ASSETFIELD_HAS_IPFS,
|
|
521
|
+
opcodes_d_ASSETFIELD_IPFS_HASH as ASSETFIELD_IPFS_HASH,
|
|
522
|
+
opcodes_d_ASSETFIELD_NAME as ASSETFIELD_NAME,
|
|
523
|
+
opcodes_d_ASSETFIELD_REISSUABLE as ASSETFIELD_REISSUABLE,
|
|
524
|
+
opcodes_d_ASSETFIELD_TYPE as ASSETFIELD_TYPE,
|
|
525
|
+
opcodes_d_ASSETFIELD_UNITS as ASSETFIELD_UNITS,
|
|
526
|
+
opcodes_d_CHAINCONTEXT_CHAIN_ID as CHAINCONTEXT_CHAIN_ID,
|
|
527
|
+
opcodes_d_CHAINCONTEXT_HEIGHT as CHAINCONTEXT_HEIGHT,
|
|
528
|
+
opcodes_d_CHAINCONTEXT_MTP as CHAINCONTEXT_MTP,
|
|
529
|
+
opcodes_d_OP_0 as OP_0,
|
|
530
|
+
opcodes_d_OP_0NOTEQUAL as OP_0NOTEQUAL,
|
|
531
|
+
opcodes_d_OP_1 as OP_1,
|
|
532
|
+
opcodes_d_OP_10 as OP_10,
|
|
533
|
+
opcodes_d_OP_11 as OP_11,
|
|
534
|
+
opcodes_d_OP_12 as OP_12,
|
|
535
|
+
opcodes_d_OP_13 as OP_13,
|
|
536
|
+
opcodes_d_OP_14 as OP_14,
|
|
537
|
+
opcodes_d_OP_15 as OP_15,
|
|
538
|
+
opcodes_d_OP_16 as OP_16,
|
|
539
|
+
opcodes_d_OP_1ADD as OP_1ADD,
|
|
540
|
+
opcodes_d_OP_1NEGATE as OP_1NEGATE,
|
|
541
|
+
opcodes_d_OP_1SUB as OP_1SUB,
|
|
542
|
+
opcodes_d_OP_2 as OP_2,
|
|
543
|
+
opcodes_d_OP_2DROP as OP_2DROP,
|
|
544
|
+
opcodes_d_OP_2DUP as OP_2DUP,
|
|
545
|
+
opcodes_d_OP_2OVER as OP_2OVER,
|
|
546
|
+
opcodes_d_OP_2ROT as OP_2ROT,
|
|
547
|
+
opcodes_d_OP_2SWAP as OP_2SWAP,
|
|
548
|
+
opcodes_d_OP_3 as OP_3,
|
|
549
|
+
opcodes_d_OP_3DUP as OP_3DUP,
|
|
550
|
+
opcodes_d_OP_4 as OP_4,
|
|
551
|
+
opcodes_d_OP_5 as OP_5,
|
|
552
|
+
opcodes_d_OP_6 as OP_6,
|
|
553
|
+
opcodes_d_OP_7 as OP_7,
|
|
554
|
+
opcodes_d_OP_8 as OP_8,
|
|
555
|
+
opcodes_d_OP_9 as OP_9,
|
|
556
|
+
opcodes_d_OP_ABS as OP_ABS,
|
|
557
|
+
opcodes_d_OP_ADD as OP_ADD,
|
|
558
|
+
opcodes_d_OP_BLAKE2B as OP_BLAKE2B,
|
|
559
|
+
opcodes_d_OP_BLAKE3 as OP_BLAKE3,
|
|
560
|
+
opcodes_d_OP_BOOLAND as OP_BOOLAND,
|
|
561
|
+
opcodes_d_OP_BOOLOR as OP_BOOLOR,
|
|
562
|
+
opcodes_d_OP_CAT as OP_CAT,
|
|
563
|
+
opcodes_d_OP_CHAINCONTEXT as OP_CHAINCONTEXT,
|
|
564
|
+
opcodes_d_OP_CHECKLOCKTIMEVERIFY as OP_CHECKLOCKTIMEVERIFY,
|
|
565
|
+
opcodes_d_OP_CHECKMERKLEINCLUSION as OP_CHECKMERKLEINCLUSION,
|
|
566
|
+
opcodes_d_OP_CHECKMULTISIG as OP_CHECKMULTISIG,
|
|
567
|
+
opcodes_d_OP_CHECKMULTISIGVERIFY as OP_CHECKMULTISIGVERIFY,
|
|
568
|
+
opcodes_d_OP_CHECKSEQUENCEVERIFY as OP_CHECKSEQUENCEVERIFY,
|
|
569
|
+
opcodes_d_OP_CHECKSIG as OP_CHECKSIG,
|
|
570
|
+
opcodes_d_OP_CHECKSIGADD as OP_CHECKSIGADD,
|
|
571
|
+
opcodes_d_OP_CHECKSIGFROMSTACK as OP_CHECKSIGFROMSTACK,
|
|
572
|
+
opcodes_d_OP_CHECKSIGVERIFY as OP_CHECKSIGVERIFY,
|
|
573
|
+
opcodes_d_OP_CHECKSIG_ED25519 as OP_CHECKSIG_ED25519,
|
|
574
|
+
opcodes_d_OP_CHECKTEMPLATEVERIFY as OP_CHECKTEMPLATEVERIFY,
|
|
575
|
+
opcodes_d_OP_CODESEPARATOR as OP_CODESEPARATOR,
|
|
576
|
+
opcodes_d_OP_DEPTH as OP_DEPTH,
|
|
577
|
+
opcodes_d_OP_DIV as OP_DIV,
|
|
578
|
+
opcodes_d_OP_DROP as OP_DROP,
|
|
579
|
+
opcodes_d_OP_DUP as OP_DUP,
|
|
580
|
+
opcodes_d_OP_ELSE as OP_ELSE,
|
|
581
|
+
opcodes_d_OP_ENDIF as OP_ENDIF,
|
|
582
|
+
opcodes_d_OP_EQUAL as OP_EQUAL,
|
|
583
|
+
opcodes_d_OP_EQUALVERIFY as OP_EQUALVERIFY,
|
|
584
|
+
opcodes_d_OP_FALSE as OP_FALSE,
|
|
585
|
+
opcodes_d_OP_FROMALTSTACK as OP_FROMALTSTACK,
|
|
586
|
+
opcodes_d_OP_GREATERTHAN as OP_GREATERTHAN,
|
|
587
|
+
opcodes_d_OP_GREATERTHANOREQUAL as OP_GREATERTHANOREQUAL,
|
|
588
|
+
opcodes_d_OP_HASH160 as OP_HASH160,
|
|
589
|
+
opcodes_d_OP_HASH256 as OP_HASH256,
|
|
590
|
+
opcodes_d_OP_IF as OP_IF,
|
|
591
|
+
opcodes_d_OP_IFDUP as OP_IFDUP,
|
|
592
|
+
opcodes_d_OP_INPUTASSETFIELD as OP_INPUTASSETFIELD,
|
|
593
|
+
opcodes_d_OP_INPUTCOUNT as OP_INPUTCOUNT,
|
|
594
|
+
opcodes_d_OP_INPUTVALUE as OP_INPUTVALUE,
|
|
595
|
+
opcodes_d_OP_KECCAK256 as OP_KECCAK256,
|
|
596
|
+
opcodes_d_OP_LESSTHAN as OP_LESSTHAN,
|
|
597
|
+
opcodes_d_OP_LESSTHANOREQUAL as OP_LESSTHANOREQUAL,
|
|
598
|
+
opcodes_d_OP_MAX as OP_MAX,
|
|
599
|
+
opcodes_d_OP_MIN as OP_MIN,
|
|
600
|
+
opcodes_d_OP_MOD as OP_MOD,
|
|
601
|
+
opcodes_d_OP_MUL as OP_MUL,
|
|
602
|
+
opcodes_d_OP_NEGATE as OP_NEGATE,
|
|
603
|
+
opcodes_d_OP_NIP as OP_NIP,
|
|
604
|
+
opcodes_d_OP_NOP as OP_NOP,
|
|
605
|
+
opcodes_d_OP_NOP1 as OP_NOP1,
|
|
606
|
+
opcodes_d_OP_NOP10 as OP_NOP10,
|
|
607
|
+
opcodes_d_OP_NOP9 as OP_NOP9,
|
|
608
|
+
opcodes_d_OP_NOT as OP_NOT,
|
|
609
|
+
opcodes_d_OP_NOTIF as OP_NOTIF,
|
|
610
|
+
opcodes_d_OP_NUMEQUAL as OP_NUMEQUAL,
|
|
611
|
+
opcodes_d_OP_NUMEQUALVERIFY as OP_NUMEQUALVERIFY,
|
|
612
|
+
opcodes_d_OP_NUMNOTEQUAL as OP_NUMNOTEQUAL,
|
|
613
|
+
opcodes_d_OP_OUTPUTASSETFIELD as OP_OUTPUTASSETFIELD,
|
|
614
|
+
opcodes_d_OP_OUTPUTAUTHCOMMITMENT as OP_OUTPUTAUTHCOMMITMENT,
|
|
615
|
+
opcodes_d_OP_OUTPUTCOUNT as OP_OUTPUTCOUNT,
|
|
616
|
+
opcodes_d_OP_OUTPUTSCRIPT as OP_OUTPUTSCRIPT,
|
|
617
|
+
opcodes_d_OP_OUTPUTVALUE as OP_OUTPUTVALUE,
|
|
618
|
+
opcodes_d_OP_OVER as OP_OVER,
|
|
619
|
+
opcodes_d_OP_PICK as OP_PICK,
|
|
620
|
+
opcodes_d_OP_POSEIDON as OP_POSEIDON,
|
|
621
|
+
opcodes_d_OP_PUSHDATA1 as OP_PUSHDATA1,
|
|
622
|
+
opcodes_d_OP_PUSHDATA2 as OP_PUSHDATA2,
|
|
623
|
+
opcodes_d_OP_PUSHDATA4 as OP_PUSHDATA4,
|
|
624
|
+
opcodes_d_OP_REFINPUTASSETFIELD as OP_REFINPUTASSETFIELD,
|
|
625
|
+
opcodes_d_OP_REFINPUTCOUNT as OP_REFINPUTCOUNT,
|
|
626
|
+
opcodes_d_OP_REFINPUTFIELD as OP_REFINPUTFIELD,
|
|
627
|
+
opcodes_d_OP_RESERVED as OP_RESERVED,
|
|
628
|
+
opcodes_d_OP_RETURN as OP_RETURN,
|
|
629
|
+
opcodes_d_OP_REVERSEBYTES as OP_REVERSEBYTES,
|
|
630
|
+
opcodes_d_OP_RIPEMD160 as OP_RIPEMD160,
|
|
631
|
+
opcodes_d_OP_ROLL as OP_ROLL,
|
|
632
|
+
opcodes_d_OP_ROT as OP_ROT,
|
|
633
|
+
opcodes_d_OP_SHA1 as OP_SHA1,
|
|
634
|
+
opcodes_d_OP_SHA256 as OP_SHA256,
|
|
635
|
+
opcodes_d_OP_SHA3_256 as OP_SHA3_256,
|
|
636
|
+
opcodes_d_OP_SHA512 as OP_SHA512,
|
|
637
|
+
opcodes_d_OP_SIZE as OP_SIZE,
|
|
638
|
+
opcodes_d_OP_SPLIT as OP_SPLIT,
|
|
639
|
+
opcodes_d_OP_SUB as OP_SUB,
|
|
640
|
+
opcodes_d_OP_SWAP as OP_SWAP,
|
|
641
|
+
opcodes_d_OP_TOALTSTACK as OP_TOALTSTACK,
|
|
642
|
+
opcodes_d_OP_TRUE as OP_TRUE,
|
|
643
|
+
opcodes_d_OP_TUCK as OP_TUCK,
|
|
644
|
+
opcodes_d_OP_TXFIELD as OP_TXFIELD,
|
|
645
|
+
opcodes_d_OP_TXHASH as OP_TXHASH,
|
|
646
|
+
opcodes_d_OP_TXLOCKTIME as OP_TXLOCKTIME,
|
|
647
|
+
opcodes_d_OP_VERIFY as OP_VERIFY,
|
|
648
|
+
opcodes_d_OP_WITHIN as OP_WITHIN,
|
|
649
|
+
opcodes_d_OP_XNA_ASSET as OP_XNA_ASSET,
|
|
650
|
+
opcodes_d_TXFIELD_AUTHSCRIPT_COMMITMENT as TXFIELD_AUTHSCRIPT_COMMITMENT,
|
|
651
|
+
opcodes_d_TXFIELD_SCRIPTPUBKEY as TXFIELD_SCRIPTPUBKEY,
|
|
652
|
+
opcodes_d_TXFIELD_VALUE as TXFIELD_VALUE,
|
|
653
|
+
opcodes_d_TXHASH_ALL as TXHASH_ALL,
|
|
654
|
+
opcodes_d_TXHASH_CURRENT_INDEX as TXHASH_CURRENT_INDEX,
|
|
655
|
+
opcodes_d_TXHASH_CURRENT_PREVOUT as TXHASH_CURRENT_PREVOUT,
|
|
656
|
+
opcodes_d_TXHASH_CURRENT_SEQUENCE as TXHASH_CURRENT_SEQUENCE,
|
|
657
|
+
opcodes_d_TXHASH_INPUT_PREVOUTS as TXHASH_INPUT_PREVOUTS,
|
|
658
|
+
opcodes_d_TXHASH_INPUT_SEQUENCES as TXHASH_INPUT_SEQUENCES,
|
|
659
|
+
opcodes_d_TXHASH_LOCKTIME as TXHASH_LOCKTIME,
|
|
660
|
+
opcodes_d_TXHASH_OUTPUTS as TXHASH_OUTPUTS,
|
|
661
|
+
opcodes_d_TXHASH_VERSION as TXHASH_VERSION,
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Pay-to-Public-Key-Hash (P2PKH) scriptPubKey.
|
|
667
|
+
* Layout: OP_DUP OP_HASH160 0x14 <20-byte PKH> OP_EQUALVERIFY OP_CHECKSIG
|
|
668
|
+
*/
|
|
669
|
+
declare function encodeP2PKHScriptPubKey(pubKeyHash: Uint8Array): Uint8Array;
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Native segwit v0 Pay-to-Witness-Public-Key-Hash (P2WPKH) scriptPubKey.
|
|
673
|
+
* Layout: OP_0 0x14 <20-byte HASH160(pubKey)>
|
|
674
|
+
*
|
|
675
|
+
* Callers compute HASH160 externally (e.g. via neurai-key / their crypto
|
|
676
|
+
* stack). This helper only encodes the scriptPubKey once the hash is known.
|
|
677
|
+
*/
|
|
678
|
+
declare function encodeP2WPKHScriptPubKey(pubKeyHash: Uint8Array): Uint8Array;
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Native segwit v0 Pay-to-Witness-Script-Hash (P2WSH) scriptPubKey.
|
|
682
|
+
* Layout: OP_0 0x20 <32-byte SHA256(witnessScript)>
|
|
683
|
+
*
|
|
684
|
+
* This helper takes the SHA256 digest of the witness script directly. The
|
|
685
|
+
* SHA256 is computed externally by the caller's crypto stack (kept out of
|
|
686
|
+
* this library to avoid a hash dependency).
|
|
687
|
+
*/
|
|
688
|
+
declare function encodeP2WSHScriptPubKey(witnessScriptSha256: Uint8Array): Uint8Array;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* AuthScript scriptPubKey + witness-stack builders.
|
|
692
|
+
*
|
|
693
|
+
* AuthScript outputs encode a 32-byte commitment in a witness program:
|
|
694
|
+
* scriptPubKey = OP_n 0x20 <32-byte program>
|
|
695
|
+
*
|
|
696
|
+
* OP_1 generic AuthScript v1 (nc1p… / tnc1p…): any auth type, any witnessScript
|
|
697
|
+
* OP_2 strict PQ v2 (pq1z… / tpq1z…): auth type 0x01, witnessScript OP_TRUE
|
|
698
|
+
* OP_3 strict ECDSA v3 (nq1r… / tnq1r…): auth type 0x02, witnessScript OP_TRUE
|
|
699
|
+
*
|
|
700
|
+
* The witness version is also the first byte of the commitment preimage:
|
|
701
|
+
* tagged_hash("NeuraiAuthScript", version || auth_descriptor || SHA256(witnessScript))
|
|
702
|
+
*
|
|
703
|
+
* The program is `HASH160`/`SHA256` over a descriptor that depends on the
|
|
704
|
+
* `auth_type` byte carried as the first witness-stack element at spend time.
|
|
705
|
+
* This library only assembles the stack; computing the descriptor/commitment
|
|
706
|
+
* and producing the signature live in neurai-key / neurai-sign-transaction.
|
|
707
|
+
*
|
|
708
|
+
* Auth type values (authoritative: Neurai `src/script/interpreter.cpp`,
|
|
709
|
+
* cross-checked against `lib/neurai-key/src/shared/address.ts`):
|
|
710
|
+
*
|
|
711
|
+
* 0x00 NoAuth — no signature; spend gated only by witnessScript
|
|
712
|
+
* 0x01 PQ — ML-DSA-44 signature (post-quantum)
|
|
713
|
+
* 0x02 Legacy — secp256k1 ECDSA signature (classic)
|
|
714
|
+
* 0x03 RefScript — NIP-015 reference-script spend (future)
|
|
715
|
+
*
|
|
716
|
+
* Witness stack (exact order consumed by the interpreter):
|
|
717
|
+
* [ auth_type, sig, pubkey, arg0, ..., argN, witnessScript ]
|
|
718
|
+
*
|
|
719
|
+
* NoAuth and RefScript spends omit the `sig`/`pubkey` items.
|
|
720
|
+
*/
|
|
721
|
+
declare const AUTHSCRIPT_NOAUTH = 0;
|
|
722
|
+
declare const AUTHSCRIPT_PQ = 1;
|
|
723
|
+
declare const AUTHSCRIPT_LEGACY = 2;
|
|
724
|
+
/** NIP-015: reference-script spend mode. Not yet activated in consensus. */
|
|
725
|
+
declare const AUTHSCRIPT_REF = 3;
|
|
726
|
+
type AuthType = typeof AUTHSCRIPT_NOAUTH | typeof AUTHSCRIPT_PQ | typeof AUTHSCRIPT_LEGACY | typeof AUTHSCRIPT_REF;
|
|
727
|
+
/** AuthScript witness version: 1 generic, 2 strict PQ, 3 strict ECDSA. */
|
|
728
|
+
type AuthScriptWitnessVersion = 1 | 2 | 3;
|
|
729
|
+
/**
|
|
730
|
+
* `OP_n 0x20 <program>` for witness version `n`. Defaults to the generic
|
|
731
|
+
* AuthScript v1 (`OP_1`), which is what every covenant commits to.
|
|
732
|
+
*/
|
|
733
|
+
declare function encodeAuthScriptScriptPubKey(program: Uint8Array, witnessVersion?: AuthScriptWitnessVersion): Uint8Array;
|
|
734
|
+
interface AuthScriptWitnessLegacyInput {
|
|
735
|
+
/** DER-encoded secp256k1 signature WITH trailing sighash byte. */
|
|
736
|
+
signature: Uint8Array;
|
|
737
|
+
/** Compressed (33B) or uncompressed (65B) secp256k1 public key. */
|
|
738
|
+
pubKey: Uint8Array;
|
|
739
|
+
/** Additional items consumed by the witnessScript, in bottom-to-top order. */
|
|
740
|
+
args?: Uint8Array[];
|
|
741
|
+
/** The full witnessScript whose hash equals the program of the output. */
|
|
742
|
+
witnessScript: Uint8Array;
|
|
743
|
+
}
|
|
744
|
+
interface AuthScriptWitnessPQInput {
|
|
745
|
+
/** ML-DSA-44 signature (~2421 B) WITH trailing sighash byte. */
|
|
746
|
+
signature: Uint8Array;
|
|
747
|
+
/** Versioned PQ pubkey (1-byte prefix + 1312-byte ML-DSA-44 key ≈ 1313 B). */
|
|
748
|
+
pubKey: Uint8Array;
|
|
749
|
+
args?: Uint8Array[];
|
|
750
|
+
witnessScript: Uint8Array;
|
|
751
|
+
}
|
|
752
|
+
interface AuthScriptWitnessNoAuthInput {
|
|
753
|
+
args?: Uint8Array[];
|
|
754
|
+
witnessScript: Uint8Array;
|
|
755
|
+
}
|
|
756
|
+
interface AuthScriptWitnessRefInput {
|
|
757
|
+
/** Index into tx.vrefin where the reference-script carrier lives. */
|
|
758
|
+
refIndex: number;
|
|
759
|
+
args?: Uint8Array[];
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Build the witness stack for a legacy ECDSA AuthScript spend.
|
|
763
|
+
*
|
|
764
|
+
* Returns an array of raw stack elements. Serialization of the witness
|
|
765
|
+
* (compact-size item count + per-item length-prefixes) is the caller's
|
|
766
|
+
* responsibility — neurai-create-transaction handles it at tx-assembly time.
|
|
767
|
+
*/
|
|
768
|
+
declare function buildAuthScriptWitnessLegacy(input: AuthScriptWitnessLegacyInput): Uint8Array[];
|
|
769
|
+
/**
|
|
770
|
+
* Build the witness stack for a PQ (ML-DSA-44) AuthScript spend.
|
|
771
|
+
* NIP-018 must be active: both signature and pubKey are pushed as single
|
|
772
|
+
* stack elements and may each be up to 3072 B.
|
|
773
|
+
*/
|
|
774
|
+
declare function buildAuthScriptWitnessPQ(input: AuthScriptWitnessPQInput): Uint8Array[];
|
|
775
|
+
/** Length of the versioned ML-DSA-44 pubkey the node expects (0x05 prefix + 1312 B). */
|
|
776
|
+
declare const STRICT_PQ_PUBKEY_LENGTH = 1313;
|
|
777
|
+
/** Version prefix of an ML-DSA-44 pubkey on the witness stack. */
|
|
778
|
+
declare const PQ_PUBKEY_PREFIX = 5;
|
|
779
|
+
interface StrictWitnessPQInput {
|
|
780
|
+
/** ML-DSA-44 signature WITH trailing sighash byte. */
|
|
781
|
+
signature: Uint8Array;
|
|
782
|
+
/** Versioned PQ pubkey: 0x05 prefix + 1312-byte ML-DSA-44 key (1313 B). */
|
|
783
|
+
pubKey: Uint8Array;
|
|
784
|
+
}
|
|
785
|
+
interface StrictWitnessECDSAInput {
|
|
786
|
+
/** DER-encoded secp256k1 signature WITH trailing sighash byte. */
|
|
787
|
+
signature: Uint8Array;
|
|
788
|
+
/** Compressed secp256k1 public key (33 B). */
|
|
789
|
+
pubKey: Uint8Array;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Witness stack for spending a strict PQ witness v2 output (`pq1z…`):
|
|
793
|
+
* exactly `[0x01, sig, pubKey, OP_TRUE]`. The node rejects any other
|
|
794
|
+
* shape (extra arguments, another witnessScript) for the strict families.
|
|
795
|
+
*/
|
|
796
|
+
declare function buildStrictWitnessPQ(input: StrictWitnessPQInput): Uint8Array[];
|
|
797
|
+
/**
|
|
798
|
+
* Witness stack for spending a strict ECDSA witness v3 output (`nq1r…`):
|
|
799
|
+
* exactly `[0x02, sig, pubKey33, OP_TRUE]`. The node rejects uncompressed
|
|
800
|
+
* keys for this family.
|
|
801
|
+
*/
|
|
802
|
+
declare function buildStrictWitnessECDSA(input: StrictWitnessECDSAInput): Uint8Array[];
|
|
803
|
+
/**
|
|
804
|
+
* Build the witness stack for a NoAuth AuthScript spend. The spend is gated
|
|
805
|
+
* by the witnessScript alone (covenants, hash-locks, time-locks, ...); no
|
|
806
|
+
* signature or public key is carried.
|
|
807
|
+
*/
|
|
808
|
+
declare function buildAuthScriptWitnessNoAuth(input: AuthScriptWitnessNoAuthInput): Uint8Array[];
|
|
809
|
+
/**
|
|
810
|
+
* Build the witness stack for a NIP-015 reference-script spend. The last
|
|
811
|
+
* item is the 4-byte little-endian index into `tx.vrefin` that locates the
|
|
812
|
+
* reference-script carrier output; the interpreter resolves the `refScript`
|
|
813
|
+
* from that carrier at validation time.
|
|
814
|
+
*
|
|
815
|
+
* NOTE: NIP-015 is not yet activated in consensus. This builder emits the
|
|
816
|
+
* spec-conformant witness for forward compatibility and testnet experiments.
|
|
817
|
+
*/
|
|
818
|
+
declare function buildAuthScriptWitnessRef(input: AuthScriptWitnessRefInput): Uint8Array[];
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Provably-unspendable OP_RETURN (null-data) output scripts.
|
|
822
|
+
* Layout: OP_RETURN <push> [<push> ...]
|
|
823
|
+
*
|
|
824
|
+
* Neurai inherits the Bitcoin Core standard policy cap of 80 bytes of
|
|
825
|
+
* payload for a relayed null-data output. Outputs over that cap are still
|
|
826
|
+
* consensus-valid but will not be relayed by default mempool policy; use
|
|
827
|
+
* the `allowNonStandard` option to opt in explicitly.
|
|
828
|
+
*/
|
|
829
|
+
declare const NULLDATA_STANDARD_MAX_SIZE = 80;
|
|
830
|
+
interface EncodeNullDataOptions {
|
|
831
|
+
/** Bypass the 80-byte standard-policy cap. Default: false. */
|
|
832
|
+
allowNonStandard?: boolean;
|
|
833
|
+
}
|
|
834
|
+
declare function encodeNullDataScript(payload: Uint8Array | Uint8Array[], options?: EncodeNullDataOptions): Uint8Array;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Classic bare m-of-n multisig via OP_CHECKMULTISIG, plus the P2SH wrapper
|
|
838
|
+
* that is normally used in practice.
|
|
839
|
+
*
|
|
840
|
+
* redeemScript = <m> <pubkey_1> ... <pubkey_n> <n> OP_CHECKMULTISIG
|
|
841
|
+
* P2SH spk = OP_HASH160 0x14 <HASH160(redeemScript)> OP_EQUAL
|
|
842
|
+
*
|
|
843
|
+
* OP_CHECKMULTISIG caps n at 20 pubkeys (see `MAX_PUBKEYS_PER_MULTISIG` in
|
|
844
|
+
* the Neurai interpreter). Bare multisig outputs are still consensus-valid
|
|
845
|
+
* but non-standard for relay; the P2SH wrapping is what mempool accepts.
|
|
846
|
+
*/
|
|
847
|
+
declare const MULTISIG_MAX_PUBKEYS = 20;
|
|
848
|
+
interface MultisigParams {
|
|
849
|
+
/** Number of required signatures (1..n). */
|
|
850
|
+
m: number;
|
|
851
|
+
/** Compressed (33B) or uncompressed (65B) secp256k1 pubkeys, ordered. */
|
|
852
|
+
pubKeys: Uint8Array[];
|
|
853
|
+
}
|
|
854
|
+
declare function encodeMultisigRedeemScript({ m, pubKeys }: MultisigParams): Uint8Array;
|
|
855
|
+
declare function encodeMultisigRedeemScriptHex(params: MultisigParams): string;
|
|
856
|
+
/**
|
|
857
|
+
* P2SH scriptPubKey wrapping any redeem script. Pass the 20-byte HASH160 of
|
|
858
|
+
* the redeem script (RIPEMD160(SHA256(redeemScript))) — compute it
|
|
859
|
+
* externally via the caller's crypto stack.
|
|
860
|
+
*/
|
|
861
|
+
declare function encodeP2SHScriptPubKey(redeemScriptHash160: Uint8Array): Uint8Array;
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Address helpers. Wraps `decodeAddress` from
|
|
865
|
+
* `@neuraiproject/neurai-create-transaction` to produce the exact
|
|
866
|
+
* scriptPubKey bytes a covenant needs to hardcode. The actual
|
|
867
|
+
* scriptPubKey encoders live in `./standard/*`; this module delegates.
|
|
868
|
+
*
|
|
869
|
+
* Every Neurai destination type is supported for the payment output
|
|
870
|
+
* (output[0]):
|
|
871
|
+
* - Legacy P2PKH (base58check) → `76a914<20>88ac`
|
|
872
|
+
* - Generic AuthScript witness v1 (nc1p… / tnc1p…) → `5120<32>`
|
|
873
|
+
* - Strict PQ witness v2 (pq1z… / tpq1z…) → `5220<32>`
|
|
874
|
+
* - Strict ECDSA witness v3 (nq1r… / tnq1r…) → `5320<32>`
|
|
875
|
+
*/
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* `authscript` is the generic witness v1; `pq` and `ecdsa` are the strict
|
|
879
|
+
* witness v2 and v3 families.
|
|
880
|
+
*/
|
|
881
|
+
type SellerAddressKind = 'p2pkh' | 'authscript' | 'pq' | 'ecdsa';
|
|
882
|
+
interface SellerScriptPubKey {
|
|
883
|
+
kind: SellerAddressKind;
|
|
884
|
+
/** Witness version of an AuthScript destination (1, 2 or 3). */
|
|
885
|
+
witnessVersion?: AuthScriptWitnessVersion;
|
|
886
|
+
/** Raw scriptPubKey bytes that output[0] of a fill tx must equal. */
|
|
887
|
+
bytes: Uint8Array;
|
|
888
|
+
/**
|
|
889
|
+
* Address-specific hash: 20-byte PKH for P2PKH, 32-byte program for
|
|
890
|
+
* AuthScript. Used by the cancel branch (either as the HASH160 target or
|
|
891
|
+
* as the SHA256(pubKey) commitment).
|
|
892
|
+
*/
|
|
893
|
+
hash: Uint8Array;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Resolve any accepted seller address string into its scriptPubKey.
|
|
898
|
+
* The returned bytes are what the covenant will hardcode and later verify
|
|
899
|
+
* via `OP_OUTPUTSCRIPT == <bytes>`.
|
|
900
|
+
*/
|
|
901
|
+
declare function encodeSellerScriptPubKey(address: string): SellerScriptPubKey;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Asset-transfer wrapper split helper.
|
|
905
|
+
*
|
|
906
|
+
* Neurai asset UTXOs have a scriptPubKey of the form
|
|
907
|
+
*
|
|
908
|
+
* <prefix scriptPubKey bytes> OP_XNA_ASSET <pushdata(payload)> OP_DROP
|
|
909
|
+
*
|
|
910
|
+
* where `prefix` is the recipient's standard script (typically a P2PKH, an
|
|
911
|
+
* AuthScript `OP_1`/`OP_2`/`OP_3` witness program, or a bare covenant such
|
|
912
|
+
* as the partial-fill sell order), and `payload` serializes a `CAssetTransfer`:
|
|
913
|
+
*
|
|
914
|
+
* payload = marker ("rvn" 0x72 0x76 0x6e | "xna" 0x78 0x6e 0x61)
|
|
915
|
+
* || type_marker (0x74 transfer)
|
|
916
|
+
* || VarStr(assetName)
|
|
917
|
+
* || int64LE(amountRaw)
|
|
918
|
+
* [ || messageRef (optional) || int64LE(expireTime) (optional) ]
|
|
919
|
+
*
|
|
920
|
+
* NIP-040: mainnet still emits the Ravencoin-inherited "rvn" marker;
|
|
921
|
+
* testnet/regtest emit "xna" after activation. Both are accepted when
|
|
922
|
+
* reading — the detected marker is surfaced on the parsed payload.
|
|
923
|
+
*
|
|
924
|
+
* This helper separates the two halves so consumers can validate the prefix
|
|
925
|
+
* (e.g. feed it to `parsePartialFillScript`) while independently reading the
|
|
926
|
+
* asset data displayed to the user. The optional payload tail
|
|
927
|
+
* (`message` + `expireTime`) is tolerated but not exposed — the first
|
|
928
|
+
* version only needs `assetName` and `amountRaw`.
|
|
929
|
+
*
|
|
930
|
+
* Bare (non-wrapped) scriptPubKeys round-trip through this helper by
|
|
931
|
+
* returning `prefixHex === input` and `assetTransfer === null`.
|
|
932
|
+
*/
|
|
933
|
+
/** NIP-040 asset payload marker: legacy `rvn` or post-activation `xna`. */
|
|
934
|
+
type AssetMarker = 'rvn' | 'xna';
|
|
935
|
+
interface AssetTransferPayload {
|
|
936
|
+
/** ASCII asset name as declared in the VarStr field. */
|
|
937
|
+
assetName: string;
|
|
938
|
+
/** Raw satoshi-scaled amount from the int64LE field. Display units = raw / 1e8. */
|
|
939
|
+
amountRaw: bigint;
|
|
940
|
+
/** Marker detected at the start of the payload (`rvn` | `xna`). */
|
|
941
|
+
marker: AssetMarker;
|
|
942
|
+
/** Hex of the full payload bytes (starting at the marker magic, ending at
|
|
943
|
+
* the last byte before OP_DROP). Includes optional tail when present. */
|
|
944
|
+
payloadHex: string;
|
|
945
|
+
}
|
|
946
|
+
interface SplitAssetWrappedResult {
|
|
947
|
+
/** Bytes of the scriptPubKey BEFORE the OP_XNA_ASSET wrapper, hex. Equal
|
|
948
|
+
* to the input when the script carries no asset wrapper. */
|
|
949
|
+
prefixHex: string;
|
|
950
|
+
/** Parsed asset-transfer data, or null if the input has no asset wrapper. */
|
|
951
|
+
assetTransfer: AssetTransferPayload | null;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Parse an asset-transfer-wrapped scriptPubKey. Accepts both wrapped and
|
|
955
|
+
* bare forms. Throws on structural malformation (truncated pushdata,
|
|
956
|
+
* missing OP_DROP after payload, bad magic, unsupported pushdata width).
|
|
957
|
+
*/
|
|
958
|
+
declare function splitAssetWrappedScriptPubKey(spkHex: string): SplitAssetWrappedResult;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Partial-Fill Sell Order covenant script (three-branch).
|
|
962
|
+
*
|
|
963
|
+
* The covenant has three branches selected by the top of the unlock stack:
|
|
964
|
+
*
|
|
965
|
+
* OP_IF ← Cancel: seller signs, recovers remainder.
|
|
966
|
+
* OP_ELSE OP_IF ← Full fill: buyer drains the covenant entirely.
|
|
967
|
+
* No continuation output is required.
|
|
968
|
+
* OP_ELSE OP_ELSE ← Partial fill: buyer takes N < total. A
|
|
969
|
+
* continuation UTXO at vout[2] preserves the
|
|
970
|
+
* covenant with amount = total - N.
|
|
971
|
+
*
|
|
972
|
+
* Output layout:
|
|
973
|
+
*
|
|
974
|
+
* output[0] = XNA payment to seller (value >= N * unitPriceSats)
|
|
975
|
+
* output[1] = asset to buyer (tokenId, amount == N)
|
|
976
|
+
* output[2] = covenant continuation (only for partial fill;
|
|
977
|
+
* same AuthScript commitment,
|
|
978
|
+
* amount == inputAmount - N)
|
|
979
|
+
* output[3+] = optional buyer change (not constrained by the covenant)
|
|
980
|
+
*
|
|
981
|
+
* Continuity — the remainder UTXO reuses the spent covenant's AuthScript v1
|
|
982
|
+
* commitment via `OP_OUTPUTAUTHCOMMITMENT(2) == OP_TXFIELD(0x02)` (NIP-023).
|
|
983
|
+
* Comparing commitments rather than full scriptPubKeys is mandatory because
|
|
984
|
+
* the remainder's asset wrapper carries a different `amountRaw` than the
|
|
985
|
+
* spent UTXO's wrapper.
|
|
986
|
+
*
|
|
987
|
+
* Unlock stack shapes (scriptSig pushes, top → bottom):
|
|
988
|
+
*
|
|
989
|
+
* Cancel: <sig> <pubkey> <1>
|
|
990
|
+
* Full fill: <1> <0> (full-flag=1, cancel-flag=0)
|
|
991
|
+
* Partial fill: <N> <0> <0> (N, full-flag=0, cancel-flag=0)
|
|
992
|
+
*
|
|
993
|
+
* The cancel branch uses classical ECDSA (`OP_HASH160 + OP_CHECKSIG`) and
|
|
994
|
+
* commits to a 20-byte PKH — this variant only accepts legacy P2PKH
|
|
995
|
+
* addresses as the seller destination. For AuthScript bech32m destinations
|
|
996
|
+
* and post-quantum signing, use `buildPartialFillScriptPQ`.
|
|
997
|
+
*/
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Build the `scriptPubKey` of a Partial-Fill Sell Order covenant UTXO.
|
|
1001
|
+
* Returns raw bytes; wrap with `bytesToHex` for wire format.
|
|
1002
|
+
*/
|
|
1003
|
+
declare function buildPartialFillScript(params: PartialFillOrderParams): Uint8Array;
|
|
1004
|
+
/** Hex convenience wrapper for `buildPartialFillScript`. */
|
|
1005
|
+
declare function buildPartialFillScriptHex(params: PartialFillOrderParams): string;
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* PQ (post-quantum) variant of the Partial-Fill Sell Order covenant.
|
|
1009
|
+
*
|
|
1010
|
+
* Identical fill branches (full + partial) to the legacy covenant, but the
|
|
1011
|
+
* **cancel** branch accepts an ML-DSA-44 signature instead of an ECDSA one.
|
|
1012
|
+
* This requires:
|
|
1013
|
+
* - `SCRIPT_VERIFY_CHECKSIGFROMSTACK` (for OP_CSFS) active
|
|
1014
|
+
* - `SCRIPT_VERIFY_TXHASH` (for OP_TXHASH) active
|
|
1015
|
+
* - NIP-18 (`MAX_PQ_SCRIPT_ELEMENT_SIZE = 3072`) active, so the ~2.4 KB
|
|
1016
|
+
* signature and ~1.3 KB pubkey can be pushed to the script stack
|
|
1017
|
+
*
|
|
1018
|
+
* All three are active on DePIN-Test testnet.
|
|
1019
|
+
*
|
|
1020
|
+
* Cancel-branch flow (scriptSig pushes `<sig> <pubkey> OP_1`):
|
|
1021
|
+
*
|
|
1022
|
+
* 1. OP_DUP OP_SHA256 <commitment> OP_EQUALVERIFY → pubkey matches
|
|
1023
|
+
* 2. <selector> OP_TXHASH → message = H(tx)
|
|
1024
|
+
* 3. OP_SWAP OP_CHECKSIGFROMSTACK → CSFS verifies sig
|
|
1025
|
+
*
|
|
1026
|
+
* The message that gets signed is **SHA256(OP_TXHASH(selector))** — CSFS
|
|
1027
|
+
* single-SHA256s its message argument before verification, and OP_TXHASH
|
|
1028
|
+
* produces its own 32-byte hash, so the seller computes:
|
|
1029
|
+
* `sign(pqSeckey, SHA256(doubleSHA256(selected_tx_fields)))`
|
|
1030
|
+
*
|
|
1031
|
+
* Fill branches are identical in structure to the legacy variant — see
|
|
1032
|
+
* `./script.ts` for the three-branch layout description.
|
|
1033
|
+
*/
|
|
1034
|
+
|
|
1035
|
+
declare const DEFAULT_PQ_TXHASH_SELECTOR = 255;
|
|
1036
|
+
/**
|
|
1037
|
+
* Build the scriptPubKey of a PQ Partial-Fill Sell Order covenant UTXO.
|
|
1038
|
+
*/
|
|
1039
|
+
declare function buildPartialFillScriptPQ(params: PartialFillOrderPQParams): Uint8Array;
|
|
1040
|
+
declare function buildPartialFillScriptPQHex(params: PartialFillOrderPQParams): string;
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* scriptSig builders for the Partial-Fill Sell Order covenant.
|
|
1044
|
+
*
|
|
1045
|
+
* These return the raw scriptSig bytes that unlock the covenant UTXO. The
|
|
1046
|
+
* surrounding transaction (inputs, outputs, fees, signatures on the buyer's
|
|
1047
|
+
* own inputs, etc.) is the caller's responsibility — stitch them together
|
|
1048
|
+
* with `@neuraiproject/neurai-create-transaction`.
|
|
1049
|
+
*/
|
|
1050
|
+
/**
|
|
1051
|
+
* Unlock the covenant via the public fill branches.
|
|
1052
|
+
*
|
|
1053
|
+
* amount === total → full-fill branch. The entire covenant drains to
|
|
1054
|
+
* vout[1]; no vout[2] continuation is emitted.
|
|
1055
|
+
* amount < total → partial-fill branch. vout[2] re-locks the
|
|
1056
|
+
* continuation (`total - amount` units).
|
|
1057
|
+
*
|
|
1058
|
+
* Unlock stack shapes (pushed bottom → top):
|
|
1059
|
+
*
|
|
1060
|
+
* Full fill: <1> <0> ( full-flag=1, cancel-flag=0 )
|
|
1061
|
+
* Partial fill: <N> <0> <0> ( N, full-flag=0, cancel-flag=0 )
|
|
1062
|
+
*
|
|
1063
|
+
* @param amount units the buyer is taking. Must be > 0 and ≤ total.
|
|
1064
|
+
* @param total current asset amount locked in the covenant UTXO. The
|
|
1065
|
+
* builder reads this to decide whether to emit the full-fill
|
|
1066
|
+
* or partial-fill witness — consensus uses `OP_INPUTASSETFIELD`
|
|
1067
|
+
* inside the covenant to check it independently, so the value
|
|
1068
|
+
* passed here must match on-chain reality or the script fails.
|
|
1069
|
+
*/
|
|
1070
|
+
declare function buildFillScriptSig(amount: bigint, total: bigint): Uint8Array;
|
|
1071
|
+
declare function buildFillScriptSigHex(amount: bigint, total: bigint): string;
|
|
1072
|
+
/**
|
|
1073
|
+
* Unlock the covenant via the seller's cancel branch.
|
|
1074
|
+
*
|
|
1075
|
+
* Stack before OP_IF (top → bottom):
|
|
1076
|
+
* 1 ← selects the OP_IF branch
|
|
1077
|
+
* pubkey ← consumed by OP_DUP OP_HASH160 … OP_EQUALVERIFY
|
|
1078
|
+
* sig ← consumed by OP_CHECKSIG
|
|
1079
|
+
*
|
|
1080
|
+
* so the scriptSig pushes `<sig> <pubkey> <1>`.
|
|
1081
|
+
*
|
|
1082
|
+
* The signature is on whatever sighash the caller picked; this builder does
|
|
1083
|
+
* not hash or sign, it only assembles the unlock script once a signature is
|
|
1084
|
+
* available.
|
|
1085
|
+
*/
|
|
1086
|
+
declare function buildCancelScriptSig(signatureDer: Uint8Array, pubKey: Uint8Array): Uint8Array;
|
|
1087
|
+
declare function buildCancelScriptSigHex(signatureDer: Uint8Array, pubKey: Uint8Array): string;
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* scriptSig builders for the PQ Partial-Fill Sell Order covenant.
|
|
1091
|
+
*
|
|
1092
|
+
* The fill branch is identical to the legacy variant (just pushes `<N> <0>`),
|
|
1093
|
+
* so callers reuse `buildFillScriptSig` from `./spend.ts`. Only the cancel
|
|
1094
|
+
* branch is different: it carries a full PQ pubkey (~1313 B) and signature
|
|
1095
|
+
* (~2421 B), which requires NIP-18's expanded element-size cap.
|
|
1096
|
+
*/
|
|
1097
|
+
/**
|
|
1098
|
+
* Build the scriptSig that unlocks the PQ cancel branch.
|
|
1099
|
+
*
|
|
1100
|
+
* Stack ordering pushed (bottom → top): `sig, pubkey, 1`.
|
|
1101
|
+
*
|
|
1102
|
+
* @param sigPQ ML-DSA-44 signature over `SHA256(OP_TXHASH(selector))`,
|
|
1103
|
+
* **with trailing sighash byte appended** (same convention as
|
|
1104
|
+
* OP_CHECKSIG — CSFS strips it before verification). Expected
|
|
1105
|
+
* length 2421 bytes for ML-DSA-44.
|
|
1106
|
+
* @param pubKey Versioned PQ public key bytes, 1313 bytes (1-byte prefix
|
|
1107
|
+
* + 1312-byte ML-DSA-44 key). Must hash (via SHA256) to the
|
|
1108
|
+
* `pubKeyCommitment` embedded in the covenant scriptPubKey.
|
|
1109
|
+
*/
|
|
1110
|
+
declare function buildCancelScriptSigPQ(sigPQ: Uint8Array, pubKey: Uint8Array): Uint8Array;
|
|
1111
|
+
declare function buildCancelScriptSigPQHex(sigPQ: Uint8Array, pubKey: Uint8Array): string;
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* Witness-stack builders for the Partial-Fill Sell Order covenant.
|
|
1115
|
+
*
|
|
1116
|
+
* When the covenant lives behind an AuthScript commitment (the only
|
|
1117
|
+
* asset-compatible deployment since the node's OP_XNA_ASSET placement rules
|
|
1118
|
+
* — bare covenant outputs can no longer carry assets), the unlock data goes
|
|
1119
|
+
* in the witness, not the scriptSig. The scriptSig builders in `spend.ts`
|
|
1120
|
+
* return a serialized script that PUSHES the elements; a witness needs the
|
|
1121
|
+
* elements THEMSELVES, one per stack slot, so those blobs cannot be reused
|
|
1122
|
+
* as a single `args` entry.
|
|
1123
|
+
*
|
|
1124
|
+
* These builders return the raw `args` stack (bottom → top), mirroring the
|
|
1125
|
+
* shapes documented in `spend.ts`:
|
|
1126
|
+
*
|
|
1127
|
+
* Full fill: [ <1>, <0> ]
|
|
1128
|
+
* Partial fill: [ <N>, <0>, <0> ]
|
|
1129
|
+
* Cancel: [ <sig>, <pubkey>, <1> ]
|
|
1130
|
+
*
|
|
1131
|
+
* Numbers are minimal CScriptNum stack values (0 = empty element). Wrap the
|
|
1132
|
+
* result with `buildAuthScriptWitnessNoAuth({ args, witnessScript: covenant })`
|
|
1133
|
+
* (from `standard/authscript.ts`) to get the final `[0x00, ...args, covenant]`
|
|
1134
|
+
* witness, and serialize the spending transaction with
|
|
1135
|
+
* `serializeTransaction` from `@neuraiproject/neurai-create-transaction`
|
|
1136
|
+
* (0.5.1+, witness elements as hex strings: `witness.map(bytesToHex)`).
|
|
1137
|
+
*/
|
|
1138
|
+
/**
|
|
1139
|
+
* Witness `args` for the public fill branches. Same semantics and
|
|
1140
|
+
* validations as `buildFillScriptSig`.
|
|
1141
|
+
*/
|
|
1142
|
+
declare function buildFillWitnessStack(amount: bigint, total: bigint): Uint8Array[];
|
|
1143
|
+
/**
|
|
1144
|
+
* Witness `args` for the seller's ECDSA cancel branch. Same semantics and
|
|
1145
|
+
* validations as `buildCancelScriptSig`.
|
|
1146
|
+
*/
|
|
1147
|
+
declare function buildCancelWitnessStack(signatureDer: Uint8Array, pubKey: Uint8Array): Uint8Array[];
|
|
1148
|
+
/**
|
|
1149
|
+
* Witness `args` for the seller's PQ (ML-DSA-44) cancel branch. Same
|
|
1150
|
+
* semantics and validations as `buildCancelScriptSigPQ`.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function buildCancelWitnessStackPQ(sigPQ: Uint8Array, pubKey: Uint8Array): Uint8Array[];
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Parser for the Partial-Fill Sell Order covenant (three-branch).
|
|
1156
|
+
*
|
|
1157
|
+
* Extracts `(sellerPubKeyHash, unitPriceSats, tokenId)` from a scriptPubKey
|
|
1158
|
+
* that was produced by `buildPartialFillScript`. Walks the exact byte
|
|
1159
|
+
* layout emitted by the builder and fails on any deviation — this is
|
|
1160
|
+
* deliberate, so a downstream indexer can unambiguously classify a UTXO as
|
|
1161
|
+
* "partial-fill order" or "unknown script" with no false positives.
|
|
1162
|
+
*
|
|
1163
|
+
* The full-fill and partial-fill branches share `(sellerScriptPubKey,
|
|
1164
|
+
* unitPriceSats, tokenId)`. The parser reads both branches and verifies
|
|
1165
|
+
* consistency; inconsistency throws.
|
|
1166
|
+
*/
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Parse a covenant scriptPubKey and extract its parameters. Throws with a
|
|
1170
|
+
* descriptive message if the bytes don't match the partial-fill template.
|
|
1171
|
+
*/
|
|
1172
|
+
declare function parsePartialFillScript(script: Uint8Array | string, network?: Network): ParsedPartialFillOrder;
|
|
1173
|
+
|
|
1174
|
+
/**
|
|
1175
|
+
* Parser for the PQ Partial-Fill Sell Order covenant (three-branch).
|
|
1176
|
+
* Returns the same economic parameters as the legacy parser, plus the
|
|
1177
|
+
* payment scriptPubKey bytes (which may be P2PKH or AuthScript) and the
|
|
1178
|
+
* configured TXHASH selector.
|
|
1179
|
+
*
|
|
1180
|
+
* The full-fill and partial-fill branches share `(paymentScriptPubKey,
|
|
1181
|
+
* unitPriceSats, tokenId)`. The parser reads both branches and verifies
|
|
1182
|
+
* consistency; inconsistency throws.
|
|
1183
|
+
*/
|
|
1184
|
+
|
|
1185
|
+
/** Quick discriminator without throwing — useful for indexers. */
|
|
1186
|
+
declare function isPartialFillScriptPQ(script: Uint8Array | string): boolean;
|
|
1187
|
+
/**
|
|
1188
|
+
* Parse a PQ partial-fill covenant. Throws if the bytes do not match the
|
|
1189
|
+
* exact layout produced by `buildPartialFillScriptPQ`.
|
|
1190
|
+
*/
|
|
1191
|
+
declare function parsePartialFillScriptPQ(script: Uint8Array | string, network?: Network): ParsedPartialFillOrderPQ;
|
|
1192
|
+
|
|
1193
|
+
export { AUTHSCRIPT_LEGACY, AUTHSCRIPT_NOAUTH, AUTHSCRIPT_PQ, AUTHSCRIPT_REF, DEFAULT_PQ_TXHASH_SELECTOR, MULTISIG_MAX_PUBKEYS, NULLDATA_STANDARD_MAX_SIZE, PQ_PUBKEY_PREFIX, STRICT_PQ_PUBKEY_LENGTH, ScriptBuilder, buildAuthScriptWitnessLegacy, buildAuthScriptWitnessNoAuth, buildAuthScriptWitnessPQ, buildAuthScriptWitnessRef, buildCancelScriptSig, buildCancelScriptSigHex, buildCancelScriptSigPQ, buildCancelScriptSigPQHex, buildCancelWitnessStack, buildCancelWitnessStackPQ, buildFillScriptSig, buildFillScriptSigHex, buildFillWitnessStack, buildPartialFillScript, buildPartialFillScriptHex, buildPartialFillScriptPQ, buildPartialFillScriptPQHex, buildStrictWitnessECDSA, buildStrictWitnessPQ, bytesEqual, bytesToHex, concatBytes, encodeAuthScriptScriptPubKey, encodeMultisigRedeemScript, encodeMultisigRedeemScriptHex, encodeNullDataScript, encodeP2PKHScriptPubKey, encodeP2SHScriptPubKey, encodeP2WPKHScriptPubKey, encodeP2WSHScriptPubKey, encodeScriptNum, encodeSellerScriptPubKey, ensureHex, hexToBytes, isPartialFillScriptPQ, opcodes_d as opcodes, parsePartialFillScript, parsePartialFillScriptPQ, pushBytes, pushHex, pushInt, splitAssetWrappedScriptPubKey };
|
|
1194
|
+
export type { AssetMarker, AssetTransferPayload, AuthScriptWitnessLegacyInput, AuthScriptWitnessNoAuthInput, AuthScriptWitnessPQInput, AuthScriptWitnessRefInput, AuthScriptWitnessVersion, AuthType, EncodeNullDataOptions, MultisigParams, Network, OrderUtxo, ParsedPartialFillOrder, ParsedPartialFillOrderPQ, PartialFillExpiration, PartialFillExpirationMode, PartialFillOrderPQParams, PartialFillOrderParams, SellerAddressKind, SellerScriptPubKey, SplitAssetWrappedResult, StrictWitnessECDSAInput, StrictWitnessPQInput, TxInputRef };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuraiproject/neurai-scripts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Script-assembly library for Neurai: opcode constants, ScriptBuilder, standard scripts (P2PKH, P2WPKH, P2WSH, AuthScript, multisig, OP_RETURN) and covenants (partial-fill sell orders, legacy + PQ) targeting the DePIN-Test opcode set",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -9,9 +9,14 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
15
20
|
},
|
|
16
21
|
"./browser": {
|
|
17
22
|
"types": "./dist/index.d.ts",
|
|
@@ -27,11 +32,13 @@
|
|
|
27
32
|
"access": "public"
|
|
28
33
|
},
|
|
29
34
|
"scripts": {
|
|
30
|
-
"build": "tsc -p tsconfig.json && rollup -c rollup.config.mjs",
|
|
35
|
+
"build": "tsc -p tsconfig.json && rollup -c rollup.config.mjs && rollup -c rollup.dts.config.mjs",
|
|
31
36
|
"build:ts": "tsc -p tsconfig.json",
|
|
32
37
|
"prepack": "npm run build",
|
|
33
38
|
"prepublishOnly": "npm run build",
|
|
34
|
-
"test": "npm run build && vitest run",
|
|
39
|
+
"test": "npm run build && vitest run && npm run test:types",
|
|
40
|
+
"test:types": "tsc -p tsconfig.types.json && tsc -p tsconfig.types-node16.json && tsc -p tsconfig.types-bundler.json",
|
|
41
|
+
"test:package": "npm run build && node scripts/check-package.mjs",
|
|
35
42
|
"test:run": "vitest run",
|
|
36
43
|
"test:watch": "vitest"
|
|
37
44
|
},
|
|
@@ -66,6 +73,7 @@
|
|
|
66
73
|
"bech32": "^2.0.0",
|
|
67
74
|
"bs58check": "^4.0.0",
|
|
68
75
|
"rollup": "^4.52.4",
|
|
76
|
+
"rollup-plugin-dts": "^6.5.1",
|
|
69
77
|
"typescript": "^5.9.3",
|
|
70
78
|
"vitest": "^4.1.11"
|
|
71
79
|
}
|