edge-currency-monero 1.4.1 → 1.5.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/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # edge-currency-monero
2
2
 
3
- ## Unreleased
3
+ ## 1.5.0 (2025-04-21)
4
+
5
+ - added: Support for multiple spend targets.
6
+
7
+ ## 1.4.2 (2025-04-01)
8
+
9
+ - fixed: Small internal implementation cleanup on how transactions are saved.
4
10
 
5
11
  ## 1.4.1 (2025-03-28)
6
12
 
@@ -267,7 +267,7 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
267
267
  })
268
268
  }
269
269
 
270
- let edgeTransaction = {
270
+ const edgeTransaction = {
271
271
  blockHeight,
272
272
  currencyCode: 'XMR',
273
273
  date,
@@ -284,33 +284,9 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
284
284
  walletId: this.walletId
285
285
  }
286
286
 
287
- const idx = this.findTransaction(PRIMARY_CURRENCY_TOKEN_ID, tx.hash)
288
- if (idx === -1) {
289
- this.log(`New transaction: ${tx.hash}`)
290
-
291
- // New transaction not in database
292
- this.addTransaction(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction)
293
-
294
- this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray)
295
- this.transactionEventArray = []
296
- } else {
297
- // Already have this tx in the database. See if anything changed
298
- const transactionsArray = this.getTxs(PRIMARY_CURRENCY_TOKEN_ID)
299
- const edgeTx = transactionsArray[idx]
300
-
301
- if (edgeTx.blockHeight !== edgeTransaction.blockHeight) {
302
- // The native amounts returned from the API take some time before they're accurate. We can trust the amounts we saved instead.
303
- edgeTransaction = {
304
- ...edgeTransaction,
305
- nativeAmount: edgeTx.nativeAmount
306
- }
307
-
308
- this.log(`Update transaction: ${tx.hash} height:${tx.height}`)
309
- this.updateTransaction(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction, idx)
310
- this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray)
311
- this.transactionEventArray = []
312
- }
313
- }
287
+ this.saveTransactionState(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction)
288
+ this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray)
289
+ this.transactionEventArray = []
314
290
 
315
291
  return blockHeight
316
292
  }
@@ -379,11 +355,15 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
379
355
  return txs
380
356
  }
381
357
 
382
- addTransaction(tokenId, edgeTransaction) {
358
+ saveTransactionState(
359
+ tokenId,
360
+ edgeTransaction
361
+ ) {
383
362
  // Add or update tx in transactionsObj
384
363
  const idx = this.findTransaction(tokenId, edgeTransaction.txid)
385
364
 
386
365
  if (idx === -1) {
366
+ this.log(`New transaction: ${edgeTransaction.txid}`)
387
367
  this.log.warn(
388
368
  'addTransaction: adding and sorting:' +
389
369
  edgeTransaction.txid +
@@ -408,26 +388,35 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
408
388
  transaction: edgeTransaction
409
389
  })
410
390
  } else {
411
- this.updateTransaction(tokenId, edgeTransaction, idx)
412
- }
413
- }
391
+ const txs = this.getTxs(tokenId)
392
+ const edgeTx = txs[idx]
414
393
 
415
- updateTransaction(
416
- tokenId,
417
- edgeTransaction,
418
- idx
419
- ) {
420
- // Update the transaction
421
- const txs = this.getTxs(tokenId)
422
- txs[idx] = edgeTransaction
423
- this.walletLocalDataDirty = true
424
- this.transactionEventArray.push({
425
- isNew: false,
426
- transaction: edgeTransaction
427
- })
428
- this.log.warn(
429
- 'updateTransaction' + edgeTransaction.txid + edgeTransaction.nativeAmount
430
- )
394
+ // Already have this tx in the database. Consider a change if blockHeight changed
395
+ if (edgeTx.blockHeight === edgeTransaction.blockHeight) return
396
+ this.log(
397
+ `Update transaction: ${edgeTransaction.txid} height:${edgeTransaction.blockHeight}`
398
+ )
399
+
400
+ // The native amounts returned from the API take some time before they're
401
+ // accurate. We can trust the amounts we saved instead.
402
+ edgeTransaction = {
403
+ ...edgeTransaction,
404
+ nativeAmount: edgeTx.nativeAmount
405
+ }
406
+
407
+ // Update the transaction
408
+ txs[idx] = edgeTransaction
409
+ this.walletLocalDataDirty = true
410
+ this.transactionEventArray.push({
411
+ isNew: false,
412
+ transaction: edgeTransaction
413
+ })
414
+ this.log.warn(
415
+ 'updateTransaction' +
416
+ edgeTransaction.txid +
417
+ edgeTransaction.nativeAmount
418
+ )
419
+ }
431
420
  }
432
421
 
433
422
  // *************************************
@@ -612,10 +601,14 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
612
601
  }
613
602
 
614
603
  const options = {
615
- amount: '0',
616
604
  isSweepTx: true,
617
605
  priority: translateFee(edgeSpendInfo.networkFeeOption),
618
- targetAddress: publicAddress
606
+ targets: [
607
+ {
608
+ amount: '0',
609
+ targetAddress: publicAddress
610
+ }
611
+ ]
619
612
  }
620
613
 
621
614
  const result = await this.createMyMoneroTransaction(options, privateKeys)
@@ -653,39 +646,45 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
653
646
  const { memos = [] } = edgeSpendInfo
654
647
  const privateKeys = _moneroTypes.asPrivateKeys.call(void 0, _optionalChain([opts, 'optionalAccess', _7 => _7.privateKeys]))
655
648
 
656
- // Monero can only have one output
657
- // TODO: The new SDK fixes this!
658
- if (edgeSpendInfo.spendTargets.length !== 1) {
659
- throw new Error('Error: only one output allowed')
660
- }
649
+ const { spendTargets } = edgeSpendInfo
661
650
 
662
- const [spendTarget] = edgeSpendInfo.spendTargets
663
- const { publicAddress, nativeAmount } = spendTarget
664
- if (publicAddress == null) {
665
- throw new TypeError('Missing destination address')
666
- }
667
- if (nativeAmount == null || _biggystring.eq.call(void 0, nativeAmount, '0')) {
668
- throw new (0, _types.NoAmountSpecifiedError)()
669
- }
651
+ let totalAmount = '0'
652
+ const targets = []
670
653
 
671
- if (
672
- _biggystring.gte.call(void 0,
673
- nativeAmount,
674
- _nullishCoalesce(this.walletLocalData.totalBalances.get(PRIMARY_CURRENCY_TOKEN_ID), () => ( '0'))
675
- )
676
- ) {
677
- if (_biggystring.gte.call(void 0, this.walletLocalData.lockedXmrBalance, nativeAmount)) {
678
- throw new (0, _types.PendingFundsError)()
679
- } else {
680
- throw new (0, _types.InsufficientFundsError)({ tokenId: PRIMARY_CURRENCY_TOKEN_ID })
654
+ for (const spendTarget of spendTargets) {
655
+ const { publicAddress, nativeAmount } = spendTarget
656
+ if (publicAddress == null) {
657
+ throw new TypeError('Missing destination address')
658
+ }
659
+ if (nativeAmount == null || _biggystring.eq.call(void 0, nativeAmount, '0')) {
660
+ throw new (0, _types.NoAmountSpecifiedError)()
681
661
  }
662
+ totalAmount = _biggystring.add.call(void 0, totalAmount, nativeAmount)
663
+ if (
664
+ _biggystring.gte.call(void 0,
665
+ totalAmount,
666
+ _nullishCoalesce(this.walletLocalData.totalBalances.get(PRIMARY_CURRENCY_TOKEN_ID), () => (
667
+ '0'))
668
+ )
669
+ ) {
670
+ if (_biggystring.gte.call(void 0, this.walletLocalData.lockedXmrBalance, totalAmount)) {
671
+ throw new (0, _types.PendingFundsError)()
672
+ } else {
673
+ throw new (0, _types.InsufficientFundsError)({
674
+ tokenId: PRIMARY_CURRENCY_TOKEN_ID
675
+ })
676
+ }
677
+ }
678
+ targets.push({
679
+ amount: _biggystring.div.call(void 0, nativeAmount, '1000000000000', 12),
680
+ targetAddress: publicAddress
681
+ })
682
682
  }
683
683
 
684
684
  const options = {
685
- amount: _biggystring.div.call(void 0, nativeAmount, '1000000000000', 12),
686
685
  isSweepTx: false,
687
686
  priority: translateFee(edgeSpendInfo.networkFeeOption),
688
- targetAddress: publicAddress
687
+ targets
689
688
  }
690
689
  this.log(`Creating transaction: ${JSON.stringify(options, null, 1)}`)
691
690
 
@@ -746,7 +745,7 @@ const PRIMARY_CURRENCY_TOKEN_ID = null
746
745
  }
747
746
 
748
747
  async saveTx(edgeTransaction) {
749
- await this.addTransaction(edgeTransaction.tokenId, edgeTransaction)
748
+ await this.saveTransactionState(edgeTransaction.tokenId, edgeTransaction)
750
749
  }
751
750
 
752
751
  getDisplayPrivateSeed(privateKeys) {
@@ -48,6 +48,8 @@ var _ResponseParser = require('./mymonero-utils/ResponseParser'); var _ResponseP
48
48
 
49
49
 
50
50
 
51
+
52
+
51
53
 
52
54
 
53
55
 
@@ -238,13 +240,7 @@ const asGetAddressTxsResponse = _cleaners.asObject.call(void 0, {
238
240
  opts
239
241
  ) {
240
242
  const { address, privateSpendKey, privateViewKey, publicSpendKey } = keys
241
- const {
242
- amount,
243
- isSweepTx = false,
244
- paymentId,
245
- priority = 1,
246
- targetAddress
247
- } = opts
243
+ const { isSweepTx = false, paymentId, priority = 1, targets } = opts
248
244
 
249
245
  // Grab the UTXO set:
250
246
  const unspentOuts = await this.fetchPostMyMonero('get_unspent_outs', {
@@ -268,14 +264,14 @@ const asGetAddressTxsResponse = _cleaners.asObject.call(void 0, {
268
264
  })
269
265
  }
270
266
 
267
+ const destinations = targets.map(t => ({
268
+ send_amount: t.amount,
269
+ to_address: t.targetAddress
270
+ }))
271
+
271
272
  // Make the transaction:
272
273
  return await this.cppBridge.createTransaction({
273
- destinations: [
274
- {
275
- send_amount: amount,
276
- to_address: targetAddress
277
- }
278
- ],
274
+ destinations,
279
275
  priority,
280
276
  address,
281
277
  paymentId,
@@ -2167,31 +2167,9 @@ var MoneroEngine = /*#__PURE__*/function () {
2167
2167
  txid: tx.hash,
2168
2168
  walletId: this.walletId
2169
2169
  };
2170
- var idx = this.findTransaction(PRIMARY_CURRENCY_TOKEN_ID, tx.hash);
2171
-
2172
- if (idx === -1) {
2173
- this.log("New transaction: ".concat(tx.hash)); // New transaction not in database
2174
-
2175
- this.addTransaction(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction);
2176
- this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray);
2177
- this.transactionEventArray = [];
2178
- } else {
2179
- // Already have this tx in the database. See if anything changed
2180
- var transactionsArray = this.getTxs(PRIMARY_CURRENCY_TOKEN_ID);
2181
- var edgeTx = transactionsArray[idx];
2182
-
2183
- if (edgeTx.blockHeight !== edgeTransaction.blockHeight) {
2184
- // The native amounts returned from the API take some time before they're accurate. We can trust the amounts we saved instead.
2185
- edgeTransaction = _objectSpread(_objectSpread({}, edgeTransaction), {}, {
2186
- nativeAmount: edgeTx.nativeAmount
2187
- });
2188
- this.log("Update transaction: ".concat(tx.hash, " height:").concat(tx.height));
2189
- this.updateTransaction(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction, idx);
2190
- this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray);
2191
- this.transactionEventArray = [];
2192
- }
2193
- }
2194
-
2170
+ this.saveTransactionState(PRIMARY_CURRENCY_TOKEN_ID, edgeTransaction);
2171
+ this.edgeTxLibCallbacks.onTransactions(this.transactionEventArray);
2172
+ this.transactionEventArray = [];
2195
2173
  return blockHeight;
2196
2174
  }
2197
2175
  }, {
@@ -2283,12 +2261,13 @@ var MoneroEngine = /*#__PURE__*/function () {
2283
2261
  return txs;
2284
2262
  }
2285
2263
  }, {
2286
- key: "addTransaction",
2287
- value: function addTransaction(tokenId, edgeTransaction) {
2264
+ key: "saveTransactionState",
2265
+ value: function saveTransactionState(tokenId, edgeTransaction) {
2288
2266
  // Add or update tx in transactionsObj
2289
2267
  var idx = this.findTransaction(tokenId, edgeTransaction.txid);
2290
2268
 
2291
2269
  if (idx === -1) {
2270
+ this.log("New transaction: ".concat(edgeTransaction.txid));
2292
2271
  this.log.warn('addTransaction: adding and sorting:' + edgeTransaction.txid + edgeTransaction.nativeAmount);
2293
2272
  var txs = this.getTxs(tokenId);
2294
2273
  txs.push(edgeTransaction); // Sort
@@ -2305,21 +2284,26 @@ var MoneroEngine = /*#__PURE__*/function () {
2305
2284
  transaction: edgeTransaction
2306
2285
  });
2307
2286
  } else {
2308
- this.updateTransaction(tokenId, edgeTransaction, idx);
2287
+ var _txs2 = this.getTxs(tokenId);
2288
+
2289
+ var edgeTx = _txs2[idx]; // Already have this tx in the database. Consider a change if blockHeight changed
2290
+
2291
+ if (edgeTx.blockHeight === edgeTransaction.blockHeight) return;
2292
+ this.log("Update transaction: ".concat(edgeTransaction.txid, " height:").concat(edgeTransaction.blockHeight)); // The native amounts returned from the API take some time before they're
2293
+ // accurate. We can trust the amounts we saved instead.
2294
+
2295
+ edgeTransaction = _objectSpread(_objectSpread({}, edgeTransaction), {}, {
2296
+ nativeAmount: edgeTx.nativeAmount
2297
+ }); // Update the transaction
2298
+
2299
+ _txs2[idx] = edgeTransaction;
2300
+ this.walletLocalDataDirty = true;
2301
+ this.transactionEventArray.push({
2302
+ isNew: false,
2303
+ transaction: edgeTransaction
2304
+ });
2305
+ this.log.warn('updateTransaction' + edgeTransaction.txid + edgeTransaction.nativeAmount);
2309
2306
  }
2310
- }
2311
- }, {
2312
- key: "updateTransaction",
2313
- value: function updateTransaction(tokenId, edgeTransaction, idx) {
2314
- // Update the transaction
2315
- var txs = this.getTxs(tokenId);
2316
- txs[idx] = edgeTransaction;
2317
- this.walletLocalDataDirty = true;
2318
- this.transactionEventArray.push({
2319
- isNew: false,
2320
- transaction: edgeTransaction
2321
- });
2322
- this.log.warn('updateTransaction' + edgeTransaction.txid + edgeTransaction.nativeAmount);
2323
2307
  } // *************************************
2324
2308
  // Save the wallet data store
2325
2309
  // *************************************
@@ -2852,10 +2836,12 @@ var MoneroEngine = /*#__PURE__*/function () {
2852
2836
 
2853
2837
  case 5:
2854
2838
  options = {
2855
- amount: '0',
2856
2839
  isSweepTx: true,
2857
2840
  priority: translateFee(edgeSpendInfo.networkFeeOption),
2858
- targetAddress: publicAddress
2841
+ targets: [{
2842
+ amount: '0',
2843
+ targetAddress: publicAddress
2844
+ }]
2859
2845
  };
2860
2846
  _context20.next = 8;
2861
2847
  return this.createMyMoneroTransaction(options, privateKeys);
@@ -2927,74 +2913,85 @@ var MoneroEngine = /*#__PURE__*/function () {
2927
2913
  key: "makeSpend",
2928
2914
  value: function () {
2929
2915
  var _makeSpend = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(edgeSpendInfo, opts) {
2930
- var _this$walletLocalData8;
2931
-
2932
- var _edgeSpendInfo$memos, memos, privateKeys, _edgeSpendInfo$spendT2, spendTarget, publicAddress, nativeAmount, options, result, date, edgeTransaction;
2916
+ var _edgeSpendInfo$memos, memos, privateKeys, spendTargets, totalAmount, targets, _i4, _this$walletLocalData8, spendTarget, publicAddress, nativeAmount, options, result, date, edgeTransaction;
2933
2917
 
2934
2918
  return regeneratorRuntime.wrap(function _callee22$(_context22) {
2935
2919
  while (1) {
2936
2920
  switch (_context22.prev = _context22.next) {
2937
2921
  case 0:
2938
2922
  _edgeSpendInfo$memos = edgeSpendInfo.memos, memos = _edgeSpendInfo$memos === void 0 ? [] : _edgeSpendInfo$memos;
2939
- privateKeys = (0,_moneroTypes__WEBPACK_IMPORTED_MODULE_4__.asPrivateKeys)(opts === null || opts === void 0 ? void 0 : opts.privateKeys); // Monero can only have one output
2940
- // TODO: The new SDK fixes this!
2923
+ privateKeys = (0,_moneroTypes__WEBPACK_IMPORTED_MODULE_4__.asPrivateKeys)(opts === null || opts === void 0 ? void 0 : opts.privateKeys);
2924
+ spendTargets = edgeSpendInfo.spendTargets;
2925
+ totalAmount = '0';
2926
+ targets = [];
2927
+ _i4 = 0;
2941
2928
 
2942
- if (!(edgeSpendInfo.spendTargets.length !== 1)) {
2943
- _context22.next = 4;
2929
+ case 6:
2930
+ if (!(_i4 < spendTargets.length)) {
2931
+ _context22.next = 24;
2944
2932
  break;
2945
2933
  }
2946
2934
 
2947
- throw new Error('Error: only one output allowed');
2948
-
2949
- case 4:
2950
- _edgeSpendInfo$spendT2 = _slicedToArray(edgeSpendInfo.spendTargets, 1), spendTarget = _edgeSpendInfo$spendT2[0];
2935
+ spendTarget = spendTargets[_i4];
2951
2936
  publicAddress = spendTarget.publicAddress, nativeAmount = spendTarget.nativeAmount;
2952
2937
 
2953
2938
  if (!(publicAddress == null)) {
2954
- _context22.next = 8;
2939
+ _context22.next = 11;
2955
2940
  break;
2956
2941
  }
2957
2942
 
2958
2943
  throw new TypeError('Missing destination address');
2959
2944
 
2960
- case 8:
2945
+ case 11:
2961
2946
  if (!(nativeAmount == null || (0,biggystring__WEBPACK_IMPORTED_MODULE_0__.eq)(nativeAmount, '0'))) {
2962
- _context22.next = 10;
2947
+ _context22.next = 13;
2963
2948
  break;
2964
2949
  }
2965
2950
 
2966
2951
  throw new edge_core_js_types__WEBPACK_IMPORTED_MODULE_1__.NoAmountSpecifiedError();
2967
2952
 
2968
- case 10:
2969
- if (!(0,biggystring__WEBPACK_IMPORTED_MODULE_0__.gte)(nativeAmount, (_this$walletLocalData8 = this.walletLocalData.totalBalances.get(PRIMARY_CURRENCY_TOKEN_ID)) !== null && _this$walletLocalData8 !== void 0 ? _this$walletLocalData8 : '0')) {
2970
- _context22.next = 16;
2953
+ case 13:
2954
+ totalAmount = (0,biggystring__WEBPACK_IMPORTED_MODULE_0__.add)(totalAmount, nativeAmount);
2955
+
2956
+ if (!(0,biggystring__WEBPACK_IMPORTED_MODULE_0__.gte)(totalAmount, (_this$walletLocalData8 = this.walletLocalData.totalBalances.get(PRIMARY_CURRENCY_TOKEN_ID)) !== null && _this$walletLocalData8 !== void 0 ? _this$walletLocalData8 : '0')) {
2957
+ _context22.next = 20;
2971
2958
  break;
2972
2959
  }
2973
2960
 
2974
- if (!(0,biggystring__WEBPACK_IMPORTED_MODULE_0__.gte)(this.walletLocalData.lockedXmrBalance, nativeAmount)) {
2975
- _context22.next = 15;
2961
+ if (!(0,biggystring__WEBPACK_IMPORTED_MODULE_0__.gte)(this.walletLocalData.lockedXmrBalance, totalAmount)) {
2962
+ _context22.next = 19;
2976
2963
  break;
2977
2964
  }
2978
2965
 
2979
2966
  throw new edge_core_js_types__WEBPACK_IMPORTED_MODULE_1__.PendingFundsError();
2980
2967
 
2981
- case 15:
2968
+ case 19:
2982
2969
  throw new edge_core_js_types__WEBPACK_IMPORTED_MODULE_1__.InsufficientFundsError({
2983
2970
  tokenId: PRIMARY_CURRENCY_TOKEN_ID
2984
2971
  });
2985
2972
 
2986
- case 16:
2987
- options = {
2973
+ case 20:
2974
+ targets.push({
2988
2975
  amount: (0,biggystring__WEBPACK_IMPORTED_MODULE_0__.div)(nativeAmount, '1000000000000', 12),
2976
+ targetAddress: publicAddress
2977
+ });
2978
+
2979
+ case 21:
2980
+ _i4++;
2981
+ _context22.next = 6;
2982
+ break;
2983
+
2984
+ case 24:
2985
+ options = {
2989
2986
  isSweepTx: false,
2990
2987
  priority: translateFee(edgeSpendInfo.networkFeeOption),
2991
- targetAddress: publicAddress
2988
+ targets: targets
2992
2989
  };
2993
2990
  this.log("Creating transaction: ".concat(JSON.stringify(options, null, 1)));
2994
- _context22.next = 20;
2991
+ _context22.next = 28;
2995
2992
  return this.createMyMoneroTransaction(options, privateKeys);
2996
2993
 
2997
- case 20:
2994
+ case 28:
2998
2995
  result = _context22.sent;
2999
2996
  date = Date.now() / 1000;
3000
2997
  this.log("Total sent: ".concat(result.total_sent, ", Fee: ").concat(result.used_fee));
@@ -3023,7 +3020,7 @@ var MoneroEngine = /*#__PURE__*/function () {
3023
3020
  this.log.warn("makeSpend edgeTransaction ".concat((0,_utils__WEBPACK_IMPORTED_MODULE_6__.cleanTxLogs)(edgeTransaction)));
3024
3021
  return _context22.abrupt("return", edgeTransaction);
3025
3022
 
3026
- case 26:
3023
+ case 34:
3027
3024
  case "end":
3028
3025
  return _context22.stop();
3029
3026
  }
@@ -3115,7 +3112,7 @@ var MoneroEngine = /*#__PURE__*/function () {
3115
3112
  switch (_context25.prev = _context25.next) {
3116
3113
  case 0:
3117
3114
  _context25.next = 2;
3118
- return this.addTransaction(edgeTransaction.tokenId, edgeTransaction);
3115
+ return this.saveTransactionState(edgeTransaction.tokenId, edgeTransaction);
3119
3116
 
3120
3117
  case 2:
3121
3118
  case "end":
@@ -3985,14 +3982,14 @@ var MyMoneroApi = /*#__PURE__*/function () {
3985
3982
  var _createTransaction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(keys, opts) {
3986
3983
  var _this = this;
3987
3984
 
3988
- var address, privateSpendKey, privateViewKey, publicSpendKey, amount, _opts$isSweepTx, isSweepTx, paymentId, _opts$priority, priority, targetAddress, unspentOuts, randomOutsCb;
3985
+ var address, privateSpendKey, privateViewKey, publicSpendKey, _opts$isSweepTx, isSweepTx, paymentId, _opts$priority, priority, targets, unspentOuts, randomOutsCb, destinations;
3989
3986
 
3990
3987
  return regeneratorRuntime.wrap(function _callee5$(_context5) {
3991
3988
  while (1) {
3992
3989
  switch (_context5.prev = _context5.next) {
3993
3990
  case 0:
3994
3991
  address = keys.address, privateSpendKey = keys.privateSpendKey, privateViewKey = keys.privateViewKey, publicSpendKey = keys.publicSpendKey;
3995
- amount = opts.amount, _opts$isSweepTx = opts.isSweepTx, isSweepTx = _opts$isSweepTx === void 0 ? false : _opts$isSweepTx, paymentId = opts.paymentId, _opts$priority = opts.priority, priority = _opts$priority === void 0 ? 1 : _opts$priority, targetAddress = opts.targetAddress; // Grab the UTXO set:
3992
+ _opts$isSweepTx = opts.isSweepTx, isSweepTx = _opts$isSweepTx === void 0 ? false : _opts$isSweepTx, paymentId = opts.paymentId, _opts$priority = opts.priority, priority = _opts$priority === void 0 ? 1 : _opts$priority, targets = opts.targets; // Grab the UTXO set:
3996
3993
 
3997
3994
  _context5.next = 4;
3998
3995
  return this.fetchPostMyMonero('get_unspent_outs', {
@@ -4043,15 +4040,18 @@ var MyMoneroApi = /*#__PURE__*/function () {
4043
4040
  return function randomOutsCb(_x6) {
4044
4041
  return _ref.apply(this, arguments);
4045
4042
  };
4046
- }(); // Make the transaction:
4043
+ }();
4047
4044
 
4045
+ destinations = targets.map(function (t) {
4046
+ return {
4047
+ send_amount: t.amount,
4048
+ to_address: t.targetAddress
4049
+ };
4050
+ }); // Make the transaction:
4048
4051
 
4049
- _context5.next = 8;
4052
+ _context5.next = 9;
4050
4053
  return this.cppBridge.createTransaction({
4051
- destinations: [{
4052
- send_amount: amount,
4053
- to_address: targetAddress
4054
- }],
4054
+ destinations: destinations,
4055
4055
  priority: priority,
4056
4056
  address: address,
4057
4057
  paymentId: paymentId,
@@ -4064,10 +4064,10 @@ var MyMoneroApi = /*#__PURE__*/function () {
4064
4064
  randomOutsCb: randomOutsCb
4065
4065
  });
4066
4066
 
4067
- case 8:
4067
+ case 9:
4068
4068
  return _context5.abrupt("return", _context5.sent);
4069
4069
 
4070
- case 9:
4070
+ case 10:
4071
4071
  case "end":
4072
4072
  return _context5.stop();
4073
4073
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-monero",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Edge Monero currency plugin",
5
5
  "homepage": "https://edge.app",
6
6
  "repository": {