@exodus/bitcoin-plugin 1.6.14 → 1.6.16
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/ordinals/nfts.js +30 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-plugin",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.16",
|
|
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.4",
|
|
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": "79ecc918b12dc473b5f293ee50dbf054756e1a55"
|
|
33
33
|
}
|
package/src/ordinals/nfts.js
CHANGED
|
@@ -2,6 +2,7 @@ import assert from 'minimalistic-assert'
|
|
|
2
2
|
import { getInscriptionAddresses } from './get-inscription-addresses'
|
|
3
3
|
import { isNftBrc20 } from './nft-utils'
|
|
4
4
|
import { getOrdinalsUtxos } from '@exodus/bitcoin-api'
|
|
5
|
+
import { uniq } from 'lodash'
|
|
5
6
|
|
|
6
7
|
export const nftsApiFactory = ({ ordinalChainIndex, asset }) => {
|
|
7
8
|
assert(asset, 'asset is required')
|
|
@@ -47,31 +48,37 @@ export const nftsApiFactory = ({ ordinalChainIndex, asset }) => {
|
|
|
47
48
|
const unconfirmedUtxosArray = storedOrdinalsUtxos
|
|
48
49
|
.toArray()
|
|
49
50
|
.filter((utxo) => !utxo.confirmations)
|
|
51
|
+
|
|
52
|
+
const inscriptionIds = unconfirmedUtxosArray.flatMap(({ inscriptions }) =>
|
|
53
|
+
inscriptions.map(({ inscriptionId }) => inscriptionId)
|
|
54
|
+
)
|
|
55
|
+
const uniqueInscriptionIds = uniq(inscriptionIds)
|
|
56
|
+
|
|
50
57
|
try {
|
|
51
58
|
const retrievedNfts = await Promise.all(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
59
|
+
uniqueInscriptionIds.map(async (inscriptionId) => {
|
|
60
|
+
if (nfts.find((nft) => nft.tokenId === inscriptionId)) {
|
|
61
|
+
return undefined
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const json = await nftsProxy.getNft(inscriptionId)
|
|
65
|
+
const utxo = unconfirmedUtxosArray.find((utxo) =>
|
|
66
|
+
utxo.inscriptions
|
|
67
|
+
.map(({ inscriptionId }) => inscriptionId)
|
|
68
|
+
.includes(inscriptionId)
|
|
69
|
+
)
|
|
70
|
+
return {
|
|
71
|
+
...json,
|
|
72
|
+
receiving: true,
|
|
73
|
+
output: `${utxo.txId}:${utxo.vout}`,
|
|
74
|
+
pendingTxId: utxo.txId,
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
console.warn(
|
|
78
|
+
`Cannot load ${asset.name} nft ${inscriptionId} from proxy server. Error: ${e.message}`
|
|
79
|
+
)
|
|
80
|
+
return undefined
|
|
81
|
+
}
|
|
75
82
|
})
|
|
76
83
|
)
|
|
77
84
|
const unconfirmedNfts = retrievedNfts.flat().filter((i) => i)
|