@tuwaio/pulsar-core 1.0.0-fix-retry-actions-alpha.3.fe1128f → 1.0.0-fix-callbacks-alpha.2.c81eb98

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/README.md CHANGED
@@ -62,20 +62,12 @@ import { wagmiConfig, chains } from './path/to/your/wagmi/config';
62
62
  const pulsarStore = createPulsarStore({
63
63
  // A unique name for Zustand's persistence middleware. This will be the key in localStorage.
64
64
  name: 'my-app-pulsar-storage',
65
-
66
65
  // An array of adapters for different blockchain ecosystems.
67
66
  // Each adapter provides chain-specific logic.
68
- adapters: [
67
+ adapter: [
69
68
  evmAdapter(wagmiConfig, chains),
70
69
  // ... add other adapters like solanaAdapter here
71
70
  ],
72
-
73
- // (Optional) A callback function to execute on every successful transaction.
74
- // Ideal for global logic like showing a success notification.
75
- onSucceedCallbacks: (tx) => {
76
- console.log('Transaction succeeded!', tx);
77
- // e.g., showToast('Success!', { type: 'success' });
78
- },
79
71
  });
80
72
 
81
73
  export default pulsarStore;
package/dist/index.d.mts CHANGED
@@ -25,6 +25,20 @@ declare enum TransactionAdapter {
25
25
  /** For the Starknet L2 network. */
26
26
  Starknet = "starknet"
27
27
  }
28
+ /**
29
+ * Enum representing the different tracking strategies available for EVM transactions.
30
+ * Each tracker corresponds to a specific method of monitoring a transaction's lifecycle.
31
+ */
32
+ declare enum TransactionTracker {
33
+ /** For standard on-chain EVM transactions tracked by their hash. */
34
+ Ethereum = "ethereum",
35
+ /** For multi-signature transactions managed and executed via a Safe contract. */
36
+ Safe = "safe",
37
+ /** For meta-transactions relayed and executed by the Gelato Network. */
38
+ Gelato = "gelato",
39
+ /** The tracker for monitoring standard Solana transaction signatures. */
40
+ Solana = "solana"
41
+ }
28
42
  /**
29
43
  * Represents the terminal status of a transaction after it has been processed.
30
44
  */
@@ -36,12 +50,30 @@ declare enum TransactionStatus {
36
50
  /** The transaction was replaced by another with the same nonce (e.g., a speed-up or cancel). */
37
51
  Replaced = "Replaced"
38
52
  }
53
+ /**
54
+ * Defines the shape of the identifier for a Gelato transaction task.
55
+ */
56
+ type GelatoTxKey = {
57
+ taskId: string;
58
+ };
59
+ /**
60
+ * A union type representing the unique identifier returned by an `actionFunction`
61
+ * after a transaction is submitted to the network or a relay service.
62
+ *
63
+ * This key is crucial for the EVM adapter to determine which tracker should
64
+ * monitor the transaction.
65
+ *
66
+ * It can be one of the following:
67
+ * - A standard `0x...` transaction hash (`Hex`).
68
+ * - A structured object from a relay service like Gelato (`GelatoTxKey`).
69
+ */
70
+ type ActionTxKey = `0x${string}` | GelatoTxKey | string;
71
+ type OnSuccessCallback<T> = (tx: T) => Promise<void> | void;
39
72
  /**
40
73
  * The fundamental structure for any transaction being tracked by Pulsar.
41
74
  * This serves as the base upon which chain-specific transaction types are built.
42
- * @template T The type of the tracker identifier (e.g., 'ethereum', 'gelato').
43
75
  */
44
- type BaseTransaction<T> = {
76
+ type BaseTransaction = {
45
77
  /** The chain identifier (e.g., 1 for Ethereum Mainnet, 'SN_MAIN' for Starknet). */
46
78
  chainId: number | string;
47
79
  /**
@@ -81,7 +113,7 @@ type BaseTransaction<T> = {
81
113
  */
82
114
  title?: string | [string, string, string, string];
83
115
  /** The specific tracker responsible for monitoring this transaction's status. */
84
- tracker: T;
116
+ tracker: TransactionTracker;
85
117
  /** The unique identifier for the transaction (e.g., EVM hash, Gelato task ID). */
86
118
  txKey: string;
87
119
  /** The application-specific type or category of the transaction (e.g., 'SWAP', 'APPROVE'). */
@@ -91,9 +123,8 @@ type BaseTransaction<T> = {
91
123
  };
92
124
  /**
93
125
  * Represents an EVM-specific transaction, extending the base properties with EVM fields.
94
- * @template T The type of the tracker identifier.
95
126
  */
96
- type EvmTransaction<T> = BaseTransaction<T> & {
127
+ type EvmTransaction = BaseTransaction & {
97
128
  adapter: TransactionAdapter.EVM;
98
129
  /** The on-chain transaction hash, available after submission. */
99
130
  hash?: `0x${string}`;
@@ -114,9 +145,8 @@ type EvmTransaction<T> = BaseTransaction<T> & {
114
145
  };
115
146
  /**
116
147
  * Represents a Solana-specific transaction, extending the base properties.
117
- * @template T The type of the tracker identifier.
118
148
  */
119
- type SolanaTransaction<T> = BaseTransaction<T> & {
149
+ type SolanaTransaction = BaseTransaction & {
120
150
  adapter: TransactionAdapter.SOLANA;
121
151
  /** The transaction fee in lamports. */
122
152
  fee?: number;
@@ -126,16 +156,15 @@ type SolanaTransaction<T> = BaseTransaction<T> & {
126
156
  recentBlockhash?: string;
127
157
  /** The slot in which the transaction was processed. */
128
158
  slot?: number;
129
- /** The number of confirmations received. `null` if the transaction is pending or unconfirmed. */
130
- confirmations?: number | null;
159
+ /** The number of confirmations received. `string` when tx successed. `null` if the transaction is pending or unconfirmed. */
160
+ confirmations?: number | string | null;
131
161
  /** The RPC URL used to submit and track this transaction. */
132
162
  rpcUrl?: string;
133
163
  };
134
164
  /**
135
165
  * Represents a Starknet-specific transaction, extending the base properties.
136
- * @template T The type of the tracker identifier.
137
166
  */
138
- type StarknetTransaction<T> = BaseTransaction<T> & {
167
+ type StarknetTransaction = BaseTransaction & {
139
168
  adapter: TransactionAdapter.Starknet;
140
169
  /** The actual fee paid for the transaction. */
141
170
  actualFee?: {
@@ -144,18 +173,16 @@ type StarknetTransaction<T> = BaseTransaction<T> & {
144
173
  };
145
174
  /** The address of the contract being interacted with. */
146
175
  contractAddress?: string;
147
- /** The reason for transaction failure, if applicable. */
148
- revertReason?: string;
149
176
  };
150
177
  /** A union type representing any possible transaction structure that Pulsar can handle. */
151
- type Transaction<T> = EvmTransaction<T> | SolanaTransaction<T> | StarknetTransaction<T>;
178
+ type Transaction = EvmTransaction | SolanaTransaction | StarknetTransaction;
152
179
  /**
153
180
  * Represents the parameters required to initiate a new transaction tracking flow.
154
181
  */
155
- type InitialTransactionParams<A> = {
182
+ type InitialTransactionParams = {
156
183
  adapter: TransactionAdapter;
157
184
  /** The function that executes the on-chain action (e.g., sending a transaction) and returns a preliminary identifier like a hash. */
158
- actionFunction: (...args: any[]) => Promise<A | undefined>;
185
+ actionFunction: (...args: any[]) => Promise<ActionTxKey | undefined>;
159
186
  /** A user-facing description for the transaction. Supports state-specific descriptions. */
160
187
  description?: string | [string, string, string, string];
161
188
  /** The target chain ID for the transaction. */
@@ -175,7 +202,7 @@ type InitialTransactionParams<A> = {
175
202
  * Represents a transaction in its temporary, pre-submission state.
176
203
  * This is used for UI feedback while the transaction is being signed and sent.
177
204
  */
178
- type InitialTransaction<A> = InitialTransactionParams<A> & {
205
+ type InitialTransaction = InitialTransactionParams & {
179
206
  /** An error message if the initialization fails (e.g., user rejects signature). */
180
207
  errorMessage?: string;
181
208
  /** A flag indicating if the transaction is being processed (e.g., waiting for signature). */
@@ -187,11 +214,9 @@ type InitialTransaction<A> = InitialTransactionParams<A> & {
187
214
  };
188
215
  /**
189
216
  * Defines the interface for a transaction adapter, which provides chain-specific logic and utilities.
190
- * @template TR The type of the tracker identifier (e.g., a string enum).
191
- * @template T The specific transaction type, extending `Transaction<TR>`.
192
- * @template A The type of the key returned by the `actionFunction` (e.g., a transaction hash).
217
+ * @template T The specific transaction type, extending `Transaction`.
193
218
  */
194
- type TxAdapter<TR, T extends Transaction<TR>, A> = {
219
+ type TxAdapter<T extends Transaction> = {
195
220
  /** The unique key identifying this adapter. */
196
221
  key: TransactionAdapter;
197
222
  /** Returns information about the currently connected wallet. */
@@ -202,16 +227,17 @@ type TxAdapter<TR, T extends Transaction<TR>, A> = {
202
227
  /** Ensures the connected wallet is on the correct network for the transaction. Throws an error if the chain is mismatched. */
203
228
  checkChainForTx: (chainId: string | number) => Promise<void>;
204
229
  /** Determines the appropriate tracker and final `txKey` from the result of an action. */
205
- checkTransactionsTracker: (actionTxKey: A, walletType: string) => {
230
+ checkTransactionsTracker: (actionTxKey: ActionTxKey, walletType: string) => {
206
231
  txKey: string;
207
- tracker: TR;
232
+ tracker: TransactionTracker;
208
233
  };
209
234
  /** Selects and initializes the correct background tracker for a given transaction. */
210
235
  checkAndInitializeTrackerInStore: (params: {
211
236
  tx: T;
212
- } & Pick<ITxTrackingStore<TR, T, A>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'>) => Promise<void>;
237
+ onSucceedCallback?: OnSuccessCallback<T>;
238
+ } & Pick<ITxTrackingStore<T>, 'updateTxParams' | 'removeTxFromPool' | 'transactionsPool'>) => Promise<void>;
213
239
  /** Returns the base URL for the blockchain explorer for the current network. */
214
- getExplorerUrl: () => string | undefined;
240
+ getExplorerUrl: (url?: string) => string | undefined;
215
241
  /** Optional: Fetches a name from a chain-specific name service (e.g., ENS). */
216
242
  getName?: (address: string) => Promise<string | null>;
217
243
  /** Optional: Fetches an avatar URL from a chain-specific name service. */
@@ -223,22 +249,20 @@ type TxAdapter<TR, T extends Transaction<TR>, A> = {
223
249
  /** Optional: Logic to retry a failed transaction. */
224
250
  retryTxAction?: (params: {
225
251
  txKey: string;
226
- tx: InitialTransactionParams<A>;
252
+ tx: InitialTransactionParams;
227
253
  onClose: (txKey?: string) => void;
228
- } & Partial<Pick<ITxTrackingStore<TR, T, A>, 'handleTransaction'>>) => Promise<void>;
254
+ } & Partial<Pick<ITxTrackingStore<T>, 'handleTransaction'>>) => Promise<void>;
229
255
  /**
230
256
  * Optional: Constructs a full explorer URL for a specific transaction.
231
257
  * May require the full transaction pool to resolve details for replaced transactions.
232
258
  */
233
- getExplorerTxUrl?: (transactionsPool: TransactionPool<TR, T>, txKey: string, replacedTxHash?: string) => string;
259
+ getExplorerTxUrl?: (tx: T) => string;
234
260
  };
235
261
  /**
236
262
  * The complete interface for the Pulsar transaction tracking store.
237
- * @template TR The type of the tracker identifier.
238
263
  * @template T The transaction type.
239
- * @template A The return type of the `actionFunction`.
240
264
  */
241
- type ITxTrackingStore<TR, T extends Transaction<TR>, A> = IInitializeTxTrackingStore<TR, T, A> & {
265
+ type ITxTrackingStore<T extends Transaction> = IInitializeTxTrackingStore<T> & {
242
266
  /**
243
267
  * The primary method for initiating and tracking a new transaction from start to finish.
244
268
  * It manages UI state, executes the on-chain action, and initiates background tracking.
@@ -246,11 +270,13 @@ type ITxTrackingStore<TR, T extends Transaction<TR>, A> = IInitializeTxTrackingS
246
270
  */
247
271
  handleTransaction: (params: {
248
272
  /** The async function to execute (e.g., a smart contract write call). Must return a unique key or undefined. */
249
- actionFunction: () => Promise<A | undefined>;
273
+ actionFunction: () => Promise<ActionTxKey | undefined>;
250
274
  /** The metadata for the transaction. */
251
- params: Omit<InitialTransactionParams<A>, 'actionFunction'>;
275
+ params: Omit<InitialTransactionParams, 'actionFunction'>;
252
276
  /** The default tracker to use if it cannot be determined automatically. */
253
- defaultTracker?: TR;
277
+ defaultTracker?: TransactionTracker;
278
+ /** Callback to execute when the transaction is successfully submitted. */
279
+ onSucceedCallback?: OnSuccessCallback<T>;
254
280
  }) => Promise<void>;
255
281
  /**
256
282
  * Initializes trackers for all pending transactions in the pool.
@@ -266,37 +292,31 @@ type ITxTrackingStore<TR, T extends Transaction<TR>, A> = IInitializeTxTrackingS
266
292
 
267
293
  /**
268
294
  * Defines the structure of the transaction pool, a key-value store of transactions indexed by their unique keys.
269
- * @template TR The type of the tracker identifier.
270
- * @template T The transaction type.
295
+ * @template T The type of the transaction object being tracked.
271
296
  */
272
- type TransactionPool<TR, T extends Transaction<TR>> = Record<string, T>;
297
+ type TransactionPool<T extends Transaction> = Record<string, T>;
273
298
  /**
274
299
  * A utility type that creates a union of all fields that can be safely updated
275
300
  * on a transaction object via the `updateTxParams` action. This ensures type safety
276
301
  * and prevents accidental modification of immutable properties.
277
- * @template TR The type of the tracker identifier.
278
302
  */
279
- type UpdatableTransactionFields<TR> = Partial<Pick<EvmTransaction<TR>, 'to' | 'nonce' | 'txKey' | 'pending' | 'hash' | 'status' | 'replacedTxHash' | 'errorMessage' | 'finishedTimestamp' | 'isTrackedModalOpen' | 'isError' | 'maxPriorityFeePerGas' | 'maxFeePerGas' | 'input' | 'value'>> & Partial<Pick<SolanaTransaction<TR>, 'slot' | 'confirmations' | 'fee' | 'instructions' | 'recentBlockhash' | 'rpcUrl'>>;
303
+ type UpdatableTransactionFields = Partial<Pick<EvmTransaction, 'to' | 'nonce' | 'txKey' | 'pending' | 'hash' | 'status' | 'replacedTxHash' | 'errorMessage' | 'finishedTimestamp' | 'isTrackedModalOpen' | 'isError' | 'maxPriorityFeePerGas' | 'maxFeePerGas' | 'input' | 'value'>> & Partial<Pick<SolanaTransaction, 'slot' | 'confirmations' | 'fee' | 'instructions' | 'recentBlockhash' | 'rpcUrl'>>;
280
304
  /**
281
305
  * The interface for the base transaction tracking store slice.
282
306
  * It includes the state and actions for managing the transaction lifecycle.
283
- * @template TR The type of the tracker identifier.
284
307
  * @template T The specific transaction type.
285
- * @template A The return type of the initial action function.
286
308
  */
287
- interface IInitializeTxTrackingStore<TR, T extends Transaction<TR>, A> {
288
- /** A callback function executed when any transaction successfully completes. */
289
- onSucceedCallbacks?: (tx: T) => Promise<void> | void;
309
+ interface IInitializeTxTrackingStore<T extends Transaction> {
290
310
  /** A pool of all transactions currently being tracked, indexed by `txKey`. */
291
- transactionsPool: TransactionPool<TR, T>;
311
+ transactionsPool: TransactionPool<T>;
292
312
  /** The `txKey` of the most recently added transaction. */
293
313
  lastAddedTxKey?: string;
294
314
  /** The state for a transaction being initiated, used for UI feedback before it's submitted to the chain. */
295
- initialTx?: InitialTransaction<A>;
315
+ initialTx?: InitialTransaction;
296
316
  /** Adds a new transaction to the tracking pool and marks it as pending. */
297
- addTxToPool: (tx: Transaction<TR>) => void;
317
+ addTxToPool: (tx: T) => void;
298
318
  /** Updates one or more properties of an existing transaction in the pool. */
299
- updateTxParams: (txKey: string, fields: UpdatableTransactionFields<TR>) => void;
319
+ updateTxParams: (txKey: string, fields: UpdatableTransactionFields) => void;
300
320
  /** Removes a transaction from the tracking pool by its key. */
301
321
  removeTxFromPool: (txKey: string) => void;
302
322
  /** Closes the tracking modal for a transaction and clears any initial transaction state. */
@@ -308,16 +328,11 @@ interface IInitializeTxTrackingStore<TR, T extends Transaction<TR>, A> {
308
328
  * Creates a Zustand store slice with the core logic for transaction state management.
309
329
  * This function is a slice creator intended for use with Zustand's `create` function.
310
330
  *
311
- * @template TR The type of the tracker identifier.
312
331
  * @template T The specific transaction type.
313
- * @template A The return type of the initial action function.
314
332
  * @param options Configuration for the store slice.
315
- * @param options.onSucceedCallbacks An optional async callback to run when a transaction succeeds.
316
333
  * @returns A Zustand store slice implementing `IInitializeTxTrackingStore`.
317
334
  */
318
- declare function initializeTxTrackingStore<TR, T extends Transaction<TR>, A>({ onSucceedCallbacks, }: {
319
- onSucceedCallbacks?: (tx: T) => Promise<void> | void;
320
- }): StoreSlice<IInitializeTxTrackingStore<TR, T, A>>;
335
+ declare function initializeTxTrackingStore<T extends Transaction>(): StoreSlice<IInitializeTxTrackingStore<T>>;
321
336
 
322
337
  /**
323
338
  * @file This file contains selector functions for deriving state from the transaction tracking store.
@@ -326,47 +341,42 @@ declare function initializeTxTrackingStore<TR, T extends Transaction<TR>, A>({ o
326
341
 
327
342
  /**
328
343
  * Selects all transactions from the pool and sorts them by their creation timestamp in ascending order.
329
- * @template TR - The type of the tracker identifier.
330
344
  * @template T - The transaction type.
331
- * @param {TransactionPool<TR, T>} transactionsPool - The entire transaction pool from the store.
345
+ * @param {TransactionPool<T>} transactionsPool - The entire transaction pool from the store.
332
346
  * @returns {T[]} An array of all transactions, sorted chronologically.
333
347
  */
334
- declare const selectAllTransactions: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>) => T[];
348
+ declare const selectAllTransactions: <T extends Transaction>(transactionsPool: TransactionPool<T>) => T[];
335
349
  /**
336
350
  * Selects all transactions that are currently in a pending state, sorted chronologically.
337
- * @template TR - The type of the tracker identifier.
338
351
  * @template T - The transaction type.
339
- * @param {TransactionPool<TR, T>} transactionsPool - The entire transaction pool from the store.
352
+ * @param {TransactionPool<T>} transactionsPool - The entire transaction pool from the store.
340
353
  * @returns {T[]} An array of pending transactions.
341
354
  */
342
- declare const selectPendingTransactions: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>) => T[];
355
+ declare const selectPendingTransactions: <T extends Transaction>(transactionsPool: TransactionPool<T>) => T[];
343
356
  /**
344
357
  * Selects a single transaction from the pool by its unique key (`txKey`).
345
- * @template TR - The type of the tracker identifier.
346
358
  * @template T - The transaction type.
347
- * @param {TransactionPool<TR, T>} transactionsPool - The entire transaction pool from the store.
359
+ * @param {TransactionPool<T>} transactionsPool - The entire transaction pool from the store.
348
360
  * @param {string} key - The `txKey` of the transaction to retrieve.
349
361
  * @returns {T | undefined} The transaction object if found, otherwise undefined.
350
362
  */
351
- declare const selectTxByKey: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>, key: string) => T | undefined;
363
+ declare const selectTxByKey: <T extends Transaction>(transactionsPool: TransactionPool<T>, key: string) => T | undefined;
352
364
  /**
353
365
  * Selects all transactions initiated by a specific wallet address, sorted chronologically.
354
- * @template TR - The type of the tracker identifier.
355
366
  * @template T - The transaction type.
356
- * @param {TransactionPool<TR, T>} transactionsPool - The entire transaction pool from the store.
367
+ * @param {TransactionPool<T>} transactionsPool - The entire transaction pool from the store.
357
368
  * @param {string} from - The wallet address (`from` address) to filter transactions by.
358
369
  * @returns {T[]} An array of transactions associated with the given wallet.
359
370
  */
360
- declare const selectAllTransactionsByActiveWallet: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>, from: string) => T[];
371
+ declare const selectAllTransactionsByActiveWallet: <T extends Transaction>(transactionsPool: TransactionPool<T>, from: string) => T[];
361
372
  /**
362
373
  * Selects all pending transactions for a specific wallet address, sorted chronologically.
363
- * @template TR - The type of the tracker identifier.
364
374
  * @template T - The transaction type.
365
- * @param {TransactionPool<TR, T>} transactionsPool - The entire transaction pool from the store.
375
+ * @param {TransactionPool<T>} transactionsPool - The entire transaction pool from the store.
366
376
  * @param {string} from - The wallet address (`from` address) to filter transactions by.
367
377
  * @returns {T[]} An array of pending transactions for the given wallet.
368
378
  */
369
- declare const selectPendingTransactionsByActiveWallet: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>, from: string) => T[];
379
+ declare const selectPendingTransactionsByActiveWallet: <T extends Transaction>(transactionsPool: TransactionPool<T>, from: string) => T[];
370
380
 
371
381
  /**
372
382
  * Creates the main Pulsar store for transaction tracking.
@@ -375,30 +385,26 @@ declare const selectPendingTransactionsByActiveWallet: <TR, T extends Transactio
375
385
  * slice with a powerful orchestration logic that leverages chain-specific adapters to handle the entire
376
386
  * lifecycle of a transaction—from initiation and chain validation to execution and background status tracking.
377
387
  *
378
- * @template TR The type of the tracker identifier (e.g., a string enum).
379
388
  * @template T The specific transaction type, extending the base `Transaction`.
380
- * @template A The type of the key returned by the `actionFunction` (e.g., a transaction hash).
381
389
  *
382
390
  * @param config Configuration object for creating the store.
383
- * @param config.onSucceedCallbacks Optional async callback executed on transaction success.
384
- * @param config.adapters An array of adapters for different chains or transaction types.
391
+ * @param config.adapter Adapter or an array of adapters for different chains or transaction types.
385
392
  * @param options Configuration for the Zustand `persist` middleware.
386
393
  * @returns A fully configured Zustand store instance.
387
394
  */
388
- declare function createPulsarStore<TR, T extends Transaction<TR>, A>({ onSucceedCallbacks, adapters, ...options }: {
389
- onSucceedCallbacks?: (tx: T) => Promise<void> | void;
390
- adapters: TxAdapter<TR, T, A>[];
391
- } & PersistOptions<ITxTrackingStore<TR, T, A>>): Omit<zustand.StoreApi<ITxTrackingStore<TR, T, A>>, "setState" | "persist"> & {
392
- setState(partial: ITxTrackingStore<TR, T, A> | Partial<ITxTrackingStore<TR, T, A>> | ((state: ITxTrackingStore<TR, T, A>) => ITxTrackingStore<TR, T, A> | Partial<ITxTrackingStore<TR, T, A>>), replace?: false | undefined): unknown;
393
- setState(state: ITxTrackingStore<TR, T, A> | ((state: ITxTrackingStore<TR, T, A>) => ITxTrackingStore<TR, T, A>), replace: true): unknown;
395
+ declare function createPulsarStore<T extends Transaction>({ adapter, ...options }: {
396
+ adapter: TxAdapter<T> | TxAdapter<T>[];
397
+ } & PersistOptions<ITxTrackingStore<T>>): Omit<zustand.StoreApi<ITxTrackingStore<T>>, "setState" | "persist"> & {
398
+ setState(partial: ITxTrackingStore<T> | Partial<ITxTrackingStore<T>> | ((state: ITxTrackingStore<T>) => ITxTrackingStore<T> | Partial<ITxTrackingStore<T>>), replace?: false | undefined): unknown;
399
+ setState(state: ITxTrackingStore<T> | ((state: ITxTrackingStore<T>) => ITxTrackingStore<T>), replace: true): unknown;
394
400
  persist: {
395
- setOptions: (options: Partial<PersistOptions<ITxTrackingStore<TR, T, A>, ITxTrackingStore<TR, T, A>, unknown>>) => void;
401
+ setOptions: (options: Partial<PersistOptions<ITxTrackingStore<T>, ITxTrackingStore<T>, unknown>>) => void;
396
402
  clearStorage: () => void;
397
403
  rehydrate: () => Promise<void> | void;
398
404
  hasHydrated: () => boolean;
399
- onHydrate: (fn: (state: ITxTrackingStore<TR, T, A>) => void) => () => void;
400
- onFinishHydration: (fn: (state: ITxTrackingStore<TR, T, A>) => void) => () => void;
401
- getOptions: () => Partial<PersistOptions<ITxTrackingStore<TR, T, A>, ITxTrackingStore<TR, T, A>, unknown>>;
405
+ onHydrate: (fn: (state: ITxTrackingStore<T>) => void) => () => void;
406
+ onFinishHydration: (fn: (state: ITxTrackingStore<T>) => void) => () => void;
407
+ getOptions: () => Partial<PersistOptions<ITxTrackingStore<T>, ITxTrackingStore<T>, unknown>>;
402
408
  };
403
409
  };
404
410
 
@@ -447,8 +453,8 @@ declare const createBoundedUseStore: <S extends StoreApi<unknown>>(store: S) =>
447
453
  /**
448
454
  * Defines the parameters for the fetcher function used within the polling tracker.
449
455
  * The fetcher is the core logic that performs the actual API call.
450
- * @template R - The expected type of the successful API response.
451
- * @template T - The type of the transaction object being tracked.
456
+ * @template R The expected type of the successful API response.
457
+ * @template T The type of the transaction object being tracked.
452
458
  */
453
459
  type PollingFetcherParams<R, T> = {
454
460
  /** The transaction object being tracked. */
@@ -468,13 +474,12 @@ type PollingFetcherParams<R, T> = {
468
474
  };
469
475
  /**
470
476
  * Defines the configuration object for the `initializePollingTracker` function.
471
- * @template R - The expected type of the successful API response.
472
- * @template T - The type of the transaction object.
473
- * @template TR - The type of the tracker identifier.
477
+ * @template R The expected type of the successful API response.
478
+ * @template T The type of the transaction object.
474
479
  */
475
- type PollingTrackerConfig<R, T, TR> = {
480
+ type PollingTrackerConfig<R, T extends Transaction> = {
476
481
  /** The transaction object to be tracked. It must include `txKey` and `pending` status. */
477
- tx: T & Pick<Transaction<TR>, 'txKey' | 'pending'>;
482
+ tx: T & Pick<Transaction, 'txKey' | 'pending'>;
478
483
  /** The function that performs the data fetching (e.g., an API call) on each interval. */
479
484
  fetcher: (params: PollingFetcherParams<R, T>) => Promise<void>;
480
485
  /** Callback to be invoked when the transaction successfully completes. */
@@ -503,10 +508,9 @@ type PollingTrackerConfig<R, T, TR> = {
503
508
  *
504
509
  * @template R The expected type of the API response.
505
510
  * @template T The type of the transaction object.
506
- * @template TR The type of the tracker identifier.
507
- * @param {PollingTrackerConfig<R, T, TR>} config - The configuration for the tracker.
511
+ * @param {PollingTrackerConfig<R, T>} config - The configuration for the tracker.
508
512
  */
509
- declare function initializePollingTracker<R, T, TR>(config: PollingTrackerConfig<R, T, TR>): void;
513
+ declare function initializePollingTracker<R, T extends Transaction>(config: PollingTrackerConfig<R, T>): void;
510
514
 
511
515
  /**
512
516
  * @file This file contains a utility function for selecting a specific transaction adapter from a list.
@@ -520,19 +524,17 @@ declare function initializePollingTracker<R, T, TR>(config: PollingTrackerConfig
520
524
  * and returns the first adapter in the array as a fallback. This fallback mechanism
521
525
  * ensures that the system can still function, but it highlights a potential configuration issue.
522
526
  *
523
- * @template TR - The type of the tracker identifier.
524
527
  * @template T - The transaction type, extending the base `Transaction`.
525
- * @template A - The type for the adapter-specific context or API.
526
528
  *
527
529
  * @param {object} params - The parameters for the selection.
528
530
  * @param {TransactionAdapter} params.adapterKey - The key of the desired adapter.
529
- * @param {TxAdapter<TR, T, A>[]} params.adapters - An array of available transaction adapters.
531
+ * @param {TxAdapter<T> | TxAdapter<T>[]} params.adapter - Adapter or an array of adapters for different chains or transaction types.
530
532
  *
531
- * @returns {TxAdapter<TR, T, A> | undefined} The found transaction adapter, the fallback adapter, or undefined if the adapters array is empty.
533
+ * @returns {TxAdapter<T> | undefined} The found transaction adapter, the fallback adapter, or undefined if the adapters array is empty.
532
534
  */
533
- declare const selectAdapterByKey: <TR, T extends Transaction<TR>, A>({ adapterKey, adapters, }: {
535
+ declare const selectAdapterByKey: <T extends Transaction>({ adapterKey, adapter, }: {
534
536
  adapterKey: TransactionAdapter;
535
- adapters: TxAdapter<TR, T, A>[];
536
- }) => TxAdapter<TR, T, A> | undefined;
537
+ adapter: TxAdapter<T> | TxAdapter<T>[];
538
+ }) => TxAdapter<T> | undefined;
537
539
 
538
- export { type BaseTransaction, type EvmTransaction, type IInitializeTxTrackingStore, type ITxTrackingStore, type InitialTransaction, type InitialTransactionParams, type PollingTrackerConfig, type SolanaTransaction, type StarknetTransaction, type StoreSlice, type Transaction, TransactionAdapter, type TransactionPool, TransactionStatus, type TxAdapter, createBoundedUseStore, createPulsarStore, initializePollingTracker, initializeTxTrackingStore, selectAdapterByKey, selectAllTransactions, selectAllTransactionsByActiveWallet, selectPendingTransactions, selectPendingTransactionsByActiveWallet, selectTxByKey };
540
+ export { type ActionTxKey, type BaseTransaction, type EvmTransaction, type GelatoTxKey, type IInitializeTxTrackingStore, type ITxTrackingStore, type InitialTransaction, type InitialTransactionParams, type OnSuccessCallback, type PollingTrackerConfig, type SolanaTransaction, type StarknetTransaction, type StoreSlice, type Transaction, TransactionAdapter, type TransactionPool, TransactionStatus, TransactionTracker, type TxAdapter, createBoundedUseStore, createPulsarStore, initializePollingTracker, initializeTxTrackingStore, selectAdapterByKey, selectAllTransactions, selectAllTransactionsByActiveWallet, selectPendingTransactions, selectPendingTransactionsByActiveWallet, selectTxByKey };