@xchainjs/xchain-utxo-providers 0.1.2 → 0.2.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/lib/index.d.ts +1 -1
- package/lib/index.esm.js +930 -1768
- package/lib/index.js +931 -1765
- package/lib/providers/blockcypher/blockcypher-api-types.d.ts +96 -96
- package/lib/providers/blockcypher/blockcypher-api.d.ts +69 -69
- package/lib/providers/blockcypher/blockcypher-data-provider.d.ts +52 -52
- package/lib/providers/haskoin/haskoin-api-types.d.ts +113 -113
- package/lib/providers/haskoin/haskoin-api.d.ts +150 -150
- package/lib/providers/haskoin/haskoin-data-provider.d.ts +37 -37
- package/lib/providers/index.d.ts +8 -8
- package/lib/providers/sochainv3/sochain-api-types.d.ts +101 -101
- package/lib/providers/sochainv3/sochain-api.d.ts +113 -113
- package/lib/providers/sochainv3/sochain-data-provider.d.ts +42 -42
- package/package.json +9 -9
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
|
-
export declare enum BlockcypherNetwork {
|
|
3
|
-
BTC = "btc/main",
|
|
4
|
-
BTCTEST = "btc/test3",
|
|
5
|
-
LTC = "ltc/main",
|
|
6
|
-
DOGE = "doge/main"
|
|
7
|
-
}
|
|
8
|
-
export
|
|
9
|
-
apiKey?: string;
|
|
10
|
-
baseUrl: string;
|
|
11
|
-
network: BlockcypherNetwork;
|
|
12
|
-
address: string;
|
|
13
|
-
page: number;
|
|
14
|
-
};
|
|
15
|
-
export
|
|
16
|
-
apiKey?: string;
|
|
17
|
-
baseUrl: string;
|
|
18
|
-
network: BlockcypherNetwork;
|
|
19
|
-
address: string;
|
|
20
|
-
confirmedOnly: boolean;
|
|
21
|
-
assetDecimals: number;
|
|
22
|
-
};
|
|
23
|
-
export
|
|
24
|
-
apiKey?: string;
|
|
25
|
-
baseUrl: string;
|
|
26
|
-
network: BlockcypherNetwork;
|
|
27
|
-
hash: TxHash;
|
|
28
|
-
};
|
|
29
|
-
export
|
|
30
|
-
apiKey?: string;
|
|
31
|
-
baseUrl: string;
|
|
32
|
-
network: BlockcypherNetwork;
|
|
33
|
-
txHex: string;
|
|
34
|
-
};
|
|
35
|
-
export interface TxInput {
|
|
36
|
-
output_value: string;
|
|
37
|
-
addresses: string[];
|
|
38
|
-
script_type?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface TxOutput {
|
|
41
|
-
value: string;
|
|
42
|
-
addresses: string[];
|
|
43
|
-
script_type?: string;
|
|
44
|
-
script: string;
|
|
45
|
-
}
|
|
46
|
-
export interface Transaction {
|
|
47
|
-
hash: string;
|
|
48
|
-
block_hash: string;
|
|
49
|
-
confirmed: string;
|
|
50
|
-
hex: string;
|
|
51
|
-
inputs: TxInput[];
|
|
52
|
-
outputs: TxOutput[];
|
|
53
|
-
}
|
|
54
|
-
export
|
|
55
|
-
hash: string;
|
|
56
|
-
index: number;
|
|
57
|
-
script: string;
|
|
58
|
-
address: string;
|
|
59
|
-
tx_hex: string;
|
|
60
|
-
value: string;
|
|
61
|
-
block: number;
|
|
62
|
-
};
|
|
63
|
-
export
|
|
64
|
-
tx_hash: string;
|
|
65
|
-
block_height: number;
|
|
66
|
-
confirmed: string;
|
|
67
|
-
};
|
|
68
|
-
export
|
|
69
|
-
balance: string;
|
|
70
|
-
unconfirmed_balance: string;
|
|
71
|
-
final_balance: string;
|
|
72
|
-
n_tx: number;
|
|
73
|
-
unconfirmed_n_tx: number;
|
|
74
|
-
final_n_tx: number;
|
|
75
|
-
};
|
|
76
|
-
export
|
|
77
|
-
txrefs: AddressTxDTO[];
|
|
78
|
-
};
|
|
79
|
-
export
|
|
80
|
-
tx: {
|
|
81
|
-
hash: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
export
|
|
85
|
-
outputs: AddressUTXO[];
|
|
86
|
-
};
|
|
87
|
-
export
|
|
88
|
-
network: string;
|
|
89
|
-
txid: string;
|
|
90
|
-
};
|
|
91
|
-
export
|
|
92
|
-
network: string;
|
|
93
|
-
txid: string;
|
|
94
|
-
confirmations: number;
|
|
95
|
-
is_confirmed: boolean;
|
|
96
|
-
};
|
|
1
|
+
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
|
+
export declare enum BlockcypherNetwork {
|
|
3
|
+
BTC = "btc/main",
|
|
4
|
+
BTCTEST = "btc/test3",
|
|
5
|
+
LTC = "ltc/main",
|
|
6
|
+
DOGE = "doge/main"
|
|
7
|
+
}
|
|
8
|
+
export type AddressParams = {
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
network: BlockcypherNetwork;
|
|
12
|
+
address: string;
|
|
13
|
+
page: number;
|
|
14
|
+
};
|
|
15
|
+
export type BalanceParams = {
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
network: BlockcypherNetwork;
|
|
19
|
+
address: string;
|
|
20
|
+
confirmedOnly: boolean;
|
|
21
|
+
assetDecimals: number;
|
|
22
|
+
};
|
|
23
|
+
export type TxHashParams = {
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
baseUrl: string;
|
|
26
|
+
network: BlockcypherNetwork;
|
|
27
|
+
hash: TxHash;
|
|
28
|
+
};
|
|
29
|
+
export type TxBroadcastParams = {
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
network: BlockcypherNetwork;
|
|
33
|
+
txHex: string;
|
|
34
|
+
};
|
|
35
|
+
export interface TxInput {
|
|
36
|
+
output_value: string;
|
|
37
|
+
addresses: string[];
|
|
38
|
+
script_type?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface TxOutput {
|
|
41
|
+
value: string;
|
|
42
|
+
addresses: string[];
|
|
43
|
+
script_type?: string;
|
|
44
|
+
script: string;
|
|
45
|
+
}
|
|
46
|
+
export interface Transaction {
|
|
47
|
+
hash: string;
|
|
48
|
+
block_hash: string;
|
|
49
|
+
confirmed: string;
|
|
50
|
+
hex: string;
|
|
51
|
+
inputs: TxInput[];
|
|
52
|
+
outputs: TxOutput[];
|
|
53
|
+
}
|
|
54
|
+
export type AddressUTXO = {
|
|
55
|
+
hash: string;
|
|
56
|
+
index: number;
|
|
57
|
+
script: string;
|
|
58
|
+
address: string;
|
|
59
|
+
tx_hex: string;
|
|
60
|
+
value: string;
|
|
61
|
+
block: number;
|
|
62
|
+
};
|
|
63
|
+
export type AddressTxDTO = {
|
|
64
|
+
tx_hash: string;
|
|
65
|
+
block_height: number;
|
|
66
|
+
confirmed: string;
|
|
67
|
+
};
|
|
68
|
+
export type GetBalanceDTO = {
|
|
69
|
+
balance: string;
|
|
70
|
+
unconfirmed_balance: string;
|
|
71
|
+
final_balance: string;
|
|
72
|
+
n_tx: number;
|
|
73
|
+
unconfirmed_n_tx: number;
|
|
74
|
+
final_n_tx: number;
|
|
75
|
+
};
|
|
76
|
+
export type GetTxsDTO = {
|
|
77
|
+
txrefs: AddressTxDTO[];
|
|
78
|
+
};
|
|
79
|
+
export type BroadcastDTO = {
|
|
80
|
+
tx: {
|
|
81
|
+
hash: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
export type UnspentTxsDTO = {
|
|
85
|
+
outputs: AddressUTXO[];
|
|
86
|
+
};
|
|
87
|
+
export type BroadcastTransfer = {
|
|
88
|
+
network: string;
|
|
89
|
+
txid: string;
|
|
90
|
+
};
|
|
91
|
+
export type TxConfirmedStatus = {
|
|
92
|
+
network: string;
|
|
93
|
+
txid: string;
|
|
94
|
+
confirmations: number;
|
|
95
|
+
is_confirmed: boolean;
|
|
96
|
+
};
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
|
-
import { BaseAmount } from '@xchainjs/xchain-util';
|
|
3
|
-
import { BalanceParams, BlockcypherNetwork, GetTxsDTO, Transaction, TxConfirmedStatus, TxHashParams } from './blockcypher-api-types';
|
|
4
|
-
/**
|
|
5
|
-
* Get transaction by hash.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param {string} baseUrl The sochain node url.
|
|
9
|
-
* @param {string} network network id
|
|
10
|
-
* @param {string} hash The transaction hash.
|
|
11
|
-
* @returns {Transactions}
|
|
12
|
-
*/
|
|
13
|
-
export declare const getTx: ({ apiKey, baseUrl, network, hash }: TxHashParams) => Promise<Transaction>;
|
|
14
|
-
/**
|
|
15
|
-
* Get transactions
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param {string} baseUrl The sochain node url.
|
|
19
|
-
* @param {string} network network id
|
|
20
|
-
* @param {string} hash The transaction hash.
|
|
21
|
-
* @returns {Transactions}
|
|
22
|
-
*/
|
|
23
|
-
export declare const getTxs: ({ apiKey, address, baseUrl, network, beforeBlock, limit, unspentOnly, }: {
|
|
24
|
-
apiKey?: string | undefined;
|
|
25
|
-
address: string;
|
|
26
|
-
baseUrl: string;
|
|
27
|
-
network: BlockcypherNetwork;
|
|
28
|
-
limit: number;
|
|
29
|
-
beforeBlock?: number | undefined;
|
|
30
|
-
unspentOnly: boolean;
|
|
31
|
-
}) => Promise<GetTxsDTO>;
|
|
32
|
-
/**
|
|
33
|
-
* Get address balance.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param {string} baseUrl The sochain node url.
|
|
37
|
-
* @param {string} network Network
|
|
38
|
-
* @param {string} address Address
|
|
39
|
-
* @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
|
|
40
|
-
* @returns {number}
|
|
41
|
-
*/
|
|
42
|
-
export declare const getBalance: ({ apiKey, baseUrl, network, address, confirmedOnly, assetDecimals, }: BalanceParams) => Promise<BaseAmount>;
|
|
43
|
-
/**
|
|
44
|
-
* Get Tx Confirmation status
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param {string} baseUrl The sochain node url.
|
|
48
|
-
* @param {Network} network
|
|
49
|
-
* @param {string} hash tx id
|
|
50
|
-
* @returns {TxConfirmedStatus}
|
|
51
|
-
*/
|
|
52
|
-
export declare const getIsTxConfirmed: ({ apiKey, baseUrl, network, hash, }: TxHashParams) => Promise<TxConfirmedStatus>;
|
|
53
|
-
/**
|
|
54
|
-
* Helper to get `confirmed` status of a tx.
|
|
55
|
-
*
|
|
56
|
-
* It will get it from cache or try to get it from Sochain (if not cached before)
|
|
57
|
-
*/
|
|
58
|
-
export declare const getConfirmedTxStatus: ({ apiKey, txHash, baseUrl, network, }: {
|
|
59
|
-
apiKey?: string | undefined;
|
|
60
|
-
baseUrl: string;
|
|
61
|
-
txHash: TxHash;
|
|
62
|
-
network: BlockcypherNetwork;
|
|
63
|
-
}) => Promise<boolean>;
|
|
64
|
-
export declare const broadcastTx: ({ apiKey, baseUrl, network, txHex, }: {
|
|
65
|
-
apiKey?: string | undefined;
|
|
66
|
-
baseUrl: string;
|
|
67
|
-
txHex: string;
|
|
68
|
-
network: BlockcypherNetwork;
|
|
69
|
-
}) => Promise<TxHash>;
|
|
1
|
+
import { TxHash } from '@xchainjs/xchain-client';
|
|
2
|
+
import { BaseAmount } from '@xchainjs/xchain-util';
|
|
3
|
+
import { BalanceParams, BlockcypherNetwork, GetTxsDTO, Transaction, TxConfirmedStatus, TxHashParams } from './blockcypher-api-types';
|
|
4
|
+
/**
|
|
5
|
+
* Get transaction by hash.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @param {string} baseUrl The sochain node url.
|
|
9
|
+
* @param {string} network network id
|
|
10
|
+
* @param {string} hash The transaction hash.
|
|
11
|
+
* @returns {Transactions}
|
|
12
|
+
*/
|
|
13
|
+
export declare const getTx: ({ apiKey, baseUrl, network, hash }: TxHashParams) => Promise<Transaction>;
|
|
14
|
+
/**
|
|
15
|
+
* Get transactions
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @param {string} baseUrl The sochain node url.
|
|
19
|
+
* @param {string} network network id
|
|
20
|
+
* @param {string} hash The transaction hash.
|
|
21
|
+
* @returns {Transactions}
|
|
22
|
+
*/
|
|
23
|
+
export declare const getTxs: ({ apiKey, address, baseUrl, network, beforeBlock, limit, unspentOnly, }: {
|
|
24
|
+
apiKey?: string | undefined;
|
|
25
|
+
address: string;
|
|
26
|
+
baseUrl: string;
|
|
27
|
+
network: BlockcypherNetwork;
|
|
28
|
+
limit: number;
|
|
29
|
+
beforeBlock?: number | undefined;
|
|
30
|
+
unspentOnly: boolean;
|
|
31
|
+
}) => Promise<GetTxsDTO>;
|
|
32
|
+
/**
|
|
33
|
+
* Get address balance.
|
|
34
|
+
*
|
|
35
|
+
*
|
|
36
|
+
* @param {string} baseUrl The sochain node url.
|
|
37
|
+
* @param {string} network Network
|
|
38
|
+
* @param {string} address Address
|
|
39
|
+
* @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
export declare const getBalance: ({ apiKey, baseUrl, network, address, confirmedOnly, assetDecimals, }: BalanceParams) => Promise<BaseAmount>;
|
|
43
|
+
/**
|
|
44
|
+
* Get Tx Confirmation status
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
* @param {string} baseUrl The sochain node url.
|
|
48
|
+
* @param {Network} network
|
|
49
|
+
* @param {string} hash tx id
|
|
50
|
+
* @returns {TxConfirmedStatus}
|
|
51
|
+
*/
|
|
52
|
+
export declare const getIsTxConfirmed: ({ apiKey, baseUrl, network, hash, }: TxHashParams) => Promise<TxConfirmedStatus>;
|
|
53
|
+
/**
|
|
54
|
+
* Helper to get `confirmed` status of a tx.
|
|
55
|
+
*
|
|
56
|
+
* It will get it from cache or try to get it from Sochain (if not cached before)
|
|
57
|
+
*/
|
|
58
|
+
export declare const getConfirmedTxStatus: ({ apiKey, txHash, baseUrl, network, }: {
|
|
59
|
+
apiKey?: string | undefined;
|
|
60
|
+
baseUrl: string;
|
|
61
|
+
txHash: TxHash;
|
|
62
|
+
network: BlockcypherNetwork;
|
|
63
|
+
}) => Promise<boolean>;
|
|
64
|
+
export declare const broadcastTx: ({ apiKey, baseUrl, network, txHex, }: {
|
|
65
|
+
apiKey?: string | undefined;
|
|
66
|
+
baseUrl: string;
|
|
67
|
+
txHex: string;
|
|
68
|
+
network: BlockcypherNetwork;
|
|
69
|
+
}) => Promise<TxHash>;
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
|
-
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
-
import { BlockcypherNetwork } from './blockcypher-api-types';
|
|
4
|
-
export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
5
|
-
private baseUrl;
|
|
6
|
-
private _apiKey?;
|
|
7
|
-
private chain;
|
|
8
|
-
private asset;
|
|
9
|
-
private assetDecimals;
|
|
10
|
-
private blockcypherNetwork;
|
|
11
|
-
constructor(baseUrl: string | undefined, chain: Chain, asset: Asset, assetDecimals: number, blockcypherNetwork: BlockcypherNetwork, apiKey?: string);
|
|
12
|
-
get apiKey(): string | undefined;
|
|
13
|
-
set apiKey(value: string | undefined);
|
|
14
|
-
broadcastTx(txHex: string): Promise<TxHash>;
|
|
15
|
-
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
16
|
-
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
17
|
-
getBalance(address: Address, assets?: Asset[], confirmedOnly?: boolean): Promise<Balance[]>;
|
|
18
|
-
/**
|
|
19
|
-
* Get transaction history of a given address with pagination options.
|
|
20
|
-
* By default it will return the transaction history of the current wallet.
|
|
21
|
-
*
|
|
22
|
-
* @param {TxHistoryParams} params The options to get transaction history. (optional)
|
|
23
|
-
* @returns {TxsPage} The transaction history.
|
|
24
|
-
*/
|
|
25
|
-
getTransactions(params?: TxHistoryParams, unspentOnly?: boolean): Promise<TxsPage>;
|
|
26
|
-
/**
|
|
27
|
-
* Get the transaction details of a given transaction id.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} txId The transaction id.
|
|
30
|
-
* @returns {Tx} The transaction details of the given transaction id.
|
|
31
|
-
*/
|
|
32
|
-
getTransactionData(txId: string): Promise<Tx>;
|
|
33
|
-
private mapTransactionToTx;
|
|
34
|
-
private mapUTXOs;
|
|
35
|
-
/**
|
|
36
|
-
* helper function tto limit adding to an array
|
|
37
|
-
*
|
|
38
|
-
* @param arr array to be added to
|
|
39
|
-
* @param toAdd elements to add
|
|
40
|
-
* @param limit do not add more than this limit
|
|
41
|
-
*/
|
|
42
|
-
private addArrayUpToLimit;
|
|
43
|
-
private delay;
|
|
44
|
-
/**
|
|
45
|
-
* Get transaction history of a given address with pagination options.
|
|
46
|
-
* By default it will return the transaction history of the current wallet.
|
|
47
|
-
*
|
|
48
|
-
* @param {TxHistoryParams} params The options to get transaction history. (optional)
|
|
49
|
-
* @returns {TxsPage} The transaction history.
|
|
50
|
-
*/
|
|
51
|
-
private getRawTransactions;
|
|
52
|
-
}
|
|
1
|
+
import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
|
|
2
|
+
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
+
import { BlockcypherNetwork } from './blockcypher-api-types';
|
|
4
|
+
export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
5
|
+
private baseUrl;
|
|
6
|
+
private _apiKey?;
|
|
7
|
+
private chain;
|
|
8
|
+
private asset;
|
|
9
|
+
private assetDecimals;
|
|
10
|
+
private blockcypherNetwork;
|
|
11
|
+
constructor(baseUrl: string | undefined, chain: Chain, asset: Asset, assetDecimals: number, blockcypherNetwork: BlockcypherNetwork, apiKey?: string);
|
|
12
|
+
get apiKey(): string | undefined;
|
|
13
|
+
set apiKey(value: string | undefined);
|
|
14
|
+
broadcastTx(txHex: string): Promise<TxHash>;
|
|
15
|
+
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
16
|
+
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
17
|
+
getBalance(address: Address, assets?: Asset[], confirmedOnly?: boolean): Promise<Balance[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Get transaction history of a given address with pagination options.
|
|
20
|
+
* By default it will return the transaction history of the current wallet.
|
|
21
|
+
*
|
|
22
|
+
* @param {TxHistoryParams} params The options to get transaction history. (optional)
|
|
23
|
+
* @returns {TxsPage} The transaction history.
|
|
24
|
+
*/
|
|
25
|
+
getTransactions(params?: TxHistoryParams, unspentOnly?: boolean): Promise<TxsPage>;
|
|
26
|
+
/**
|
|
27
|
+
* Get the transaction details of a given transaction id.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} txId The transaction id.
|
|
30
|
+
* @returns {Tx} The transaction details of the given transaction id.
|
|
31
|
+
*/
|
|
32
|
+
getTransactionData(txId: string): Promise<Tx>;
|
|
33
|
+
private mapTransactionToTx;
|
|
34
|
+
private mapUTXOs;
|
|
35
|
+
/**
|
|
36
|
+
* helper function tto limit adding to an array
|
|
37
|
+
*
|
|
38
|
+
* @param arr array to be added to
|
|
39
|
+
* @param toAdd elements to add
|
|
40
|
+
* @param limit do not add more than this limit
|
|
41
|
+
*/
|
|
42
|
+
private addArrayUpToLimit;
|
|
43
|
+
private delay;
|
|
44
|
+
/**
|
|
45
|
+
* Get transaction history of a given address with pagination options.
|
|
46
|
+
* By default it will return the transaction history of the current wallet.
|
|
47
|
+
*
|
|
48
|
+
* @param {TxHistoryParams} params The options to get transaction history. (optional)
|
|
49
|
+
* @returns {TxsPage} The transaction history.
|
|
50
|
+
*/
|
|
51
|
+
private getRawTransactions;
|
|
52
|
+
}
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Haskoin API types
|
|
3
|
-
*/
|
|
4
|
-
import { TxHash } from '@xchainjs/xchain-client';
|
|
5
|
-
import { Address } from '@xchainjs/xchain-util';
|
|
6
|
-
export declare enum HaskoinNetwork {
|
|
7
|
-
BTC = "btc",
|
|
8
|
-
BTCTEST = "btctest",
|
|
9
|
-
BCH = "bch",
|
|
10
|
-
BCHTEST = "bchtest"
|
|
11
|
-
}
|
|
12
|
-
export
|
|
13
|
-
haskoinUrl: string;
|
|
14
|
-
network: HaskoinNetwork;
|
|
15
|
-
address: string;
|
|
16
|
-
};
|
|
17
|
-
export
|
|
18
|
-
error: unknown;
|
|
19
|
-
};
|
|
20
|
-
export
|
|
21
|
-
received: number;
|
|
22
|
-
utxo: number;
|
|
23
|
-
address: string;
|
|
24
|
-
txs: number;
|
|
25
|
-
unconfirmed: number;
|
|
26
|
-
confirmed: number;
|
|
27
|
-
};
|
|
28
|
-
export
|
|
29
|
-
address: Address;
|
|
30
|
-
confirmed: number;
|
|
31
|
-
unconfirmed: number;
|
|
32
|
-
utxo: number;
|
|
33
|
-
txs: number;
|
|
34
|
-
received: number;
|
|
35
|
-
};
|
|
36
|
-
export
|
|
37
|
-
result: string;
|
|
38
|
-
};
|
|
39
|
-
export
|
|
40
|
-
network: string;
|
|
41
|
-
address: string;
|
|
42
|
-
balance: string;
|
|
43
|
-
received_value: string;
|
|
44
|
-
pending_value: string;
|
|
45
|
-
total_txs: number;
|
|
46
|
-
};
|
|
47
|
-
export
|
|
48
|
-
haskoinUrl: string;
|
|
49
|
-
network: HaskoinNetwork;
|
|
50
|
-
txId: TxHash;
|
|
51
|
-
};
|
|
52
|
-
export interface TxIO {
|
|
53
|
-
txid: number;
|
|
54
|
-
output: number;
|
|
55
|
-
script: string;
|
|
56
|
-
address: string;
|
|
57
|
-
value: number;
|
|
58
|
-
type?: string;
|
|
59
|
-
}
|
|
60
|
-
export
|
|
61
|
-
txid: string;
|
|
62
|
-
block: Block;
|
|
63
|
-
confirmations: number;
|
|
64
|
-
time: number;
|
|
65
|
-
tx_hex: string;
|
|
66
|
-
inputs: TxIO[];
|
|
67
|
-
outputs: TxIO[];
|
|
68
|
-
};
|
|
69
|
-
export interface HaskoinResponse<T> {
|
|
70
|
-
data: T;
|
|
71
|
-
status: string;
|
|
72
|
-
}
|
|
73
|
-
export
|
|
74
|
-
height: number;
|
|
75
|
-
position: number;
|
|
76
|
-
};
|
|
77
|
-
export
|
|
78
|
-
transactions: AddressTxDTO[];
|
|
79
|
-
};
|
|
80
|
-
export
|
|
81
|
-
txid: string;
|
|
82
|
-
block: Block;
|
|
83
|
-
time: number;
|
|
84
|
-
};
|
|
85
|
-
export
|
|
86
|
-
network: string;
|
|
87
|
-
txid: string;
|
|
88
|
-
confirmations: number;
|
|
89
|
-
is_confirmed: boolean;
|
|
90
|
-
};
|
|
91
|
-
export
|
|
92
|
-
address: string;
|
|
93
|
-
block: Block;
|
|
94
|
-
txid: string;
|
|
95
|
-
index: number;
|
|
96
|
-
pkscript: string;
|
|
97
|
-
value: string;
|
|
98
|
-
tx_hex: string;
|
|
99
|
-
};
|
|
100
|
-
export
|
|
101
|
-
outputs: AddressUTXO[];
|
|
102
|
-
};
|
|
103
|
-
export
|
|
104
|
-
pkscript: string;
|
|
105
|
-
value: number;
|
|
106
|
-
address: string;
|
|
107
|
-
block: {
|
|
108
|
-
height: number;
|
|
109
|
-
position: number;
|
|
110
|
-
};
|
|
111
|
-
index: number;
|
|
112
|
-
txid: string;
|
|
113
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Haskoin API types
|
|
3
|
+
*/
|
|
4
|
+
import { TxHash } from '@xchainjs/xchain-client';
|
|
5
|
+
import { Address } from '@xchainjs/xchain-util';
|
|
6
|
+
export declare enum HaskoinNetwork {
|
|
7
|
+
BTC = "btc",
|
|
8
|
+
BTCTEST = "btctest",
|
|
9
|
+
BCH = "bch",
|
|
10
|
+
BCHTEST = "bchtest"
|
|
11
|
+
}
|
|
12
|
+
export type AddressParams = {
|
|
13
|
+
haskoinUrl: string;
|
|
14
|
+
network: HaskoinNetwork;
|
|
15
|
+
address: string;
|
|
16
|
+
};
|
|
17
|
+
export type ErrorResponse = {
|
|
18
|
+
error: unknown;
|
|
19
|
+
};
|
|
20
|
+
export type AddressBalance = {
|
|
21
|
+
received: number;
|
|
22
|
+
utxo: number;
|
|
23
|
+
address: string;
|
|
24
|
+
txs: number;
|
|
25
|
+
unconfirmed: number;
|
|
26
|
+
confirmed: number;
|
|
27
|
+
};
|
|
28
|
+
export type BalanceData = {
|
|
29
|
+
address: Address;
|
|
30
|
+
confirmed: number;
|
|
31
|
+
unconfirmed: number;
|
|
32
|
+
utxo: number;
|
|
33
|
+
txs: number;
|
|
34
|
+
received: number;
|
|
35
|
+
};
|
|
36
|
+
export type RawTransaction = {
|
|
37
|
+
result: string;
|
|
38
|
+
};
|
|
39
|
+
export type AddressDTO = {
|
|
40
|
+
network: string;
|
|
41
|
+
address: string;
|
|
42
|
+
balance: string;
|
|
43
|
+
received_value: string;
|
|
44
|
+
pending_value: string;
|
|
45
|
+
total_txs: number;
|
|
46
|
+
};
|
|
47
|
+
export type TxHashParams = {
|
|
48
|
+
haskoinUrl: string;
|
|
49
|
+
network: HaskoinNetwork;
|
|
50
|
+
txId: TxHash;
|
|
51
|
+
};
|
|
52
|
+
export interface TxIO {
|
|
53
|
+
txid: number;
|
|
54
|
+
output: number;
|
|
55
|
+
script: string;
|
|
56
|
+
address: string;
|
|
57
|
+
value: number;
|
|
58
|
+
type?: string;
|
|
59
|
+
}
|
|
60
|
+
export type Transaction = {
|
|
61
|
+
txid: string;
|
|
62
|
+
block: Block;
|
|
63
|
+
confirmations: number;
|
|
64
|
+
time: number;
|
|
65
|
+
tx_hex: string;
|
|
66
|
+
inputs: TxIO[];
|
|
67
|
+
outputs: TxIO[];
|
|
68
|
+
};
|
|
69
|
+
export interface HaskoinResponse<T> {
|
|
70
|
+
data: T;
|
|
71
|
+
status: string;
|
|
72
|
+
}
|
|
73
|
+
export type Block = {
|
|
74
|
+
height: number;
|
|
75
|
+
position: number;
|
|
76
|
+
};
|
|
77
|
+
export type GetTxsDTO = {
|
|
78
|
+
transactions: AddressTxDTO[];
|
|
79
|
+
};
|
|
80
|
+
export type AddressTxDTO = {
|
|
81
|
+
txid: string;
|
|
82
|
+
block: Block;
|
|
83
|
+
time: number;
|
|
84
|
+
};
|
|
85
|
+
export type TxConfirmedStatus = {
|
|
86
|
+
network: string;
|
|
87
|
+
txid: string;
|
|
88
|
+
confirmations: number;
|
|
89
|
+
is_confirmed: boolean;
|
|
90
|
+
};
|
|
91
|
+
export type AddressUTXO = {
|
|
92
|
+
address: string;
|
|
93
|
+
block: Block;
|
|
94
|
+
txid: string;
|
|
95
|
+
index: number;
|
|
96
|
+
pkscript: string;
|
|
97
|
+
value: string;
|
|
98
|
+
tx_hex: string;
|
|
99
|
+
};
|
|
100
|
+
export type UnspentTxsDTO = {
|
|
101
|
+
outputs: AddressUTXO[];
|
|
102
|
+
};
|
|
103
|
+
export type TxUnspent = {
|
|
104
|
+
pkscript: string;
|
|
105
|
+
value: number;
|
|
106
|
+
address: string;
|
|
107
|
+
block: {
|
|
108
|
+
height: number;
|
|
109
|
+
position: number;
|
|
110
|
+
};
|
|
111
|
+
index: number;
|
|
112
|
+
txid: string;
|
|
113
|
+
};
|