@exodus/bitcoin-plugin 1.6.11 → 1.6.13
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 +3 -3
- package/src/create-asset.js +1 -2
- package/src/ordinals/nfts.js +9 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-plugin",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "Exodus bitcoin-plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@exodus/asset-lib": "^4.0.0",
|
|
22
22
|
"@exodus/basic-utils": "^2.1.0",
|
|
23
|
-
"@exodus/bitcoin-api": "^2.7.
|
|
23
|
+
"@exodus/bitcoin-api": "^2.7.2",
|
|
24
24
|
"@exodus/bitcoin-lib": "^2.2.11",
|
|
25
25
|
"@exodus/models": "^11.0.0",
|
|
26
26
|
"@exodus/text-encoding-utf8": "^1.0.2",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@exodus/nfts-proxy": "^2.10.1"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "349bca373d37c40ab5b04cc82b97f9f7c3ab69b0"
|
|
33
33
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -44,7 +44,6 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl: defaultApiUrl, coinIn
|
|
|
44
44
|
gapLimit = 10,
|
|
45
45
|
refreshGapLimit = 25,
|
|
46
46
|
overrideCallback = ({ asset }) => asset,
|
|
47
|
-
nftsProxy,
|
|
48
47
|
feeDataCustomValues,
|
|
49
48
|
} = {}) => {
|
|
50
49
|
const apiUrl = customApiUrl || defaultApiUrl
|
|
@@ -173,7 +172,7 @@ export const createBitcoinAssetFactory = ({ asset, apiUrl: defaultApiUrl, coinIn
|
|
|
173
172
|
|
|
174
173
|
const accountStateClass = createAccountState({ asset: asset, ordinalsEnabled, brc20Enabled })
|
|
175
174
|
|
|
176
|
-
const nfts = ordinalsEnabled ? nftsApiFactory({ ordinalChainIndex, asset
|
|
175
|
+
const nfts = ordinalsEnabled ? nftsApiFactory({ ordinalChainIndex, asset }) : undefined
|
|
177
176
|
|
|
178
177
|
const { createToken, getTokens, validateAssetId } = brc20Enabled
|
|
179
178
|
? createTokenFactory({ address, bip44, keys, getBalances }, [])
|
package/src/ordinals/nfts.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getInscriptionAddresses } from './get-inscription-addresses'
|
|
|
3
3
|
import { isNftBrc20 } from './nft-utils'
|
|
4
4
|
import { getOrdinalsUtxos } from '@exodus/bitcoin-api'
|
|
5
5
|
|
|
6
|
-
export const nftsApiFactory = ({ ordinalChainIndex, asset
|
|
6
|
+
export const nftsApiFactory = ({ ordinalChainIndex, asset }) => {
|
|
7
7
|
assert(asset, 'asset is required')
|
|
8
8
|
assert(typeof ordinalChainIndex === 'number', 'ordinalChainIndex must be a number')
|
|
9
9
|
let aci // convert to constructor argument when wallet send aci at createAsset time
|
|
@@ -31,7 +31,7 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset, nftsProxy }) => {
|
|
|
31
31
|
It flags the nfts in transfer, that don't have a utxo anymore
|
|
32
32
|
It removes nfts that have brc20 content
|
|
33
33
|
*/
|
|
34
|
-
postProcessNfts: async ({ nfts, walletAccount: walletAccountInstance }) => {
|
|
34
|
+
postProcessNfts: async ({ nfts, walletAccount: walletAccountInstance, nftsProxy }) => {
|
|
35
35
|
if (!aci) {
|
|
36
36
|
console.warn('bitcoin nfts not initialized yet')
|
|
37
37
|
return []
|
|
@@ -43,11 +43,10 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset, nftsProxy }) => {
|
|
|
43
43
|
})
|
|
44
44
|
const storedOrdinalsUtxos = getOrdinalsUtxos({ accountState, asset })
|
|
45
45
|
|
|
46
|
-
const unconfirmedUtxosArray = storedOrdinalsUtxos
|
|
47
|
-
.toArray()
|
|
48
|
-
.filter((utxo) => !utxo.confirmations)
|
|
49
|
-
|
|
50
46
|
if (nftsProxy) {
|
|
47
|
+
const unconfirmedUtxosArray = storedOrdinalsUtxos
|
|
48
|
+
.toArray()
|
|
49
|
+
.filter((utxo) => !utxo.confirmations)
|
|
51
50
|
try {
|
|
52
51
|
const retrievedNfts = await Promise.all(
|
|
53
52
|
unconfirmedUtxosArray.map(async (utxo) => {
|
|
@@ -57,9 +56,8 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset, nftsProxy }) => {
|
|
|
57
56
|
if (nfts.find((nft) => nft.tokenId === inscriptionId)) {
|
|
58
57
|
return undefined
|
|
59
58
|
}
|
|
60
|
-
const id = `${asset.name}:${inscriptionId}`
|
|
61
59
|
try {
|
|
62
|
-
const json = await nftsProxy.getNft(
|
|
60
|
+
const json = await nftsProxy.getNft(inscriptionId)
|
|
63
61
|
return {
|
|
64
62
|
...json,
|
|
65
63
|
receiving: true,
|
|
@@ -67,7 +65,9 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset, nftsProxy }) => {
|
|
|
67
65
|
pendingTxId: utxo.txId,
|
|
68
66
|
}
|
|
69
67
|
} catch (e) {
|
|
70
|
-
console.warn(
|
|
68
|
+
console.warn(
|
|
69
|
+
`Cannot load ${asset.name} nft ${inscriptionId} from proxy server. Error: ${e.message}`
|
|
70
|
+
)
|
|
71
71
|
return undefined
|
|
72
72
|
}
|
|
73
73
|
})
|