@neuraiproject/neurai-scripts 0.11.0 → 0.12.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 +10 -0
- package/dist/NeuraiScripts.global.js +17 -2
- package/dist/NeuraiScripts.global.js.map +1 -1
- package/dist/browser.js +17 -2
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -724,6 +724,16 @@ consumable; callers import directly from the package root.
|
|
|
724
724
|
|
|
725
725
|
## Version notes
|
|
726
726
|
|
|
727
|
+
### 0.12.0
|
|
728
|
+
|
|
729
|
+
- Requires `@neuraiproject/neurai-create-transaction` **0.10.0**, which follows the node's
|
|
730
|
+
NIP-014 encoding (Neurai DePIN-Test `d4ff4ef`, live on the testnet reset of 2026-11-05):
|
|
731
|
+
reference inputs are announced by flag `0x02` of the extended format, and a version 3
|
|
732
|
+
transaction without them has the plain layout. `assetAuthProposalHash` parses the
|
|
733
|
+
proposal's raw transaction with that codec; the proposal message itself is unchanged
|
|
734
|
+
(it already committed an empty reference list for a transaction without references).
|
|
735
|
+
Checked against a regtest node built from Neurai `7f1773e`.
|
|
736
|
+
|
|
727
737
|
### 0.11.0
|
|
728
738
|
|
|
729
739
|
- P2AH custody (NIP-054 `OP_CHECKASSETAUTH`, slot `0xdf`): `opcodes.OP_CHECKASSETAUTH`,
|
|
@@ -1986,12 +1986,19 @@ var NeuraiScriptsBundle = (function (exports) {
|
|
|
1986
1986
|
for (let i = 0; i < voutCount; i += 1)
|
|
1987
1987
|
outputs.push(readOutput(reader));
|
|
1988
1988
|
}
|
|
1989
|
-
// NIP-014:
|
|
1989
|
+
// NIP-014: reference inputs sit between vout and witness, announced by flag
|
|
1990
|
+
// 0x02. Without the flag a version 3 transaction reads as 1.0.7 reads it.
|
|
1990
1991
|
const vrefin = [];
|
|
1991
|
-
|
|
1992
|
+
const hasRefInputs = (flags & 2) !== 0;
|
|
1993
|
+
if (hasRefInputs) {
|
|
1994
|
+
flags ^= 2;
|
|
1992
1995
|
const refCount = reader.readCount(36, 'refinput');
|
|
1993
1996
|
for (let i = 0; i < refCount; i += 1)
|
|
1994
1997
|
vrefin.push(readOutpoint(reader));
|
|
1998
|
+
if (vrefin.length === 0) {
|
|
1999
|
+
// One encoding per transaction: the flag means some.
|
|
2000
|
+
throw new Error('Superfluous reference inputs record (flag 0x02 with no reference inputs)');
|
|
2001
|
+
}
|
|
1995
2002
|
}
|
|
1996
2003
|
if (flags & 1) {
|
|
1997
2004
|
flags ^= 1;
|
|
@@ -2004,6 +2011,11 @@ var NeuraiScriptsBundle = (function (exports) {
|
|
|
2004
2011
|
}
|
|
2005
2012
|
input.witness = stack;
|
|
2006
2013
|
}
|
|
2014
|
+
if (hasRefInputs && !inputs.some(inputHasWitness)) {
|
|
2015
|
+
// With reference inputs the witness flag means some witness; 1.0.7 reads
|
|
2016
|
+
// an empty witness record without them, and so does the node.
|
|
2017
|
+
throw new Error('Superfluous witness record (flag 0x01 with no witness data)');
|
|
2018
|
+
}
|
|
2007
2019
|
}
|
|
2008
2020
|
if (flags) {
|
|
2009
2021
|
throw new Error(`Unknown transaction optional data (flags 0x${flags.toString(16)})`);
|
|
@@ -2014,6 +2026,9 @@ var NeuraiScriptsBundle = (function (exports) {
|
|
|
2014
2026
|
}
|
|
2015
2027
|
return { version, inputs, outputs, vrefin, locktime };
|
|
2016
2028
|
}
|
|
2029
|
+
function inputHasWitness(input) {
|
|
2030
|
+
return (input.witness?.length ?? 0) > 0;
|
|
2031
|
+
}
|
|
2017
2032
|
|
|
2018
2033
|
/**
|
|
2019
2034
|
* Address helpers. Wraps `decodeAddress` from
|