@exodus/bitcoin-plugin 1.6.0 → 1.6.2

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.6.0",
3
+ "version": "1.6.2",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -18,15 +18,14 @@
18
18
  "lint:fix": "yarn lint --fix"
19
19
  },
20
20
  "dependencies": {
21
- "@exodus/asset-lib": "^3.7.1",
22
- "@exodus/bitcoin-api": "^2.6.0",
23
- "@exodus/bitcoin-lib": "^2.2.8",
21
+ "@exodus/asset-lib": "^4.0.0",
22
+ "@exodus/basic-utils": "^2.1.0",
23
+ "@exodus/bitcoin-api": "^2.6.2",
24
+ "@exodus/bitcoin-lib": "^2.2.9",
25
+ "@exodus/models": "^10.1.0",
24
26
  "@exodus/text-encoding-utf8": "^1.0.2",
25
27
  "bitcoinjs-lib": "^6.1.5",
26
28
  "minimalistic-assert": "^1.0.1"
27
29
  },
28
- "devDependencies": {
29
- "@exodus/keychain": "^3.0.0"
30
- },
31
- "gitHead": "6bfd72d44715d9c44057d5134841a875cbb7e8c4"
30
+ "gitHead": "a9f5e8c6f0ac0655cdd2721cf20813f86a373678"
32
31
  }
@@ -0,0 +1,30 @@
1
+ import { WalletAccount } from '@exodus/models'
2
+
3
+ export const ordinals84 = 'ordinals84'
4
+ export const ordinals86 = 'ordinals86'
5
+ export const xverse49 = 'xverse49'
6
+
7
+ export const getDefaultAddressPath = ({ compatibilityMode }) => {
8
+ if ([ordinals84, ordinals86].includes(compatibilityMode)) {
9
+ return 'm/0'
10
+ }
11
+ return 'm/0/0'
12
+ }
13
+
14
+ export const getSupportedPurposes = ({ compatibilityMode, walletAccount }) => {
15
+ if (walletAccount.source === WalletAccount.TREZOR_SRC) {
16
+ return [84, 44]
17
+ }
18
+
19
+ if (compatibilityMode === ordinals84) {
20
+ return [84, 86, 44]
21
+ }
22
+ if (compatibilityMode === ordinals86) {
23
+ return [86, 84, 44]
24
+ }
25
+ if (compatibilityMode === xverse49) {
26
+ return [49, 84, 86, 44]
27
+ }
28
+
29
+ return [84, 86, 44]
30
+ }
@@ -5,17 +5,17 @@ import createGetKeyIdentifier from '@exodus/bitcoin-lib/lib/key-identifier'
5
5
  import bip44Constants from '@exodus/bip44-constants/by-ticker'
6
6
  import {
7
7
  createAccountState,
8
+ createAndBroadcastTXFactory,
8
9
  createBitcoinMonitor,
9
10
  createBtcLikeAddress,
10
11
  createBtcLikeKeys,
11
- getBalancesFactory,
12
12
  getAddressesFromPrivateKeyFactory,
13
+ getBalancesFactory,
13
14
  getBtcVersions,
14
- createAndBroadcastTXFactory,
15
15
  getFeeEstimatorFactory,
16
16
  GetFeeResolver,
17
- moveFundsFactory,
18
17
  InsightAPIClient,
18
+ moveFundsFactory,
19
19
  parseUnsignedTx,
20
20
  signTxFactory,
21
21
  } from '@exodus/bitcoin-api'
@@ -31,6 +31,7 @@ import { brc20BalancesAndFeeAdapterFactory } from './ordinals/brc-20-balances-an
31
31
  import { parseCurrency } from '@exodus/bitcoin-api/src/fee/fee-utils'
32
32
  import { inscriptionsServiceFactory } from './ordinals/inscriptions-service'
33
33
  import { tickInscriptionIdIndexerFactory } from './ordinals/tick-inscription-id-indexer'
34
+ import { getDefaultAddressPath, getSupportedPurposes } from './compatibility-modes'
34
35
 
35
36
  export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) => ({
36
37
  allowUnconfirmedRbfEnabledUtxos = false,
@@ -193,10 +194,15 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
193
194
  return !!result?.items.length
194
195
  }
195
196
 
197
+ const isOrdinalTx = (tx) => {
198
+ const isInscription = tx.data?.isInscriptionSent || tx.data?.isInscriptionReceived
199
+ return ordinalsEnabled && tx.coinName === asset.name && isInscription
200
+ }
201
+
196
202
  const txLogFilter = (tx) => {
197
203
  const isDroppedBitcoinTx = tx.dropped
198
204
  const isWaitingRbf = tx.data && tx.data.replacedBy && tx.pending
199
- return !isDroppedBitcoinTx && !isWaitingRbf
205
+ return !isDroppedBitcoinTx && !isWaitingRbf && !isOrdinalTx(tx)
200
206
  }
201
207
 
202
208
  const getActivityTxs = ({ txs, asset }) => {
@@ -230,12 +236,13 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
230
236
  const api = {
231
237
  getActivityTxs,
232
238
  addressHasHistory,
233
- defaultAddressPath: 'm/0/0',
239
+ defaultAddressPath: 'm/0/0', // deprecated
234
240
  broadcastTx: (...args) => insightClient.broadcastTx(...args),
235
241
  createFeeMonitor: (args) =>
236
242
  new BitcoinFeeMonitor({ ...args, insight: () => insightClient, assetName: asset.name }),
237
243
  createHistoryMonitor,
238
244
  features,
245
+ getDefaultAddressPath,
239
246
  getFeeData: () => feeData,
240
247
  getBalances,
241
248
  getKeyIdentifier: createGetKeyIdentifier({
@@ -243,6 +250,7 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
243
250
  allowedPurposes,
244
251
  allowedChainIndices: [0, 1, 2],
245
252
  }),
253
+ getSupportedPurposes,
246
254
  hasFeature: (feature) => !!features[feature], // @deprecated use api.features instead
247
255
  createAccountState: () => accountStateClass,
248
256
  parseUnsignedTx,