@@ -627,8 +627,8 @@ var DashTx = ("object" === typeof module && exports) || {};
627
627
* - ASC `outputIndex` (a.k.a. `output_index`, `vout`)
628
628
*/
629
629
Tx . sortInputs = function ( a , b ) {
630
- let aTxid = a . txid || a . txId ;
631
- let bTxid = b . txid || b . txId ;
630
+ let aTxid = a . txId || a . txid ;
631
+ let bTxid = b . txId || b . txid ;
632
632
// Ascending Lexicographical on TxId (prev-hash) in-memory (not wire) byte order
633
633
if ( aTxid > bTxid ) {
634
634
return 1 ;
@@ -988,8 +988,8 @@ var DashTx = ("object" === typeof module && exports) || {};
988
988
989
989
/** @type TxInputSigned */
990
990
let txInputSigned = {
991
- txId : txInput . txId || txInput . txid ,
992
991
txid : txInput . txId || txInput . txid ,
992
+ txId : txInput . txId || txInput . txid ,
993
993
outputIndex : txInput . outputIndex ,
994
994
signature : sigHex ,
995
995
publicKey : pubKeyHex ,
@@ -1027,6 +1027,7 @@ var DashTx = ("object" === typeof module && exports) || {};
1027
1027
return {
1028
1028
//@ts -ignore - workaround for txId (insight) vs txid (dashcore rpc utxo) issue
1029
1029
// (picking 'txId' over 'txid' may have been a mistake in a recent update)
1030
+ txid : input . txId || input . txid ,
1030
1031
txId : input . txId || input . txid ,
1031
1032
outputIndex : input . outputIndex ,
1032
1033
} ;
@@ -1042,8 +1043,8 @@ var DashTx = ("object" === typeof module && exports) || {};
1042
1043
txInfoHashable . inputs = txInfo . inputs . map ( function ( input , i ) {
1043
1044
if ( inputIndex !== i ) {
1044
1045
return {
1045
- txId : input . txId || input . txid ,
1046
1046
txid : input . txId || input . txid ,
1047
+ txId : input . txId || input . txid ,
1047
1048
outputIndex : input . outputIndex ,
1048
1049
} ;
1049
1050
}
@@ -1127,20 +1128,20 @@ var DashTx = ("object" === typeof module && exports) || {};
1127
1128
for ( let input of inputs ) {
1128
1129
let inputHex = [ ] ;
1129
1130
1130
- let txId = input . txId || input . txid ;
1131
- if ( ! txId ) {
1132
- throw new Error ( "missing required utxo property 'txId '" ) ;
1131
+ let txid = input . txId || input . txid ;
1132
+ if ( ! txid ) {
1133
+ throw new Error ( "missing required utxo property 'txid '" ) ;
1133
1134
}
1134
1135
1135
- if ( 64 !== txId . length ) {
1136
+ if ( 64 !== txid . length ) {
1136
1137
throw new Error (
1137
- `expected uxto property 'txId ' to be a valid 64-character (32-byte) hex string, but got '${ txId } ' (size ${ txId . length } )` ,
1138
+ `expected uxto property 'txid ' to be a valid 64-character (32-byte) hex string, but got '${ txid } ' (size ${ txid . length } )` ,
1138
1139
) ;
1139
1140
}
1140
1141
1141
- assertHex ( txId , "txId " ) ;
1142
+ assertHex ( txid , "txid " ) ;
1142
1143
1143
- let reverseTxId = Tx . utils . reverseHex ( txId ) ;
1144
+ let reverseTxId = Tx . utils . reverseHex ( txid ) ;
1144
1145
inputHex . push ( reverseTxId ) ;
1145
1146
1146
1147
let voutIndex = input . outputIndex ;
@@ -1619,7 +1620,8 @@ if ("object" === typeof module) {
1619
1620
1620
1621
/**
1621
1622
* @typedef CoreUtxo
1622
- * @property {String } txId
1623
+ * @property {String } [txId] - deprecated
1624
+ * @property {String } txid
1623
1625
* @property {Number } outputIndex
1624
1626
* @property {String } address
1625
1627
* @property {String } script
@@ -1685,7 +1687,8 @@ if ("object" === typeof module) {
1685
1687
/**
1686
1688
* @typedef TxInput
1687
1689
* @prop {String } [address] - BaseCheck58-encoded pubKeyHash
1688
- * @prop {String } txId - hex (not pre-reversed)
1690
+ * @prop {String } [txId] - deprecated
1691
+ * @prop {String } txid - hex (not pre-reversed)
1689
1692
* @prop {Uint32 } outputIndex - index in previous tx's output (vout index)
1690
1693
* @prop {String } signature - hex-encoded ASN.1 (DER) signature (starts with 0x30440220 or 0x30440221)
1691
1694
* @prop {String } [script] - the previous lock script (default: derived from public key as p2pkh)
@@ -1712,21 +1715,24 @@ if ("object" === typeof module) {
1712
1715
* @typedef TxInputRaw
1713
1716
* @prop {String } [address] - BaseCheck58-encoded pubKeyHash
1714
1717
* @prop {Uint53 } [satoshis] - for convenience
1715
- * @prop {String } txId - hex (not pre-reversed)
1718
+ * @prop {String } [txId] - deprecated
1719
+ * @prop {String } txid - hex (not pre-reversed)
1716
1720
* @prop {Uint32 } outputIndex - index in previous tx's output (vout index)
1717
1721
*/
1718
1722
1719
1723
/**
1720
1724
* @typedef TxInputUnspent
1721
1725
* @prop {String } [address] - BaseCheck58-encoded pubKeyHash
1722
1726
* @prop {Uint53 } satoshis
1723
- * @prop {String } txId - hex (not pre-reversed)
1727
+ * @prop {String } [txId] - deprecated
1728
+ * @prop {String } txid - hex (not pre-reversed)
1724
1729
* @prop {Uint32 } outputIndex - index in previous tx's output (vout index)
1725
1730
*/
1726
1731
1727
1732
/**
1728
1733
* @typedef TxInputSortable
1729
- * @prop {String } txId
1734
+ * @prop {String } [txId] - deprecated
1735
+ * @prop {String } txid
1730
1736
* @prop {Uint32 } outputIndex
1731
1737
*/
1732
1738
@@ -1736,7 +1742,7 @@ if ("object" === typeof module) {
1736
1742
*/
1737
1743
1738
1744
/**
1739
- * @typedef {Pick<TxInput, "txId"|"outputIndex"|"signature"|"publicKey"|"sigHashType"> } TxInputSigned
1745
+ * @typedef {Pick<TxInput, "txId"|"txid"|" outputIndex"|"signature"|"publicKey"|"sigHashType"> } TxInputSigned
1740
1746
*/
1741
1747
1742
1748
/**
0 commit comments