@exodus/bitcoin-plugin 1.0.11 → 1.0.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 +4 -4
- package/src/create-asset.js +11 -5
- package/src/index.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/bitcoin-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Exodus bitcoin-plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@exodus/asset-lib": "^3.7.1",
|
|
22
|
-
"@exodus/bitcoin-api": "^2.3.
|
|
23
|
-
"@exodus/bitcoin-lib": "^2.2.
|
|
22
|
+
"@exodus/bitcoin-api": "^2.3.14",
|
|
23
|
+
"@exodus/bitcoin-lib": "^2.2.7",
|
|
24
24
|
"minimalistic-assert": "^1.0.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@exodus/keychain": "^3.0.0"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ae9ce2178387cabffcf542daabe8e6a25e9afa3c"
|
|
30
30
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { connectAsset } from '@exodus/assets'
|
|
2
1
|
import _coinInfo from 'coininfo'
|
|
3
2
|
import * as bitcoinjsLib from '@exodus/bitcoinjs-lib'
|
|
4
3
|
import createGetKeyIdentifier from '@exodus/bitcoin-lib/lib/key-identifier'
|
|
@@ -25,14 +24,14 @@ import { bitcoinFeeDataFactory } from './fee-data'
|
|
|
25
24
|
import BitcoinFeeMonitor from './fee-monitor'
|
|
26
25
|
import assert from 'minimalistic-assert'
|
|
27
26
|
|
|
28
|
-
export const createBitcoinAssetFactory = ({
|
|
27
|
+
export const createBitcoinAssetFactory = ({ asset, apiUrl, coinInfoNetwork }) => ({
|
|
29
28
|
allowUnconfirmedRbfEnabledUtxos = false,
|
|
30
29
|
overrideCallback = ({ asset }) => asset,
|
|
31
30
|
} = {}) => {
|
|
32
|
-
assert(
|
|
31
|
+
assert(asset, 'asset is required')
|
|
33
32
|
assert(apiUrl, 'apiUrl is required')
|
|
34
|
-
|
|
35
|
-
const coinInfo = _coinInfo(coinInfoNetwork ||
|
|
33
|
+
|
|
34
|
+
const coinInfo = _coinInfo(coinInfoNetwork || asset.name)
|
|
36
35
|
|
|
37
36
|
const insightClient = new InsightAPIClient(apiUrl)
|
|
38
37
|
const useBip84 = true
|
|
@@ -104,7 +103,14 @@ export const createBitcoinAssetFactory = ({ base, apiUrl, coinInfoNetwork }) =>
|
|
|
104
103
|
|
|
105
104
|
const accountStateClass = createAccountState({ asset })
|
|
106
105
|
|
|
106
|
+
const addressHasHistory = async (address) => {
|
|
107
|
+
assert(typeof address === 'string', 'Address is required')
|
|
108
|
+
const result = await insightClient.fetchTxData([address], { from: 0, to: 1 })
|
|
109
|
+
return !!result?.items.length
|
|
110
|
+
}
|
|
111
|
+
|
|
107
112
|
const api = {
|
|
113
|
+
addressHasHistory,
|
|
108
114
|
defaultAddressPath: 'm/0/0',
|
|
109
115
|
broadcastTx: (...args) => insightClient.broadcastTx(...args),
|
|
110
116
|
createFeeMonitor: (args) =>
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { asset
|
|
1
|
+
import { asset } from '@exodus/bitcoin-meta'
|
|
2
2
|
import { createBitcoinAssetFactory } from './create-asset'
|
|
3
3
|
export * from './create-asset' // for bitcoinregtest and bitcointestnet
|
|
4
4
|
|
|
5
5
|
const apiUrl = 'https://bitcoin.a.exodus.io/insight/'
|
|
6
|
-
export const createAsset = createBitcoinAssetFactory({
|
|
6
|
+
export const createAsset = createBitcoinAssetFactory({ asset, apiUrl })
|