@bigmi/core 0.4.0 → 0.4.3

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 (176) 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/errors/request.d.ts +2 -1
  6. package/dist/cjs/errors/request.js +2 -2
  7. package/dist/cjs/errors/request.js.map +1 -1
  8. package/dist/cjs/errors/rpc.d.ts +2 -1
  9. package/dist/cjs/errors/rpc.js +1 -0
  10. package/dist/cjs/errors/rpc.js.map +1 -1
  11. package/dist/cjs/factories/createClient.d.ts +2 -2
  12. package/dist/cjs/factories/createClient.js.map +1 -1
  13. package/dist/cjs/index.d.ts +42 -43
  14. package/dist/cjs/index.js +75 -75
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/transports/ankr/ankr.js +1 -0
  17. package/dist/cjs/transports/ankr/ankr.js.map +1 -1
  18. package/dist/cjs/transports/ankr/getBalance.js +2 -1
  19. package/dist/cjs/transports/ankr/getBalance.js.map +1 -1
  20. package/dist/cjs/transports/blockchair/blockchair.js +1 -0
  21. package/dist/cjs/transports/blockchair/blockchair.js.map +1 -1
  22. package/dist/cjs/transports/blockchair/getBalance.js +7 -2
  23. package/dist/cjs/transports/blockchair/getBalance.js.map +1 -1
  24. package/dist/cjs/transports/blockchair/getTransactionFee.js +7 -2
  25. package/dist/cjs/transports/blockchair/getTransactionFee.js.map +1 -1
  26. package/dist/cjs/transports/blockchair/getUTXOs.js +4 -1
  27. package/dist/cjs/transports/blockchair/getUTXOs.js.map +1 -1
  28. package/dist/cjs/transports/blockcypher/blockcypher.js +1 -0
  29. package/dist/cjs/transports/blockcypher/blockcypher.js.map +1 -1
  30. package/dist/cjs/transports/blockcypher/getBalance.js +5 -1
  31. package/dist/cjs/transports/blockcypher/getBalance.js.map +1 -1
  32. package/dist/cjs/transports/blockcypher/getTransactionFee.js +2 -1
  33. package/dist/cjs/transports/blockcypher/getTransactionFee.js.map +1 -1
  34. package/dist/cjs/transports/blockcypher/getUTXOs.js +3 -2
  35. package/dist/cjs/transports/blockcypher/getUTXOs.js.map +1 -1
  36. package/dist/cjs/transports/blockcypher/utils.d.ts +2 -0
  37. package/dist/cjs/transports/blockcypher/utils.js +11 -0
  38. package/dist/cjs/transports/blockcypher/utils.js.map +1 -0
  39. package/dist/cjs/transports/getHttpRpcClient.js +5 -1
  40. package/dist/cjs/transports/getHttpRpcClient.js.map +1 -1
  41. package/dist/cjs/transports/mempool/mempool.js +1 -0
  42. package/dist/cjs/transports/mempool/mempool.js.map +1 -1
  43. package/dist/cjs/utils/deepEqual.js +1 -1
  44. package/dist/cjs/utils/deepEqual.js.map +1 -1
  45. package/dist/cjs/utils/getAction.d.ts +2 -2
  46. package/dist/cjs/utils/getAction.js.map +1 -1
  47. package/dist/cjs/utils/poll.js +1 -1
  48. package/dist/cjs/utils/poll.js.map +1 -1
  49. package/dist/cjs/utils/withTimeout.js.map +1 -1
  50. package/dist/cjs/version.d.ts +1 -1
  51. package/dist/cjs/version.js +1 -1
  52. package/dist/esm/actions/waitForTransaction.js +1 -1
  53. package/dist/esm/actions/waitForTransaction.js.map +1 -1
  54. package/dist/esm/clients/decorators/public.d.ts +2 -2
  55. package/dist/esm/clients/decorators/public.js +1 -1
  56. package/dist/esm/clients/decorators/public.js.map +1 -1
  57. package/dist/esm/errors/request.d.ts +2 -1
  58. package/dist/esm/errors/request.js +2 -2
  59. package/dist/esm/errors/request.js.map +1 -1
  60. package/dist/esm/errors/rpc.d.ts +5 -1
  61. package/dist/esm/errors/rpc.js +4 -0
  62. package/dist/esm/errors/rpc.js.map +1 -1
  63. package/dist/esm/factories/createClient.d.ts +2 -2
  64. package/dist/esm/factories/createClient.js.map +1 -1
  65. package/dist/esm/index.d.ts +42 -43
  66. package/dist/esm/index.js +29 -29
  67. package/dist/esm/index.js.map +1 -1
  68. package/dist/esm/transports/ankr/ankr.js +1 -0
  69. package/dist/esm/transports/ankr/ankr.js.map +1 -1
  70. package/dist/esm/transports/ankr/getBalance.js +2 -1
  71. package/dist/esm/transports/ankr/getBalance.js.map +1 -1
  72. package/dist/esm/transports/blockchair/blockchair.js +1 -0
  73. package/dist/esm/transports/blockchair/blockchair.js.map +1 -1
  74. package/dist/esm/transports/blockchair/getBalance.js +7 -2
  75. package/dist/esm/transports/blockchair/getBalance.js.map +1 -1
  76. package/dist/esm/transports/blockchair/getTransactionFee.js +7 -2
  77. package/dist/esm/transports/blockchair/getTransactionFee.js.map +1 -1
  78. package/dist/esm/transports/blockchair/getUTXOs.js +4 -1
  79. package/dist/esm/transports/blockchair/getUTXOs.js.map +1 -1
  80. package/dist/esm/transports/blockcypher/blockcypher.js +1 -0
  81. package/dist/esm/transports/blockcypher/blockcypher.js.map +1 -1
  82. package/dist/esm/transports/blockcypher/getBalance.js +5 -1
  83. package/dist/esm/transports/blockcypher/getBalance.js.map +1 -1
  84. package/dist/esm/transports/blockcypher/getTransactionFee.js +2 -1
  85. package/dist/esm/transports/blockcypher/getTransactionFee.js.map +1 -1
  86. package/dist/esm/transports/blockcypher/getUTXOs.js +3 -2
  87. package/dist/esm/transports/blockcypher/getUTXOs.js.map +1 -1
  88. package/dist/esm/transports/blockcypher/utils.d.ts +2 -0
  89. package/dist/esm/transports/blockcypher/utils.js +8 -0
  90. package/dist/esm/transports/blockcypher/utils.js.map +1 -0
  91. package/dist/esm/transports/getHttpRpcClient.js +5 -1
  92. package/dist/esm/transports/getHttpRpcClient.js.map +1 -1
  93. package/dist/esm/transports/http.js.map +1 -1
  94. package/dist/esm/transports/mempool/mempool.js +1 -0
  95. package/dist/esm/transports/mempool/mempool.js.map +1 -1
  96. package/dist/esm/utils/cancelTransaction.js +1 -1
  97. package/dist/esm/utils/cancelTransaction.js.map +1 -1
  98. package/dist/esm/utils/deepEqual.js +2 -2
  99. package/dist/esm/utils/deepEqual.js.map +1 -1
  100. package/dist/esm/utils/getAction.d.ts +2 -2
  101. package/dist/esm/utils/getAction.js.map +1 -1
  102. package/dist/esm/utils/getAddressInfo.js.map +1 -1
  103. package/dist/esm/utils/modifyFee.js +1 -1
  104. package/dist/esm/utils/modifyFee.js.map +1 -1
  105. package/dist/esm/utils/poll.js +1 -1
  106. package/dist/esm/utils/poll.js.map +1 -1
  107. package/dist/esm/utils/withTimeout.js.map +1 -1
  108. package/dist/esm/version.d.ts +1 -1
  109. package/dist/esm/version.js +1 -1
  110. package/dist/types/actions/waitForTransaction.d.ts.map +1 -1
  111. package/dist/types/clients/decorators/public.d.ts +2 -2
  112. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  113. package/dist/types/errors/request.d.ts +2 -1
  114. package/dist/types/errors/request.d.ts.map +1 -1
  115. package/dist/types/errors/rpc.d.ts +5 -1
  116. package/dist/types/errors/rpc.d.ts.map +1 -1
  117. package/dist/types/factories/createClient.d.ts +2 -2
  118. package/dist/types/factories/createClient.d.ts.map +1 -1
  119. package/dist/types/index.d.ts +42 -43
  120. package/dist/types/index.d.ts.map +1 -1
  121. package/dist/types/transports/ankr/ankr.d.ts.map +1 -1
  122. package/dist/types/transports/ankr/getBalance.d.ts.map +1 -1
  123. package/dist/types/transports/blockchair/blockchair.d.ts.map +1 -1
  124. package/dist/types/transports/blockchair/getBalance.d.ts.map +1 -1
  125. package/dist/types/transports/blockchair/getTransactionFee.d.ts.map +1 -1
  126. package/dist/types/transports/blockchair/getUTXOs.d.ts.map +1 -1
  127. package/dist/types/transports/blockcypher/blockcypher.d.ts.map +1 -1
  128. package/dist/types/transports/blockcypher/getBalance.d.ts.map +1 -1
  129. package/dist/types/transports/blockcypher/getTransactionFee.d.ts.map +1 -1
  130. package/dist/types/transports/blockcypher/getUTXOs.d.ts.map +1 -1
  131. package/dist/types/transports/blockcypher/utils.d.ts +3 -0
  132. package/dist/types/transports/blockcypher/utils.d.ts.map +1 -0
  133. package/dist/types/transports/fallback.d.ts.map +1 -1
  134. package/dist/types/transports/getHttpRpcClient.d.ts.map +1 -1
  135. package/dist/types/transports/http.d.ts.map +1 -1
  136. package/dist/types/transports/mempool/mempool.d.ts.map +1 -1
  137. package/dist/types/utils/cancelTransaction.d.ts.map +1 -1
  138. package/dist/types/utils/getAction.d.ts +2 -2
  139. package/dist/types/utils/getAction.d.ts.map +1 -1
  140. package/dist/types/utils/modifyFee.d.ts.map +1 -1
  141. package/dist/types/utils/withTimeout.d.ts.map +1 -1
  142. package/dist/types/version.d.ts +1 -1
  143. package/package.json +2 -2
  144. package/package.json.tmp +7 -3
  145. package/src/actions/waitForTransaction.ts +1 -1
  146. package/src/clients/decorators/public.ts +6 -7
  147. package/src/errors/request.ts +3 -1
  148. package/src/errors/rpc.ts +4 -0
  149. package/src/factories/createClient.ts +2 -4
  150. package/src/index.ts +103 -114
  151. package/src/transports/ankr/ankr.ts +2 -1
  152. package/src/transports/ankr/getBalance.ts +2 -1
  153. package/src/transports/blockchair/blockchair.spec.ts +85 -61
  154. package/src/transports/blockchair/blockchair.ts +1 -1
  155. package/src/transports/blockchair/getBalance.ts +10 -2
  156. package/src/transports/blockchair/getTransactionFee.ts +10 -2
  157. package/src/transports/blockchair/getUTXOs.ts +5 -1
  158. package/src/transports/blockcypher/blockcypher.ts +1 -0
  159. package/src/transports/blockcypher/getBalance.ts +5 -1
  160. package/src/transports/blockcypher/getTransactionFee.ts +2 -1
  161. package/src/transports/blockcypher/getUTXOs.ts +3 -2
  162. package/src/transports/blockcypher/utils.ts +8 -0
  163. package/src/transports/custom.ts +1 -1
  164. package/src/transports/fallback.ts +3 -3
  165. package/src/transports/getHttpRpcClient.ts +5 -1
  166. package/src/transports/http.ts +1 -1
  167. package/src/transports/mempool/mempool.spec.ts +3 -4
  168. package/src/transports/mempool/mempool.ts +1 -0
  169. package/src/utils/cancelTransaction.ts +1 -1
  170. package/src/utils/deepEqual.ts +2 -2
  171. package/src/utils/getAction.ts +2 -3
  172. package/src/utils/getAddressInfo.ts +1 -1
  173. package/src/utils/modifyFee.ts +1 -1
  174. package/src/utils/poll.ts +1 -1
  175. package/src/utils/withTimeout.ts +3 -1
  176. package/src/version.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"withTimeout.d.ts","sourceRoot":"","sources":["../../../src/utils/withTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAA;AAE5C,wBAAgB,WAAW,CAAC,IAAI,EAC9B,EAAE,EAAE,CAAC,EACH,MAAM,GACP,EAAE;IAAE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,EACjE,EACE,aAAsC,EACtC,OAAO,EACP,MAAM,GACP,EAAE;IAED,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;IAEjC,OAAO,EAAE,MAAM,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B,GACA,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
1
+ {"version":3,"file":"withTimeout.d.ts","sourceRoot":"","sources":["../../../src/utils/withTimeout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAA;AAE5C,wBAAgB,WAAW,CAAC,IAAI,EAC9B,EAAE,EAAE,CAAC,EACH,MAAM,GACP,EAAE;IACD,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;CACzC,KAAK,OAAO,CAAC,IAAI,CAAC,EACnB,EACE,aAAsC,EACtC,OAAO,EACP,MAAM,GACP,EAAE;IAED,aAAa,CAAC,EAAE,KAAK,GAAG,SAAS,CAAA;IAEjC,OAAO,EAAE,MAAM,CAAA;IAEf,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B,GACA,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@bigmi/core";
2
- export declare const version = "0.4.0";
2
+ export declare const version = "0.4.3";
3
3
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigmi/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "TypeScript library for Bitcoin apps.",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/index.js",
@@ -32,7 +32,7 @@
32
32
  "bitcoinjs-lib": "^7.0.0-rc.0",
33
33
  "bs58": "^6.0.0",
34
34
  "eventemitter3": "^5.0.1",
35
- "zustand": "^5.0.6"
35
+ "zustand": "^5.0.7"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "bs58": "^6.0.0"
package/package.json.tmp CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigmi/core",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "TypeScript library for Bitcoin apps.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -50,7 +50,7 @@
50
50
  "bitcoinjs-lib": "^7.0.0-rc.0",
51
51
  "bs58": "^6.0.0",
52
52
  "eventemitter3": "^5.0.1",
53
- "zustand": "^5.0.6"
53
+ "zustand": "^5.0.7"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vitest/coverage-v8": "^3.2.4",
@@ -62,5 +62,9 @@
62
62
  "peerDependencies": {
63
63
  "bs58": "^6.0.0"
64
64
  },
65
- "files": ["dist/**", "src/**", "!tsconfig.json"]
65
+ "files": [
66
+ "dist/**",
67
+ "src/**",
68
+ "!tsconfig.json"
69
+ ]
66
70
  }
@@ -1,4 +1,4 @@
1
- import { Transaction, address } from 'bitcoinjs-lib'
1
+ import { address, Transaction } from 'bitcoinjs-lib'
2
2
  import {
3
3
  TransactionNotFoundError,
4
4
  TransactionReceiptNotFoundError,
@@ -27,23 +27,22 @@ import {
27
27
  type GetTransactionsReturnType,
28
28
  getTransactions,
29
29
  } from '../../actions/getTransactions.js'
30
- import {
31
- type GetUTXOTransactionParameters,
32
- type GetUTXOTransactionReturnType,
33
- getUTXOTransaction,
34
- } from '../../actions/getUTXOTransaction.js'
35
30
  import {
36
31
  type GetUTXOsParameters,
37
32
  type GetUTXOsReturnType,
38
33
  getUTXOs,
39
34
  } from '../../actions/getUTXOs.js'
35
+ import {
36
+ type GetUTXOTransactionParameters,
37
+ type GetUTXOTransactionReturnType,
38
+ getUTXOTransaction,
39
+ } from '../../actions/getUTXOTransaction.js'
40
40
 
41
41
  import type { Client } from '../../factories/createClient.js'
42
42
  import type { UTXOSchema } from '../../transports/types.js'
43
43
  import type { Account } from '../../types/account.js'
44
- import type { Transport } from '../../types/transport.js'
45
-
46
44
  import type { Chain } from '../../types/chain.js'
45
+ import type { Transport } from '../../types/transport.js'
47
46
 
48
47
  export type PublicActions = {
49
48
  getBalance: (args: GetBalanceParameters) => Promise<GetBalanceReturnType>
@@ -121,12 +121,14 @@ export class TimeoutError extends BaseError {
121
121
  constructor({
122
122
  body,
123
123
  url,
124
+ timeout,
124
125
  }: {
125
126
  body: { [x: string]: unknown } | { [y: string]: unknown }[]
126
127
  url: string
128
+ timeout: number
127
129
  }) {
128
130
  super('The request took too long to respond.', {
129
- details: 'The request timed out.',
131
+ details: `The request timed out after ${timeout}ms.`,
130
132
  metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`],
131
133
  name: 'TimeoutError',
132
134
  })
package/src/errors/rpc.ts CHANGED
@@ -39,6 +39,10 @@ export enum RpcErrorCode {
39
39
  * The client does not have permission to access the requested resource.
40
40
  */
41
41
  ACCESS_DENIED = -32002,
42
+ /**
43
+ * Unknown generic errors
44
+ */
45
+ MISC_ERROR = -1,
42
46
  }
43
47
 
44
48
  export class UserRejectedRequestError extends BaseError {
@@ -1,12 +1,10 @@
1
- import type { Address } from '../types/address.js'
2
-
3
1
  import type { ErrorType } from '../errors/utils.js'
4
2
  import type { Account } from '../types/account.js'
3
+ import type { Address } from '../types/address.js'
5
4
  import type { Chain } from '../types/chain.js'
6
- import type { Transport } from '../types/transport.js'
7
-
8
5
  import type { BtcRpcRequestFn, RpcSchema } from '../types/request.js'
9
6
  import type { BitcoinRpcMethods } from '../types/rpc.js'
7
+ import type { Transport } from '../types/transport.js'
10
8
  import type { Prettify } from '../types/utils.js'
11
9
 
12
10
  import { parseAccount } from '../utils/parseAccount.js'
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,3 +1,4 @@
1
+ import { RpcErrorCode } from '../../errors/rpc.js'
1
2
  import type { RpcMethodHandler } from '../types.js'
2
3
  import type { AnkrBalanceResponse } from './ankr.types.js'
3
4
 
@@ -16,7 +17,7 @@ export const getBalance: RpcMethodHandler<'getBalance'> = async (
16
17
  })) as unknown as AnkrBalanceResponse
17
18
  if (response.error) {
18
19
  return {
19
- error: { code: -1, message: response.error },
20
+ error: { code: RpcErrorCode.MISC_ERROR, message: response.error },
20
21
  }
21
22
  }
22
23
  return {