edge-currency-plugins 1.1.3 → 1.1.4

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.
@@ -396,7 +396,8 @@ var _utils = require('./utils');
396
396
  currencyCode: currencyInfo.currencyCode,
397
397
  setRBF,
398
398
  freshChangeAddress,
399
- subtractFee
399
+ subtractFee,
400
+ log
400
401
  })
401
402
  if (tx.changeUsed) {
402
403
  ourReceiveAddresses.push(freshChangeAddress)
@@ -1244,25 +1244,10 @@ const processProcessorUtxos = async (
1244
1244
  oldBalance = _biggystring.add.call(void 0, utxo.value, oldBalance)
1245
1245
  }
1246
1246
 
1247
- // If the UTXO isn't present in the update UTXO set, then it is spent.
1247
+ // If the UTXO isn't present in the update UTXO set, then it is spent or dropped.
1248
+ // Remove it from the database if so
1248
1249
  if (updatedUtxos[utxo.id] == null) {
1249
- if (utxo.blockHeight > 0) {
1250
- // Delete the UTXO from the database if it's spent and confirmed
1251
- utxoIdsToRemove.push(utxo.id)
1252
- } else {
1253
- // Otherwise just mark it as spent.
1254
- updatedUtxos[utxo.id] = { ...utxo, spent: true }
1255
- }
1256
- } else {
1257
- /*
1258
- If the UTXO is present in the updated UTXO set, enforce that the UTXO
1259
- remains spent in the new UTXO set. This means, we will never mark a UTXO
1260
- as unspent again. UTXOs only become unspent again if the tx is dropped
1261
- which shall be affected by another routine.
1262
- */
1263
- // TODO: To fix this logic for dropped-tx, add a condition which uses the
1264
- // network's block-height to determine whether to set it back as unspend
1265
- updatedUtxos[utxo.id].spent = utxo.spent || updatedUtxos[utxo.id].spent
1250
+ utxoIdsToRemove.push(utxo.id)
1266
1251
  }
1267
1252
  }
1268
1253
 
@@ -232,6 +232,7 @@ var VerifyAddressEnum; (function (VerifyAddressEnum) {
232
232
 
233
233
 
234
234
 
235
+
235
236
 
236
237
 
237
238
  function bip43PurposeNumberToTypeEnum(
@@ -828,6 +829,7 @@ const wifToPrivateKeyInternal = (
828
829
  } exports.signMessageBase64 = signMessageBase64;
829
830
 
830
831
  function makeTx(args) {
832
+ const { log } = args
831
833
  let sequence = 0xffffffff
832
834
  if (args.setRBF) {
833
835
  sequence -= 2
@@ -963,8 +965,13 @@ const wifToPrivateKeyInternal = (
963
965
  const sortedOutputs = _bip69.sortOutputs.call(void 0, result.outputs)
964
966
 
965
967
  const psbt = new bitcoin.Psbt()
966
- psbt.addInputs(sortedInputs)
967
- psbt.addOutputs(sortedOutputs)
968
+ try {
969
+ psbt.addInputs(sortedInputs)
970
+ psbt.addOutputs(sortedOutputs)
971
+ } catch (error) {
972
+ _optionalChain([log, 'optionalAccess', _16 => _16.error, 'call', _17 => _17(`Failed makeTx: ${String(error)}`)])
973
+ throw error
974
+ }
968
975
 
969
976
  return {
970
977
  inputs: sortedInputs,
@@ -972,7 +979,7 @@ const wifToPrivateKeyInternal = (
972
979
  changeUsed: result.changeUsed,
973
980
  fee: result.fee,
974
981
  psbtBase64: psbt.toBase64(),
975
- hex: _optionalChain([psbt, 'access', _16 => _16.data, 'optionalAccess', _17 => _17.globalMap, 'optionalAccess', _18 => _18.unsignedTx, 'optionalAccess', _19 => _19.toBuffer, 'call', _20 => _20(), 'optionalAccess', _21 => _21.toString, 'call', _22 => _22('hex')])
982
+ hex: _optionalChain([psbt, 'access', _18 => _18.data, 'optionalAccess', _19 => _19.globalMap, 'optionalAccess', _20 => _20.unsignedTx, 'optionalAccess', _21 => _21.toBuffer, 'call', _22 => _22(), 'optionalAccess', _23 => _23.toString, 'call', _24 => _24('hex')])
976
983
  }
977
984
  } exports.makeTx = makeTx;
978
985
 
@@ -1,3 +1,4 @@
1
+ import { EdgeLog } from 'edge-core-js/types';
1
2
  import { AddressPath } from '../../plugin/types';
2
3
  import { IUTXO } from '../db/types';
3
4
  import { ScriptTemplate } from '../info/scriptTemplates/types';
@@ -131,6 +132,7 @@ export interface MakeTxArgs {
131
132
  currencyCode: string;
132
133
  freshChangeAddress: string;
133
134
  subtractFee?: boolean;
135
+ log?: EdgeLog;
134
136
  }
135
137
  export interface MakeTxTarget {
136
138
  address?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",
6
6
  "license": "MIT",