@neuraiproject/neurai-scripts 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -24
- package/dist/NeuraiScripts.global.js +343 -476
- package/dist/NeuraiScripts.global.js.map +1 -1
- package/dist/browser.js +343 -476
- package/dist/browser.js.map +1 -1
- package/dist/core/opcodes.d.ts +12 -1
- package/dist/core/script-parser.d.ts +3 -10
- package/dist/covenants/partial-fill/fill-branches.d.ts +74 -0
- package/dist/covenants/partial-fill/parse-pq.d.ts +2 -3
- package/dist/covenants/partial-fill/parse.d.ts +8 -10
- package/dist/covenants/partial-fill/script-pq.d.ts +5 -5
- package/dist/covenants/partial-fill/script.d.ts +9 -10
- package/dist/index.cjs +343 -476
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -45
- package/dist/index.js +343 -476
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +35 -15
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -45,17 +45,35 @@ interface PartialFillExpiration {
|
|
|
45
45
|
*/
|
|
46
46
|
value: bigint;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Seller of an ECDSA-cancel order, in one of two forms:
|
|
50
|
+
* - `sellerAddress` alone: a legacy P2PKH address that is both the
|
|
51
|
+
* payment destination and the cancel key hash;
|
|
52
|
+
* - `paymentAddress` with `sellerPubKeyHash`: any payment destination
|
|
53
|
+
* and the HASH160 of the secp256k1 key that may cancel. This is the
|
|
54
|
+
* form for a strict ECDSA v3 (`nq1r…`) seller, whose address program is
|
|
55
|
+
* a commitment and not a key hash.
|
|
56
|
+
* Passing both forms, or neither, throws.
|
|
57
|
+
*/
|
|
48
58
|
interface PartialFillOrderParams {
|
|
49
59
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
* Legacy P2PKH seller (base58check, "t..." on testnet, "N..." on
|
|
61
|
+
* mainnet). Its 20-byte PKH is hardcoded as the cancel key hash and the
|
|
62
|
+
* payment output must be the P2PKH script of that same PKH. Bech32m
|
|
63
|
+
* addresses are rejected here: use `paymentAddress` + `sellerPubKeyHash`.
|
|
64
|
+
*/
|
|
65
|
+
sellerAddress?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Destination for the XNA payment: legacy P2PKH, generic AuthScript v1
|
|
68
|
+
* (`nc1p…`), strict PQ v2 (`pq1z…`) or strict ECDSA v3 (`nq1r…`). The
|
|
69
|
+
* covenant hardcodes its full scriptPubKey. Requires `sellerPubKeyHash`.
|
|
70
|
+
*/
|
|
71
|
+
paymentAddress?: string;
|
|
72
|
+
/**
|
|
73
|
+
* HASH160 of the compressed secp256k1 public key allowed to cancel the
|
|
74
|
+
* order (20 bytes). Requires `paymentAddress`.
|
|
57
75
|
*/
|
|
58
|
-
|
|
76
|
+
sellerPubKeyHash?: Uint8Array;
|
|
59
77
|
/** Name of the asset being sold (e.g. "CAT"). */
|
|
60
78
|
tokenId: string;
|
|
61
79
|
/**
|
|
@@ -78,11 +96,13 @@ interface ParsedPartialFillOrder {
|
|
|
78
96
|
/** Network the parser was invoked with (used for downstream address formatting). */
|
|
79
97
|
network: Network;
|
|
80
98
|
/**
|
|
81
|
-
*
|
|
82
|
-
* branch.
|
|
83
|
-
*
|
|
99
|
+
* 20-byte HASH160 of the key allowed to cancel, extracted from the
|
|
100
|
+
* covenant's cancel branch. It equals the payment P2PKH hash only for
|
|
101
|
+
* orders built with `sellerAddress`.
|
|
84
102
|
*/
|
|
85
103
|
sellerPubKeyHash: Uint8Array;
|
|
104
|
+
/** scriptPubKey bytes embedded in the covenant for the payment output. */
|
|
105
|
+
paymentScriptPubKey: Uint8Array;
|
|
86
106
|
/** Asset name parsed from the covenant. */
|
|
87
107
|
tokenId: string;
|
|
88
108
|
/** Unit price parsed from the covenant, in XNA satoshis. */
|
|
@@ -136,10 +156,10 @@ interface PartialFillOrderPQParams {
|
|
|
136
156
|
/** Price in XNA satoshis per indivisible unit of the asset. */
|
|
137
157
|
unitPriceSats: bigint;
|
|
138
158
|
/**
|
|
139
|
-
* OP_TXHASH selector
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
159
|
+
* NIP-042 OP_TXHASH selector bound into the script as exactly two
|
|
160
|
+
* little-endian bytes. Default `0x1ff` commits all nine fields, including
|
|
161
|
+
* reference inputs. The seller signs `SHA256(OP_TXHASH(selector))` with
|
|
162
|
+
* their PQ key at cancel time.
|
|
143
163
|
*/
|
|
144
164
|
txHashSelector?: number;
|
|
145
165
|
/**
|
|
@@ -348,12 +368,16 @@ declare const CHAINCONTEXT_HEIGHT = 1;
|
|
|
348
368
|
declare const CHAINCONTEXT_MTP = 2;
|
|
349
369
|
declare const CHAINCONTEXT_CHAIN_ID = 3;
|
|
350
370
|
declare const OP_CHECKMERKLEINCLUSION = 193;
|
|
371
|
+
declare const OP_OUTPUTAUTHDEST = 194;
|
|
372
|
+
declare const OP_ZKVERIFY = 195;
|
|
373
|
+
declare const OP_INPUTFIELD = 196;
|
|
351
374
|
declare const OP_CAT = 126;
|
|
352
375
|
declare const OP_SPLIT = 183;
|
|
353
376
|
declare const OP_REVERSEBYTES = 188;
|
|
354
377
|
declare const TXFIELD_VALUE = 1;
|
|
355
378
|
declare const TXFIELD_AUTHSCRIPT_COMMITMENT = 2;
|
|
356
379
|
declare const TXFIELD_SCRIPTPUBKEY = 3;
|
|
380
|
+
declare const TXFIELD_AUTHDEST = 4;
|
|
357
381
|
declare const TXHASH_VERSION = 1;
|
|
358
382
|
declare const TXHASH_LOCKTIME = 2;
|
|
359
383
|
declare const TXHASH_INPUT_PREVOUTS = 4;
|
|
@@ -362,7 +386,8 @@ declare const TXHASH_OUTPUTS = 16;
|
|
|
362
386
|
declare const TXHASH_CURRENT_PREVOUT = 32;
|
|
363
387
|
declare const TXHASH_CURRENT_SEQUENCE = 64;
|
|
364
388
|
declare const TXHASH_CURRENT_INDEX = 128;
|
|
365
|
-
declare const
|
|
389
|
+
declare const TXHASH_REFINPUTS = 256;
|
|
390
|
+
declare const TXHASH_ALL = 511;
|
|
366
391
|
declare const ASSETFIELD_NAME = 1;
|
|
367
392
|
declare const ASSETFIELD_AMOUNT = 2;
|
|
368
393
|
declare const ASSETFIELD_UNITS = 3;
|
|
@@ -370,10 +395,17 @@ declare const ASSETFIELD_REISSUABLE = 4;
|
|
|
370
395
|
declare const ASSETFIELD_HAS_IPFS = 5;
|
|
371
396
|
declare const ASSETFIELD_IPFS_HASH = 6;
|
|
372
397
|
declare const ASSETFIELD_TYPE = 7;
|
|
398
|
+
declare const ASSETFIELD_MESSAGE = 8;
|
|
399
|
+
declare const MERKLE_SCHEME_BITCOIN_NEURAI = 1;
|
|
400
|
+
declare const MERKLE_SCHEME_SHA256_PLAIN = 2;
|
|
401
|
+
declare const MERKLE_SCHEME_KECCAK256_PLAIN = 3;
|
|
402
|
+
declare const MERKLE_SCHEME_BLAKE2B_PLAIN = 4;
|
|
403
|
+
declare const MERKLE_SCHEME_POSEIDON_BN254 = 5;
|
|
373
404
|
|
|
374
405
|
declare const opcodes_d_ASSETFIELD_AMOUNT: typeof ASSETFIELD_AMOUNT;
|
|
375
406
|
declare const opcodes_d_ASSETFIELD_HAS_IPFS: typeof ASSETFIELD_HAS_IPFS;
|
|
376
407
|
declare const opcodes_d_ASSETFIELD_IPFS_HASH: typeof ASSETFIELD_IPFS_HASH;
|
|
408
|
+
declare const opcodes_d_ASSETFIELD_MESSAGE: typeof ASSETFIELD_MESSAGE;
|
|
377
409
|
declare const opcodes_d_ASSETFIELD_NAME: typeof ASSETFIELD_NAME;
|
|
378
410
|
declare const opcodes_d_ASSETFIELD_REISSUABLE: typeof ASSETFIELD_REISSUABLE;
|
|
379
411
|
declare const opcodes_d_ASSETFIELD_TYPE: typeof ASSETFIELD_TYPE;
|
|
@@ -381,6 +413,11 @@ declare const opcodes_d_ASSETFIELD_UNITS: typeof ASSETFIELD_UNITS;
|
|
|
381
413
|
declare const opcodes_d_CHAINCONTEXT_CHAIN_ID: typeof CHAINCONTEXT_CHAIN_ID;
|
|
382
414
|
declare const opcodes_d_CHAINCONTEXT_HEIGHT: typeof CHAINCONTEXT_HEIGHT;
|
|
383
415
|
declare const opcodes_d_CHAINCONTEXT_MTP: typeof CHAINCONTEXT_MTP;
|
|
416
|
+
declare const opcodes_d_MERKLE_SCHEME_BITCOIN_NEURAI: typeof MERKLE_SCHEME_BITCOIN_NEURAI;
|
|
417
|
+
declare const opcodes_d_MERKLE_SCHEME_BLAKE2B_PLAIN: typeof MERKLE_SCHEME_BLAKE2B_PLAIN;
|
|
418
|
+
declare const opcodes_d_MERKLE_SCHEME_KECCAK256_PLAIN: typeof MERKLE_SCHEME_KECCAK256_PLAIN;
|
|
419
|
+
declare const opcodes_d_MERKLE_SCHEME_POSEIDON_BN254: typeof MERKLE_SCHEME_POSEIDON_BN254;
|
|
420
|
+
declare const opcodes_d_MERKLE_SCHEME_SHA256_PLAIN: typeof MERKLE_SCHEME_SHA256_PLAIN;
|
|
384
421
|
declare const opcodes_d_OP_0: typeof OP_0;
|
|
385
422
|
declare const opcodes_d_OP_0NOTEQUAL: typeof OP_0NOTEQUAL;
|
|
386
423
|
declare const opcodes_d_OP_1: typeof OP_1;
|
|
@@ -446,6 +483,7 @@ declare const opcodes_d_OP_IF: typeof OP_IF;
|
|
|
446
483
|
declare const opcodes_d_OP_IFDUP: typeof OP_IFDUP;
|
|
447
484
|
declare const opcodes_d_OP_INPUTASSETFIELD: typeof OP_INPUTASSETFIELD;
|
|
448
485
|
declare const opcodes_d_OP_INPUTCOUNT: typeof OP_INPUTCOUNT;
|
|
486
|
+
declare const opcodes_d_OP_INPUTFIELD: typeof OP_INPUTFIELD;
|
|
449
487
|
declare const opcodes_d_OP_INPUTVALUE: typeof OP_INPUTVALUE;
|
|
450
488
|
declare const opcodes_d_OP_KECCAK256: typeof OP_KECCAK256;
|
|
451
489
|
declare const opcodes_d_OP_LESSTHAN: typeof OP_LESSTHAN;
|
|
@@ -467,6 +505,7 @@ declare const opcodes_d_OP_NUMEQUALVERIFY: typeof OP_NUMEQUALVERIFY;
|
|
|
467
505
|
declare const opcodes_d_OP_NUMNOTEQUAL: typeof OP_NUMNOTEQUAL;
|
|
468
506
|
declare const opcodes_d_OP_OUTPUTASSETFIELD: typeof OP_OUTPUTASSETFIELD;
|
|
469
507
|
declare const opcodes_d_OP_OUTPUTAUTHCOMMITMENT: typeof OP_OUTPUTAUTHCOMMITMENT;
|
|
508
|
+
declare const opcodes_d_OP_OUTPUTAUTHDEST: typeof OP_OUTPUTAUTHDEST;
|
|
470
509
|
declare const opcodes_d_OP_OUTPUTCOUNT: typeof OP_OUTPUTCOUNT;
|
|
471
510
|
declare const opcodes_d_OP_OUTPUTSCRIPT: typeof OP_OUTPUTSCRIPT;
|
|
472
511
|
declare const opcodes_d_OP_OUTPUTVALUE: typeof OP_OUTPUTVALUE;
|
|
@@ -502,6 +541,8 @@ declare const opcodes_d_OP_TXLOCKTIME: typeof OP_TXLOCKTIME;
|
|
|
502
541
|
declare const opcodes_d_OP_VERIFY: typeof OP_VERIFY;
|
|
503
542
|
declare const opcodes_d_OP_WITHIN: typeof OP_WITHIN;
|
|
504
543
|
declare const opcodes_d_OP_XNA_ASSET: typeof OP_XNA_ASSET;
|
|
544
|
+
declare const opcodes_d_OP_ZKVERIFY: typeof OP_ZKVERIFY;
|
|
545
|
+
declare const opcodes_d_TXFIELD_AUTHDEST: typeof TXFIELD_AUTHDEST;
|
|
505
546
|
declare const opcodes_d_TXFIELD_AUTHSCRIPT_COMMITMENT: typeof TXFIELD_AUTHSCRIPT_COMMITMENT;
|
|
506
547
|
declare const opcodes_d_TXFIELD_SCRIPTPUBKEY: typeof TXFIELD_SCRIPTPUBKEY;
|
|
507
548
|
declare const opcodes_d_TXFIELD_VALUE: typeof TXFIELD_VALUE;
|
|
@@ -513,12 +554,14 @@ declare const opcodes_d_TXHASH_INPUT_PREVOUTS: typeof TXHASH_INPUT_PREVOUTS;
|
|
|
513
554
|
declare const opcodes_d_TXHASH_INPUT_SEQUENCES: typeof TXHASH_INPUT_SEQUENCES;
|
|
514
555
|
declare const opcodes_d_TXHASH_LOCKTIME: typeof TXHASH_LOCKTIME;
|
|
515
556
|
declare const opcodes_d_TXHASH_OUTPUTS: typeof TXHASH_OUTPUTS;
|
|
557
|
+
declare const opcodes_d_TXHASH_REFINPUTS: typeof TXHASH_REFINPUTS;
|
|
516
558
|
declare const opcodes_d_TXHASH_VERSION: typeof TXHASH_VERSION;
|
|
517
559
|
declare namespace opcodes_d {
|
|
518
560
|
export {
|
|
519
561
|
opcodes_d_ASSETFIELD_AMOUNT as ASSETFIELD_AMOUNT,
|
|
520
562
|
opcodes_d_ASSETFIELD_HAS_IPFS as ASSETFIELD_HAS_IPFS,
|
|
521
563
|
opcodes_d_ASSETFIELD_IPFS_HASH as ASSETFIELD_IPFS_HASH,
|
|
564
|
+
opcodes_d_ASSETFIELD_MESSAGE as ASSETFIELD_MESSAGE,
|
|
522
565
|
opcodes_d_ASSETFIELD_NAME as ASSETFIELD_NAME,
|
|
523
566
|
opcodes_d_ASSETFIELD_REISSUABLE as ASSETFIELD_REISSUABLE,
|
|
524
567
|
opcodes_d_ASSETFIELD_TYPE as ASSETFIELD_TYPE,
|
|
@@ -526,6 +569,11 @@ declare namespace opcodes_d {
|
|
|
526
569
|
opcodes_d_CHAINCONTEXT_CHAIN_ID as CHAINCONTEXT_CHAIN_ID,
|
|
527
570
|
opcodes_d_CHAINCONTEXT_HEIGHT as CHAINCONTEXT_HEIGHT,
|
|
528
571
|
opcodes_d_CHAINCONTEXT_MTP as CHAINCONTEXT_MTP,
|
|
572
|
+
opcodes_d_MERKLE_SCHEME_BITCOIN_NEURAI as MERKLE_SCHEME_BITCOIN_NEURAI,
|
|
573
|
+
opcodes_d_MERKLE_SCHEME_BLAKE2B_PLAIN as MERKLE_SCHEME_BLAKE2B_PLAIN,
|
|
574
|
+
opcodes_d_MERKLE_SCHEME_KECCAK256_PLAIN as MERKLE_SCHEME_KECCAK256_PLAIN,
|
|
575
|
+
opcodes_d_MERKLE_SCHEME_POSEIDON_BN254 as MERKLE_SCHEME_POSEIDON_BN254,
|
|
576
|
+
opcodes_d_MERKLE_SCHEME_SHA256_PLAIN as MERKLE_SCHEME_SHA256_PLAIN,
|
|
529
577
|
opcodes_d_OP_0 as OP_0,
|
|
530
578
|
opcodes_d_OP_0NOTEQUAL as OP_0NOTEQUAL,
|
|
531
579
|
opcodes_d_OP_1 as OP_1,
|
|
@@ -591,6 +639,7 @@ declare namespace opcodes_d {
|
|
|
591
639
|
opcodes_d_OP_IFDUP as OP_IFDUP,
|
|
592
640
|
opcodes_d_OP_INPUTASSETFIELD as OP_INPUTASSETFIELD,
|
|
593
641
|
opcodes_d_OP_INPUTCOUNT as OP_INPUTCOUNT,
|
|
642
|
+
opcodes_d_OP_INPUTFIELD as OP_INPUTFIELD,
|
|
594
643
|
opcodes_d_OP_INPUTVALUE as OP_INPUTVALUE,
|
|
595
644
|
opcodes_d_OP_KECCAK256 as OP_KECCAK256,
|
|
596
645
|
opcodes_d_OP_LESSTHAN as OP_LESSTHAN,
|
|
@@ -612,6 +661,7 @@ declare namespace opcodes_d {
|
|
|
612
661
|
opcodes_d_OP_NUMNOTEQUAL as OP_NUMNOTEQUAL,
|
|
613
662
|
opcodes_d_OP_OUTPUTASSETFIELD as OP_OUTPUTASSETFIELD,
|
|
614
663
|
opcodes_d_OP_OUTPUTAUTHCOMMITMENT as OP_OUTPUTAUTHCOMMITMENT,
|
|
664
|
+
opcodes_d_OP_OUTPUTAUTHDEST as OP_OUTPUTAUTHDEST,
|
|
615
665
|
opcodes_d_OP_OUTPUTCOUNT as OP_OUTPUTCOUNT,
|
|
616
666
|
opcodes_d_OP_OUTPUTSCRIPT as OP_OUTPUTSCRIPT,
|
|
617
667
|
opcodes_d_OP_OUTPUTVALUE as OP_OUTPUTVALUE,
|
|
@@ -647,6 +697,8 @@ declare namespace opcodes_d {
|
|
|
647
697
|
opcodes_d_OP_VERIFY as OP_VERIFY,
|
|
648
698
|
opcodes_d_OP_WITHIN as OP_WITHIN,
|
|
649
699
|
opcodes_d_OP_XNA_ASSET as OP_XNA_ASSET,
|
|
700
|
+
opcodes_d_OP_ZKVERIFY as OP_ZKVERIFY,
|
|
701
|
+
opcodes_d_TXFIELD_AUTHDEST as TXFIELD_AUTHDEST,
|
|
650
702
|
opcodes_d_TXFIELD_AUTHSCRIPT_COMMITMENT as TXFIELD_AUTHSCRIPT_COMMITMENT,
|
|
651
703
|
opcodes_d_TXFIELD_SCRIPTPUBKEY as TXFIELD_SCRIPTPUBKEY,
|
|
652
704
|
opcodes_d_TXFIELD_VALUE as TXFIELD_VALUE,
|
|
@@ -658,6 +710,7 @@ declare namespace opcodes_d {
|
|
|
658
710
|
opcodes_d_TXHASH_INPUT_SEQUENCES as TXHASH_INPUT_SEQUENCES,
|
|
659
711
|
opcodes_d_TXHASH_LOCKTIME as TXHASH_LOCKTIME,
|
|
660
712
|
opcodes_d_TXHASH_OUTPUTS as TXHASH_OUTPUTS,
|
|
713
|
+
opcodes_d_TXHASH_REFINPUTS as TXHASH_REFINPUTS,
|
|
661
714
|
opcodes_d_TXHASH_VERSION as TXHASH_VERSION,
|
|
662
715
|
};
|
|
663
716
|
}
|
|
@@ -958,7 +1011,7 @@ interface SplitAssetWrappedResult {
|
|
|
958
1011
|
declare function splitAssetWrappedScriptPubKey(spkHex: string): SplitAssetWrappedResult;
|
|
959
1012
|
|
|
960
1013
|
/**
|
|
961
|
-
* Partial-Fill Sell Order covenant script (three-branch).
|
|
1014
|
+
* Partial-Fill Sell Order covenant script (three-branch), ECDSA cancel.
|
|
962
1015
|
*
|
|
963
1016
|
* The covenant has three branches selected by the top of the unlock stack:
|
|
964
1017
|
*
|
|
@@ -978,11 +1031,8 @@ declare function splitAssetWrappedScriptPubKey(spkHex: string): SplitAssetWrappe
|
|
|
978
1031
|
* amount == inputAmount - N)
|
|
979
1032
|
* output[3+] = optional buyer change (not constrained by the covenant)
|
|
980
1033
|
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
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.
|
|
1034
|
+
* The order must be input 0 for either fill branch to succeed: see the
|
|
1035
|
+
* input-0 binding in `./fill-branches.ts`.
|
|
986
1036
|
*
|
|
987
1037
|
* Unlock stack shapes (scriptSig pushes, top → bottom):
|
|
988
1038
|
*
|
|
@@ -990,10 +1040,12 @@ declare function splitAssetWrappedScriptPubKey(spkHex: string): SplitAssetWrappe
|
|
|
990
1040
|
* Full fill: <1> <0> (full-flag=1, cancel-flag=0)
|
|
991
1041
|
* Partial fill: <N> <0> <0> (N, full-flag=0, cancel-flag=0)
|
|
992
1042
|
*
|
|
993
|
-
* The cancel branch uses classical ECDSA (`OP_HASH160 + OP_CHECKSIG`)
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
*
|
|
1043
|
+
* The cancel branch uses classical ECDSA (`OP_HASH160 + OP_CHECKSIG`)
|
|
1044
|
+
* against a 20-byte key hash. The payment destination is independent of
|
|
1045
|
+
* that key: a legacy P2PKH seller passes `sellerAddress` (both at once),
|
|
1046
|
+
* any other seller with a secp256k1 key — typically a strict ECDSA v3
|
|
1047
|
+
* `nq1r…` wallet — passes `paymentAddress` and `sellerPubKeyHash`. For
|
|
1048
|
+
* post-quantum cancellation use `buildPartialFillScriptPQ`.
|
|
997
1049
|
*/
|
|
998
1050
|
|
|
999
1051
|
/**
|
|
@@ -1025,14 +1077,14 @@ declare function buildPartialFillScriptHex(params: PartialFillOrderParams): stri
|
|
|
1025
1077
|
*
|
|
1026
1078
|
* The message that gets signed is **SHA256(OP_TXHASH(selector))** — CSFS
|
|
1027
1079
|
* 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(
|
|
1080
|
+
* produces its own 32-byte NIP-042 tagged hash, so the seller computes:
|
|
1081
|
+
* `sign(pqSeckey, SHA256(TaggedHash("NeuraiTxHash", mask || selected_tx_fields)))`
|
|
1030
1082
|
*
|
|
1031
|
-
*
|
|
1032
|
-
*
|
|
1083
|
+
* The fill branches, including the input-0 binding, are shared with the
|
|
1084
|
+
* ECDSA variant — see `./fill-branches.ts`.
|
|
1033
1085
|
*/
|
|
1034
1086
|
|
|
1035
|
-
declare const DEFAULT_PQ_TXHASH_SELECTOR =
|
|
1087
|
+
declare const DEFAULT_PQ_TXHASH_SELECTOR = 511;
|
|
1036
1088
|
/**
|
|
1037
1089
|
* Build the scriptPubKey of a PQ Partial-Fill Sell Order covenant UTXO.
|
|
1038
1090
|
*/
|
|
@@ -1152,17 +1204,15 @@ declare function buildCancelWitnessStack(signatureDer: Uint8Array, pubKey: Uint8
|
|
|
1152
1204
|
declare function buildCancelWitnessStackPQ(sigPQ: Uint8Array, pubKey: Uint8Array): Uint8Array[];
|
|
1153
1205
|
|
|
1154
1206
|
/**
|
|
1155
|
-
* Parser for the Partial-Fill Sell Order covenant (three-branch).
|
|
1156
|
-
*
|
|
1157
|
-
* Extracts `(sellerPubKeyHash, unitPriceSats, tokenId)`
|
|
1158
|
-
* that was produced by `buildPartialFillScript`. Walks
|
|
1159
|
-
* layout emitted by the builder and fails on any deviation —
|
|
1160
|
-
* deliberate, so a downstream indexer can unambiguously classify a
|
|
1161
|
-
* "partial-fill order" or "unknown script" with no false positives.
|
|
1162
|
-
*
|
|
1163
|
-
*
|
|
1164
|
-
* unitPriceSats, tokenId)`. The parser reads both branches and verifies
|
|
1165
|
-
* consistency; inconsistency throws.
|
|
1207
|
+
* Parser for the Partial-Fill Sell Order covenant (three-branch, ECDSA cancel).
|
|
1208
|
+
*
|
|
1209
|
+
* Extracts `(sellerPubKeyHash, paymentScriptPubKey, unitPriceSats, tokenId)`
|
|
1210
|
+
* from a scriptPubKey that was produced by `buildPartialFillScript`. Walks
|
|
1211
|
+
* the exact byte layout emitted by the builder and fails on any deviation —
|
|
1212
|
+
* this is deliberate, so a downstream indexer can unambiguously classify a
|
|
1213
|
+
* UTXO as "partial-fill order" or "unknown script" with no false positives.
|
|
1214
|
+
* Covenants built before the input-0 binding (neurai-scripts < 0.10.0) are
|
|
1215
|
+
* rejected: their fill branches can be drained through a foreign input 0.
|
|
1166
1216
|
*/
|
|
1167
1217
|
|
|
1168
1218
|
/**
|
|
@@ -1177,9 +1227,8 @@ declare function parsePartialFillScript(script: Uint8Array | string, network?: N
|
|
|
1177
1227
|
* payment scriptPubKey bytes (which may be P2PKH or AuthScript) and the
|
|
1178
1228
|
* configured TXHASH selector.
|
|
1179
1229
|
*
|
|
1180
|
-
* The
|
|
1181
|
-
*
|
|
1182
|
-
* consistency; inconsistency throws.
|
|
1230
|
+
* The fill branches (and their input-0 binding) are read by the shared
|
|
1231
|
+
* `readFillBranches`; covenants built before the binding are rejected.
|
|
1183
1232
|
*/
|
|
1184
1233
|
|
|
1185
1234
|
/** Quick discriminator without throwing — useful for indexers. */
|