edge-currency-plugins 3.0.1 → 3.0.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.
@@ -24,6 +24,7 @@ var _bnjs = require('bn.js'); var _bnjs2 = _interopRequireDefault(_bnjs);
24
24
  const inputs = otherParams.psbt.inputs.map((input, n) => ({
25
25
  amount: input.value.toString(),
26
26
  scriptPubkey: Buffer.from(input.scriptPubkey).toString('hex'), // [1]
27
+ sequence: input.sequence,
27
28
  n,
28
29
  txId: Buffer.from(input.hash).reverse().toString('hex'), // [1]
29
30
  outputIndex: input.index
@@ -74,6 +74,10 @@ var _keymanager = require('../keymanager/keymanager');
74
74
 
75
75
 
76
76
 
77
+
78
+
79
+
80
+
77
81
 
78
82
 
79
83
 
@@ -155,8 +155,12 @@ var _UtxoWalletTools = require('./UtxoWalletTools');
155
155
  })
156
156
 
157
157
  // Transaction checks:
158
- // The transaction must be found and not confirmed or dropped.
158
+ // Must be found
159
159
  if (replacedTx == null) return null
160
+ // Must have at least one input with the sequence enabling RBF policy
161
+ if (replacedTx.inputs.every(input => input.sequence > 0xfffffffd))
162
+ return null
163
+ // Must not be confirmed or dropped.
160
164
  if (replacedTx.blockHeight !== 0) return null
161
165
 
162
166
  // Double the fee used for the RBF transaction:
@@ -1332,9 +1332,10 @@ const processTransactionResponse = (
1332
1332
  })
1333
1333
  return {
1334
1334
  txId: vin.txid,
1335
- outputIndex: vin.vout, // case for tx `fefac8c22ba1178df5d7c90b78cc1c203d1a9f5f5506f7b8f6f469fa821c2674` no `vout` for input
1335
+ outputIndex: vin.vout,
1336
1336
  n: vin.n,
1337
1337
  scriptPubkey,
1338
+ sequence: vin.sequence,
1338
1339
  amount: vin.value
1339
1340
  }
1340
1341
  })
@@ -87,9 +87,15 @@ var _cleaners = require('cleaners');
87
87
  vin: _cleaners.asArray.call(void 0,
88
88
  _cleaners.asObject.call(void 0, {
89
89
  txid: _cleaners.asString,
90
- sequence: _cleaners.asOptional.call(void 0, _cleaners.asNumber),
90
+ // Empirically observed omitted sequence is possible for when sequence is zero.
91
+ // Is the case for tx `19ecc679cfc7e71ad616a22bbee96fd5abe8616e4f408f1f5daaf137400ae091`.
92
+ sequence: _cleaners.asOptional.call(void 0, _cleaners.asNumber, 0),
91
93
  n: _cleaners.asNumber,
92
- vout: _cleaners.asOptional.call(void 0, _cleaners.asNumber, 0), // If Blockbook doesn't provide vout, assume 0 (empirically observed)
94
+ // If Blockbook doesn't provide vout, assume 0. Empirically observed
95
+ // case for tx `fefac8c22ba1178df5d7c90b78cc1c203d1a9f5f5506f7b8f6f469fa821c2674`
96
+ // which has no `vout` for input in WebSocket response payload but block
97
+ // will show the input's vout value to be `0`.
98
+ vout: _cleaners.asOptional.call(void 0, _cleaners.asNumber, 0),
93
99
  addresses: _cleaners.asArray.call(void 0, asAddress),
94
100
  isAddress: _cleaners.asBoolean,
95
101
  value: _cleaners.asString,
@@ -40,10 +40,14 @@ export interface IProcessorTransaction {
40
40
  }
41
41
  export interface ITransactionOutput {
42
42
  amount: string;
43
- scriptPubkey: string;
44
43
  n: number;
44
+ scriptPubkey: string;
45
45
  }
46
- export interface ITransactionInput extends ITransactionOutput {
47
- txId: string;
46
+ export interface ITransactionInput {
47
+ amount: string;
48
+ n: number;
48
49
  outputIndex: number;
50
+ scriptPubkey: string;
51
+ sequence: number;
52
+ txId: string;
49
53
  }
@@ -5,7 +5,7 @@ export declare type Input = UTXO;
5
5
  export interface UTXO extends PsbtInput {
6
6
  hash: Buffer;
7
7
  index: number;
8
- sequence?: number;
8
+ sequence: number;
9
9
  value: number;
10
10
  script: Buffer;
11
11
  scriptPubkey: Buffer;
@@ -28,7 +28,7 @@ export interface BlockbookTransaction {
28
28
  fees: string;
29
29
  vin: Array<{
30
30
  txid: string;
31
- sequence?: number;
31
+ sequence: number;
32
32
  n: number;
33
33
  vout: number;
34
34
  addresses: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "homepage": "https://edge.app/",
6
6
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",