@bigmi/core 0.4.0-beta.1 → 0.4.2

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/clients/decorators/public.d.ts +2 -2
  3. package/dist/cjs/clients/decorators/public.js +1 -1
  4. package/dist/cjs/clients/decorators/public.js.map +1 -1
  5. package/dist/cjs/factories/createClient.d.ts +2 -2
  6. package/dist/cjs/factories/createClient.js.map +1 -1
  7. package/dist/cjs/index.d.ts +42 -43
  8. package/dist/cjs/index.js +75 -75
  9. package/dist/cjs/index.js.map +1 -1
  10. package/dist/cjs/transports/ankr/ankr.js +1 -0
  11. package/dist/cjs/transports/ankr/ankr.js.map +1 -1
  12. package/dist/cjs/transports/blockchair/blockchair.js +1 -0
  13. package/dist/cjs/transports/blockchair/blockchair.js.map +1 -1
  14. package/dist/cjs/transports/blockcypher/blockcypher.js +1 -0
  15. package/dist/cjs/transports/blockcypher/blockcypher.js.map +1 -1
  16. package/dist/cjs/transports/blockcypher/getUTXOs.js +1 -1
  17. package/dist/cjs/transports/blockcypher/getUTXOs.js.map +1 -1
  18. package/dist/cjs/transports/mempool/mempool.js +1 -0
  19. package/dist/cjs/transports/mempool/mempool.js.map +1 -1
  20. package/dist/cjs/utils/deepEqual.js +1 -1
  21. package/dist/cjs/utils/deepEqual.js.map +1 -1
  22. package/dist/cjs/utils/getAction.d.ts +2 -2
  23. package/dist/cjs/utils/getAction.js.map +1 -1
  24. package/dist/cjs/utils/poll.js +1 -1
  25. package/dist/cjs/utils/poll.js.map +1 -1
  26. package/dist/cjs/utils/withTimeout.js.map +1 -1
  27. package/dist/cjs/version.d.ts +1 -1
  28. package/dist/cjs/version.js +1 -1
  29. package/dist/cjs/version.js.map +1 -1
  30. package/dist/esm/actions/waitForTransaction.js +1 -1
  31. package/dist/esm/actions/waitForTransaction.js.map +1 -1
  32. package/dist/esm/clients/decorators/public.d.ts +2 -2
  33. package/dist/esm/clients/decorators/public.js +1 -1
  34. package/dist/esm/clients/decorators/public.js.map +1 -1
  35. package/dist/esm/factories/createClient.d.ts +2 -2
  36. package/dist/esm/factories/createClient.js.map +1 -1
  37. package/dist/esm/index.d.ts +42 -43
  38. package/dist/esm/index.js +29 -29
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/transports/ankr/ankr.js +1 -0
  41. package/dist/esm/transports/ankr/ankr.js.map +1 -1
  42. package/dist/esm/transports/blockchair/blockchair.js +1 -0
  43. package/dist/esm/transports/blockchair/blockchair.js.map +1 -1
  44. package/dist/esm/transports/blockcypher/blockcypher.js +1 -0
  45. package/dist/esm/transports/blockcypher/blockcypher.js.map +1 -1
  46. package/dist/esm/transports/blockcypher/getUTXOs.js +1 -1
  47. package/dist/esm/transports/blockcypher/getUTXOs.js.map +1 -1
  48. package/dist/esm/transports/http.js.map +1 -1
  49. package/dist/esm/transports/mempool/mempool.js +1 -0
  50. package/dist/esm/transports/mempool/mempool.js.map +1 -1
  51. package/dist/esm/utils/cancelTransaction.js +1 -1
  52. package/dist/esm/utils/cancelTransaction.js.map +1 -1
  53. package/dist/esm/utils/deepEqual.js +2 -2
  54. package/dist/esm/utils/deepEqual.js.map +1 -1
  55. package/dist/esm/utils/getAction.d.ts +2 -2
  56. package/dist/esm/utils/getAction.js.map +1 -1
  57. package/dist/esm/utils/getAddressInfo.js.map +1 -1
  58. package/dist/esm/utils/modifyFee.js +1 -1
  59. package/dist/esm/utils/modifyFee.js.map +1 -1
  60. package/dist/esm/utils/poll.js +1 -1
  61. package/dist/esm/utils/poll.js.map +1 -1
  62. package/dist/esm/utils/withTimeout.js.map +1 -1
  63. package/dist/esm/version.d.ts +1 -1
  64. package/dist/esm/version.js +1 -1
  65. package/dist/esm/version.js.map +1 -1
  66. package/dist/types/actions/waitForTransaction.d.ts.map +1 -1
  67. package/dist/types/clients/decorators/public.d.ts +2 -2
  68. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  69. package/dist/types/factories/createClient.d.ts +2 -2
  70. package/dist/types/factories/createClient.d.ts.map +1 -1
  71. package/dist/types/index.d.ts +42 -43
  72. package/dist/types/index.d.ts.map +1 -1
  73. package/dist/types/transports/ankr/ankr.d.ts.map +1 -1
  74. package/dist/types/transports/blockchair/blockchair.d.ts.map +1 -1
  75. package/dist/types/transports/blockcypher/blockcypher.d.ts.map +1 -1
  76. package/dist/types/transports/fallback.d.ts.map +1 -1
  77. package/dist/types/transports/http.d.ts.map +1 -1
  78. package/dist/types/transports/mempool/mempool.d.ts.map +1 -1
  79. package/dist/types/utils/cancelTransaction.d.ts.map +1 -1
  80. package/dist/types/utils/getAction.d.ts +2 -2
  81. package/dist/types/utils/getAction.d.ts.map +1 -1
  82. package/dist/types/utils/modifyFee.d.ts.map +1 -1
  83. package/dist/types/utils/withTimeout.d.ts.map +1 -1
  84. package/dist/types/version.d.ts +1 -1
  85. package/dist/types/version.d.ts.map +1 -1
  86. package/package.json +2 -2
  87. package/package.json.tmp +7 -3
  88. package/src/actions/waitForTransaction.ts +1 -1
  89. package/src/clients/decorators/public.ts +6 -7
  90. package/src/factories/createClient.ts +2 -4
  91. package/src/index.ts +103 -114
  92. package/src/transports/ankr/ankr.ts +2 -1
  93. package/src/transports/blockchair/blockchair.ts +1 -1
  94. package/src/transports/blockcypher/blockcypher.ts +1 -0
  95. package/src/transports/blockcypher/getUTXOs.ts +1 -1
  96. package/src/transports/custom.ts +1 -1
  97. package/src/transports/fallback.ts +3 -3
  98. package/src/transports/http.ts +1 -1
  99. package/src/transports/mempool/mempool.spec.ts +3 -4
  100. package/src/transports/mempool/mempool.ts +1 -0
  101. package/src/utils/cancelTransaction.ts +1 -1
  102. package/src/utils/deepEqual.ts +2 -2
  103. package/src/utils/getAction.ts +2 -3
  104. package/src/utils/getAddressInfo.ts +1 -1
  105. package/src/utils/modifyFee.ts +1 -1
  106. package/src/utils/poll.ts +1 -1
  107. package/src/utils/withTimeout.ts +3 -1
  108. package/src/version.ts +1 -1
package/src/index.ts CHANGED
@@ -1,34 +1,43 @@
1
1
  // Exporting actions
2
2
  export { getBalance } from './actions/getBalance.js'
3
- export { getBlock } from './actions/getBlock.js'
4
3
  export type {
5
4
  GetBlockParameters,
6
5
  GetBlockReturnType,
7
6
  } from './actions/getBlock.js'
8
- export { getBlockCount } from './actions/getBlockCount.js'
7
+ export { getBlock } from './actions/getBlock.js'
9
8
  export type { GetBlockCountReturnType } from './actions/getBlockCount.js'
10
- export { getBlockStats } from './actions/getBlockStats.js'
9
+ export { getBlockCount } from './actions/getBlockCount.js'
11
10
  export type {
12
11
  GetBlockStatsParameters,
13
12
  GetBlockStatsReturnType,
14
13
  } from './actions/getBlockStats.js'
15
- export { getTransactionFee } from './actions/getTransactionFee.js'
14
+ export { getBlockStats } from './actions/getBlockStats.js'
16
15
  export type {
17
16
  GetTransactionFeeParameters,
18
17
  GetTransactionFeeReturnType,
19
18
  } from './actions/getTransactionFee.js'
20
- export { getUTXOTransaction } from './actions/getUTXOTransaction.js'
19
+ export { getTransactionFee } from './actions/getTransactionFee.js'
20
+ export type {
21
+ GetTransactionsParameters,
22
+ GetTransactionsReturnType,
23
+ } from './actions/getTransactions.js'
24
+ export { getTransactions } from './actions/getTransactions.js'
25
+ export type {
26
+ GetUTXOsParameters,
27
+ GetUTXOsReturnType,
28
+ } from './actions/getUTXOs.js'
29
+ export { getUTXOs } from './actions/getUTXOs.js'
21
30
  export type {
22
31
  GetUTXOTransactionParameters,
23
32
  GetUTXOTransactionReturnType,
24
33
  } from './actions/getUTXOTransaction.js'
25
- export { sendUTXOTransaction } from './actions/sendUTXOTransaction.js'
34
+ export { getUTXOTransaction } from './actions/getUTXOTransaction.js'
26
35
  export type {
27
36
  SendUTXOTransactionParameters,
28
37
  SendUTXOTransactionReturnType,
29
38
  } from './actions/sendUTXOTransaction.js'
39
+ export { sendUTXOTransaction } from './actions/sendUTXOTransaction.js'
30
40
  export { signPsbt } from './actions/signPsbt.js'
31
- export { waitForTransaction } from './actions/waitForTransaction.js'
32
41
  export type {
33
42
  ReplacementReason,
34
43
  ReplacementReturnType,
@@ -36,24 +45,17 @@ export type {
36
45
  WaitForTransactionReceiptReturnType,
37
46
  WithRetryParameters,
38
47
  } from './actions/waitForTransaction.js'
39
- export { watchBlockNumber } from './actions/watchBlockNumber.js'
48
+ export { waitForTransaction } from './actions/waitForTransaction.js'
40
49
  export type {
41
50
  OnBlockNumberFn,
42
51
  OnBlockNumberParameter,
43
52
  WatchBlockNumberParameters,
44
53
  WatchBlockNumberReturnType,
45
54
  } from './actions/watchBlockNumber.js'
46
- export { getUTXOs } from './actions/getUTXOs.js'
47
- export type {
48
- GetUTXOsParameters,
49
- GetUTXOsReturnType,
50
- } from './actions/getUTXOs.js'
51
- export { getTransactions } from './actions/getTransactions.js'
52
- export type {
53
- GetTransactionsParameters,
54
- GetTransactionsReturnType,
55
- } from './actions/getTransactions.js'
56
-
55
+ export { watchBlockNumber } from './actions/watchBlockNumber.js'
56
+ // Exporting chains
57
+ export { bitcoin } from './chains/bitcoin.js'
58
+ export { defineChain } from './chains/defineChain.js'
57
59
  // Exporting clients
58
60
  export {
59
61
  type PublicActions,
@@ -63,37 +65,96 @@ export {
63
65
  type WalletActions,
64
66
  walletActions,
65
67
  } from './clients/decorators/wallet.js'
66
-
68
+ // Exporting errors
69
+ export {
70
+ InvalidAddressError,
71
+ type InvalidAddressErrorType,
72
+ } from './errors/address.js'
73
+ export { BaseError, type BaseErrorType } from './errors/base.js'
74
+ export { BlockNotFoundError } from './errors/block.js'
75
+ export {
76
+ ChainNotConfiguredError,
77
+ ConnectorAccountNotFoundError,
78
+ ConnectorAlreadyConnectedError,
79
+ ConnectorChainMismatchError,
80
+ ConnectorNotConnectedError,
81
+ ConnectorNotFoundError,
82
+ } from './errors/config.js'
83
+ export { ProviderNotFoundError } from './errors/provider.js'
84
+ export {
85
+ HttpRequestError,
86
+ RpcRequestError,
87
+ SocketClosedError,
88
+ TimeoutError,
89
+ } from './errors/request.js'
90
+ export {
91
+ MethodNotSupportedRpcError,
92
+ ParseError,
93
+ RpcErrorCode,
94
+ UserRejectedRequestError,
95
+ } from './errors/rpc.js'
96
+ export {
97
+ TransactionNotFoundError,
98
+ TransactionReceiptNotFoundError,
99
+ WaitForTransactionReceiptTimeoutError,
100
+ } from './errors/transaction.js'
101
+ export type {
102
+ AllTransportsFailedErrorType,
103
+ TransportMethodNotSupportedErrorType,
104
+ UrlRequiredErrorType,
105
+ } from './errors/transport.js'
106
+ export {
107
+ AllTransportsFailedError,
108
+ UrlRequiredError,
109
+ } from './errors/transport.js'
110
+ export type { ErrorType } from './errors/utils.js'
111
+ export {
112
+ InsufficientUTXOBalanceError,
113
+ type InsufficientUTXOBalanceErrorType,
114
+ } from './errors/utxo.js'
115
+ // Exporting factories
116
+ export { createClient, rpcSchema } from './factories/createClient.js'
117
+ export { ankr } from './transports/ankr/ankr.js'
67
118
  // Exporting transports
68
119
  export { ankrMethods } from './transports/ankr/methods.js'
120
+ export { blockchair } from './transports/blockchair/blockchair.js'
69
121
  export { blockchairMethods } from './transports/blockchair/methods.js'
122
+ export { blockcypher } from './transports/blockcypher/blockcypher.js'
70
123
  export { blockcypherMethods } from './transports/blockcypher/methods.js'
71
- export { getHttpRpcClient } from './transports/getHttpRpcClient.js'
124
+ export { custom } from './transports/custom.js'
125
+ export {
126
+ type FallbackTransport,
127
+ type FallbackTransportConfig,
128
+ type FallbackTransportErrorType,
129
+ fallback,
130
+ } from './transports/fallback.js'
72
131
  export type {
73
132
  HttpRequestParameters,
74
133
  HttpRpcClient,
75
134
  RpcRequest,
76
135
  } from './transports/getHttpRpcClient.js'
136
+ export { getHttpRpcClient } from './transports/getHttpRpcClient.js'
77
137
  export { getRpcProviderMethods } from './transports/getRpcProviderMethods.js'
138
+ export {
139
+ type HttpTransport,
140
+ type HttpTransportConfig,
141
+ type HttpTransportErrorType,
142
+ http,
143
+ } from './transports/http.js'
144
+ export { mempool } from './transports/mempool/mempool.js'
78
145
  export { mempoolMethods } from './transports/mempool/methods.js'
79
146
  export type {
80
147
  ErrorResult,
81
148
  RpcMethodHandler,
82
149
  RpcMethods,
83
150
  RpcResponse,
151
+ SignPsbtParameters,
152
+ SignPsbtReturnType,
84
153
  SuccessResult,
85
154
  UTXOSchema,
86
155
  UTXOWalletSchema,
87
- SignPsbtParameters,
88
- SignPsbtReturnType,
89
156
  } from './transports/types.js'
90
157
  export { utxo } from './transports/utxo.js'
91
- export { custom } from './transports/custom.js'
92
- export { ankr } from './transports/ankr/ankr.js'
93
- export { blockchair } from './transports/blockchair/blockchair.js'
94
- export { blockcypher } from './transports/blockcypher/blockcypher.js'
95
- export { mempool } from './transports/mempool/mempool.js'
96
-
97
158
  // Exporting types
98
159
  export type { Account } from './types/account.js'
99
160
  export {
@@ -129,6 +190,7 @@ export type {
129
190
  WalletRpcSchema,
130
191
  } from './types/rpc.js'
131
192
  export type { UTXOTransaction } from './types/transaction.js'
193
+ export type { Transport } from './types/transport.js'
132
194
  export type {
133
195
  Assign,
134
196
  Compute,
@@ -137,100 +199,27 @@ export type {
137
199
  IsNever,
138
200
  IsUnknown,
139
201
  LooseOmit,
202
+ OneOf,
203
+ RemoveUndefined,
140
204
  UnionStrictOmit,
141
205
  } from './types/utils.js'
142
-
143
206
  // Exporting utils
144
207
  export { cancelTransaction } from './utils/cancelTransaction.js'
145
-
146
- export { getAddressInfo } from './utils/getAddressInfo.js'
147
- export { isAddress as isUTXOAddress } from './utils/isAddress.js'
148
- export { modifyFee } from './utils/modifyFee.js'
149
- export { cleanupCache, listenersCache, observe } from './utils/observe.js'
150
- export { poll } from './utils/poll.js'
151
208
  export {
152
209
  base64ToHex,
153
- hexToBase64,
154
210
  base64urlEncode,
155
- stringToHex,
211
+ hexToBase64,
156
212
  hexToUnit8Array,
213
+ stringToHex,
157
214
  } from './utils/converter.js'
158
- export { withRetry } from './utils/withRetry.js'
159
- export { parseAccount } from './utils/parseAccount.js'
160
215
  export { deepEqual } from './utils/deepEqual.js'
161
- export { withTimeout } from './utils/withTimeout.js'
162
-
163
- // Exporting factories
164
- export { createClient, rpcSchema } from './factories/createClient.js'
165
-
166
- // Exporting chains
167
- export { bitcoin } from './chains/bitcoin.js'
168
- export { defineChain } from './chains/defineChain.js'
169
-
170
- // Exporting errors
171
- export {
172
- InvalidAddressError,
173
- type InvalidAddressErrorType,
174
- } from './errors/address.js'
175
- export { BaseError, type BaseErrorType } from './errors/base.js'
176
- export { BlockNotFoundError } from './errors/block.js'
177
- export {
178
- ChainNotConfiguredError,
179
- ConnectorAccountNotFoundError,
180
- ConnectorAlreadyConnectedError,
181
- ConnectorChainMismatchError,
182
- ConnectorNotConnectedError,
183
- ConnectorNotFoundError,
184
- } from './errors/config.js'
185
- export { ProviderNotFoundError } from './errors/provider.js'
186
- export {
187
- HttpRequestError,
188
- RpcRequestError,
189
- SocketClosedError,
190
- TimeoutError,
191
- } from './errors/request.js'
192
- export {
193
- MethodNotSupportedRpcError,
194
- ParseError,
195
- RpcErrorCode,
196
- UserRejectedRequestError,
197
- } from './errors/rpc.js'
198
- export {
199
- TransactionNotFoundError,
200
- TransactionReceiptNotFoundError,
201
- WaitForTransactionReceiptTimeoutError,
202
- } from './errors/transaction.js'
203
- export {
204
- InsufficientUTXOBalanceError,
205
- type InsufficientUTXOBalanceErrorType,
206
- } from './errors/utxo.js'
207
- export {
208
- UrlRequiredError,
209
- AllTransportsFailedError,
210
- } from './errors/transport.js'
211
- export type {
212
- UrlRequiredErrorType,
213
- AllTransportsFailedErrorType,
214
- TransportMethodNotSupportedErrorType,
215
- } from './errors/transport.js'
216
- export type { ErrorType } from './errors/utils.js'
217
-
218
- export {
219
- http,
220
- type HttpTransport,
221
- type HttpTransportConfig,
222
- type HttpTransportErrorType,
223
- } from './transports/http.js'
224
-
225
- export {
226
- fallback,
227
- type FallbackTransport,
228
- type FallbackTransportConfig,
229
- type FallbackTransportErrorType,
230
- } from './transports/fallback.js'
231
-
232
- export type { Transport } from './types/transport.js'
233
-
234
- export type { OneOf, RemoveUndefined } from './types/utils.js'
216
+ export { getAddressInfo } from './utils/getAddressInfo.js'
217
+ export { isAddress as isUTXOAddress } from './utils/isAddress.js'
218
+ export { modifyFee } from './utils/modifyFee.js'
219
+ export { cleanupCache, listenersCache, observe } from './utils/observe.js'
220
+ export { parseAccount } from './utils/parseAccount.js'
221
+ export { poll } from './utils/poll.js'
235
222
  export { uid } from './utils/uid.js'
223
+ export { withRetry } from './utils/withRetry.js'
224
+ export { withTimeout } from './utils/withTimeout.js'
236
225
  export { version } from './version.js'
@@ -1,6 +1,6 @@
1
1
  import type { TransportConfig } from '../../types/transport.js'
2
2
  import type { HttpTransportConfig } from '../http.js'
3
- import type { UTXOAPISchema, UTXOMethod } from '../types.js'
3
+ import type { UTXOMethod } from '../types.js'
4
4
  import { utxo } from '../utxo.js'
5
5
  import { ankrMethods } from './methods.js'
6
6
 
@@ -20,6 +20,7 @@ export const ankr = (config?: AnkrConfig) => {
20
20
  return utxo(
21
21
  `https://rpc.ankr.com/premium-http/btc_blockbook/${config.apiKey}/api/v2`,
22
22
  {
23
+ name: 'Ankr API',
23
24
  key: 'ankr',
24
25
  methods,
25
26
  ...config,
@@ -1,4 +1,3 @@
1
- import type { TransportConfig } from '../../types/transport.js'
2
1
  import type { HttpTransportConfig } from '../http.js'
3
2
  import type { UTXOMethod } from '../types.js'
4
3
  import { utxo } from '../utxo.js'
@@ -11,6 +10,7 @@ type BlockchairConfig = {
11
10
 
12
11
  export const blockchair = (config?: BlockchairConfig) =>
13
12
  utxo(config?.baseUrl || 'https://api.blockchair.com', {
13
+ name: 'Blockchair API',
14
14
  key: 'blockchair',
15
15
  includeChainToURL: true,
16
16
  methods: {
@@ -10,6 +10,7 @@ type BlockcypherConfig = {
10
10
 
11
11
  export const blockcypher = (config?: BlockcypherConfig) =>
12
12
  utxo(config?.baseUrl || 'https://api.blockcypher.com/v1/btc/main', {
13
+ name: 'Blockcypher API',
13
14
  key: 'blockcypher',
14
15
  methods: {
15
16
  include: Object.keys(blockcypherMethods) as UTXOMethod[],
@@ -27,7 +27,7 @@ export const getUTXOs: RpcMethodHandler<'getUTXOs'> = async (
27
27
  ) => {
28
28
  async function* fetchUTXOs() {
29
29
  let hasMore = true
30
- let beforeBlock = undefined
30
+ let beforeBlock: number | undefined
31
31
 
32
32
  while (hasMore) {
33
33
  const apiUrl = urlWithParams(`${baseUrl}/addrs/${address}`, {
@@ -23,7 +23,7 @@ export type CustomTransportConfig = {
23
23
 
24
24
  export type CustomTransport = Transport<
25
25
  'custom',
26
- // biome-ignore lint/complexity/noBannedTypes: <explanation>
26
+ // biome-ignore lint/complexity/noBannedTypes: part of the types
27
27
  {},
28
28
  BitcoinProvider['request']
29
29
  >
@@ -43,9 +43,9 @@ type RankOptions = {
43
43
  /**
44
44
  * Ping method to determine latency.
45
45
  */
46
- ping?: (parameters: { transport: ReturnType<Transport> }) =>
47
- | Promise<unknown>
48
- | undefined
46
+ ping?: (parameters: {
47
+ transport: ReturnType<Transport>
48
+ }) => Promise<unknown> | undefined
49
49
  /**
50
50
  * The number of previous samples to perform ranking on.
51
51
  * @default 10
@@ -13,9 +13,9 @@ import type {
13
13
  } from '../types/transport.js'
14
14
  import { createBatchScheduler } from '../utils/createBatchScheduler.js'
15
15
  import {
16
+ getHttpRpcClient,
16
17
  type HttpRpcClientOptions,
17
18
  type RpcRequest,
18
- getHttpRpcClient,
19
19
  } from './getHttpRpcClient.js'
20
20
  import { UTXOAPISchemaMethods } from './types.js'
21
21
 
@@ -1,18 +1,17 @@
1
1
  import { beforeEach, describe, expect, it, vi } from 'vitest'
2
2
  import { getBalance } from '../../actions/getBalance'
3
+ import { getTransactionFee } from '../../actions/getTransactionFee'
3
4
  import { getTransactions } from '../../actions/getTransactions'
4
5
  import { bitcoin } from '../../chains/bitcoin'
6
+ import { BaseError } from '../../errors/base'
5
7
  import { createClient, rpcSchema } from '../../factories/createClient'
6
8
  import { createMockResponse } from '../../test/utils'
7
- import type { UTXOSchema } from '../types'
8
-
9
- import { getTransactionFee } from '../../actions/getTransactionFee'
10
- import { BaseError } from '../../errors/base'
11
9
  import {
12
10
  INVALID_TX_ID,
13
11
  TX_FEE,
14
12
  VALID_TX_ID,
15
13
  } from '../__mocks__/getTransactionFee'
14
+ import type { UTXOSchema } from '../types'
16
15
  import getBalanceInValidResponse from './__mocks__/getBalance/invalid.json'
17
16
  import getBalanceValidResponse from './__mocks__/getBalance/valid.json'
18
17
  import getTransactionFeeInvalidResponse from './__mocks__/getTransactionFee/invalid.json'
@@ -9,6 +9,7 @@ type MempoolConfig = {
9
9
 
10
10
  export const mempool = (config?: MempoolConfig) =>
11
11
  utxo(config?.baseUrl || 'https://mempool.space/api', {
12
+ name: 'Mempool.space API',
12
13
  key: 'mempool',
13
14
  methods: {
14
15
  include: Object.keys(mempoolMethods) as UTXOMethod[],
@@ -1,4 +1,4 @@
1
- import { Psbt, address } from 'bitcoinjs-lib'
1
+ import { address, Psbt } from 'bitcoinjs-lib'
2
2
 
3
3
  interface InputData {
4
4
  hash: Uint8Array
@@ -40,7 +40,7 @@ export function deepEqual(a: any, b: any) {
40
40
  }
41
41
 
42
42
  for (i = length; i-- !== 0; ) {
43
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]!)) {
43
+ if (!Object.hasOwn(b, keys[i]!)) {
44
44
  return false
45
45
  }
46
46
  }
@@ -57,6 +57,6 @@ export function deepEqual(a: any, b: any) {
57
57
  }
58
58
 
59
59
  // true if both NaN, false otherwise
60
- // biome-ignore lint/suspicious/noSelfCompare: <explanation>
60
+ // biome-ignore lint/suspicious/noSelfCompare: allowed in utils
61
61
  return a !== a && b !== b
62
62
  }
@@ -1,11 +1,10 @@
1
1
  import type { PublicActions } from '../clients/decorators/public.js'
2
2
  import type { WalletActions } from '../clients/decorators/wallet.js'
3
3
  import type { UTXOSchema } from '../transports/types.js'
4
- import type { Client } from '../types/client.js'
5
- import type { Transport } from '../types/transport.js'
6
-
7
4
  import type { Account } from '../types/account.js'
8
5
  import type { Chain } from '../types/chain.js'
6
+ import type { Client } from '../types/client.js'
7
+ import type { Transport } from '../types/transport.js'
9
8
 
10
9
  /**
11
10
  * Retrieves and returns an action from the client (if exists), and falls
@@ -1,5 +1,5 @@
1
1
  import { sha256 } from '@noble/hashes/sha256'
2
- import { type Decoded, bech32, bech32m } from 'bech32'
2
+ import { bech32, bech32m, type Decoded } from 'bech32'
3
3
  import bs58 from 'bs58'
4
4
 
5
5
  import {
@@ -1,4 +1,4 @@
1
- import { Psbt, address } from 'bitcoinjs-lib'
1
+ import { address, Psbt } from 'bitcoinjs-lib'
2
2
 
3
3
  interface InputData {
4
4
  hash: Uint8Array
package/src/utils/poll.ts CHANGED
@@ -23,7 +23,7 @@ export function poll<T>(
23
23
  }
24
24
 
25
25
  const watch = async () => {
26
- let data: T | undefined = undefined
26
+ let data: T | undefined
27
27
  if (emitOnBegin) {
28
28
  data = await fn({ unpoll: unwatch })
29
29
  }
@@ -5,7 +5,9 @@ export type WithTimeoutErrorType = ErrorType
5
5
  export function withTimeout<data>(
6
6
  fn: ({
7
7
  signal,
8
- }: { signal: AbortController['signal'] | null }) => Promise<data>,
8
+ }: {
9
+ signal: AbortController['signal'] | null
10
+ }) => Promise<data>,
9
11
  {
10
12
  errorInstance = new Error('timed out'),
11
13
  timeout,
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@bigmi/core'
2
- export const version = '0.4.0-beta.1'
2
+ export const version = '0.4.2'