@multiplechain/bitcoin 0.1.18 → 0.4.0
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/README.md +7 -1
- package/dist/assets/Coin.d.ts +38 -0
- package/dist/assets/index.d.ts +1 -0
- package/dist/browser/Wallet.d.ts +81 -0
- package/dist/browser/adapters/Leather.d.ts +16 -0
- package/dist/browser/adapters/UniSat.d.ts +19 -0
- package/dist/browser/adapters/Xverse.d.ts +6 -0
- package/dist/browser/adapters/icons.d.ts +6 -0
- package/dist/browser/adapters/index.d.ts +3 -0
- package/dist/browser/index.d.ts +11 -0
- package/dist/index.cjs +83 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +43583 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +133 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/models/CoinTransaction.d.ts +24 -0
- package/dist/models/Transaction.d.ts +106 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/services/Provider.d.ts +80 -0
- package/dist/services/TransactionListener.d.ts +120 -0
- package/dist/services/TransactionSigner.d.ts +50 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/utils.d.ts +3 -0
- package/package.json +85 -50
- package/LICENSE +0 -21
- package/dist/bitcoin-provider.js +0 -2
- package/dist/bitcoin-provider.js.LICENSE.txt +0 -30
- package/src/adapters/leather.js +0 -75
- package/src/adapters/trustwallet.js +0 -32
- package/src/adapters/unisat.js +0 -42
- package/src/adapters/xverse.js +0 -86
- package/src/entity/coin.js +0 -74
- package/src/entity/token.js +0 -5
- package/src/entity/transaction.js +0 -183
- package/src/get-adapter.js +0 -14
- package/src/provider.js +0 -221
- package/src/utils.js +0 -26
- package/src/wallet.js +0 -180
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* The buffer module from node.js, for the browser.
|
|
3
|
-
*
|
|
4
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
5
|
-
* @license MIT
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/*!
|
|
9
|
-
* The buffer module from node.js, for the browser.
|
|
10
|
-
*
|
|
11
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
-
* @license MIT
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
16
|
-
|
|
17
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
18
|
-
|
|
19
|
-
/*! noble-secp256k1 - MIT License (c) 2019 Paul Miller (paulmillr.com) */
|
|
20
|
-
|
|
21
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
25
|
-
*
|
|
26
|
-
* @version 0.8.0
|
|
27
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
28
|
-
* @copyright Chen, Yi-Cyuan 2015-2018
|
|
29
|
-
* @license MIT
|
|
30
|
-
*/
|
package/src/adapters/leather.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
module.exports = (provider) => {
|
|
2
|
-
|
|
3
|
-
if (window.crypto && !window.crypto.randomUUID) {
|
|
4
|
-
window.crypto.randomUUID = () => {
|
|
5
|
-
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
6
|
-
const r = (Math.random() * 16) | 0;
|
|
7
|
-
const v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
8
|
-
return v.toString(16);
|
|
9
|
-
});
|
|
10
|
-
return uuid;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const network = provider.testnet ? 'testnet' : 'mainnet';
|
|
15
|
-
|
|
16
|
-
let wallet = Object.assign({
|
|
17
|
-
sendBitcoin: (to, amount) => {
|
|
18
|
-
return new Promise(async (resolve, reject) => {
|
|
19
|
-
try {
|
|
20
|
-
await wallet.request('sendTransfer', {
|
|
21
|
-
address: to,
|
|
22
|
-
amount,
|
|
23
|
-
network
|
|
24
|
-
})
|
|
25
|
-
.then((response) => {
|
|
26
|
-
resolve(response.result.txid);
|
|
27
|
-
})
|
|
28
|
-
.catch(({error}) => {
|
|
29
|
-
reject(error);
|
|
30
|
-
});
|
|
31
|
-
} catch (error) {
|
|
32
|
-
reject(error)
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
on: (event, callback) => {
|
|
37
|
-
if (window.btc && btc.listen) {
|
|
38
|
-
btc.listen(event, callback);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}, window.LeatherProvider);
|
|
42
|
-
|
|
43
|
-
const connect = async () => {
|
|
44
|
-
return new Promise(async (resolve, reject) => {
|
|
45
|
-
try {
|
|
46
|
-
const addresses = (await wallet.request('getAddresses', {
|
|
47
|
-
network
|
|
48
|
-
})).result.addresses;
|
|
49
|
-
const bitcoin = addresses.find(address => address.type == 'p2wpkh');
|
|
50
|
-
|
|
51
|
-
// for ordinals & BRC-20 integrations
|
|
52
|
-
// const ordinals = addresses.find(address => address.type == 'p2tr');
|
|
53
|
-
|
|
54
|
-
wallet = Object.assign(wallet, window.LeatherProvider);
|
|
55
|
-
|
|
56
|
-
wallet.getAddress = async () => {
|
|
57
|
-
return bitcoin.address;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
resolve(wallet);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
reject(error);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return {
|
|
68
|
-
key: 'leather',
|
|
69
|
-
name: 'Leather',
|
|
70
|
-
supports: ['browser'],
|
|
71
|
-
connect,
|
|
72
|
-
download: 'https://leather.io/install-extension',
|
|
73
|
-
isDetected: () => Boolean(typeof window.LeatherProvider !== 'undefined')
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
module.exports = (provider) => {
|
|
2
|
-
|
|
3
|
-
const wallet = window?.trustwallet?.bitcoin;
|
|
4
|
-
|
|
5
|
-
const connect = async () => {
|
|
6
|
-
return new Promise(async (resolve, reject) => {
|
|
7
|
-
try {
|
|
8
|
-
wallet.requestAccounts()
|
|
9
|
-
.then(async () => {
|
|
10
|
-
resolve(wallet);
|
|
11
|
-
})
|
|
12
|
-
.catch(error => {
|
|
13
|
-
reject(error);
|
|
14
|
-
});
|
|
15
|
-
} catch (error) {
|
|
16
|
-
reject(error);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
key: 'trustwallet',
|
|
23
|
-
name: 'Trust Wallet',
|
|
24
|
-
supports: [
|
|
25
|
-
'browser',
|
|
26
|
-
'mobile'
|
|
27
|
-
],
|
|
28
|
-
connect,
|
|
29
|
-
download: 'https://trustwallet.com/download',
|
|
30
|
-
isDetected : () => Boolean(window?.trustwallet?.bitcoin?.isTrust)
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/adapters/unisat.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
module.exports = (provider) => {
|
|
2
|
-
|
|
3
|
-
const wallet = window.unisat;
|
|
4
|
-
const network = provider.testnet ? 'testnet' : 'livenet';
|
|
5
|
-
|
|
6
|
-
if (wallet) {
|
|
7
|
-
wallet.getAddress = async () => {
|
|
8
|
-
return (await wallet.getAccounts())[0];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const connect = async () => {
|
|
13
|
-
return new Promise(async (resolve, reject) => {
|
|
14
|
-
try {
|
|
15
|
-
wallet.requestAccounts()
|
|
16
|
-
.then(async () => {
|
|
17
|
-
wallet.switchNetwork(network)
|
|
18
|
-
.then(async () => {
|
|
19
|
-
resolve(wallet);
|
|
20
|
-
})
|
|
21
|
-
.catch(error => {
|
|
22
|
-
reject(error);
|
|
23
|
-
});
|
|
24
|
-
})
|
|
25
|
-
.catch(error => {
|
|
26
|
-
reject(error);
|
|
27
|
-
});
|
|
28
|
-
} catch (error) {
|
|
29
|
-
reject(error);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
key: 'unisat',
|
|
36
|
-
name: 'UniSat',
|
|
37
|
-
supports: ['browser'],
|
|
38
|
-
connect,
|
|
39
|
-
download: 'https://unisat.io/download',
|
|
40
|
-
isDetected: () => Boolean(typeof window.unisat !== 'undefined' && window.unisat.requestAccounts)
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/adapters/xverse.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
const {getAddress, sendBtcTransaction, BitcoinNetworkType} = require('sats-connect');
|
|
2
|
-
|
|
3
|
-
module.exports = (provider) => {
|
|
4
|
-
|
|
5
|
-
const type = provider.testnet ?
|
|
6
|
-
BitcoinNetworkType.Testnet:
|
|
7
|
-
BitcoinNetworkType.Mainnet;
|
|
8
|
-
|
|
9
|
-
let wallet = {
|
|
10
|
-
sendBitcoin: (to, amount) => {
|
|
11
|
-
return new Promise(async (resolve, reject) => {
|
|
12
|
-
sendBtcTransaction({
|
|
13
|
-
payload: {
|
|
14
|
-
network: {
|
|
15
|
-
type,
|
|
16
|
-
},
|
|
17
|
-
recipients: [
|
|
18
|
-
{
|
|
19
|
-
address: to,
|
|
20
|
-
amountSats: BigInt(amount),
|
|
21
|
-
}
|
|
22
|
-
],
|
|
23
|
-
senderAddress: provider.connectedWallet.connectedAccount,
|
|
24
|
-
},
|
|
25
|
-
onFinish: (txId) => {
|
|
26
|
-
resolve(txId);
|
|
27
|
-
},
|
|
28
|
-
onCancel: () => {
|
|
29
|
-
reject('request-rejected');
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
on: (event, callback) => {
|
|
35
|
-
// TODO: implement
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const connect = async () => {
|
|
40
|
-
return new Promise(async (resolve, reject) => {
|
|
41
|
-
try {
|
|
42
|
-
getAddress({
|
|
43
|
-
payload: {
|
|
44
|
-
purposes: ['ordinals', 'payment'],
|
|
45
|
-
message: 'Address for receiving Ordinals and payments',
|
|
46
|
-
network: {
|
|
47
|
-
type
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
onFinish: (response) => {
|
|
51
|
-
const addresses = Object.values(response.addresses);
|
|
52
|
-
const bitcoin = addresses.find(address => address.purpose == 'payment');
|
|
53
|
-
|
|
54
|
-
// for ordinals & BRC-20 integrations
|
|
55
|
-
// const ordinals = addresses.find(address => address.purpose == 'ordinals');
|
|
56
|
-
|
|
57
|
-
wallet = Object.assign(wallet, window.XverseProviders.BitcoinProvider);
|
|
58
|
-
|
|
59
|
-
wallet.getAddress = async () => {
|
|
60
|
-
return bitcoin.address;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
resolve(wallet);
|
|
64
|
-
},
|
|
65
|
-
onCancel: () => {
|
|
66
|
-
reject('request-rejected');
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
} catch (error) {
|
|
70
|
-
reject(error);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
key: 'xverse',
|
|
77
|
-
name: 'Xverse',
|
|
78
|
-
supports: [
|
|
79
|
-
'browser',
|
|
80
|
-
'mobile'
|
|
81
|
-
],
|
|
82
|
-
connect,
|
|
83
|
-
download: 'https://www.xverse.app/download',
|
|
84
|
-
isDetected: () => Boolean(typeof window.XverseProviders !== 'undefined' && XverseProviders.BitcoinProvider)
|
|
85
|
-
}
|
|
86
|
-
}
|
package/src/entity/coin.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const utils = require('../utils');
|
|
2
|
-
|
|
3
|
-
class Coin {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @var {String}
|
|
7
|
-
*/
|
|
8
|
-
symbol;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @var {String}
|
|
12
|
-
*/
|
|
13
|
-
decimals;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @var {Provider}
|
|
17
|
-
*/
|
|
18
|
-
provider;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {Provider} provider
|
|
22
|
-
*/
|
|
23
|
-
constructor(provider) {
|
|
24
|
-
this.provider = provider;
|
|
25
|
-
this.decimals = 8;
|
|
26
|
-
this.symbol = 'BTC';
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @returns {String}
|
|
31
|
-
*/
|
|
32
|
-
getSymbol() {
|
|
33
|
-
return this.symbol;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @returns {Integer}
|
|
38
|
-
*/
|
|
39
|
-
getDecimals() {
|
|
40
|
-
return this.decimals;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @returns {Object}
|
|
45
|
-
*/
|
|
46
|
-
async getBalance(address) {
|
|
47
|
-
let addressStatsApi = this.provider.api + 'address/' + address;
|
|
48
|
-
let addressStats = await fetch(addressStatsApi).then(res => res.json());
|
|
49
|
-
let balanceSat = addressStats.chain_stats.funded_txo_sum - addressStats.chain_stats.spent_txo_sum;
|
|
50
|
-
return utils.toBitcoin(balanceSat);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @param {String} from
|
|
55
|
-
* @param {String} to
|
|
56
|
-
* @param {Number} amount
|
|
57
|
-
* @returns {String|Object}
|
|
58
|
-
*/
|
|
59
|
-
transfer(from, to, amount) {
|
|
60
|
-
return new Promise(async (resolve, reject) => {
|
|
61
|
-
|
|
62
|
-
if (parseFloat(amount) > await this.getBalance(from)) {
|
|
63
|
-
return reject('insufficient-balance');
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
amount = utils.toSatoshi(amount);
|
|
67
|
-
|
|
68
|
-
// develop for be side
|
|
69
|
-
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = Coin;
|
package/src/entity/token.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
const utils = require('@multiplechain/utils');
|
|
2
|
-
|
|
3
|
-
class Transaction {
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @var {Object}
|
|
7
|
-
*/
|
|
8
|
-
provider;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @var {String}
|
|
12
|
-
*/
|
|
13
|
-
hash;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @var {Object}
|
|
17
|
-
*/
|
|
18
|
-
data;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @var {Number}
|
|
22
|
-
*/
|
|
23
|
-
timer = 30;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @param {String} hash
|
|
27
|
-
*/
|
|
28
|
-
constructor(hash, provider) {
|
|
29
|
-
this.provider = provider;
|
|
30
|
-
this.hash = hash;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @returns {String}
|
|
35
|
-
*/
|
|
36
|
-
getHash() {
|
|
37
|
-
return this.hash;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @param {Number} timer
|
|
42
|
-
*/
|
|
43
|
-
setTimer(timer) {
|
|
44
|
-
this.timer = timer;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @returns {Object}
|
|
49
|
-
*/
|
|
50
|
-
async getData() {
|
|
51
|
-
try {
|
|
52
|
-
let txApi = this.provider.api + 'tx/' + this.hash;
|
|
53
|
-
this.data = await fetch(txApi).then(res => res.json());
|
|
54
|
-
} catch (error) {
|
|
55
|
-
throw new Error('There was a problem retrieving transaction data!');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return this.data;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @param {Object} options
|
|
63
|
-
* @returns {Number}
|
|
64
|
-
*/
|
|
65
|
-
async getTransferAmount(options) {
|
|
66
|
-
let data = await this.getData();
|
|
67
|
-
let receiver = options.receiver;
|
|
68
|
-
let index = data.vout.findIndex(object => {
|
|
69
|
-
return object.scriptpubkey_address == receiver;
|
|
70
|
-
});
|
|
71
|
-
data = data.vout[index];
|
|
72
|
-
return utils.toDec(data.value, 8);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @returns {Number}
|
|
77
|
-
*/
|
|
78
|
-
async getConfirmations() {
|
|
79
|
-
try {
|
|
80
|
-
|
|
81
|
-
let blockApi = this.provider.api + 'blocks/tip/height';
|
|
82
|
-
if (!this.data) await this.getData();
|
|
83
|
-
let latestBlock = await fetch(blockApi).then(res => res.json());
|
|
84
|
-
|
|
85
|
-
if (typeof latestBlock == 'object') {
|
|
86
|
-
latestBlock = latestBlock.height;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return ((latestBlock - (this.data.status.block_height || 0)) + 1);
|
|
90
|
-
} catch (error) {}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @param {Number} confirmations
|
|
95
|
-
* @returns {Number}
|
|
96
|
-
*/
|
|
97
|
-
confirmTransaction(confirmations = 2) {
|
|
98
|
-
return new Promise((resolve, reject) => {
|
|
99
|
-
try {
|
|
100
|
-
this.intervalConfirm = setInterval(async () => {
|
|
101
|
-
const trxConfirmations = await this.getConfirmations();
|
|
102
|
-
|
|
103
|
-
if (trxConfirmations >= confirmations) {
|
|
104
|
-
clearInterval(this.intervalConfirm);
|
|
105
|
-
return resolve(trxConfirmations);
|
|
106
|
-
}
|
|
107
|
-
}, (this.timer*1000));
|
|
108
|
-
} catch (error) {
|
|
109
|
-
reject(error);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @returns {Boolean}
|
|
116
|
-
*/
|
|
117
|
-
async validate(timer = 1) {
|
|
118
|
-
timer = this.timer || timer;
|
|
119
|
-
try {
|
|
120
|
-
|
|
121
|
-
await new Promise(r => setTimeout(r, (timer*1000)));
|
|
122
|
-
|
|
123
|
-
await this.getData();
|
|
124
|
-
|
|
125
|
-
let result = null;
|
|
126
|
-
|
|
127
|
-
if (this.data && this.data.status.block_height) {
|
|
128
|
-
result = true;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (typeof result == 'boolean') {
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return this.validate(timer);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
|
|
138
|
-
if (error.message == 'There was a problem retrieving transaction data!') {
|
|
139
|
-
return this.validate(timer);
|
|
140
|
-
} else {
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* @param {Object} config
|
|
148
|
-
* @returns {Boolean}
|
|
149
|
-
*/
|
|
150
|
-
async verifyTransferWithData(config) {
|
|
151
|
-
|
|
152
|
-
if (await this.validate()) {
|
|
153
|
-
|
|
154
|
-
let index = this.data.vout.findIndex(object => {
|
|
155
|
-
return object.scriptpubkey_address == config.receiver;
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
let data = this.data.vout[index];
|
|
159
|
-
|
|
160
|
-
data = {
|
|
161
|
-
receiver: data.scriptpubkey_address,
|
|
162
|
-
amount: utils.toDec(data.value, 8)
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (data.receiver == config.receiver && data.amount == config.amount) {
|
|
166
|
-
return true;
|
|
167
|
-
} else {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
} else {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* @returns {String}
|
|
177
|
-
*/
|
|
178
|
-
getUrl() {
|
|
179
|
-
return this.provider.explorer + 'tx/' + this.hash;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
module.exports = Transaction;
|
package/src/get-adapter.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const adapters = {
|
|
2
|
-
unisat: require('./adapters/unisat'),
|
|
3
|
-
xverse: require('./adapters/xverse'),
|
|
4
|
-
leather: require('./adapters/leather'),
|
|
5
|
-
trustwallet: require('./adapters/trustwallet'),
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @param {String} adapter
|
|
10
|
-
* @param {Object} provider
|
|
11
|
-
*/
|
|
12
|
-
module.exports = getAdapter = (adapter, provider) => {
|
|
13
|
-
return adapters[adapter](provider);
|
|
14
|
-
}
|