viem 2.6.1 → 2.7.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/actions/public/getTransaction.js.map +1 -1
  3. package/_cjs/actions/public/waitForTransactionReceipt.js +5 -5
  4. package/_cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  5. package/_cjs/errors/version.js +1 -1
  6. package/_cjs/index.js.map +1 -1
  7. package/_cjs/utils/formatters/block.js +4 -0
  8. package/_cjs/utils/formatters/block.js.map +1 -1
  9. package/_cjs/utils/formatters/transaction.js +9 -0
  10. package/_cjs/utils/formatters/transaction.js.map +1 -1
  11. package/_cjs/utils/formatters/transactionReceipt.js +6 -1
  12. package/_cjs/utils/formatters/transactionReceipt.js.map +1 -1
  13. package/_cjs/utils/formatters/transactionRequest.js +1 -0
  14. package/_cjs/utils/formatters/transactionRequest.js.map +1 -1
  15. package/_cjs/utils/promise/withRetry.js.map +1 -1
  16. package/_esm/actions/public/getTransaction.js.map +1 -1
  17. package/_esm/actions/public/waitForTransactionReceipt.js +7 -8
  18. package/_esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  19. package/_esm/errors/version.js +1 -1
  20. package/_esm/index.js.map +1 -1
  21. package/_esm/utils/formatters/block.js +4 -0
  22. package/_esm/utils/formatters/block.js.map +1 -1
  23. package/_esm/utils/formatters/transaction.js +9 -0
  24. package/_esm/utils/formatters/transaction.js.map +1 -1
  25. package/_esm/utils/formatters/transactionReceipt.js +6 -1
  26. package/_esm/utils/formatters/transactionReceipt.js.map +1 -1
  27. package/_esm/utils/formatters/transactionRequest.js +1 -0
  28. package/_esm/utils/formatters/transactionRequest.js.map +1 -1
  29. package/_esm/utils/promise/withRetry.js.map +1 -1
  30. package/_types/actions/public/getTransaction.d.ts +2 -1
  31. package/_types/actions/public/getTransaction.d.ts.map +1 -1
  32. package/_types/actions/public/waitForTransactionReceipt.d.ts +13 -1
  33. package/_types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  34. package/_types/chains/celo/chainConfig.d.ts +375 -65
  35. package/_types/chains/celo/chainConfig.d.ts.map +1 -1
  36. package/_types/chains/celo/formatters.d.ts +375 -65
  37. package/_types/chains/celo/formatters.d.ts.map +1 -1
  38. package/_types/chains/definitions/base.d.ts +279 -49
  39. package/_types/chains/definitions/base.d.ts.map +1 -1
  40. package/_types/chains/definitions/baseGoerli.d.ts +279 -49
  41. package/_types/chains/definitions/baseGoerli.d.ts.map +1 -1
  42. package/_types/chains/definitions/baseSepolia.d.ts +279 -49
  43. package/_types/chains/definitions/baseSepolia.d.ts.map +1 -1
  44. package/_types/chains/definitions/celo.d.ts +375 -65
  45. package/_types/chains/definitions/celo.d.ts.map +1 -1
  46. package/_types/chains/definitions/celoAlfajores.d.ts +375 -65
  47. package/_types/chains/definitions/celoAlfajores.d.ts.map +1 -1
  48. package/_types/chains/definitions/optimism.d.ts +279 -49
  49. package/_types/chains/definitions/optimism.d.ts.map +1 -1
  50. package/_types/chains/definitions/optimismGoerli.d.ts +279 -49
  51. package/_types/chains/definitions/optimismGoerli.d.ts.map +1 -1
  52. package/_types/chains/definitions/optimismSepolia.d.ts +279 -49
  53. package/_types/chains/definitions/optimismSepolia.d.ts.map +1 -1
  54. package/_types/chains/definitions/pgn.d.ts +279 -49
  55. package/_types/chains/definitions/pgn.d.ts.map +1 -1
  56. package/_types/chains/definitions/pgnTestnet.d.ts +279 -49
  57. package/_types/chains/definitions/pgnTestnet.d.ts.map +1 -1
  58. package/_types/chains/definitions/zkSync.d.ts +122 -6
  59. package/_types/chains/definitions/zkSync.d.ts.map +1 -1
  60. package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts +122 -6
  61. package/_types/chains/definitions/zkSyncSepoliaTestnet.d.ts.map +1 -1
  62. package/_types/chains/definitions/zkSyncTestnet.d.ts +122 -6
  63. package/_types/chains/definitions/zkSyncTestnet.d.ts.map +1 -1
  64. package/_types/chains/definitions/zora.d.ts +279 -49
  65. package/_types/chains/definitions/zora.d.ts.map +1 -1
  66. package/_types/chains/definitions/zoraSepolia.d.ts +279 -49
  67. package/_types/chains/definitions/zoraSepolia.d.ts.map +1 -1
  68. package/_types/chains/definitions/zoraTestnet.d.ts +279 -49
  69. package/_types/chains/definitions/zoraTestnet.d.ts.map +1 -1
  70. package/_types/chains/opStack/chainConfig.d.ts +279 -49
  71. package/_types/chains/opStack/chainConfig.d.ts.map +1 -1
  72. package/_types/chains/opStack/formatters.d.ts +279 -49
  73. package/_types/chains/opStack/formatters.d.ts.map +1 -1
  74. package/_types/chains/zksync/chainConfig.d.ts +122 -6
  75. package/_types/chains/zksync/chainConfig.d.ts.map +1 -1
  76. package/_types/chains/zksync/formatters.d.ts +122 -6
  77. package/_types/chains/zksync/formatters.d.ts.map +1 -1
  78. package/_types/errors/version.d.ts +1 -1
  79. package/_types/index.d.ts +2 -2
  80. package/_types/index.d.ts.map +1 -1
  81. package/_types/types/block.d.ts +4 -0
  82. package/_types/types/block.d.ts.map +1 -1
  83. package/_types/types/fee.d.ts +9 -3
  84. package/_types/types/fee.d.ts.map +1 -1
  85. package/_types/types/rpc.d.ts +2 -2
  86. package/_types/types/rpc.d.ts.map +1 -1
  87. package/_types/types/transaction.d.ts +20 -5
  88. package/_types/types/transaction.d.ts.map +1 -1
  89. package/_types/utils/formatters/block.d.ts.map +1 -1
  90. package/_types/utils/formatters/transaction.d.ts +387 -2
  91. package/_types/utils/formatters/transaction.d.ts.map +1 -1
  92. package/_types/utils/formatters/transactionReceipt.d.ts.map +1 -1
  93. package/_types/utils/formatters/transactionRequest.d.ts +2 -1
  94. package/_types/utils/formatters/transactionRequest.d.ts.map +1 -1
  95. package/_types/utils/promise/withRetry.d.ts +4 -3
  96. package/_types/utils/promise/withRetry.d.ts.map +1 -1
  97. package/actions/public/getTransaction.ts +2 -1
  98. package/actions/public/waitForTransactionReceipt.ts +20 -7
  99. package/errors/version.ts +1 -1
  100. package/index.ts +2 -0
  101. package/package.json +1 -1
  102. package/types/block.ts +4 -0
  103. package/types/fee.ts +14 -2
  104. package/types/rpc.ts +3 -1
  105. package/types/transaction.ts +37 -6
  106. package/utils/formatters/block.ts +4 -0
  107. package/utils/formatters/transaction.ts +9 -0
  108. package/utils/formatters/transactionReceipt.ts +8 -1
  109. package/utils/formatters/transactionRequest.ts +1 -0
  110. package/utils/promise/withRetry.ts +16 -14
@@ -12,7 +12,10 @@ import type { Hash } from '../../types/misc.js'
12
12
  import type { Transaction } from '../../types/transaction.js'
13
13
  import { getAction } from '../../utils/getAction.js'
14
14
  import { type ObserveErrorType, observe } from '../../utils/observe.js'
15
- import { withRetry } from '../../utils/promise/withRetry.js'
15
+ import {
16
+ type WithRetryParameters,
17
+ withRetry,
18
+ } from '../../utils/promise/withRetry.js'
16
19
  import { stringify } from '../../utils/stringify.js'
17
20
 
18
21
  import { type GetBlockErrorType, getBlock } from './getBlock.js'
@@ -62,6 +65,16 @@ export type WaitForTransactionReceiptParameters<
62
65
  * @default client.pollingInterval
63
66
  */
64
67
  pollingInterval?: number
68
+ /**
69
+ * Number of times to retry if the transaction or block is not found.
70
+ * @default 6 (exponential backoff)
71
+ */
72
+ retryCount?: WithRetryParameters['retryCount']
73
+ /**
74
+ * Time to wait (in ms) between retries.
75
+ * @default `({ count }) => ~~(1 << count) * 200` (exponential backoff)
76
+ */
77
+ retryDelay?: WithRetryParameters['delay']
65
78
  /** Optional timeout (in milliseconds) to wait before stopping polling. */
66
79
  timeout?: number
67
80
  }
@@ -121,6 +134,8 @@ export async function waitForTransactionReceipt<
121
134
  hash,
122
135
  onReplaced,
123
136
  pollingInterval = client.pollingInterval,
137
+ retryCount = 6,
138
+ retryDelay = ({ count }) => ~~(1 << count) * 200, // exponential backoff
124
139
  timeout,
125
140
  }: WaitForTransactionReceiptParameters<TChain>,
126
141
  ): Promise<WaitForTransactionReceiptReturnType<TChain>> {
@@ -193,9 +208,8 @@ export async function waitForTransactionReceipt<
193
208
  blockNumber = transaction.blockNumber
194
209
  },
195
210
  {
196
- // exponential backoff
197
- delay: ({ count }) => ~~(1 << count) * 200,
198
- retryCount: 6,
211
+ delay: retryDelay,
212
+ retryCount,
199
213
  },
200
214
  )
201
215
  retrying = false
@@ -247,9 +261,8 @@ export async function waitForTransactionReceipt<
247
261
  includeTransactions: true,
248
262
  }),
249
263
  {
250
- // exponential backoff
251
- delay: ({ count }) => ~~(1 << count) * 200,
252
- retryCount: 6,
264
+ delay: retryDelay,
265
+ retryCount,
253
266
  shouldRetry: ({ error }) =>
254
267
  error instanceof BlockNotFoundError,
255
268
  },
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.6.1'
1
+ export const version = '2.7.1'
package/index.ts CHANGED
@@ -872,6 +872,7 @@ export type {
872
872
  TransactionBase,
873
873
  TransactionEIP1559,
874
874
  TransactionEIP2930,
875
+ TransactionEIP4844,
875
876
  TransactionLegacy,
876
877
  TransactionReceipt,
877
878
  TransactionRequest,
@@ -942,6 +943,7 @@ export type {
942
943
  FeeHistory,
943
944
  FeeValues,
944
945
  FeeValuesEIP1559,
946
+ FeeValuesEIP4844,
945
947
  FeeValuesLegacy,
946
948
  FeeValuesType,
947
949
  } from './types/fee.js'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.6.1",
4
+ "version": "2.7.1",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",
package/types/block.ts CHANGED
@@ -16,8 +16,12 @@ export type Block<
16
16
  > = {
17
17
  /** Base fee per gas */
18
18
  baseFeePerGas: TQuantity | null
19
+ /** Total used blob gas by all transactions in this block */
20
+ blobGasUsed: TQuantity
19
21
  /** Difficulty for this block */
20
22
  difficulty: TQuantity
23
+ /** Excess blob gas */
24
+ excessBlobGas: TQuantity
21
25
  /** "Extra data" field of this block */
22
26
  extraData: Hex
23
27
  /** Maximum gas allowed in this block */
package/types/fee.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Assign } from './utils.js'
2
+
1
3
  export type FeeHistory<TQuantity = bigint> = {
2
4
  /**
3
5
  * An array of block base fees per gas (in wei). This includes the next block after
@@ -15,21 +17,31 @@ export type FeeHistory<TQuantity = bigint> = {
15
17
  export type FeeValuesLegacy<TQuantity = bigint> = {
16
18
  /** Base fee per gas. */
17
19
  gasPrice: TQuantity
20
+ maxFeePerBlobGas?: never
18
21
  maxFeePerGas?: never
19
22
  maxPriorityFeePerGas?: never
20
23
  }
21
24
 
22
25
  export type FeeValuesEIP1559<TQuantity = bigint> = {
23
- /** Base fee per gas. */
24
26
  gasPrice?: never
27
+ maxFeePerBlobGas?: never
25
28
  /** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
26
29
  maxFeePerGas: TQuantity
27
30
  /** Max priority fee per gas (in wei). */
28
31
  maxPriorityFeePerGas: TQuantity
29
32
  }
30
33
 
34
+ export type FeeValuesEIP4844<TQuantity = bigint> = Assign<
35
+ FeeValuesEIP1559<TQuantity>,
36
+ {
37
+ /** The maximum total fee per gas the sender is willing to pay for blob gas (in wei). */
38
+ maxFeePerBlobGas: TQuantity
39
+ }
40
+ >
41
+
31
42
  export type FeeValues<TQuantity = bigint> =
32
43
  | FeeValuesLegacy<TQuantity>
33
44
  | FeeValuesEIP1559<TQuantity>
45
+ | FeeValuesEIP4844<TQuantity>
34
46
 
35
- export type FeeValuesType = 'legacy' | 'eip1559'
47
+ export type FeeValuesType = 'legacy' | 'eip1559' | 'eip4844'
package/types/rpc.ts CHANGED
@@ -11,6 +11,7 @@ import type { Proof } from './proof.js'
11
11
  import type {
12
12
  TransactionEIP1559,
13
13
  TransactionEIP2930,
14
+ TransactionEIP4844,
14
15
  TransactionLegacy,
15
16
  TransactionReceipt,
16
17
  TransactionRequestEIP1559,
@@ -50,7 +51,8 @@ export type RpcTransaction<TPending extends boolean = boolean> = UnionOmit<
50
51
  UnionPartialBy<
51
52
  | TransactionLegacy<Quantity, Index, TPending, '0x0'>
52
53
  | TransactionEIP2930<Quantity, Index, TPending, '0x1'>
53
- | TransactionEIP1559<Quantity, Index, TPending, '0x2'>,
54
+ | TransactionEIP1559<Quantity, Index, TPending, '0x2'>
55
+ | TransactionEIP4844<Quantity, Index, TPending, '0x3'>,
54
56
  // `yParity` is optional on the RPC type as some nodes do not return it
55
57
  // for 1559 & 2930 transactions (they should!).
56
58
  'yParity'
@@ -1,15 +1,22 @@
1
1
  import type { Address } from 'abitype'
2
2
 
3
- import type { transactionType } from '../utils/formatters/transaction.js'
4
-
5
- import type { FeeValuesEIP1559, FeeValuesLegacy } from './fee.js'
3
+ import type {
4
+ FeeValuesEIP1559,
5
+ FeeValuesEIP4844,
6
+ FeeValuesLegacy,
7
+ } from './fee.js'
6
8
  import type { Log } from './log.js'
7
9
  import type { Hash, Hex, Signature } from './misc.js'
8
- import type { ValueOf } from './utils.js'
10
+ import type { OneOf } from './utils.js'
9
11
 
10
12
  export type AccessList = { address: Address; storageKeys: Hex[] }[]
11
13
 
12
- export type TransactionType = ValueOf<typeof transactionType> | (string & {})
14
+ export type TransactionType =
15
+ | 'legacy'
16
+ | 'eip1559'
17
+ | 'eip2930'
18
+ | 'eip4844'
19
+ | (string & {})
13
20
 
14
21
  export type TransactionReceipt<
15
22
  TQuantity = bigint,
@@ -17,6 +24,10 @@ export type TransactionReceipt<
17
24
  TStatus = 'success' | 'reverted',
18
25
  TType = TransactionType,
19
26
  > = {
27
+ /** The actual value per gas deducted from the sender's account for blob gas. Only specified for blob transactions as defined by EIP-4844. */
28
+ blobGasPrice?: TQuantity
29
+ /** The amount of blob gas used. Only specified for blob transactions as defined by EIP-4844. */
30
+ blobGasUsed?: TQuantity
20
31
  /** Hash of block containing this transaction */
21
32
  blockHash: Hash
22
33
  /** Number of block containing this transaction */
@@ -94,6 +105,7 @@ export type TransactionLegacy<
94
105
  FeeValuesLegacy<TQuantity> & {
95
106
  /** EIP-2930 Access List. */
96
107
  accessList?: never
108
+ blobVersionedHashes?: never
97
109
  /** Chain ID that this transaction is valid on. */
98
110
  chainId?: TIndex
99
111
  yParity?: never
@@ -108,6 +120,7 @@ export type TransactionEIP2930<
108
120
  FeeValuesLegacy<TQuantity> & {
109
121
  /** EIP-2930 Access List. */
110
122
  accessList: AccessList
123
+ blobVersionedHashes?: never
111
124
  /** Chain ID that this transaction is valid on. */
112
125
  chainId: TIndex
113
126
  type: TType
@@ -121,6 +134,22 @@ export type TransactionEIP1559<
121
134
  FeeValuesEIP1559<TQuantity> & {
122
135
  /** EIP-2930 Access List. */
123
136
  accessList: AccessList
137
+ blobVersionedHashes?: never
138
+ /** Chain ID that this transaction is valid on. */
139
+ chainId: TIndex
140
+ type: TType
141
+ }
142
+ export type TransactionEIP4844<
143
+ TQuantity = bigint,
144
+ TIndex = number,
145
+ TPending extends boolean = boolean,
146
+ TType = 'eip4844',
147
+ > = TransactionBase<TQuantity, TIndex, TPending> &
148
+ FeeValuesEIP4844<TQuantity> & {
149
+ /** EIP-2930 Access List. */
150
+ accessList: AccessList
151
+ /** List of versioned blob hashes associated with the transaction's blobs. */
152
+ blobVersionedHashes: Hex[]
124
153
  /** Chain ID that this transaction is valid on. */
125
154
  chainId: TIndex
126
155
  type: TType
@@ -129,10 +158,12 @@ export type Transaction<
129
158
  TQuantity = bigint,
130
159
  TIndex = number,
131
160
  TPending extends boolean = boolean,
132
- > =
161
+ > = OneOf<
133
162
  | TransactionLegacy<TQuantity, TIndex, TPending>
134
163
  | TransactionEIP2930<TQuantity, TIndex, TPending>
135
164
  | TransactionEIP1559<TQuantity, TIndex, TPending>
165
+ | TransactionEIP4844<TQuantity, TIndex, TPending>
166
+ >
136
167
 
137
168
  export type TransactionRequestBase<TQuantity = bigint, TIndex = number> = {
138
169
  /** Contract code or a hashed method call with encoded args */
@@ -48,7 +48,11 @@ export function formatBlock(block: Partial<RpcBlock>) {
48
48
  return {
49
49
  ...block,
50
50
  baseFeePerGas: block.baseFeePerGas ? BigInt(block.baseFeePerGas) : null,
51
+ blobGasUsed: block.blobGasUsed ? BigInt(block.blobGasUsed) : undefined,
51
52
  difficulty: block.difficulty ? BigInt(block.difficulty) : undefined,
53
+ excessBlobGas: block.excessBlobGas
54
+ ? BigInt(block.excessBlobGas)
55
+ : undefined,
52
56
  gasLimit: block.gasLimit ? BigInt(block.gasLimit) : undefined,
53
57
  gasUsed: block.gasUsed ? BigInt(block.gasUsed) : undefined,
54
58
  hash: block.hash ? block.hash : null,
@@ -37,6 +37,7 @@ export const transactionType = {
37
37
  '0x0': 'legacy',
38
38
  '0x1': 'eip2930',
39
39
  '0x2': 'eip1559',
40
+ '0x3': 'eip4844',
40
41
  } as const
41
42
 
42
43
  export type FormatTransactionErrorType = ErrorType
@@ -51,6 +52,9 @@ export function formatTransaction(transaction: Partial<RpcTransaction>) {
51
52
  chainId: transaction.chainId ? hexToNumber(transaction.chainId) : undefined,
52
53
  gas: transaction.gas ? BigInt(transaction.gas) : undefined,
53
54
  gasPrice: transaction.gasPrice ? BigInt(transaction.gasPrice) : undefined,
55
+ maxFeePerBlobGas: transaction.maxFeePerBlobGas
56
+ ? BigInt(transaction.maxFeePerBlobGas)
57
+ : undefined,
54
58
  maxFeePerGas: transaction.maxFeePerGas
55
59
  ? BigInt(transaction.maxFeePerGas)
56
60
  : undefined,
@@ -86,14 +90,19 @@ export function formatTransaction(transaction: Partial<RpcTransaction>) {
86
90
 
87
91
  if (transaction_.type === 'legacy') {
88
92
  delete transaction_.accessList
93
+ delete transaction_.maxFeePerBlobGas
89
94
  delete transaction_.maxFeePerGas
90
95
  delete transaction_.maxPriorityFeePerGas
91
96
  delete transaction_.yParity
92
97
  }
93
98
  if (transaction_.type === 'eip2930') {
99
+ delete transaction_.maxFeePerBlobGas
94
100
  delete transaction_.maxFeePerGas
95
101
  delete transaction_.maxPriorityFeePerGas
96
102
  }
103
+ if (transaction_.type === 'eip1559') {
104
+ delete transaction_.maxFeePerBlobGas
105
+ }
97
106
  return transaction_
98
107
  }
99
108
 
@@ -29,7 +29,7 @@ export type FormatTransactionReceiptErrorType = ErrorType
29
29
  export function formatTransactionReceipt(
30
30
  transactionReceipt: Partial<RpcTransactionReceipt>,
31
31
  ) {
32
- return {
32
+ const receipt = {
33
33
  ...transactionReceipt,
34
34
  blockNumber: transactionReceipt.blockNumber
35
35
  ? BigInt(transactionReceipt.blockNumber)
@@ -62,6 +62,13 @@ export function formatTransactionReceipt(
62
62
  ] || transactionReceipt.type
63
63
  : null,
64
64
  } as TransactionReceipt
65
+
66
+ if (transactionReceipt.blobGasPrice)
67
+ receipt.blobGasPrice = BigInt(transactionReceipt.blobGasPrice)
68
+ if (transactionReceipt.blobGasUsed)
69
+ receipt.blobGasUsed = BigInt(transactionReceipt.blobGasUsed)
70
+
71
+ return receipt
65
72
  }
66
73
 
67
74
  export type DefineTransactionReceiptErrorType =
@@ -20,6 +20,7 @@ export const rpcTransactionType = {
20
20
  legacy: '0x0',
21
21
  eip2930: '0x1',
22
22
  eip1559: '0x2',
23
+ eip4844: '0x3',
23
24
  } as const
24
25
 
25
26
  export type FormatTransactionRequestErrorType = ErrorType
@@ -1,6 +1,21 @@
1
1
  import type { ErrorType } from '../../errors/utils.js'
2
2
  import { wait } from '../wait.js'
3
3
 
4
+ export type WithRetryParameters = {
5
+ // The delay (in ms) between retries.
6
+ delay?: ((config: { count: number; error: Error }) => number) | number
7
+ // The max number of times to retry.
8
+ retryCount?: number
9
+ // Whether or not to retry when an error is thrown.
10
+ shouldRetry?: ({
11
+ count,
12
+ error,
13
+ }: {
14
+ count: number
15
+ error: Error
16
+ }) => Promise<boolean> | boolean
17
+ }
18
+
4
19
  export type WithRetryErrorType = ErrorType
5
20
 
6
21
  export function withRetry<TData>(
@@ -9,20 +24,7 @@ export function withRetry<TData>(
9
24
  delay: delay_ = 100,
10
25
  retryCount = 2,
11
26
  shouldRetry = () => true,
12
- }: {
13
- // The delay (in ms) between retries.
14
- delay?: ((config: { count: number; error: Error }) => number) | number
15
- // The max number of times to retry.
16
- retryCount?: number
17
- // Whether or not to retry when an error is thrown.
18
- shouldRetry?: ({
19
- count,
20
- error,
21
- }: {
22
- count: number
23
- error: Error
24
- }) => Promise<boolean> | boolean
25
- } = {},
27
+ }: WithRetryParameters = {},
26
28
  ) {
27
29
  return new Promise<TData>((resolve, reject) => {
28
30
  const attemptRetry = async ({ count = 0 } = {}) => {