edge-currency-plugins 1.2.0 → 1.2.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.
@@ -125,6 +125,11 @@ var _cleaners = require('cleaners');
125
125
 
126
126
 
127
127
 
128
+
129
+
130
+
131
+
132
+
128
133
 
129
134
 
130
135
 
@@ -117,6 +117,7 @@ var _keymanager = require('../../keymanager/keymanager');
117
117
  currencyCode: currencyInfo.currencyCode,
118
118
  txid: tx.txid,
119
119
  blockHeight: tx.blockHeight,
120
+ confirmations: tx.confirmations,
120
121
  date: tx.date,
121
122
  nativeAmount: tx.ourAmount,
122
123
  networkFee: tx.fees,
@@ -32,6 +32,11 @@ var _ProcessorTransaction = require('../db/Models/ProcessorTransaction');
32
32
 
33
33
 
34
34
  var _cleaners3 = require('../keymanager/cleaners');
35
+
36
+
37
+
38
+
39
+
35
40
  var _keymanager = require('../keymanager/keymanager');
36
41
  var _makeUtxoEngineState = require('./makeUtxoEngineState');
37
42
  var _makeUtxoWalletTools = require('./makeUtxoWalletTools');
@@ -514,10 +519,12 @@ var _utils = require('./utils');
514
519
 
515
520
  // Use the privateKeys (WIFs) from spendInfo, otherwise get them from the
516
521
  // PBST inputs.
517
- const privateKeys = await (async () => {
522
+ const privateKeyEncodings = await (async (
523
+
524
+ ) => {
518
525
  if (edgeSpendInfo.privateKeys != null) {
519
526
  return edgeSpendInfo.privateKeys.map(wif =>
520
- walletTools.getPrivateKeyFromWif(wif)
527
+ walletTools.getPrivateKeyEncodingFromWif(wif)
521
528
  )
522
529
  } else {
523
530
  return await Promise.all(
@@ -533,10 +540,14 @@ var _utils = require('./utils');
533
540
  if (_optionalChain([address, 'optionalAccess', _15 => _15.path]) == null)
534
541
  throw new Error('Invalid script pubkey')
535
542
 
536
- return walletTools.getPrivateKey({
543
+ const privateKey = walletTools.getPrivateKey({
537
544
  path: address.path,
538
545
  xprivKeys
539
546
  })
547
+ return {
548
+ hex: privateKey,
549
+ compressed: true // We shouldn't ever be storing/deriving uncompressed keys
550
+ }
540
551
  })
541
552
  )
542
553
  }
@@ -544,7 +555,7 @@ var _utils = require('./utils');
544
555
  const signedTx = await _keymanager.signTx.call(void 0, {
545
556
  psbtBase64: psbt.base64,
546
557
  coin: coinInfo.name,
547
- privateKeys
558
+ privateKeyEncodings: privateKeyEncodings
548
559
  })
549
560
  transaction.txid = signedTx.id
550
561
  transaction.signedTx = signedTx.hex
@@ -41,6 +41,7 @@ var _keymanager = require('../keymanager/keymanager');
41
41
 
42
42
 
43
43
 
44
+
44
45
  var _BlockBookAPI = require('../network/BlockBookAPI');
45
46
  var _Deferred = require('../network/Deferred'); var _Deferred2 = _interopRequireDefault(_Deferred);
46
47
 
@@ -108,7 +109,8 @@ var _utils3 = require('./utils');
108
109
  addressUtxoCache: {},
109
110
  rawUtxoCache: {},
110
111
  processorUtxoCache: {},
111
- updateTransactionCache: {}
112
+ updateTransactionCache: {},
113
+ updateTransactionSpecificCache: {}
112
114
  }
113
115
 
114
116
  const clearTaskCache = () => {
@@ -131,6 +133,9 @@ var _utils3 = require('./utils');
131
133
  for (const key of Object.keys(taskCache.updateTransactionCache)) {
132
134
  _utils.removeItem.call(void 0, taskCache.updateTransactionCache, key)
133
135
  }
136
+ for (const key of Object.keys(taskCache.updateTransactionSpecificCache)) {
137
+ _utils.removeItem.call(void 0, taskCache.updateTransactionSpecificCache, key)
138
+ }
134
139
  }
135
140
 
136
141
  /**
@@ -525,6 +530,10 @@ var _utils3 = require('./utils');
525
530
 
526
531
 
527
532
 
533
+
534
+
535
+
536
+
528
537
 
529
538
 
530
539
 
@@ -669,7 +678,7 @@ const addToAddressTransactionCache = async (
669
678
  args
670
679
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
671
680
  ) => {
672
- const { taskCache, uri, serverStates } = args
681
+ const { pluginInfo, taskCache, uri, serverStates } = args
673
682
 
674
683
  const {
675
684
  addressSubscribeCache,
@@ -677,9 +686,17 @@ const addToAddressTransactionCache = async (
677
686
  rawUtxoCache,
678
687
  processorUtxoCache,
679
688
  addressTransactionCache,
680
- updateTransactionCache
689
+ updateTransactionCache,
690
+ updateTransactionSpecificCache
681
691
  } = taskCache
682
692
 
693
+ /**
694
+ * Some currencies require an additional blockbook payload 'getTransactionSpecific' in order
695
+ * to provide all relevant transaction data. Since this is currency-specific, we can limit
696
+ * the useage to currencies that require it.
697
+ **/
698
+ const needsTxSpecific = pluginInfo.engineInfo.txSpecificHandling != null
699
+
683
700
  const serverState = serverStates.getServerState(uri)
684
701
  if (serverState == null) return
685
702
 
@@ -799,6 +816,37 @@ const addToAddressTransactionCache = async (
799
816
  }
800
817
  }
801
818
 
819
+ // filled when transactions potentially changed (e.g. through new block notification)
820
+ if (Object.keys(updateTransactionSpecificCache).length > 0) {
821
+ let hasProcessedAtLeastOnce = false
822
+ for (const [txId, state] of Object.entries(
823
+ updateTransactionSpecificCache
824
+ )) {
825
+ if (!state.processing && serverStates.serverCanGetTx(uri, txId)) {
826
+ hasProcessedAtLeastOnce = true
827
+ state.processing = true
828
+ _utils.removeItem.call(void 0, updateTransactionSpecificCache, txId)
829
+ const updateTransactionSpecificTask = updateTransactionsSpecific({
830
+ ...args,
831
+ txId
832
+ })
833
+ // once resolved, add the txid to the server cache
834
+ updateTransactionSpecificTask.deferred.promise
835
+ .then(() => {
836
+ serverState.txids.add(txId)
837
+ })
838
+ .catch(err => {
839
+ updateTransactionSpecificCache[txId] = state
840
+ console.error(err)
841
+ args.log('error in updateTransactionSpecificCache:', err)
842
+ })
843
+ return updateTransactionSpecificTask
844
+ }
845
+ }
846
+ // This condition prevents infinite loops
847
+ if (hasProcessedAtLeastOnce) return true
848
+ }
849
+
802
850
  // filled when transactions potentially changed (e.g. through new block notification)
803
851
  if (Object.keys(updateTransactionCache).length > 0) {
804
852
  let hasProcessedAtLeastOnce = false
@@ -807,7 +855,11 @@ const addToAddressTransactionCache = async (
807
855
  hasProcessedAtLeastOnce = true
808
856
  state.processing = true
809
857
  _utils.removeItem.call(void 0, updateTransactionCache, txId)
810
- const updateTransactionTask = updateTransactions({ ...args, txId })
858
+ const updateTransactionTask = updateTransactions({
859
+ ...args,
860
+ txId,
861
+ needsTxSpecific
862
+ })
811
863
  // once resolved, add the txid to the server cache
812
864
  updateTransactionTask.deferred.promise
813
865
  .then(() => {
@@ -836,7 +888,8 @@ const addToAddressTransactionCache = async (
836
888
  const wsTask = await processAddressTransactions({
837
889
  ...args,
838
890
  addressTransactionState: state,
839
- address
891
+ address,
892
+ needsTxSpecific
840
893
  })
841
894
  wsTask.deferred.promise
842
895
  .then(() => {
@@ -856,11 +909,65 @@ const addToAddressTransactionCache = async (
856
909
 
857
910
 
858
911
 
859
- const updateTransactions = (
912
+ const updateTransactionsSpecific = (
860
913
  args
861
914
  ) => {
862
915
  const { emitter, walletTools, txId, pluginInfo, processor, taskCache } = args
863
916
  const deferred = new _Deferred2.default()
917
+ deferred.promise
918
+ .then(async (txResponse) => {
919
+ // Grab tx to update it
920
+ const txs = await processor.fetchTransactions({ txId })
921
+ let tx = txs[0]
922
+ if (tx == null) return
923
+
924
+ if (pluginInfo.engineInfo.txSpecificHandling != null) {
925
+ // Do coin-specific things to it
926
+ tx = pluginInfo.engineInfo.txSpecificHandling(tx, txResponse)
927
+ }
928
+
929
+ // Process and save new tx
930
+ const processedTx = await processor.saveTransaction({
931
+ tx
932
+ })
933
+
934
+ await exports.transactionChanged.call(void 0, {
935
+ emitter,
936
+ walletTools,
937
+ processor,
938
+ pluginInfo,
939
+ tx: processedTx
940
+ })
941
+ })
942
+ .catch(err => {
943
+ console.error(err)
944
+ args.log('error in updateTransactionsSpecific:', err)
945
+ taskCache.updateTransactionSpecificCache[txId] = { processing: false }
946
+ })
947
+ return {
948
+ ..._BlockBookAPI.transactionMessageSpecific.call(void 0, txId),
949
+ deferred
950
+ }
951
+ }
952
+
953
+
954
+
955
+
956
+
957
+
958
+ const updateTransactions = (
959
+ args
960
+ ) => {
961
+ const {
962
+ emitter,
963
+ walletTools,
964
+ txId,
965
+ needsTxSpecific,
966
+ pluginInfo,
967
+ processor,
968
+ taskCache
969
+ } = args
970
+ const deferred = new _Deferred2.default()
864
971
  deferred.promise
865
972
  .then(async (txResponse) => {
866
973
  // check if raw tx is still not confirmed, if so, don't change anything
@@ -885,6 +992,7 @@ const updateTransactions = (
885
992
  const processedTx = await processor.saveTransaction({
886
993
  tx
887
994
  })
995
+
888
996
  await exports.transactionChanged.call(void 0, {
889
997
  emitter,
890
998
  walletTools,
@@ -892,6 +1000,13 @@ const updateTransactions = (
892
1000
  pluginInfo,
893
1001
  tx: processedTx
894
1002
  })
1003
+
1004
+ if (needsTxSpecific) {
1005
+ // Add task to grab transactionSpecific payload
1006
+ taskCache.updateTransactionSpecificCache[txId] = {
1007
+ processing: false
1008
+ }
1009
+ }
895
1010
  })
896
1011
  .catch(err => {
897
1012
  console.error(err)
@@ -1002,6 +1117,7 @@ const internalGetFreshAddress = async (
1002
1117
 
1003
1118
 
1004
1119
 
1120
+
1005
1121
  const processAddressTransactions = async (
1006
1122
  args
1007
1123
  ) => {
@@ -1009,6 +1125,7 @@ const processAddressTransactions = async (
1009
1125
  address,
1010
1126
  addressTransactionState,
1011
1127
  emitter,
1128
+ needsTxSpecific,
1012
1129
  pluginInfo,
1013
1130
  processor,
1014
1131
  walletTools,
@@ -1055,6 +1172,13 @@ const processAddressTransactions = async (
1055
1172
  pluginInfo,
1056
1173
  tx: processedTx
1057
1174
  })
1175
+
1176
+ if (needsTxSpecific) {
1177
+ // Add task to grab transactionSpecific payload
1178
+ taskCache.updateTransactionSpecificCache[tx.txid] = {
1179
+ processing: false
1180
+ }
1181
+ }
1058
1182
  }
1059
1183
 
1060
1184
  // Halt on finishing the processing of address transaction until
@@ -11,6 +11,8 @@
11
11
 
12
12
 
13
13
 
14
+
15
+
14
16
  var _keymanager = require('../keymanager/keymanager');
15
17
 
16
18
 
@@ -125,12 +127,24 @@ var _utils = require('./utils');
125
127
  ) {
126
128
  const purposeType = _utils.currencyFormatToPurposeType.call(void 0, format)
127
129
  const scriptType = _utils.getScriptTypeFromPurposeType.call(void 0, purposeType)
128
- const pubkey = _keymanager.privateKeyToPubkey.call(void 0,
129
- _keymanager.wifToPrivateKey.call(void 0, {
130
- wifKey,
131
- coin
132
- })
133
- )
130
+ const privateKeyEncoding = _keymanager.wifToPrivateKeyEncoding.call(void 0, {
131
+ wifKey,
132
+ coin
133
+ })
134
+
135
+ // Restrict only compressed keys for segwit pubkeys as per BIP143
136
+ // (see https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki#restrictions-on-public-key-type)
137
+ if (
138
+ [
139
+ _keymanager.BIP43PurposeTypeEnum.Segwit,
140
+ _keymanager.BIP43PurposeTypeEnum.WrappedSegwit
141
+ ].includes(purposeType) &&
142
+ !privateKeyEncoding.compressed
143
+ ) {
144
+ privateKeyEncoding.compressed = true
145
+ }
146
+
147
+ const pubkey = _keymanager.privateKeyEncodingToPubkey.call(void 0, privateKeyEncoding)
134
148
  return _keymanager.pubkeyToScriptPubkey.call(void 0, {
135
149
  pubkey: pubkey,
136
150
  scriptType
@@ -179,8 +193,8 @@ var _utils = require('./utils');
179
193
  })
180
194
  },
181
195
 
182
- getPrivateKeyFromWif(wifKey) {
183
- return _keymanager.wifToPrivateKey.call(void 0, {
196
+ getPrivateKeyEncodingFromWif(wifKey) {
197
+ return _keymanager.wifToPrivateKeyEncoding.call(void 0, {
184
198
  wifKey,
185
199
  coin
186
200
  })
@@ -221,7 +221,7 @@ var _keymanager = require('../keymanager/keymanager');
221
221
 
222
222
  // Check if the pathname type is a wif
223
223
  try {
224
- _keymanager.wifToPrivateKey.call(void 0, {
224
+ _keymanager.wifToPrivateKeyEncoding.call(void 0, {
225
225
  wifKey: args.pathname,
226
226
  coin: args.coin
227
227
  })
@@ -1,4 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _cleaners = require('cleaners');
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -52,6 +54,21 @@ const engineInfo = {
52
54
  standardFeeHigh: '200',
53
55
  standardFeeLowAmount: '20000000',
54
56
  standardFeeHighAmount: '981000000'
57
+ },
58
+ txSpecificHandling: (
59
+ tx,
60
+ txSpecific
61
+ ) => {
62
+ const asDashTransactionSpecific = _cleaners.asObject.call(void 0, {
63
+ instantlock: _cleaners.asOptional.call(void 0, _cleaners.asBoolean)
64
+ })
65
+ const cleanedTxSpecific = _cleaners.asMaybe.call(void 0, asDashTransactionSpecific)(txSpecific)
66
+
67
+ if (_optionalChain([cleanedTxSpecific, 'optionalAccess', _ => _.instantlock]) === true) {
68
+ tx.confirmations = 'confirmed'
69
+ }
70
+
71
+ return tx
55
72
  }
56
73
  }
57
74
 
@@ -230,6 +230,11 @@ var VerifyAddressEnum; (function (VerifyAddressEnum) {
230
230
 
231
231
 
232
232
 
233
+
234
+
235
+
236
+
237
+
233
238
 
234
239
 
235
240
 
@@ -785,7 +790,7 @@ const xprivToPrivateKeyInternal = (
785
790
  }).toWIF(coinClass.wifEncodeFunc)
786
791
  } exports.privateKeyToWIF = privateKeyToWIF;
787
792
 
788
- const wifToPrivateKeyInternal = (
793
+ const wifToPrivateKeyEncodingInternal = (
789
794
  prefixIndex,
790
795
  args
791
796
  ) => {
@@ -795,29 +800,39 @@ const wifToPrivateKeyInternal = (
795
800
  forWIF: true,
796
801
  prefixIndex
797
802
  })
798
- return _optionalChain([bitcoin, 'access', _10 => _10.ECPair, 'access', _11 => _11.fromWIF, 'call', _12 => _12(
803
+ const ecPair = bitcoin.ECPair.fromWIF(
799
804
  args.wifKey,
800
805
  network,
801
806
  coin.bs58DecodeFunc
802
- ), 'access', _13 => _13.privateKey, 'optionalAccess', _14 => _14.toString, 'call', _15 => _15('hex')])
807
+ )
808
+ if (ecPair.privateKey == null) return
809
+ return {
810
+ hex: ecPair.privateKey.toString('hex'),
811
+ compressed: ecPair.compressed
812
+ }
803
813
  }
804
- const wifToPrivateKey = (args) => {
805
- const privateKey = filterCoinPrefixes(
814
+ const wifToPrivateKeyEncoding = (
815
+ args
816
+ ) => {
817
+ const privateKeyEncoding = filterCoinPrefixes(
806
818
  args.coin,
807
- prefixIndex => wifToPrivateKeyInternal(prefixIndex, args),
819
+ prefixIndex => wifToPrivateKeyEncodingInternal(prefixIndex, args),
808
820
  ['Invalid network version']
809
821
  )
810
- if (privateKey == null) {
822
+ if (privateKeyEncoding == null) {
811
823
  throw new Error('Failed to convert WIF key to private key')
812
824
  }
813
- return privateKey
814
- }; exports.wifToPrivateKey = wifToPrivateKey
825
+ return privateKeyEncoding
826
+ }; exports.wifToPrivateKeyEncoding = wifToPrivateKeyEncoding
815
827
 
816
- function privateKeyToPubkey(privateKey) {
817
- return bitcoin.ECPair.fromPrivateKey(
818
- Buffer.from(privateKey, 'hex')
819
- ).publicKey.toString('hex')
820
- } exports.privateKeyToPubkey = privateKeyToPubkey;
828
+ function privateKeyEncodingToPubkey(
829
+ privateKeyEncoding
830
+ ) {
831
+ const { hex, compressed } = privateKeyEncoding
832
+ return bitcoin.ECPair.fromPrivateKey(Buffer.from(hex, 'hex'), {
833
+ compressed
834
+ }).publicKey.toString('hex')
835
+ } exports.privateKeyEncodingToPubkey = privateKeyEncodingToPubkey;
821
836
 
822
837
  function signMessageBase64(message, privateKey) {
823
838
  const keyPair = bitcoin.ECPair.fromPrivateKey(Buffer.from(privateKey, 'hex'))
@@ -977,7 +992,7 @@ const wifToPrivateKeyInternal = (
977
992
  psbt.addInputs(sortedInputs)
978
993
  psbt.addOutputs(sortedOutputs)
979
994
  } catch (error) {
980
- _optionalChain([log, 'optionalAccess', _16 => _16.error, 'call', _17 => _17(`Failed makeTx: ${String(error)}`)])
995
+ _optionalChain([log, 'optionalAccess', _10 => _10.error, 'call', _11 => _11(`Failed makeTx: ${String(error)}`)])
981
996
  throw error
982
997
  }
983
998
 
@@ -987,7 +1002,7 @@ const wifToPrivateKeyInternal = (
987
1002
  changeUsed: result.changeUsed,
988
1003
  fee: result.fee,
989
1004
  psbtBase64: psbt.toBase64(),
990
- 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')])
1005
+ hex: _optionalChain([psbt, 'access', _12 => _12.data, 'optionalAccess', _13 => _13.globalMap, 'optionalAccess', _14 => _14.unsignedTx, 'optionalAccess', _15 => _15.toBuffer, 'call', _16 => _16(), 'optionalAccess', _17 => _17.toString, 'call', _18 => _18('hex')])
991
1006
  }
992
1007
  } exports.makeTx = makeTx;
993
1008
 
@@ -996,13 +1011,13 @@ const wifToPrivateKeyInternal = (
996
1011
  const coin = _coinmapper.getCoinFromString.call(void 0, args.coin)
997
1012
 
998
1013
  for (let i = 0; i < psbt.inputCount; i++) {
999
- const privateKey = Buffer.from(
1000
- _nullishCoalesce(args.privateKeys[i], () => ( args.privateKeys[args.privateKeys.length - 1])),
1001
- 'hex'
1002
- )
1014
+ const privateKeyEncoding =
1015
+ _nullishCoalesce(args.privateKeyEncodings[i], () => (
1016
+ args.privateKeyEncodings[args.privateKeyEncodings.length - 1]))
1017
+ const { hex, compressed } = privateKeyEncoding
1003
1018
  psbt.signInput(
1004
1019
  i,
1005
- bitcoin.ECPair.fromPrivateKey(privateKey),
1020
+ bitcoin.ECPair.fromPrivateKey(Buffer.from(hex, 'hex'), { compressed }),
1006
1021
  bitcoin.Psbt.DEFAULT_SIGHASHES,
1007
1022
  coin.sighashFunction
1008
1023
  )
@@ -8,6 +8,7 @@
8
8
 
9
9
 
10
10
 
11
+
11
12
  var _cleaners = require('cleaners');
12
13
 
13
14
 
@@ -211,6 +212,17 @@ var _cleaners = require('cleaners');
211
212
 
212
213
  const asTransactionResponse = exports.asBlockbookTransaction; exports.asTransactionResponse = asTransactionResponse
213
214
 
215
+ /**
216
+ * Get Transaction Specific
217
+ */
218
+ const transactionMessageSpecific = (
219
+ hash
220
+ ) => ({
221
+ method: 'getTransactionSpecific',
222
+ params: { txid: hash },
223
+ cleaner: exports.asBlockbookResponse.call(void 0, _cleaners.asUnknown)
224
+ }); exports.transactionMessageSpecific = transactionMessageSpecific
225
+
214
226
  /**
215
227
  * Send Transaction
216
228
  */
@@ -3,7 +3,7 @@ import { bip32 } from 'altcoin-js';
3
3
  import { Cleaner } from 'cleaners';
4
4
  import { Disklet } from 'disklet';
5
5
  import { EdgeCurrencyEngineOptions, EdgeCurrencyInfo, EdgeCurrencyTools, EdgeIo, EdgeParsedUri, EdgeWalletInfo } from 'edge-core-js/types';
6
- import { IUTXO } from '../utxobased/db/types';
6
+ import { IProcessorTransaction, IUTXO } from '../utxobased/db/types';
7
7
  import { ScriptTemplates } from '../utxobased/info/scriptTemplates/types';
8
8
  import { UtxoPicker } from '../utxobased/keymanager/utxopicker';
9
9
  import { EngineEmitter } from './makeEngineEmitter';
@@ -41,6 +41,7 @@ export interface EngineInfo {
41
41
  simpleFeeSettings: SimpleFeeSettings;
42
42
  scriptTemplates?: ScriptTemplates;
43
43
  asBlockbookAddress?: Cleaner<string>;
44
+ txSpecificHandling?: (tx: IProcessorTransaction, specialTx: unknown) => IProcessorTransaction;
44
45
  }
45
46
  /**
46
47
  * Coin Info
@@ -28,6 +28,7 @@ export interface IProcessorTransaction {
28
28
  txid: string;
29
29
  hex: string;
30
30
  blockHeight: number;
31
+ confirmations?: 'confirmed' | 'unconfirmed' | 'dropped' | number;
31
32
  date: number;
32
33
  fees: string;
33
34
  inputs: ITransactionInput[];
@@ -52,12 +52,18 @@ interface TaskCache {
52
52
  readonly processorUtxoCache: ProcessorUtxoCache;
53
53
  readonly addressTransactionCache: AddressTransactionCache;
54
54
  readonly updateTransactionCache: UpdateTransactionCache;
55
+ readonly updateTransactionSpecificCache: UpdateTransactionSpecificCache;
55
56
  }
56
57
  interface UpdateTransactionCache {
57
58
  [key: string]: {
58
59
  processing: boolean;
59
60
  };
60
61
  }
62
+ interface UpdateTransactionSpecificCache {
63
+ [key: string]: {
64
+ processing: boolean;
65
+ };
66
+ }
61
67
  interface AddressSubscribeCache {
62
68
  [key: string]: {
63
69
  processing: boolean;
@@ -1,6 +1,7 @@
1
1
  import { AddressPath, CurrencyFormat } from '../../plugin/types';
2
2
  import { ScriptTemplate } from '../info/scriptTemplates/types';
3
3
  import { PublicKey } from '../keymanager/cleaners';
4
+ import { PrivateKeyEncoding } from '../keymanager/keymanager';
4
5
  import { CurrencyFormatKeys } from './utils';
5
6
  export interface WalletToolsConfig {
6
7
  publicKey: PublicKey;
@@ -14,7 +15,7 @@ export interface UTXOPluginWalletTools {
14
15
  addressToScriptPubkey: (address: string) => string;
15
16
  scriptPubkeyToAddress: (args: ScriptPubkeyToAddressArgs) => AddressReturn;
16
17
  getPrivateKey: (args: GetPrivateKeyArgs) => string;
17
- getPrivateKeyFromWif: (wif: string) => string;
18
+ getPrivateKeyEncodingFromWif: (wif: string) => PrivateKeyEncoding;
18
19
  getScriptAddress: (args: GetScriptAddressArgs) => GetScriptAddressReturn;
19
20
  signMessageBase64: (args: SignMessageArgs) => string;
20
21
  }
@@ -101,10 +101,14 @@ export interface ScriptPubkeyToP2SHReturn {
101
101
  redeemScript: string;
102
102
  address?: string;
103
103
  }
104
- export interface WIFToPrivateKeyArgs {
104
+ export interface WIFToPrivateKeyEncodingArgs {
105
105
  wifKey: string;
106
106
  coin: string;
107
107
  }
108
+ export interface PrivateKeyEncoding {
109
+ hex: string;
110
+ compressed: boolean;
111
+ }
108
112
  export interface PrivateKeyToWIFArgs {
109
113
  privateKey: string;
110
114
  coin: string;
@@ -145,7 +149,7 @@ interface MakeTxReturn extends Required<utxopicker.UtxoPickerResult> {
145
149
  psbtBase64: string;
146
150
  }
147
151
  export interface SignTxArgs {
148
- privateKeys: string[];
152
+ privateKeyEncodings: PrivateKeyEncoding[];
149
153
  psbtBase64: string;
150
154
  coin: string;
151
155
  }
@@ -195,8 +199,8 @@ export declare function pubkeyToScriptPubkey(args: PubkeyToScriptPubkeyArgs): Pu
195
199
  export declare const toNewFormat: (address: string, coinName: string) => string;
196
200
  export declare const xprivToPrivateKey: (args: XPrivToPrivateKeyArgs) => string;
197
201
  export declare function privateKeyToWIF(args: PrivateKeyToWIFArgs): string;
198
- export declare const wifToPrivateKey: (args: WIFToPrivateKeyArgs) => string;
199
- export declare function privateKeyToPubkey(privateKey: string): string;
202
+ export declare const wifToPrivateKeyEncoding: (args: WIFToPrivateKeyEncodingArgs) => PrivateKeyEncoding;
203
+ export declare function privateKeyEncodingToPubkey(privateKeyEncoding: PrivateKeyEncoding): string;
200
204
  export declare function signMessageBase64(message: string, privateKey: string): string;
201
205
  export declare function makeTx(args: MakeTxArgs): MakeTxReturn;
202
206
  export declare function signTx(args: SignTxArgs): Promise<SignTxReturn>;
@@ -96,6 +96,10 @@ export declare const asAddressUtxosResponse: (asAddress?: Cleaner<string>) => Cl
96
96
  export declare const transactionMessage: (hash: string, asAddress?: Cleaner<string>) => BlockbookTask<TransactionResponse>;
97
97
  export declare type TransactionResponse = BlockbookTransaction;
98
98
  export declare const asTransactionResponse: (asAddress?: Cleaner<string>) => Cleaner<BlockbookTransaction>;
99
+ /**
100
+ * Get Transaction Specific
101
+ */
102
+ export declare const transactionMessageSpecific: (hash: string) => BlockbookTask<unknown>;
99
103
  /**
100
104
  * Send Transaction
101
105
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
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",