@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.
@@ -1,113 +1,113 @@
1
- import { TxHash } from '@xchainjs/xchain-client';
2
- import { BaseAmount } from '@xchainjs/xchain-util';
3
- import { AddressDTO, AddressParams, AddressUTXO, BalanceParams, GetTxsDTO, SochainNetwork, Transaction, TxConfirmedStatus, TxHashParams } from './sochain-api-types';
4
- /**
5
- * Get address information.
6
- *
7
- * @param {string} sochainUrl The sochain node url.
8
- * @param {string} network
9
- * @param {string} address
10
- * @returns {AddressDTO}
11
- */
12
- export declare const getAddress: ({ apiKey, sochainUrl, network, address }: AddressParams) => Promise<AddressDTO>;
13
- /**
14
- * Get transaction by hash.
15
- *
16
- * @see https://sochain.com/api#get-tx
17
- *
18
- * @param {string} sochainUrl 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 getTx: ({ apiKey, sochainUrl, network, hash }: TxHashParams) => Promise<Transaction>;
24
- /**
25
- * Get transactions
26
- *
27
- * @see https://sochain.com/api#get-tx
28
- *
29
- * @param {string} sochainUrl The sochain node url.
30
- * @param {string} network network id
31
- * @param {string} hash The transaction hash.
32
- * @returns {Transactions}
33
- */
34
- export declare const getTxs: ({ apiKey, address, sochainUrl, network, page, }: {
35
- apiKey: string;
36
- address: string;
37
- sochainUrl: string;
38
- network: SochainNetwork;
39
- page: number;
40
- }) => Promise<GetTxsDTO>;
41
- /**
42
- * Get address balance.
43
- *
44
- * @see https://sochain.com/api#get-balance
45
- *
46
- * @param {string} sochainUrl The sochain node url.
47
- * @param {string} network Network
48
- * @param {string} address Address
49
- * @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
50
- * @returns {number}
51
- */
52
- export declare const getBalance: ({ apiKey, sochainUrl, network, address, confirmedOnly, assetDecimals, }: BalanceParams) => Promise<BaseAmount>;
53
- /**
54
- * Get unspent txs
55
- *
56
- * @see https://sochain.com/api#get-unspent-tx
57
- *
58
- * @param {string} sochainUrl The sochain node url.
59
- * @param {string} network
60
- * @param {string} address
61
- * @returns {AddressUTXO[]}
62
- */
63
- export declare const getUnspentTxs: ({ apiKey, sochainUrl, network, address, page, }: AddressParams) => Promise<AddressUTXO[]>;
64
- /**
65
- * Get Tx Confirmation status
66
- *
67
- * @see https://sochain.com/api#get-is-tx-confirmed
68
- *
69
- * @param {string} sochainUrl The sochain node url.
70
- * @param {Network} network
71
- * @param {string} hash tx id
72
- * @returns {TxConfirmedStatus}
73
- */
74
- export declare const getIsTxConfirmed: ({ apiKey, sochainUrl, network, hash, }: TxHashParams) => Promise<TxConfirmedStatus>;
75
- /**
76
- * Helper to get `confirmed` status of a tx.
77
- *
78
- * It will get it from cache or try to get it from Sochain (if not cached before)
79
- */
80
- export declare const getConfirmedTxStatus: ({ apiKey, txHash, sochainUrl, network, }: {
81
- apiKey: string;
82
- sochainUrl: string;
83
- txHash: TxHash;
84
- network: SochainNetwork;
85
- }) => Promise<boolean>;
86
- /**
87
- * Get unspent txs and filter out pending UTXOs
88
- *
89
- * @see https://sochain.com/api#get-unspent-tx
90
- *
91
- * @param {string} sochainUrl The sochain node url.
92
- * @param {Network} network
93
- * @param {string} address
94
- * @returns {AddressUTXO[]}
95
- */
96
- export declare const getConfirmedUnspentTxs: ({ apiKey, sochainUrl, network, address, }: AddressParams) => Promise<AddressUTXO[]>;
97
- /**
98
- * Get address balance.
99
- *
100
- * @see https://sochain.com/api#get-balance
101
- *
102
- * @param {string} sochainUrl The sochain node url.
103
- * @param {string} network Network
104
- * @param {string} address Address
105
- * @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
106
- * @returns {number}
107
- */
108
- export declare const broadcastTx: ({ apiKey, sochainUrl, network, txHex, }: {
109
- apiKey: string;
110
- sochainUrl: string;
111
- txHex: string;
112
- network: SochainNetwork;
113
- }) => Promise<TxHash>;
1
+ import { TxHash } from '@xchainjs/xchain-client';
2
+ import { BaseAmount } from '@xchainjs/xchain-util';
3
+ import { AddressDTO, AddressParams, AddressUTXO, BalanceParams, GetTxsDTO, SochainNetwork, Transaction, TxConfirmedStatus, TxHashParams } from './sochain-api-types';
4
+ /**
5
+ * Get address information.
6
+ *
7
+ * @param {string} sochainUrl The sochain node url.
8
+ * @param {string} network
9
+ * @param {string} address
10
+ * @returns {AddressDTO}
11
+ */
12
+ export declare const getAddress: ({ apiKey, sochainUrl, network, address }: AddressParams) => Promise<AddressDTO>;
13
+ /**
14
+ * Get transaction by hash.
15
+ *
16
+ * @see https://sochain.com/api#get-tx
17
+ *
18
+ * @param {string} sochainUrl 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 getTx: ({ apiKey, sochainUrl, network, hash }: TxHashParams) => Promise<Transaction>;
24
+ /**
25
+ * Get transactions
26
+ *
27
+ * @see https://sochain.com/api#get-tx
28
+ *
29
+ * @param {string} sochainUrl The sochain node url.
30
+ * @param {string} network network id
31
+ * @param {string} hash The transaction hash.
32
+ * @returns {Transactions}
33
+ */
34
+ export declare const getTxs: ({ apiKey, address, sochainUrl, network, page, }: {
35
+ apiKey: string;
36
+ address: string;
37
+ sochainUrl: string;
38
+ network: SochainNetwork;
39
+ page: number;
40
+ }) => Promise<GetTxsDTO>;
41
+ /**
42
+ * Get address balance.
43
+ *
44
+ * @see https://sochain.com/api#get-balance
45
+ *
46
+ * @param {string} sochainUrl The sochain node url.
47
+ * @param {string} network Network
48
+ * @param {string} address Address
49
+ * @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
50
+ * @returns {number}
51
+ */
52
+ export declare const getBalance: ({ apiKey, sochainUrl, network, address, confirmedOnly, assetDecimals, }: BalanceParams) => Promise<BaseAmount>;
53
+ /**
54
+ * Get unspent txs
55
+ *
56
+ * @see https://sochain.com/api#get-unspent-tx
57
+ *
58
+ * @param {string} sochainUrl The sochain node url.
59
+ * @param {string} network
60
+ * @param {string} address
61
+ * @returns {AddressUTXO[]}
62
+ */
63
+ export declare const getUnspentTxs: ({ apiKey, sochainUrl, network, address, page, }: AddressParams) => Promise<AddressUTXO[]>;
64
+ /**
65
+ * Get Tx Confirmation status
66
+ *
67
+ * @see https://sochain.com/api#get-is-tx-confirmed
68
+ *
69
+ * @param {string} sochainUrl The sochain node url.
70
+ * @param {Network} network
71
+ * @param {string} hash tx id
72
+ * @returns {TxConfirmedStatus}
73
+ */
74
+ export declare const getIsTxConfirmed: ({ apiKey, sochainUrl, network, hash, }: TxHashParams) => Promise<TxConfirmedStatus>;
75
+ /**
76
+ * Helper to get `confirmed` status of a tx.
77
+ *
78
+ * It will get it from cache or try to get it from Sochain (if not cached before)
79
+ */
80
+ export declare const getConfirmedTxStatus: ({ apiKey, txHash, sochainUrl, network, }: {
81
+ apiKey: string;
82
+ sochainUrl: string;
83
+ txHash: TxHash;
84
+ network: SochainNetwork;
85
+ }) => Promise<boolean>;
86
+ /**
87
+ * Get unspent txs and filter out pending UTXOs
88
+ *
89
+ * @see https://sochain.com/api#get-unspent-tx
90
+ *
91
+ * @param {string} sochainUrl The sochain node url.
92
+ * @param {Network} network
93
+ * @param {string} address
94
+ * @returns {AddressUTXO[]}
95
+ */
96
+ export declare const getConfirmedUnspentTxs: ({ apiKey, sochainUrl, network, address, }: AddressParams) => Promise<AddressUTXO[]>;
97
+ /**
98
+ * Get address balance.
99
+ *
100
+ * @see https://sochain.com/api#get-balance
101
+ *
102
+ * @param {string} sochainUrl The sochain node url.
103
+ * @param {string} network Network
104
+ * @param {string} address Address
105
+ * @param {boolean} confirmedOnly Flag whether to get balances of confirmed txs only or for all
106
+ * @returns {number}
107
+ */
108
+ export declare const broadcastTx: ({ apiKey, sochainUrl, network, txHex, }: {
109
+ apiKey: string;
110
+ sochainUrl: string;
111
+ txHex: string;
112
+ network: SochainNetwork;
113
+ }) => Promise<TxHash>;
@@ -1,42 +1,42 @@
1
- import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
2
- import { Address, Asset, Chain } from '@xchainjs/xchain-util';
3
- import { SochainNetwork } from './sochain-api-types';
4
- export declare class SochainProvider implements UtxoOnlineDataProvider {
5
- private baseUrl;
6
- private _apiKey;
7
- private chain;
8
- private asset;
9
- private assetDecimals;
10
- private sochainNetwork;
11
- constructor(baseUrl: string | undefined, apiKey: string, chain: Chain, asset: Asset, assetDecimals: number, sochainNetwork: SochainNetwork);
12
- get apiKey(): string;
13
- set apiKey(value: string);
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): 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 mapUTXOs;
34
- /**
35
- * helper function tto limit adding to an array
36
- *
37
- * @param arr array to be added to
38
- * @param toAdd elements to add
39
- * @param limit do not add more than this limit
40
- */
41
- private addArrayUpToLimit;
42
- }
1
+ import { Balance, Tx, TxHash, TxHistoryParams, TxsPage, UTXO, UtxoOnlineDataProvider } from '@xchainjs/xchain-client';
2
+ import { Address, Asset, Chain } from '@xchainjs/xchain-util';
3
+ import { SochainNetwork } from './sochain-api-types';
4
+ export declare class SochainProvider implements UtxoOnlineDataProvider {
5
+ private baseUrl;
6
+ private _apiKey;
7
+ private chain;
8
+ private asset;
9
+ private assetDecimals;
10
+ private sochainNetwork;
11
+ constructor(baseUrl: string | undefined, apiKey: string, chain: Chain, asset: Asset, assetDecimals: number, sochainNetwork: SochainNetwork);
12
+ get apiKey(): string;
13
+ set apiKey(value: string);
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): 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 mapUTXOs;
34
+ /**
35
+ * helper function tto limit adding to an array
36
+ *
37
+ * @param arr array to be added to
38
+ * @param toAdd elements to add
39
+ * @param limit do not add more than this limit
40
+ */
41
+ private addArrayUpToLimit;
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-utxo-providers",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -27,16 +27,16 @@
27
27
  "access": "public"
28
28
  },
29
29
  "devDependencies": {
30
- "@xchainjs/xchain-client": "^0.13.7",
31
- "@xchainjs/xchain-crypto": "^0.2.6",
32
- "@xchainjs/xchain-util": "^0.12.0",
33
- "axios": "^0.25.0"
30
+ "@xchainjs/xchain-client": "^0.14.0",
31
+ "@xchainjs/xchain-crypto": "^0.3.0",
32
+ "@xchainjs/xchain-util": "^0.13.0",
33
+ "axios": "^1.3.6"
34
34
  },
35
35
  "peerDependencies": {
36
- "@xchainjs/xchain-client": "^0.13.7",
37
- "@xchainjs/xchain-crypto": "^0.2.6",
38
- "@xchainjs/xchain-util": "^0.12.0",
39
- "axios": "^0.25.0"
36
+ "@xchainjs/xchain-client": "^0.14.0",
37
+ "@xchainjs/xchain-crypto": "^0.3.0",
38
+ "@xchainjs/xchain-util": "^0.13.0",
39
+ "axios": "^1.3.6"
40
40
  },
41
41
  "dependencies": {
42
42
  "@supercharge/promise-pool": "^2.4.0"