@exodus/bitcoin-api 2.3.14 → 2.3.15

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/move-funds.js +16 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "2.3.14",
3
+ "version": "2.3.15",
4
4
  "description": "Exodus bitcoin-api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -41,5 +41,5 @@
41
41
  "@exodus/bitcoin-meta": "^1.0.1",
42
42
  "jest-when": "^3.5.1"
43
43
  },
44
- "gitHead": "ae9ce2178387cabffcf542daabe8e6a25e9afa3c"
44
+ "gitHead": "90be61265b73fc6f3238604aea72368cf684faa5"
45
45
  }
package/src/move-funds.js CHANGED
@@ -98,14 +98,21 @@ export const moveFundsFactory = ({
98
98
  throw new MoveFundsError('private-key-invalid', formatProps)
99
99
  }
100
100
 
101
- const receiveAddresses = await assetClientInterface.getReceiveAddresses({
102
- walletAccount,
103
- assetName,
104
- multiAddressMode: true,
105
- })
101
+ const receiveAddresses = (
102
+ await assetClientInterface.getReceiveAddresses({
103
+ walletAccount,
104
+ assetName,
105
+ multiAddressMode: true,
106
+ })
107
+ ).map(
108
+ (receiveAddress) =>
109
+ address.toLegacyAddress?.(receiveAddress.toString()) || receiveAddress.toString()
110
+ )
106
111
 
107
112
  const findFromAddress = async () => {
108
- for (const currentAddress of addresses) {
113
+ for (const originalCurrentAddress of addresses) {
114
+ const currentAddress =
115
+ address.toLegacyAddress?.(originalCurrentAddress) || originalCurrentAddress
109
116
  const selfSend = receiveAddresses.some(
110
117
  (receiveAddress) => String(receiveAddress) === String(currentAddress)
111
118
  )
@@ -140,7 +147,9 @@ export const moveFundsFactory = ({
140
147
  const unsignedTx = {
141
148
  txData: {
142
149
  inputs: createInputs(assetName, utxos.toArray()),
143
- outputs: [createOutput(assetName, toAddress, amount)],
150
+ outputs: [
151
+ createOutput(assetName, address.toLegacyAddress?.(toAddress) || toAddress, amount),
152
+ ],
144
153
  },
145
154
  txMeta: {
146
155
  addressPathsMap: utxos.getAddressPathsMap(),