@exodus/bitcoin-plugin 1.12.1 → 1.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/bitcoin-plugin",
3
- "version": "1.12.1",
3
+ "version": "1.14.0",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "@exodus/basic-utils": "^2.1.0",
23
23
  "@exodus/bip32": "^1.1.2",
24
24
  "@exodus/bip44-constants": "^195.0.0",
25
- "@exodus/bitcoin-api": "^2.12.1",
25
+ "@exodus/bitcoin-api": "^2.13.0",
26
26
  "@exodus/bitcoin-lib": "^2.3.0",
27
27
  "@exodus/bitcoin-meta": "^1.0.2",
28
28
  "@exodus/bitcoinjs-lib": "^6.1.5-exodus.1",
@@ -48,5 +48,5 @@
48
48
  "@scure/btc-signer": "^1.1.0",
49
49
  "jest-when": "^3.5.1"
50
50
  },
51
- "gitHead": "646b7124b8d80c3e37ac8735fb218061ef24b745"
51
+ "gitHead": "3695a5d017d63570eb4d597c2430d1812765f6aa"
52
52
  }
@@ -1,4 +1,5 @@
1
1
  import { WalletAccount } from '@exodus/models'
2
+ import { without } from 'lodash'
2
3
 
3
4
  export const ordinals84 = 'ordinals84'
4
5
  export const ordinals86 = 'ordinals86'
@@ -37,3 +38,10 @@ export const getSupportedPurposes = ({ compatibilityMode, walletAccount }) => {
37
38
 
38
39
  return [84, 86, 44]
39
40
  }
41
+
42
+ export const createGetSupportedPurposes = ({ omitPurposes = [] } = {}) => {
43
+ return ({ compatibilityMode, walletAccount }) => {
44
+ const purposes = getSupportedPurposes({ compatibilityMode, walletAccount })
45
+ return without(purposes, ...omitPurposes)
46
+ }
47
+ }
@@ -22,6 +22,7 @@ import {
22
22
  signHardwareFactory,
23
23
  signMessage,
24
24
  getPrepareSendTransaction,
25
+ createEncodeMultisigContract,
25
26
  } from '@exodus/bitcoin-api'
26
27
  import { bitcoinFeeDataFactory } from './fee-data'
27
28
  import BitcoinFeeMonitor from './fee-monitor'
@@ -35,7 +36,7 @@ import { brc20BalancesAndFeeAdapterFactory } from './ordinals/brc-20-balances-an
35
36
  import { parseCurrency } from '@exodus/bitcoin-api/src/fee/fee-utils'
36
37
  import { inscriptionsServiceFactory } from './ordinals/inscriptions-service'
37
38
  import { tickInscriptionIdIndexerFactory } from './ordinals/tick-inscription-id-indexer'
38
- import { getDefaultAddressPath, getSupportedPurposes } from './compatibility-modes'
39
+ import { createGetSupportedPurposes, getDefaultAddressPath } from './compatibility-modes'
39
40
 
40
41
  const DEFAULT_TICKS_BETWEEN_BRC20_FETCHES = 30
41
42
 
@@ -57,6 +58,7 @@ export const createBitcoinAssetFactory =
57
58
  refreshGapLimit = 25,
58
59
  feeDataCustomValues,
59
60
  utxosDescendingOrder = false,
61
+ omitSupportedPurposes = [],
60
62
  } = Object.create(null),
61
63
  } = Object.create(null)
62
64
  ) => {
@@ -136,6 +138,7 @@ export const createBitcoinAssetFactory =
136
138
  allowUnconfirmedRbfEnabledUtxos,
137
139
  ordinalsEnabled,
138
140
  utxosDescendingOrder,
141
+ assetClientInterface,
139
142
  })
140
143
 
141
144
  const baseSendTx = createAndBroadcastTXFactory({
@@ -143,6 +146,7 @@ export const createBitcoinAssetFactory =
143
146
  allowUnconfirmedRbfEnabledUtxos,
144
147
  ordinalsEnabled,
145
148
  utxosDescendingOrder,
149
+ assetClientInterface,
146
150
  })
147
151
  const inscriptionsService = brc20Enabled
148
152
  ? inscriptionsServiceFactory({
@@ -155,6 +159,7 @@ export const createBitcoinAssetFactory =
155
159
  const { getFee, getBalances, getAvailableBalance, canBumpTx, getSpendableBalance, sendTx } =
156
160
  brc20Enabled
157
161
  ? brc20BalancesAndFeeAdapterFactory({
162
+ assetClientInterface,
158
163
  inscriptionsService,
159
164
  ...baseFeeResolver,
160
165
  getBalances: baseGetBalances,
@@ -294,6 +299,8 @@ export const createBitcoinAssetFactory =
294
299
  .filter(txLogFilter)
295
300
  }
296
301
 
302
+ const encodeMultisigContract = createEncodeMultisigContract({ network: coinInfo.toBitcoinJS() })
303
+
297
304
  const api = {
298
305
  getActivityTxs,
299
306
  addressHasHistory,
@@ -312,7 +319,7 @@ export const createBitcoinAssetFactory =
312
319
  allowedPurposes,
313
320
  allowedChainIndices: [0, 1, 2],
314
321
  }),
315
- getSupportedPurposes,
322
+ getSupportedPurposes: createGetSupportedPurposes({ omitPurposes: omitSupportedPurposes }),
316
323
  hasFeature: (feature) => !!features[feature], // @deprecated use api.features instead
317
324
  createAccountState: () => accountStateClass,
318
325
  parseUnsignedTx,
@@ -345,6 +352,7 @@ export const createBitcoinAssetFactory =
345
352
  getSpendableBalance,
346
353
  inscriptions: inscriptionsService,
347
354
  prepareSendTx: baseGetPrepareSendTx,
355
+ encodeMultisigContract,
348
356
  }
349
357
  return overrideCallback({ asset: fullAsset })
350
358
  }
@@ -4,6 +4,7 @@ import { brc20Utils } from './brc-20-utils'
4
4
  import { createBrc20Command } from './create-brc-20-command'
5
5
 
6
6
  export const brc20BalancesAndFeeAdapterFactory = ({
7
+ assetClientInterface,
7
8
  inscriptionsService,
8
9
  getBalances,
9
10
  getFee,
@@ -28,10 +29,7 @@ export const brc20BalancesAndFeeAdapterFactory = ({
28
29
  return !options.feeOpts.inscriptionIds?.length
29
30
  }
30
31
 
31
- const sendBrc20 = async (
32
- { asset: token, walletAccount, address, amount, options },
33
- { assetClientInterface }
34
- ) => {
32
+ const sendBrc20 = async ({ asset: token, walletAccount, address, amount, options }) => {
35
33
  const { broadcastInscription, createBrc20Inscription } = inscriptionsService
36
34
 
37
35
  const { customFee, isSendAll } = options
@@ -80,20 +78,17 @@ export const brc20BalancesAndFeeAdapterFactory = ({
80
78
  inscriptionIds.push(inscriptionResult.inscriptionId)
81
79
  }
82
80
 
83
- return sendTx(
84
- {
85
- asset: token,
86
- walletAccount,
87
- address,
88
- amount: tokenAmount,
89
- options: {
90
- ...options,
91
- isRbfAllowed: false,
92
- brc20: { inscriptionIds },
93
- },
81
+ return sendTx({
82
+ asset: token,
83
+ walletAccount,
84
+ address,
85
+ amount: tokenAmount,
86
+ options: {
87
+ ...options,
88
+ isRbfAllowed: false,
89
+ brc20: { inscriptionIds },
94
90
  },
95
- { assetClientInterface }
96
- )
91
+ })
97
92
  }
98
93
 
99
94
  const getFeeBrc20 = ({
@@ -295,16 +295,13 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
295
295
  const minersFee = resolveMinersFee({ inscription, customFee, feeData, asset })
296
296
  const commitAmount = minersFee.add(asset.currency.baseUnit(postage))
297
297
 
298
- const commitTxResult = await asset.api.sendTx(
299
- {
300
- asset,
301
- walletAccount,
302
- address: commitTxData.revealAddress,
303
- amount: commitAmount,
304
- options: { isRbfAllowed: false, customFee },
305
- },
306
- { assetClientInterface }
307
- )
298
+ const commitTxResult = await asset.api.sendTx({
299
+ asset,
300
+ walletAccount,
301
+ address: commitTxData.revealAddress,
302
+ amount: commitAmount,
303
+ options: { isRbfAllowed: false, customFee },
304
+ })
308
305
 
309
306
  const revealTx = await createRevealTx({
310
307
  commitTxData,