@neuraiproject/neurai-scripts 0.6.0 → 0.6.2

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/dist/types.d.ts CHANGED
@@ -24,6 +24,22 @@
24
24
  * covenants: do not reintroduce `network` into builder params.
25
25
  */
26
26
  export type Network = 'xna' | 'xna-test';
27
+ export type PartialFillExpirationMode = 'height' | 'mtp';
28
+ export interface PartialFillExpiration {
29
+ /**
30
+ * Chain context used to decide whether the sale is still active.
31
+ *
32
+ * - `height`: compare against the candidate block height.
33
+ * - `mtp`: compare against the previous block's median time past.
34
+ */
35
+ mode: PartialFillExpirationMode;
36
+ /**
37
+ * Expiry boundary. Fills are valid only while `value > chainContext`.
38
+ * At exactly this height / MTP, and after it, only the seller cancel branch
39
+ * can spend the order.
40
+ */
41
+ value: bigint;
42
+ }
27
43
  export interface PartialFillOrderParams {
28
44
  /**
29
45
  * Seller destination. Must be a legacy P2PKH address (base58check,
@@ -45,6 +61,12 @@ export interface PartialFillOrderParams {
45
61
  * means `unitPriceSats = 100_000_000n`.
46
62
  */
47
63
  unitPriceSats: bigint;
64
+ /**
65
+ * Optional sale expiry enforced with OP_CHAINCONTEXT. When set, both buyer
66
+ * fill branches require `expiration.value > current height/MTP`. The seller
67
+ * cancel branch remains available to recover the order.
68
+ */
69
+ expiration?: PartialFillExpiration;
48
70
  }
49
71
  export interface ParsedPartialFillOrder {
50
72
  /** Network the parser was invoked with (used for downstream address formatting). */
@@ -59,6 +81,8 @@ export interface ParsedPartialFillOrder {
59
81
  tokenId: string;
60
82
  /** Unit price parsed from the covenant, in XNA satoshis. */
61
83
  unitPriceSats: bigint;
84
+ /** Optional sale expiry parsed from OP_CHAINCONTEXT gates. */
85
+ expiration?: PartialFillExpiration;
62
86
  /** Script hex the parser was fed. */
63
87
  scriptHex: string;
64
88
  }
@@ -110,6 +134,11 @@ export interface PartialFillOrderPQParams {
110
134
  * `doc/new-opcodes-depin-branch.md` §2.1 for the bit → field mapping.
111
135
  */
112
136
  txHashSelector?: number;
137
+ /**
138
+ * Optional sale expiry enforced with OP_CHAINCONTEXT. When set, both buyer
139
+ * fill branches require `expiration.value > current height/MTP`.
140
+ */
141
+ expiration?: PartialFillExpiration;
113
142
  }
114
143
  export interface ParsedPartialFillOrderPQ extends Omit<PartialFillOrderPQParams, 'paymentAddress'> {
115
144
  /** Network the parser was invoked with (used for downstream address formatting). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuraiproject/neurai-scripts",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
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",