@xchainjs/xchain-utxo-providers 0.2.18 → 1.0.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 -0
- package/lib/index.esm.js +3 -3
- package/lib/index.js +3 -3
- package/lib/providers/bitgo/bitgo-data-provider.d.ts +2 -2
- package/lib/providers/blockcypher/blockcypher-data-provider.d.ts +3 -3
- package/lib/providers/haskoin/haskoin-data-provider.d.ts +3 -3
- package/lib/providers/index.d.ts +0 -1
- package/lib/providers/sochainv3/sochain-data-provider.d.ts +3 -3
- package/lib/types/index.d.ts +93 -0
- package/package.json +3 -3
- package/lib/providers/types/index.d.ts +0 -21
package/lib/index.d.ts
CHANGED
package/lib/index.esm.js
CHANGED
|
@@ -191,7 +191,7 @@ class SochainProvider {
|
|
|
191
191
|
return this.mapUTXOs(allUnspent);
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
|
-
getBalance(address,
|
|
194
|
+
getBalance(address, confirmedOnly) {
|
|
195
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
196
|
try {
|
|
197
197
|
const amount = yield getBalance$2({
|
|
@@ -652,7 +652,7 @@ class HaskoinProvider {
|
|
|
652
652
|
return yield this.mapUTXOs(allUnspent);
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
|
-
getBalance(address,
|
|
655
|
+
getBalance(address, confirmedOnly) {
|
|
656
656
|
return __awaiter(this, void 0, void 0, function* () {
|
|
657
657
|
const amount = yield getBalance$1({
|
|
658
658
|
haskoinUrl: this.baseUrl,
|
|
@@ -882,7 +882,7 @@ class BlockcypherProvider {
|
|
|
882
882
|
return this.mapUTXOs(address, allUnspent);
|
|
883
883
|
});
|
|
884
884
|
}
|
|
885
|
-
getBalance(address,
|
|
885
|
+
getBalance(address, confirmedOnly) {
|
|
886
886
|
return __awaiter(this, void 0, void 0, function* () {
|
|
887
887
|
const amount = yield getBalance({
|
|
888
888
|
apiKey: this._apiKey,
|
package/lib/index.js
CHANGED
|
@@ -200,7 +200,7 @@ class SochainProvider {
|
|
|
200
200
|
return this.mapUTXOs(allUnspent);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
|
-
getBalance(address,
|
|
203
|
+
getBalance(address, confirmedOnly) {
|
|
204
204
|
return __awaiter(this, void 0, void 0, function* () {
|
|
205
205
|
try {
|
|
206
206
|
const amount = yield getBalance$2({
|
|
@@ -661,7 +661,7 @@ class HaskoinProvider {
|
|
|
661
661
|
return yield this.mapUTXOs(allUnspent);
|
|
662
662
|
});
|
|
663
663
|
}
|
|
664
|
-
getBalance(address,
|
|
664
|
+
getBalance(address, confirmedOnly) {
|
|
665
665
|
return __awaiter(this, void 0, void 0, function* () {
|
|
666
666
|
const amount = yield getBalance$1({
|
|
667
667
|
haskoinUrl: this.baseUrl,
|
|
@@ -891,7 +891,7 @@ class BlockcypherProvider {
|
|
|
891
891
|
return this.mapUTXOs(address, allUnspent);
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
|
-
getBalance(address,
|
|
894
|
+
getBalance(address, confirmedOnly) {
|
|
895
895
|
return __awaiter(this, void 0, void 0, function* () {
|
|
896
896
|
const amount = yield getBalance({
|
|
897
897
|
apiKey: this._apiKey,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeeRates } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Chain } from '@xchainjs/xchain-util';
|
|
3
|
-
import { UTXO, UtxoOnlineDataProvider } from '
|
|
3
|
+
import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types';
|
|
4
4
|
export interface BitgoConfig {
|
|
5
5
|
baseUrl: string;
|
|
6
6
|
chain: Chain;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeeRates, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
-
import { UTXO, UtxoOnlineDataProvider } from '
|
|
3
|
+
import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types';
|
|
4
4
|
import { BlockcypherNetwork } from './blockcypher-api-types';
|
|
5
5
|
export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
6
6
|
private baseUrl;
|
|
@@ -15,7 +15,7 @@ export declare class BlockcypherProvider implements UtxoOnlineDataProvider {
|
|
|
15
15
|
broadcastTx(txHex: string): Promise<TxHash>;
|
|
16
16
|
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
17
17
|
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
18
|
-
getBalance(address: Address,
|
|
18
|
+
getBalance(address: Address, confirmedOnly?: boolean): Promise<Balance[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Get transaction history of a given address with pagination options.
|
|
21
21
|
* By default it will return the transaction history of the current wallet.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeeRates, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
-
import { UTXO, UtxoOnlineDataProvider } from '
|
|
3
|
+
import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types';
|
|
4
4
|
import { HaskoinNetwork } from './haskoin-api-types';
|
|
5
5
|
export declare class HaskoinProvider implements UtxoOnlineDataProvider {
|
|
6
6
|
private baseUrl;
|
|
@@ -12,7 +12,7 @@ export declare class HaskoinProvider implements UtxoOnlineDataProvider {
|
|
|
12
12
|
broadcastTx(txHex: string): Promise<TxHash>;
|
|
13
13
|
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
14
14
|
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
15
|
-
getBalance(address: Address,
|
|
15
|
+
getBalance(address: Address, confirmedOnly?: boolean): Promise<Balance[]>;
|
|
16
16
|
/**
|
|
17
17
|
* Get transaction history of a given address with pagination options.
|
|
18
18
|
* By default it will return the transaction history of the current wallet.
|
package/lib/providers/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export * from './sochainv3/sochain-api-types';
|
|
2
2
|
export * from './sochainv3/sochain-api';
|
|
3
3
|
export * from './sochainv3/sochain-data-provider';
|
|
4
|
-
export * from './types';
|
|
5
4
|
export { AddressDTO, AddressParams, AddressUTXO, BalanceData, GetTxsDTO, HaskoinNetwork, HaskoinResponse, Transaction, TxConfirmedStatus, TxHashParams, } from './haskoin/haskoin-api-types';
|
|
6
5
|
export { getAddress, getBalance, getConfirmedTxStatus, getConfirmedUnspentTxs, getAccount, getIsTxConfirmed, getTx, getTxs, getUnspentTxs, broadcastTx, } from './haskoin/haskoin-api';
|
|
7
6
|
export * from './haskoin/haskoin-data-provider';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FeeRates, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
|
|
2
2
|
import { Address, Asset, Chain } from '@xchainjs/xchain-util';
|
|
3
|
-
import { UTXO, UtxoOnlineDataProvider } from '
|
|
3
|
+
import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types';
|
|
4
4
|
import { SochainNetwork } from './sochain-api-types';
|
|
5
5
|
export declare class SochainProvider implements UtxoOnlineDataProvider {
|
|
6
6
|
private baseUrl;
|
|
@@ -15,7 +15,7 @@ export declare class SochainProvider implements UtxoOnlineDataProvider {
|
|
|
15
15
|
broadcastTx(txHex: string): Promise<TxHash>;
|
|
16
16
|
getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
|
|
17
17
|
getUnspentTxs(address: string): Promise<UTXO[]>;
|
|
18
|
-
getBalance(address: Address,
|
|
18
|
+
getBalance(address: Address, confirmedOnly?: boolean): Promise<Balance[]>;
|
|
19
19
|
/**
|
|
20
20
|
* Get transaction history of a given address with pagination options.
|
|
21
21
|
* By default it will return the transaction history of the current wallet.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Balance as BaseBalance, FeeRates, Network, Tx as BaseTx, TxFrom as BaseTxFrom, TxHash, TxHistoryParams, TxTo as BaseTxTo, TxsPage as BaseTxsPage } from '@xchainjs/xchain-client';
|
|
3
|
+
import { Address, Asset } from '@xchainjs/xchain-util';
|
|
4
|
+
export type Witness = {
|
|
5
|
+
value: number;
|
|
6
|
+
script: Buffer;
|
|
7
|
+
};
|
|
8
|
+
export type UTXO = {
|
|
9
|
+
hash: string;
|
|
10
|
+
index: number;
|
|
11
|
+
value: number;
|
|
12
|
+
witnessUtxo?: Witness;
|
|
13
|
+
txHex?: string;
|
|
14
|
+
scriptPubKey?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Type definition for UTXO balance.
|
|
18
|
+
*/
|
|
19
|
+
export type Balance = BaseBalance & {
|
|
20
|
+
asset: Asset;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Type definition for the sender of a UTXO transaction.
|
|
24
|
+
*/
|
|
25
|
+
export type TxFrom = BaseTxFrom & {
|
|
26
|
+
asset?: Asset;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Type definition for the recipient of a UTXO transaction.
|
|
30
|
+
*/
|
|
31
|
+
export type TxTo = BaseTxTo & {
|
|
32
|
+
asset?: Asset;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Type definition for a UTXO transaction.
|
|
36
|
+
*/
|
|
37
|
+
export type Tx = BaseTx & {
|
|
38
|
+
asset: Asset;
|
|
39
|
+
from: TxFrom[];
|
|
40
|
+
to: TxTo[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Type definition for a page of UTXO transactions.
|
|
44
|
+
*/
|
|
45
|
+
export type TxsPage = BaseTxsPage & {
|
|
46
|
+
txs: Tx[];
|
|
47
|
+
};
|
|
48
|
+
export interface UtxoOnlineDataProvider {
|
|
49
|
+
/**
|
|
50
|
+
* Get the balance for a given address.
|
|
51
|
+
* @param {Address} address The address to get the balance for.
|
|
52
|
+
* @param {Asset[]} assets (Optional) An array of assets to get the balance for.
|
|
53
|
+
* @returns {Promise<Balance[]>} A promise that resolves to an array of balances.
|
|
54
|
+
*/
|
|
55
|
+
getBalance(address: Address, confirmedOnly?: boolean): Promise<Balance[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Get transactions based on provided parameters.
|
|
58
|
+
* @param {TxHistoryParams} params The parameters for fetching transactions.
|
|
59
|
+
* @returns {Promise<TxsPage>} A promise that resolves to a page of transactions.
|
|
60
|
+
*/
|
|
61
|
+
getTransactions(params: TxHistoryParams): Promise<TxsPage>;
|
|
62
|
+
/**
|
|
63
|
+
* Get transaction data based on its ID.
|
|
64
|
+
* @param {string} txId The ID of the transaction.
|
|
65
|
+
* @param {Address} assetAddress (Optional) The address of the asset.
|
|
66
|
+
* @returns {Promise<Tx>} A promise that resolves to the transaction data.
|
|
67
|
+
*/
|
|
68
|
+
getTransactionData(txId: string, assetAddress?: Address): Promise<Tx>;
|
|
69
|
+
/**
|
|
70
|
+
* Get the fee rates.
|
|
71
|
+
* @returns {Promise<FeeRates>} A promise that resolves to the fee rates.
|
|
72
|
+
*/
|
|
73
|
+
getFeeRates(): Promise<FeeRates>;
|
|
74
|
+
/**
|
|
75
|
+
* Get confirmed unspent transaction outputs
|
|
76
|
+
* @param {Address} address Address of which return the confirmed unspent transaction outputs
|
|
77
|
+
* @returns {Promise<UTXO[]>} List of the confirmed unspent transaction outputs the address has
|
|
78
|
+
*/
|
|
79
|
+
getConfirmedUnspentTxs(address: Address): Promise<UTXO[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Get unspent transaction outputs
|
|
82
|
+
* @param {Address} address Address of which return the unspent transaction outputs
|
|
83
|
+
* @returns {Promise<UTXO[]>} List of the unspent transaction outputs the address has
|
|
84
|
+
*/
|
|
85
|
+
getUnspentTxs(address: Address): Promise<UTXO[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Broadcast a signed raw transaction
|
|
88
|
+
* @param {string} txHex Signed raw transaction
|
|
89
|
+
* @returns {Promise<UTXO[]>} Hash of the transaction broadcasted
|
|
90
|
+
*/
|
|
91
|
+
broadcastTx(txHex: string): Promise<TxHash>;
|
|
92
|
+
}
|
|
93
|
+
export type UtxoOnlineDataProviders = Record<Network, UtxoOnlineDataProvider | undefined>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-utxo-providers",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@supercharge/promise-pool": "2.4.0",
|
|
32
|
-
"@xchainjs/xchain-client": "0.
|
|
33
|
-
"@xchainjs/xchain-util": "0.
|
|
32
|
+
"@xchainjs/xchain-client": "1.0.0",
|
|
33
|
+
"@xchainjs/xchain-util": "1.0.0",
|
|
34
34
|
"axios": "1.3.6"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Network, OnlineDataProvider, TxHash } from '@xchainjs/xchain-client';
|
|
3
|
-
import { Address } from '@xchainjs/xchain-util';
|
|
4
|
-
export type Witness = {
|
|
5
|
-
value: number;
|
|
6
|
-
script: Buffer;
|
|
7
|
-
};
|
|
8
|
-
export type UTXO = {
|
|
9
|
-
hash: string;
|
|
10
|
-
index: number;
|
|
11
|
-
value: number;
|
|
12
|
-
witnessUtxo?: Witness;
|
|
13
|
-
txHex?: string;
|
|
14
|
-
scriptPubKey?: string;
|
|
15
|
-
};
|
|
16
|
-
export interface UtxoOnlineDataProvider extends OnlineDataProvider {
|
|
17
|
-
getConfirmedUnspentTxs(address: Address): Promise<UTXO[]>;
|
|
18
|
-
getUnspentTxs(address: Address): Promise<UTXO[]>;
|
|
19
|
-
broadcastTx(txHex: string): Promise<TxHash>;
|
|
20
|
-
}
|
|
21
|
-
export type UtxoOnlineDataProviders = Record<Network, UtxoOnlineDataProvider | undefined>;
|