@xchainjs/xchain-utxo-providers 2.0.17 → 2.1.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.
@@ -0,0 +1,38 @@
1
+ import { TxHash } from '@xchainjs/xchain-client';
2
+ import { BaseAmount } from '@xchainjs/xchain-util';
3
+ import { AddressUTXO, BalanceParams, Transaction, TxHashParams } from './blockbook-api-types';
4
+ export declare const getTx: ({ apiKey, baseUrl, hash }: TxHashParams) => Promise<Transaction>;
5
+ export declare const getTxs: ({ apiKey, address, baseUrl, limit, }: {
6
+ apiKey?: string;
7
+ address: string;
8
+ baseUrl: string;
9
+ limit: number;
10
+ }) => Promise<{
11
+ transactions: Transaction[];
12
+ total: number;
13
+ }>;
14
+ export declare const getUTXOs: ({ apiKey, address, baseUrl, isConfirmed, }: {
15
+ apiKey?: string;
16
+ address: string;
17
+ baseUrl: string;
18
+ isConfirmed?: boolean;
19
+ }) => Promise<AddressUTXO[]>;
20
+ export declare const getBalance: ({ apiKey, baseUrl, address, confirmedOnly, assetDecimals, }: BalanceParams) => Promise<BaseAmount>;
21
+ export declare const broadcastTx: ({ apiKey, baseUrl, txHex, }: {
22
+ apiKey?: string;
23
+ baseUrl: string;
24
+ txHex: string;
25
+ }) => Promise<TxHash>;
26
+ /**
27
+ * Fetches fee estimate using Blockbook's V2 REST endpoint.
28
+ *
29
+ * Docs: https://github.com/trezor/blockbook/blob/master/docs/api.md
30
+ *
31
+ * @param numberOfBlocks Target block confirmation count
32
+ * @returns Estimated fee rate in sat/byte
33
+ */
34
+ export declare const getFeeEstimate: ({ apiKey, baseUrl, numberOfBlocks, }: {
35
+ apiKey?: string;
36
+ baseUrl: string;
37
+ numberOfBlocks: number;
38
+ }) => Promise<number>;
@@ -0,0 +1,29 @@
1
+ import { FeeOption, FeeRates, TxHash, TxHistoryParams } from '@xchainjs/xchain-client';
2
+ import { Address, Asset } from '@xchainjs/xchain-util';
3
+ import { Balance, Tx, TxsPage, UTXO, UtxoOnlineDataProvider } from '../../types';
4
+ export declare class BlockbookProvider implements UtxoOnlineDataProvider {
5
+ private baseUrl;
6
+ private _apiKey?;
7
+ private asset;
8
+ private assetDecimals;
9
+ private readonly normalizeAddressForApi?;
10
+ constructor(baseUrl: string, asset: Asset, assetDecimals: number, options?: {
11
+ apiKey?: string;
12
+ normalizeAddressForApi?: (address: string) => string;
13
+ });
14
+ private toApiAddress;
15
+ get apiKey(): string | undefined;
16
+ set apiKey(value: string | undefined);
17
+ broadcastTx(txHex: string): Promise<TxHash>;
18
+ getConfirmedUnspentTxs(address: string): Promise<UTXO[]>;
19
+ getUnspentTxs(address: string): Promise<UTXO[]>;
20
+ getBalance(address: Address, confirmedOnly?: boolean): Promise<Balance[]>;
21
+ getTransactions(params?: TxHistoryParams): Promise<TxsPage>;
22
+ getTransactionData(txId: string): Promise<Tx>;
23
+ private static readonly BLOCK_TARGETS;
24
+ getFeeRate(feeOption: FeeOption): Promise<number>;
25
+ getFeeRates(): Promise<FeeRates>;
26
+ private mapTransactionToTx;
27
+ private mapUTXOs;
28
+ private getRawTransactions;
29
+ }
@@ -9,3 +9,4 @@ export * from './blockcypher/blockcypher-data-provider';
9
9
  export { BlockcypherNetwork } from './blockcypher/blockcypher-api-types';
10
10
  export { BitgoProvider } from './bitgo/bitgo-data-provider';
11
11
  export { NownodesProvider } from './nownodes/nownodes-data-provider';
12
+ export { BlockbookProvider } from './blockbook/blockbook-data-provider';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-utxo-providers",
3
- "version": "2.0.17",
3
+ "version": "2.1.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@supercharge/promise-pool": "2.4.0",
32
- "@xchainjs/xchain-client": "2.0.15",
32
+ "@xchainjs/xchain-client": "2.0.16",
33
33
  "@xchainjs/xchain-util": "2.0.7",
34
34
  "axios": "1.16.1"
35
35
  },