@exodus/bitcoin-plugin 1.17.1 → 1.17.3

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-plugin",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -55,5 +55,5 @@
55
55
  "bip39": "^2.6.0",
56
56
  "jest-when": "^3.5.1"
57
57
  },
58
- "gitHead": "2e105f8c05f3bd241d8c8a98e52170bbcef282ae"
58
+ "gitHead": "0ba651bd58350f436a84a59b2aed119688990932"
59
59
  }
@@ -1,6 +1,7 @@
1
1
  import _coinInfo from 'coininfo'
2
2
  import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
3
3
  import { createGetKeyIdentifier } from '@exodus/bitcoin-lib'
4
+ import { Tx } from '@exodus/models'
4
5
 
5
6
  import bip44Constants from '@exodus/bip44-constants/by-ticker'
6
7
  import {
@@ -298,16 +299,23 @@ export const createBitcoinAssetFactory =
298
299
  if (tx.sent && Array.isArray(tx.data.sent) && tx.data.sent.length > 0) {
299
300
  const feeAmount = tx.feeAmount.div(tx.data.sent.length)
300
301
  return tx.data.sent
301
- .map((to, i) =>
302
- tx.update({
302
+ .map((to, i) => {
303
+ // Avoids using tx.update(...) because it uses lodash _.merge
304
+ // which can be pretty slow on mobile.
305
+ const current = tx.toJSON()
306
+ return Tx.fromJSON({
307
+ ...current,
303
308
  to: to.address,
304
- data: { sentIndex: i },
309
+ data: {
310
+ ...current.data,
311
+ sentIndex: i,
312
+ },
305
313
  coinAmount: to.amount
306
314
  ? parseCurrency(to.amount, asset.currency).negate()
307
315
  : asset.currency.ZERO,
308
316
  feeAmount,
309
317
  })
310
- )
318
+ })
311
319
  .reverse()
312
320
  }
313
321
 
@@ -338,10 +346,7 @@ export const createBitcoinAssetFactory =
338
346
  parseUnsignedTx,
339
347
  signUnsignedTx: (unsignedTx, privateKey, opts) => signTx({ unsignedTx, privateKey, ...opts }), // legacy
340
348
  sendTx,
341
- signTx: ({ unsignedTx, hdkeys, privateKeysAddressMap, signer }) =>
342
- signer
343
- ? signTx({ unsignedTx, signer })
344
- : signTx({ unsignedTx, hdkeys, privateKeysAddressMap }),
349
+ signTx,
345
350
  signHardware,
346
351
  signMessage,
347
352
  getFee,
@@ -1,5 +1,6 @@
1
1
  import assert from 'minimalistic-assert'
2
2
  import { getOrdinalsUtxos } from '@exodus/bitcoin-api'
3
+ import { xverse49 } from '../compatibility-modes'
3
4
 
4
5
  export const getInscriptionAddresses = async ({
5
6
  assetClientInterface: aci,
@@ -36,17 +37,21 @@ export const getInscriptionAddresses = async ({
36
37
  addressIndex: 0,
37
38
  })
38
39
 
39
- const specialAddress3 = await aci.getAddress({
40
- // xverse
41
- assetName,
42
- walletAccount,
43
- purpose: 49,
44
- chainIndex: 0,
45
- addressIndex: 0,
46
- })
40
+ const specialAddress3 =
41
+ walletAccountInstance.compatibilityMode === xverse49
42
+ ? await aci.getAddress({
43
+ // xverse
44
+ assetName,
45
+ walletAccount,
46
+ purpose: 49,
47
+ chainIndex: 0,
48
+ addressIndex: 0,
49
+ })
50
+ : undefined
51
+
52
+ const allAddresses = [specialAddress1, specialAddress2, specialAddress3, ...addresses]
53
+ .filter(Boolean)
54
+ .map((t) => t.address.toString())
47
55
 
48
- const allAddresses = [specialAddress1, specialAddress2, specialAddress3, ...addresses].map((t) =>
49
- t.address.toString()
50
- )
51
56
  return [...new Set(allAddresses)]
52
57
  }
@@ -69,7 +69,7 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset, assetClientInterface:
69
69
  getNftsAddresses: async ({ walletAccount: walletAccountInstance }) => {
70
70
  return getInscriptionAddresses({
71
71
  assetClientInterface: aci,
72
- walletAccount: walletAccountInstance.toString(),
72
+ walletAccount: walletAccountInstance,
73
73
  ordinalChainIndex,
74
74
  asset,
75
75
  })