@exodus/bitcoin-api 2.3.14 → 2.3.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-api",
3
- "version": "2.3.14",
3
+ "version": "2.3.16",
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": "ea21eb60e35f84cf2086ae0304bf9fa8ce4058b1"
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(),
@@ -150,6 +150,8 @@ export const createAndBroadcastTXFactory = ({
150
150
  'should not be called without either a receiving address or to bump a tx'
151
151
  )
152
152
 
153
+ const useCashAddress = asset.address.isCashAddress?.(address)
154
+
153
155
  const assetName = asset.name
154
156
 
155
157
  const receiveAddresses = await assetClientInterface.getReceiveAddresses({
@@ -292,6 +294,7 @@ export const createAndBroadcastTXFactory = ({
292
294
  outputs,
293
295
  },
294
296
  txMeta: {
297
+ useCashAddress, // for trezor to show the receiver cash address
295
298
  addressPathsMap: selectedUtxos.getAddressPathsMap(),
296
299
  blockHeight,
297
300
  },