@pioneer-platform/blockbook 8.3.17 → 8.4.1

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/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # @pioneer-platform/blockbook
2
+
3
+ ## 8.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Automated patch version bump for all packages
8
+ - Updated dependencies
9
+ - @pioneer-platform/loggerdog@8.4.1
10
+ - @pioneer-platform/nodes@8.4.1
11
+ - @pioneer-platform/pioneer-caip@9.3.1
12
+
13
+ ## 8.4.0
14
+
15
+ ### Minor Changes
16
+
17
+ - Release: minor version bump for all packages
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+ - @pioneer-platform/loggerdog@8.4.0
23
+ - @pioneer-platform/nodes@8.4.0
24
+ - @pioneer-platform/pioneer-caip@9.3.0
package/lib/index.d.ts CHANGED
@@ -1,186 +1,46 @@
1
- /**
2
- * Blockbook Client Integration Module
3
- *
4
- * Provides a unified interface for interacting with Blockbook blockchain explorers
5
- * across multiple cryptocurrency networks. Handles pagination, retries, and fallbacks.
6
- *
7
- * @module blockbook-client
8
- */
1
+ declare const TAG = " | blockbook-client | ";
9
2
  declare const Blockbook: any;
10
3
  declare const log: any;
11
4
  declare const fakeUa: any;
5
+ declare const axiosLib: any;
12
6
  declare const Axios: any;
13
7
  declare const https: any;
14
8
  declare const nodes: any;
15
- declare const axiosRetry: any;
16
- declare const TAG = " | blockbook-client | ";
17
- declare const NOW_NODES_API: string | undefined;
18
9
  declare const axios: any;
19
- interface BlockbookToken {
20
- name: string;
21
- path?: string;
22
- balance?: string;
23
- transfers?: number;
24
- totalReceived?: string;
25
- totalSent?: string;
26
- }
27
- interface XpubResponse {
28
- page?: number;
29
- totalPages?: number;
30
- itemsOnPage?: number;
31
- address?: string;
32
- balance: string;
33
- totalReceived: string;
34
- totalSent: string;
35
- unconfirmedBalance: string;
36
- unconfirmedTxs: number;
37
- txs: number;
38
- addrTxCount?: number;
39
- txids?: string[];
40
- usedTokens?: number;
41
- tokens?: BlockbookToken[];
42
- transactions?: any[];
43
- }
44
- interface NextIndexes {
45
- nextReceiveAddressIndex: number;
46
- nextChangeAddressIndex: number;
47
- }
48
- interface BlockbookConfig {
49
- symbol: string;
50
- service: string;
51
- websocket?: string;
10
+ declare let NOW_NODES_API: string | undefined;
11
+ interface NodeConfig {
12
+ url: string;
13
+ priority: number;
14
+ avgResponseTime: number;
15
+ successRate: number;
16
+ lastChecked: number;
17
+ isActive: boolean;
18
+ consecutiveFailures: number;
19
+ totalRequests: number;
20
+ successfulRequests: number;
52
21
  }
53
- interface FeeEstimate {
54
- fast?: number;
55
- average?: number;
56
- slow?: number;
57
- blockTime?: number;
58
- blockHeight?: number;
22
+ interface CoinNodes {
23
+ [symbol: string]: NodeConfig[];
59
24
  }
60
- declare let BLOCKBOOK_URLS: Record<string, string>;
61
- declare let BLOCKBOOK_SOCKETS: Record<string, any>;
62
- declare const cache: Map<string, {
63
- data: any;
64
- timestamp: number;
65
- }>;
66
- declare const CACHE_TTL = 60000;
67
- /**
68
- * Get cached data if available and not expired
69
- */
70
- declare function getCached(key: string): any | null;
71
- /**
72
- * Store data in cache
73
- */
74
- declare function setCache(key: string, data: any): void;
75
- /**
76
- * Initialize the Blockbook network with seed nodes and custom servers
77
- * @param servers Optional array of custom Blockbook server configurations
78
- * @returns Promise<boolean> indicating successful initialization
79
- */
80
- declare function init_network(servers?: BlockbookConfig[]): Promise<boolean>;
81
- /**
82
- * Get fee estimates for a specific coin
83
- * @param coin Coin symbol (e.g., 'BTC', 'ETH')
84
- * @returns Promise<FeeEstimate> containing fee recommendations
85
- */
86
- declare function get_fees(coin: string): Promise<FeeEstimate>;
87
- /**
88
- * Fetch xpub info from Blockbook with tokens, handling pagination and fallbacks.
89
- * @param coin Uppercase/anycase coin key resolvable in BLOCKBOOK_URLS (e.g., 'BTC')
90
- * @param pubkey xpub/ypub/zpub/tpub/vpub
91
- * @param page Starting page number (default 1)
92
- * @param pageSize Items per page (default 1000)
93
- * @returns Promise<XpubResponse> with complete token information including changeIndex and receiveIndex
94
- */
95
- declare function get_info_by_pubkey(coin: string, pubkey: string, page?: number, pageSize?: number): Promise<XpubResponse & {
96
- changeIndex: number;
97
- receiveIndex: number;
98
- }>;
99
- /**
100
- * Compute next indexes from Blockbook tokens array.
101
- * Returns the next external (receive) and internal (change) indexes.
102
- *
103
- * Logic:
104
- * - Consider an address "used" if transfers > 0 OR balance !== '0'
105
- * - Next index = (max used index on that branch) + 1
106
- *
107
- * @param tokens Array of BlockbookToken objects with path information
108
- * @returns Object with nextReceiveAddressIndex and nextChangeAddressIndex
109
- */
110
- declare function computeNextIndexes(tokens: BlockbookToken[]): NextIndexes;
111
- /**
112
- * Convenience function: fetch tokens and return the next indexes directly.
113
- * @param coin Coin symbol
114
- * @param pubkey Extended public key
115
- * @param page Starting page
116
- * @param pageSize Items per page
117
- * @returns Promise<NextIndexes> with next receive and change indexes
118
- */
119
- declare function get_next_indexes_by_pubkey(coin: string, pubkey: string, page?: number, pageSize?: number): Promise<NextIndexes>;
120
- /**
121
- * Get transaction IDs for a specific address with pagination support
122
- * @param coin Coin symbol
123
- * @param address Blockchain address
124
- * @param page Page number (default 1)
125
- * @returns Promise with address info including transaction IDs
126
- */
127
- declare function get_txids_by_address(coin: string, address: string, page?: number): Promise<any>;
128
- /**
129
- * Get detailed information for a specific address
130
- * @param coin Coin symbol
131
- * @param address Blockchain address
132
- * @param filter Detail level filter (default 'all')
133
- * @returns Promise with complete address information
134
- */
135
- declare function get_info_by_address(coin: string, address: string, filter?: string): Promise<any>;
136
- /**
137
- * Get all transactions for an extended public key
138
- * @param coin Coin symbol
139
- * @param xpub Extended public key
140
- * @returns Promise with xpub info including all transactions
141
- */
142
- declare function get_txs_by_xpub(coin: string, xpub: string): Promise<XpubResponse>;
143
- /**
144
- * Broadcast a raw transaction to the network
145
- * @param coin Coin symbol
146
- * @param hex Raw transaction hex
147
- * @returns Promise with broadcast result including success status and txid or error
148
- */
149
- declare function broadcast_transaction(coin: string, hex: string): Promise<{
150
- success: boolean;
151
- txid?: string;
152
- error?: string;
153
- statusCode?: number;
154
- resp?: any;
155
- }>;
156
- /**
157
- * Get detailed information about a specific transaction
158
- * @param coin Coin symbol
159
- * @param txid Transaction ID
160
- * @returns Promise with transaction details
161
- */
162
- declare function get_transaction(coin: string, txid: string): Promise<any>;
163
- /**
164
- * Get UTXOs (Unspent Transaction Outputs) for an extended public key
165
- * @param coin Coin symbol
166
- * @param xpub Extended public key
167
- * @param confirmedOnly Whether to include only confirmed UTXOs (default false)
168
- * @returns Promise with array of UTXOs
169
- */
170
- declare function get_utxos_by_xpub(coin: string, xpub: string, confirmedOnly?: boolean): Promise<any[]>;
171
- /**
172
- * Get total balance for an extended public key in BTC (not satoshis)
173
- * @param coin Coin symbol
174
- * @param xpub Extended public key
175
- * @returns Promise with balance in BTC (not satoshis)
176
- */
177
- declare function get_balance_by_xpub(coin: string, xpub: string): Promise<number>;
178
- /**
179
- * Get information about the Blockbook nodes
180
- * @returns Promise with node status information
181
- */
182
- declare function get_node_info(): Promise<{
183
- initialized: boolean;
184
- availableNodes: string[];
185
- activeWebsockets: string[];
186
- }>;
25
+ declare let BLOCKBOOK_NODES: CoinNodes;
26
+ declare let BLOCKBOOK_SOCKETS: any;
27
+ declare let BLOCKBOOK_URLS: any;
28
+ declare let add_custom_node: (coin: string, url: string, priority?: number) => boolean;
29
+ declare let remove_node: (coin: string, url: string) => boolean;
30
+ declare let set_node_priority: (coin: string, url: string, priority: number) => boolean;
31
+ declare let get_node_stats: (coin?: string) => any;
32
+ declare let reorder_nodes_by_performance: (coin: string) => void;
33
+ declare let reorder_nodes_by_priority: (symbol: string) => void;
34
+ declare let update_legacy_urls: (symbol: string) => void;
35
+ declare let init_network: (servers?: any[]) => Promise<boolean>;
36
+ declare let get_fees: (coin: string) => Promise<any>;
37
+ declare let get_info_by_pubkey: (coin: string, pubkey: string, page?: string | undefined) => Promise<any>;
38
+ declare let get_txids_by_address: (coin: string, address: string, page?: number) => Promise<any>;
39
+ declare let get_info_by_address: (coin: string, address: string, filter?: string) => Promise<any>;
40
+ declare let get_txs_by_xpub: (coin: string, xpub: string) => Promise<any>;
41
+ declare let broadcast_transaction: (coin: string, hex: string) => Promise<any>;
42
+ declare let get_transaction: (coin: string, txid: string) => Promise<any>;
43
+ declare let get_utxos_by_xpub: (coin: string, xpub: string) => Promise<any>;
44
+ declare let update_node_performance: (coin: string, url: string, success: boolean, responseTime: number) => void;
45
+ declare let get_balance_by_xpub: (coin: string, xpub: any) => Promise<number>;
46
+ declare let get_node_info: () => Promise<boolean>;