@exodus/bitcoin-plugin 1.6.5 → 1.6.6

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.5",
3
+ "version": "1.6.6",
4
4
  "description": "Exodus bitcoin-plugin",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -26,5 +26,5 @@
26
26
  "@exodus/text-encoding-utf8": "^1.0.2",
27
27
  "minimalistic-assert": "^1.0.1"
28
28
  },
29
- "gitHead": "c8877a87f29d0c4c27b18937a9ec57c81be223dd"
29
+ "gitHead": "55cb50e363ad48e4b4420976e8c126b05380247f"
30
30
  }
@@ -2,6 +2,8 @@ import { WalletAccount } from '@exodus/models'
2
2
 
3
3
  export const ordinals84 = 'ordinals84'
4
4
  export const ordinals86 = 'ordinals86'
5
+ export const trezor = 'trezor'
6
+ export const ledger = 'ledger'
5
7
  export const xverse49 = 'xverse49'
6
8
 
7
9
  export const getDefaultAddressPath = ({ compatibilityMode }) => {
@@ -12,8 +14,12 @@ export const getDefaultAddressPath = ({ compatibilityMode }) => {
12
14
  }
13
15
 
14
16
  export const getSupportedPurposes = ({ compatibilityMode, walletAccount }) => {
15
- if (walletAccount.source === WalletAccount.TREZOR_SRC) {
16
- return [84, 44]
17
+ if (walletAccount?.source === WalletAccount.TREZOR_SRC || compatibilityMode === trezor) {
18
+ return [84, 49]
19
+ }
20
+
21
+ if (compatibilityMode === ledger) {
22
+ return [84, 86, 49, 44]
17
23
  }
18
24
 
19
25
  if (compatibilityMode === ordinals84) {
@@ -198,6 +198,12 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
198
198
  return !!result?.items.length
199
199
  }
200
200
 
201
+ const getBalanceForAddress = async (address) => {
202
+ assert(typeof address === 'string', 'Address is required')
203
+ const { balance } = await insightClient.fetchBalance(address)
204
+ return asset.currency.defaultUnit(balance)
205
+ }
206
+
201
207
  const isOrdinalTx = (tx) => {
202
208
  const isInscription = tx.data?.isInscriptionSent || tx.data?.isInscriptionReceived
203
209
  return ordinalsEnabled && tx.coinName === asset.name && isInscription
@@ -249,6 +255,7 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) =>
249
255
  getDefaultAddressPath,
250
256
  getFeeData: () => feeData,
251
257
  getBalances,
258
+ getBalanceForAddress,
252
259
  getKeyIdentifier: createGetKeyIdentifier({
253
260
  bip44,
254
261
  allowedPurposes,