@exodus/bitcoin-plugin 1.6.4 → 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.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "Exodus bitcoin-plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,12 +20,11 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@exodus/asset-lib": "^4.0.0",
|
|
22
22
|
"@exodus/basic-utils": "^2.1.0",
|
|
23
|
-
"@exodus/bitcoin-api": "^2.6.
|
|
23
|
+
"@exodus/bitcoin-api": "^2.6.5",
|
|
24
24
|
"@exodus/bitcoin-lib": "^2.2.11",
|
|
25
25
|
"@exodus/models": "^11.0.0",
|
|
26
26
|
"@exodus/text-encoding-utf8": "^1.0.2",
|
|
27
|
-
"bitcoinjs-lib": "^6.1.5",
|
|
28
27
|
"minimalistic-assert": "^1.0.1"
|
|
29
28
|
},
|
|
30
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "55cb50e363ad48e4b4420976e8c126b05380247f"
|
|
31
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
|
|
16
|
-
return [84,
|
|
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) {
|
package/src/create-asset.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _coinInfo from 'coininfo'
|
|
2
|
-
import * as bitcoinjsLib from 'bitcoinjs-lib'
|
|
2
|
+
import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
|
|
3
3
|
import createGetKeyIdentifier from '@exodus/bitcoin-lib/lib/key-identifier'
|
|
4
4
|
|
|
5
5
|
import bip44Constants from '@exodus/bip44-constants/by-ticker'
|
|
@@ -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,
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert'
|
|
2
|
-
import * as bitcoinjsLib from 'bitcoinjs-lib'
|
|
2
|
+
import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
|
|
3
3
|
import { TextEncoder } from '@exodus/text-encoding-utf8'
|
|
4
|
-
import ECPairFactory from 'ecpair'
|
|
5
4
|
import { randomBytes } from '@exodus/crypto/randomBytes'
|
|
6
5
|
import secp256k1 from 'tiny-secp256k1'
|
|
7
6
|
import { DEFAULT_BRC20_POSTAGE, DEFAULT_ORDINAL_POSTAGE } from './ordinals-constants'
|
|
8
7
|
|
|
9
|
-
import { witnessStackToScriptWitness } from 'bitcoinjs-lib/src/psbt/psbtutils'
|
|
8
|
+
import { witnessStackToScriptWitness } from '@exodus/bitcoinjs-lib/src/psbt/psbtutils'
|
|
10
9
|
import getTxSequence from '@exodus/bitcoin-lib/lib/utils/get-tx-sequence'
|
|
11
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
eccFactory,
|
|
12
|
+
getECPair,
|
|
13
|
+
getOrdinalsUtxos,
|
|
14
|
+
toAsyncSigner,
|
|
15
|
+
toXOnly,
|
|
16
|
+
} from '@exodus/bitcoin-api'
|
|
12
17
|
|
|
13
18
|
const encoder = new TextEncoder()
|
|
14
19
|
export function createInscriptionScript({ xOnlyPublicKey, inscription }) {
|
|
@@ -37,8 +42,6 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
|
|
|
37
42
|
assert(network, 'network is required')
|
|
38
43
|
assert(typeof ordinalChainIndex === 'number', 'ordinalChainIndex must be a number')
|
|
39
44
|
|
|
40
|
-
let ECPair
|
|
41
|
-
|
|
42
45
|
function createInscription({ contentType, content, postage }) {
|
|
43
46
|
assert(Number.isSafeInteger(postage), 'postage must be a Safe integer')
|
|
44
47
|
assert(contentType, 'contentType is required integer')
|
|
@@ -208,7 +211,7 @@ export const inscriptionsServiceFactory = ({ network, ordinalChainIndex }) => {
|
|
|
208
211
|
...commitTxData,
|
|
209
212
|
})
|
|
210
213
|
|
|
211
|
-
ECPair =
|
|
214
|
+
const ECPair = getECPair()
|
|
212
215
|
|
|
213
216
|
const keypair = ECPair.fromPrivateKey(privateKey, { network })
|
|
214
217
|
|