edge-currency-plugins 3.8.4 → 3.8.5

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.
@@ -541,6 +541,7 @@ var _UtxoWalletTools = require('./UtxoWalletTools');
541
541
  )
542
542
  const txOptions = _nullishCoalesce(spendInfoOtherParams.txOptions, () => ( {}))
543
543
  const {
544
+ memoIndex,
544
545
  outputSort,
545
546
  utxoSourceAddress,
546
547
  forceChangeAddress
@@ -669,6 +670,7 @@ var _UtxoWalletTools = require('./UtxoWalletTools');
669
670
  freshChangeAddress,
670
671
  subtractFee,
671
672
  log,
673
+ memoIndex,
672
674
  outputSort
673
675
  })
674
676
  if (tx.changeUsed) {
@@ -6,6 +6,7 @@
6
6
 
7
7
 
8
8
 
9
+
9
10
  var _cleaners = require('cleaners');
10
11
 
11
12
 
@@ -53,6 +54,7 @@ const asOutputSort = _cleaners.asValue.call(void 0, 'bip69', 'targets')
53
54
  /** @deprecated use `EdgeSpendInfo['enableRbf']` */
54
55
  enableRbf: _cleaners.asOptional.call(void 0, _cleaners.asBoolean),
55
56
  forceChangeAddress: _cleaners.asOptional.call(void 0, _cleaners.asString),
57
+ memoIndex: _cleaners.asOptional.call(void 0, _cleaners.asNumber),
56
58
  outputSort: _cleaners.asOptional.call(void 0, asOutputSort, 'bip69'),
57
59
  txOptions: _cleaners.asOptional.call(void 0, _types3.asTxOptions),
58
60
  utxoSourceAddress: _cleaners.asOptional.call(void 0, _cleaners.asString)
@@ -272,6 +272,7 @@ var VerifyAddressEnum; (function (VerifyAddressEnum) {
272
272
 
273
273
 
274
274
 
275
+
275
276
 
276
277
 
277
278
  function bip43PurposeNumberToTypeEnum(
@@ -949,7 +950,7 @@ const wifToPrivateKeyEncodingInternal = (
949
950
  } exports.signMessageBase64 = signMessageBase64;
950
951
 
951
952
  function makeTx(args) {
952
- const { log, outputSort, memos } = args
953
+ const { log, outputSort, memos, memoIndex } = args
953
954
  let sequence = 0xffffffff
954
955
  if (args.enableRbf) {
955
956
  sequence -= 2
@@ -1102,6 +1103,16 @@ const wifToPrivateKeyEncodingInternal = (
1102
1103
  }
1103
1104
  })()
1104
1105
 
1106
+ if (memoIndex != null) {
1107
+ const currentMemoIndex = sortedOutputs.findIndex(
1108
+ output => output.value === 0
1109
+ )
1110
+ if (currentMemoIndex !== -1) {
1111
+ const memoOutput = sortedOutputs.splice(currentMemoIndex, 1)
1112
+ sortedOutputs.splice(memoIndex, 0, memoOutput[0])
1113
+ }
1114
+ }
1115
+
1105
1116
  const psbt = new (0, _altcoinjs.Psbt)()
1106
1117
  try {
1107
1118
  psbt.addInputs(sortedInputs)
@@ -28,6 +28,7 @@ export declare type UtxoSpendInfoOtherParams = ReturnType<typeof asUtxoSpendInfo
28
28
  export declare const asUtxoSpendInfoOtherParams: import("cleaners").ObjectCleaner<{
29
29
  enableRbf: boolean | undefined;
30
30
  forceChangeAddress: string | undefined;
31
+ memoIndex: number | undefined;
31
32
  outputSort: "targets" | "bip69";
32
33
  txOptions: import("../../plugin/types").TxOptions | undefined;
33
34
  utxoSourceAddress: string | undefined;
@@ -145,6 +145,7 @@ export interface MakeTxArgs {
145
145
  subtractFee?: boolean;
146
146
  log?: EdgeLog;
147
147
  outputSort: 'bip69' | 'targets';
148
+ memoIndex?: number;
148
149
  }
149
150
  export interface MakeTxTarget {
150
151
  address?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "3.8.4",
3
+ "version": "3.8.5",
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",