@bigmi/core 0.4.2 → 0.4.4

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 (100) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +354 -23
  3. package/dist/cjs/errors/request.d.ts +2 -1
  4. package/dist/cjs/errors/request.js +2 -2
  5. package/dist/cjs/errors/request.js.map +1 -1
  6. package/dist/cjs/errors/rpc.d.ts +2 -1
  7. package/dist/cjs/errors/rpc.js +1 -0
  8. package/dist/cjs/errors/rpc.js.map +1 -1
  9. package/dist/cjs/transports/ankr/getBalance.js +2 -1
  10. package/dist/cjs/transports/ankr/getBalance.js.map +1 -1
  11. package/dist/cjs/transports/blockchair/getBalance.js +7 -2
  12. package/dist/cjs/transports/blockchair/getBalance.js.map +1 -1
  13. package/dist/cjs/transports/blockchair/getTransactionFee.js +7 -2
  14. package/dist/cjs/transports/blockchair/getTransactionFee.js.map +1 -1
  15. package/dist/cjs/transports/blockchair/getUTXOs.js +4 -1
  16. package/dist/cjs/transports/blockchair/getUTXOs.js.map +1 -1
  17. package/dist/cjs/transports/blockcypher/getBalance.js +5 -1
  18. package/dist/cjs/transports/blockcypher/getBalance.js.map +1 -1
  19. package/dist/cjs/transports/blockcypher/getTransactionFee.js +2 -1
  20. package/dist/cjs/transports/blockcypher/getTransactionFee.js.map +1 -1
  21. package/dist/cjs/transports/blockcypher/getUTXOs.js +2 -1
  22. package/dist/cjs/transports/blockcypher/getUTXOs.js.map +1 -1
  23. package/dist/cjs/transports/blockcypher/utils.d.ts +2 -0
  24. package/dist/cjs/transports/blockcypher/utils.js +11 -0
  25. package/dist/cjs/transports/blockcypher/utils.js.map +1 -0
  26. package/dist/cjs/transports/getHttpRpcClient.js +5 -1
  27. package/dist/cjs/transports/getHttpRpcClient.js.map +1 -1
  28. package/dist/cjs/types/actions.d.ts +4 -4
  29. package/dist/cjs/utils/buildRequest.js +1 -1
  30. package/dist/cjs/utils/buildRequest.js.map +1 -1
  31. package/dist/cjs/version.d.ts +1 -1
  32. package/dist/cjs/version.js +1 -1
  33. package/dist/esm/errors/request.d.ts +2 -1
  34. package/dist/esm/errors/request.js +2 -2
  35. package/dist/esm/errors/request.js.map +1 -1
  36. package/dist/esm/errors/rpc.d.ts +5 -1
  37. package/dist/esm/errors/rpc.js +4 -0
  38. package/dist/esm/errors/rpc.js.map +1 -1
  39. package/dist/esm/transports/ankr/getBalance.js +2 -1
  40. package/dist/esm/transports/ankr/getBalance.js.map +1 -1
  41. package/dist/esm/transports/blockchair/getBalance.js +7 -2
  42. package/dist/esm/transports/blockchair/getBalance.js.map +1 -1
  43. package/dist/esm/transports/blockchair/getTransactionFee.js +7 -2
  44. package/dist/esm/transports/blockchair/getTransactionFee.js.map +1 -1
  45. package/dist/esm/transports/blockchair/getUTXOs.js +4 -1
  46. package/dist/esm/transports/blockchair/getUTXOs.js.map +1 -1
  47. package/dist/esm/transports/blockcypher/getBalance.js +5 -1
  48. package/dist/esm/transports/blockcypher/getBalance.js.map +1 -1
  49. package/dist/esm/transports/blockcypher/getTransactionFee.js +2 -1
  50. package/dist/esm/transports/blockcypher/getTransactionFee.js.map +1 -1
  51. package/dist/esm/transports/blockcypher/getUTXOs.js +2 -1
  52. package/dist/esm/transports/blockcypher/getUTXOs.js.map +1 -1
  53. package/dist/esm/transports/blockcypher/utils.d.ts +2 -0
  54. package/dist/esm/transports/blockcypher/utils.js +8 -0
  55. package/dist/esm/transports/blockcypher/utils.js.map +1 -0
  56. package/dist/esm/transports/getHttpRpcClient.js +5 -1
  57. package/dist/esm/transports/getHttpRpcClient.js.map +1 -1
  58. package/dist/esm/types/actions.d.ts +4 -4
  59. package/dist/esm/utils/buildRequest.js +1 -1
  60. package/dist/esm/utils/buildRequest.js.map +1 -1
  61. package/dist/esm/version.d.ts +1 -1
  62. package/dist/esm/version.js +1 -1
  63. package/dist/types/errors/request.d.ts +2 -1
  64. package/dist/types/errors/request.d.ts.map +1 -1
  65. package/dist/types/errors/rpc.d.ts +5 -1
  66. package/dist/types/errors/rpc.d.ts.map +1 -1
  67. package/dist/types/transports/ankr/getBalance.d.ts.map +1 -1
  68. package/dist/types/transports/blockchair/getBalance.d.ts.map +1 -1
  69. package/dist/types/transports/blockchair/getTransactionFee.d.ts.map +1 -1
  70. package/dist/types/transports/blockchair/getUTXOs.d.ts.map +1 -1
  71. package/dist/types/transports/blockcypher/getBalance.d.ts.map +1 -1
  72. package/dist/types/transports/blockcypher/getTransactionFee.d.ts.map +1 -1
  73. package/dist/types/transports/blockcypher/getUTXOs.d.ts.map +1 -1
  74. package/dist/types/transports/blockcypher/utils.d.ts +3 -0
  75. package/dist/types/transports/blockcypher/utils.d.ts.map +1 -0
  76. package/dist/types/transports/getHttpRpcClient.d.ts.map +1 -1
  77. package/dist/types/types/actions.d.ts +4 -4
  78. package/dist/types/types/actions.d.ts.map +1 -1
  79. package/dist/types/version.d.ts +1 -1
  80. package/package.json +2 -2
  81. package/package.json.tmp +4 -4
  82. package/src/errors/request.ts +3 -1
  83. package/src/errors/rpc.ts +4 -0
  84. package/src/transports/ankr/ankr.spec.ts +10 -10
  85. package/src/transports/ankr/getBalance.ts +2 -1
  86. package/src/transports/blockchair/blockchair.spec.ts +97 -72
  87. package/src/transports/blockchair/getBalance.ts +10 -2
  88. package/src/transports/blockchair/getTransactionFee.ts +10 -2
  89. package/src/transports/blockchair/getUTXOs.ts +5 -1
  90. package/src/transports/blockcypher/blockcyper.spec.ts +1 -1
  91. package/src/transports/blockcypher/getBalance.ts +5 -1
  92. package/src/transports/blockcypher/getTransactionFee.ts +2 -1
  93. package/src/transports/blockcypher/getUTXOs.ts +2 -1
  94. package/src/transports/blockcypher/utils.ts +8 -0
  95. package/src/transports/fallback.spec.ts +10 -10
  96. package/src/transports/getHttpRpcClient.ts +5 -1
  97. package/src/transports/mempool/mempool.spec.ts +11 -11
  98. package/src/types/actions.ts +4 -5
  99. package/src/utils/buildRequest.ts +1 -1
  100. package/src/version.ts +1 -1
@@ -98,7 +98,11 @@ export function getHttpRpcClient(
98
98
  return response
99
99
  },
100
100
  {
101
- errorInstance: new TimeoutError({ body: body ?? {}, url }),
101
+ errorInstance: new TimeoutError({
102
+ body: body ?? {},
103
+ url: params.url ?? url,
104
+ timeout,
105
+ }),
102
106
  timeout,
103
107
  signal: true,
104
108
  }
@@ -1,28 +1,28 @@
1
1
  import { beforeEach, describe, expect, it, vi } from 'vitest'
2
- import { getBalance } from '../../actions/getBalance'
3
- import { getTransactionFee } from '../../actions/getTransactionFee'
4
- import { getTransactions } from '../../actions/getTransactions'
5
- import { bitcoin } from '../../chains/bitcoin'
6
- import { BaseError } from '../../errors/base'
7
- import { createClient, rpcSchema } from '../../factories/createClient'
8
- import { createMockResponse } from '../../test/utils'
2
+ import { getBalance } from '../../actions/getBalance.js'
3
+ import { getTransactionFee } from '../../actions/getTransactionFee.js'
4
+ import { getTransactions } from '../../actions/getTransactions.js'
5
+ import { bitcoin } from '../../chains/bitcoin.js'
6
+ import { BaseError } from '../../errors/base.js'
7
+ import { createClient, rpcSchema } from '../../factories/createClient.js'
8
+ import { createMockResponse } from '../../test/utils.js'
9
9
  import {
10
10
  INVALID_TX_ID,
11
11
  TX_FEE,
12
12
  VALID_TX_ID,
13
- } from '../__mocks__/getTransactionFee'
14
- import type { UTXOSchema } from '../types'
13
+ } from '../__mocks__/getTransactionFee.js'
14
+ import type { UTXOSchema } from '../types.js'
15
15
  import getBalanceInValidResponse from './__mocks__/getBalance/invalid.json'
16
16
  import getBalanceValidResponse from './__mocks__/getBalance/valid.json'
17
17
  import getTransactionFeeInvalidResponse from './__mocks__/getTransactionFee/invalid.json'
18
18
  import getTransactionFeeValidResponse from './__mocks__/getTransactionFee/valid.json'
19
19
  import getTransactionsValidResponse from './__mocks__/getTransactions/valid.json'
20
- import { mempool } from './mempool'
20
+ import { mempool } from './mempool.js'
21
21
  import type {
22
22
  MempoolBalanceResponse,
23
23
  MempoolErrorResponse,
24
24
  MempoolUTXOTransactionsResponse,
25
- } from './mempool.types'
25
+ } from './mempool.types.js'
26
26
 
27
27
  const address = import.meta.env.VITE_TEST_ADDRESS
28
28
 
@@ -1,14 +1,13 @@
1
1
  import type {
2
2
  SendUTXOTransactionParameters,
3
3
  SendUTXOTransactionReturnType,
4
- } from '../actions/sendUTXOTransaction'
5
-
6
- import type { WaitForTransactionReceiptParameters } from '../actions/waitForTransaction'
4
+ } from '../actions/sendUTXOTransaction.js'
5
+ import type { WaitForTransactionReceiptParameters } from '../actions/waitForTransaction.js'
7
6
  import type {
8
7
  SignPsbtParameters,
9
8
  SignPsbtReturnType,
10
- } from '../transports/types'
11
- import type { UTXOTransaction } from './transaction'
9
+ } from '../transports/types.js'
10
+ import type { UTXOTransaction } from './transaction.js'
12
11
 
13
12
  export type WaitForTransactionReceiptReturnType = UTXOTransaction
14
13
 
@@ -79,7 +79,7 @@ export function buildRequest<request extends BtcRpcRequestFn<RpcSchema>>(
79
79
  if (error && error instanceof HttpRequestError) {
80
80
  const retryAfter = error?.headers?.get('Retry-After')
81
81
  if (retryAfter?.match(/\d/)) {
82
- return Number.parseInt(retryAfter) * 1000
82
+ return Number.parseInt(retryAfter, 10) * 1000
83
83
  }
84
84
  }
85
85
 
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@bigmi/core'
2
- export const version = '0.4.2'
2
+ export const version = '0.4.4'