@tuwaio/pulsar-evm 0.0.15 → 0.0.16

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/dist/index.d.mts CHANGED
@@ -1,100 +1,9 @@
1
- import { PollingTrackerConfig, Transaction, ITxTrackingStore, TxAdapter, TransactionPool } from '@tuwaio/pulsar-core';
1
+ import { Transaction, TxAdapter, ITxTrackingStore, ActionTxKey, GelatoTxKey, PollingTrackerConfig, TransactionTracker, TransactionPool } from '@tuwaio/pulsar-core';
2
2
  import { Config, GetAccountReturnType, GetClientReturnType } from '@wagmi/core';
3
3
  import * as viem from 'viem';
4
- import { Hex, Chain, GetTransactionReturnType, TransactionReceipt, Client, ReplacementReturnType, WaitForTransactionReceiptParameters, Address } from 'viem';
4
+ import { Chain, GetTransactionReturnType, TransactionReceipt, Client, ReplacementReturnType, WaitForTransactionReceiptParameters, Hex, Address } from 'viem';
5
5
  import { Chain as Chain$1 } from 'viem/chains';
6
6
 
7
- /**
8
- * @file This file implements the transaction tracking logic for meta-transactions relayed via the Gelato Network.
9
- * It uses a polling mechanism to check the status of a Gelato Task ID from the Gelato API.
10
- */
11
-
12
- /**
13
- * Defines the shape of the identifier for a Gelato transaction task.
14
- */
15
- type GelatoTxKey = {
16
- taskId: string;
17
- };
18
- /**
19
- * A type guard to determine if an ActionTxKey is a GelatoTxKey.
20
- * @param {ActionTxKey} txKey - The transaction key to check.
21
- * @returns {boolean} True if the key is for a Gelato transaction.
22
- */
23
- declare function isGelatoTxKey(txKey: ActionTxKey): txKey is GelatoTxKey;
24
- /**
25
- * Enum representing the possible states of a Gelato task.
26
- * @see https://docs.gelato.network/developer-services/relay/api/get-task-status
27
- */
28
- declare enum GelatoTaskState {
29
- CheckPending = "CheckPending",
30
- ExecPending = "ExecPending",
31
- WaitingForConfirmation = "WaitingForConfirmation",
32
- ExecSuccess = "ExecSuccess",
33
- ExecReverted = "ExecReverted",
34
- Cancelled = "Cancelled",
35
- NotFound = "NotFound"
36
- }
37
- /**
38
- * Defines the shape of the response from the Gelato `getTaskStatus` API endpoint.
39
- */
40
- type GelatoTaskStatusResponse = {
41
- task: {
42
- chainId: number;
43
- taskId: string;
44
- taskState: GelatoTaskState;
45
- creationDate?: string;
46
- executionDate?: string;
47
- transactionHash?: Hex;
48
- blockNumber?: number;
49
- lastCheckMessage?: string;
50
- };
51
- };
52
- /**
53
- * A reusable fetcher function for `initializePollingTracker` that queries the Gelato API for a task's status.
54
- * It handles the logic for interpreting Gelato's task states and calls the appropriate polling callbacks.
55
- */
56
- declare const gelatoFetcher: PollingTrackerConfig<GelatoTaskStatusResponse, Transaction<TransactionTracker>, TransactionTracker>['fetcher'];
57
- /**
58
- * A higher-level wrapper that integrates the Gelato polling logic with the Pulsar store.
59
- * It uses the generic `gelatoFetcher` and provides store-specific callbacks.
60
- *
61
- * @template T - The application-specific transaction type.
62
- */
63
- declare function gelatoTrackerForStore<T extends Transaction<TransactionTracker>>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
64
- tx: T;
65
- }): void;
66
-
67
- /**
68
- * @file This file defines types and enums specific to the EVM (Ethereum Virtual Machine) adapter.
69
- * It includes identifiers for different tracking strategies and the shape of transaction keys
70
- * used within the EVM ecosystem.
71
- */
72
-
73
- /**
74
- * Enum representing the different tracking strategies available for EVM transactions.
75
- * Each tracker corresponds to a specific method of monitoring a transaction's lifecycle.
76
- */
77
- declare enum TransactionTracker {
78
- /** For standard on-chain EVM transactions tracked by their hash. */
79
- Ethereum = "ethereum",
80
- /** For multi-signature transactions managed and executed via a Safe contract. */
81
- Safe = "safe",
82
- /** For meta-transactions relayed and executed by the Gelato Network. */
83
- Gelato = "gelato"
84
- }
85
- /**
86
- * A union type representing the unique identifier returned by an `actionFunction`
87
- * after a transaction is submitted to the network or a relay service.
88
- *
89
- * This key is crucial for the EVM adapter to determine which tracker should
90
- * monitor the transaction.
91
- *
92
- * It can be one of the following:
93
- * - A standard `0x...` transaction hash (`Hex`).
94
- * - A structured object from a relay service like Gelato (`GelatoTxKey`).
95
- */
96
- type ActionTxKey = Hex | GelatoTxKey;
97
-
98
7
  /**
99
8
  * @file This file contains the factory function for creating the EVM (Ethereum Virtual Machine) transaction adapter.
100
9
  * This adapter encapsulates all the logic required to interact with EVM-based chains using wagmi.
@@ -111,11 +20,11 @@ type ActionTxKey = Hex | GelatoTxKey;
111
20
  * @param {Config} config - The wagmi configuration object.
112
21
  * @param {Chain[]} appChains - An array of viem `Chain` objects supported by the application.
113
22
  *
114
- * @returns {TxAdapter<TransactionTracker, T, ActionTxKey>} The configured EVM transaction adapter.
23
+ * @returns {TxAdapter<T>} The configured EVM transaction adapter.
115
24
  *
116
25
  * @throws {Error} Throws an error if the wagmi `config` is not provided.
117
26
  */
118
- declare function evmAdapter<T extends Transaction<TransactionTracker>>(config: Config, appChains: Chain[]): TxAdapter<TransactionTracker, T, ActionTxKey>;
27
+ declare function evmAdapter<T extends Transaction>(config: Config, appChains: Chain[]): TxAdapter<T>;
119
28
 
120
29
  /**
121
30
  * @file This file contains the tracker implementation for standard EVM transactions.
@@ -127,7 +36,7 @@ declare function evmAdapter<T extends Transaction<TransactionTracker>>(config: C
127
36
  * Defines the parameters for the low-level EVM transaction tracker.
128
37
  */
129
38
  type EVMTrackerParams = {
130
- tx: Pick<Transaction<TransactionTracker>, 'chainId' | 'txKey'>;
39
+ tx: Pick<Transaction, 'chainId' | 'txKey'>;
131
40
  chains: Chain[];
132
41
  onTxDetailsFetched: (txDetails: GetTransactionReturnType) => void;
133
42
  onSuccess: (txDetails: GetTransactionReturnType, receipt: TransactionReceipt, client: Client) => Promise<void>;
@@ -151,10 +60,64 @@ declare function evmTracker(params: EVMTrackerParams): Promise<void>;
151
60
  *
152
61
  * @template T - The application-specific transaction type.
153
62
  */
154
- declare function evmTrackerForStore<T extends Transaction<TransactionTracker>>(params: Pick<EVMTrackerParams, 'chains'> & Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks'> & {
63
+ declare function evmTrackerForStore<T extends Transaction>(params: Pick<EVMTrackerParams, 'chains'> & Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks'> & {
155
64
  tx: T;
156
65
  }): Promise<void>;
157
66
 
67
+ /**
68
+ * @file This file implements the transaction tracking logic for meta-transactions relayed via the Gelato Network.
69
+ * It uses a polling mechanism to check the status of a Gelato Task ID from the Gelato API.
70
+ */
71
+
72
+ /**
73
+ * A type guard to determine if an ActionTxKey is a GelatoTxKey.
74
+ * @param {ActionTxKey} txKey - The transaction key to check.
75
+ * @returns {boolean} True if the key is for a Gelato transaction.
76
+ */
77
+ declare function isGelatoTxKey(txKey: ActionTxKey): txKey is GelatoTxKey;
78
+ /**
79
+ * Enum representing the possible states of a Gelato task.
80
+ * @see https://docs.gelato.network/developer-services/relay/api/get-task-status
81
+ */
82
+ declare enum GelatoTaskState {
83
+ CheckPending = "CheckPending",
84
+ ExecPending = "ExecPending",
85
+ WaitingForConfirmation = "WaitingForConfirmation",
86
+ ExecSuccess = "ExecSuccess",
87
+ ExecReverted = "ExecReverted",
88
+ Cancelled = "Cancelled",
89
+ NotFound = "NotFound"
90
+ }
91
+ /**
92
+ * Defines the shape of the response from the Gelato `getTaskStatus` API endpoint.
93
+ */
94
+ type GelatoTaskStatusResponse = {
95
+ task: {
96
+ chainId: number;
97
+ taskId: string;
98
+ taskState: GelatoTaskState;
99
+ creationDate?: string;
100
+ executionDate?: string;
101
+ transactionHash?: Hex;
102
+ blockNumber?: number;
103
+ lastCheckMessage?: string;
104
+ };
105
+ };
106
+ /**
107
+ * A reusable fetcher function for `initializePollingTracker` that queries the Gelato API for a task's status.
108
+ * It handles the logic for interpreting Gelato's task states and calls the appropriate polling callbacks.
109
+ */
110
+ declare const gelatoFetcher: PollingTrackerConfig<GelatoTaskStatusResponse, Transaction>['fetcher'];
111
+ /**
112
+ * A higher-level wrapper that integrates the Gelato polling logic with the Pulsar store.
113
+ * It uses the generic `gelatoFetcher` and provides store-specific callbacks.
114
+ *
115
+ * @template T - The application-specific transaction type.
116
+ */
117
+ declare function gelatoTrackerForStore<T extends Transaction>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
118
+ tx: T;
119
+ }): void;
120
+
158
121
  /**
159
122
  * @file This file implements the transaction tracking logic for Safe (formerly Gnosis Safe) multisig transactions.
160
123
  * It uses a polling mechanism to query the Safe Transaction Service API for the status of a `safeTxHash`.
@@ -177,14 +140,14 @@ type SafeTxStatusResponse = {
177
140
  * A reusable fetcher for `initializePollingTracker` that queries the Safe Transaction Service API.
178
141
  * It handles the complex logic of detecting executed, failed, and replaced multisig transactions.
179
142
  */
180
- declare const safeFetcher: PollingTrackerConfig<SafeTxStatusResponse, Transaction<TransactionTracker>, TransactionTracker>['fetcher'];
143
+ declare const safeFetcher: PollingTrackerConfig<SafeTxStatusResponse, Transaction>['fetcher'];
181
144
  /**
182
145
  * A higher-level wrapper that integrates the Safe polling logic with the Pulsar store.
183
146
  * It uses the generic `safeFetcher` and provides store-specific callbacks.
184
147
  *
185
148
  * @template T - The application-specific transaction type.
186
149
  */
187
- declare function safeTrackerForStore<T extends Transaction<TransactionTracker>>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
150
+ declare function safeTrackerForStore<T extends Transaction>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
188
151
  tx: T;
189
152
  }): void;
190
153
 
@@ -227,7 +190,7 @@ declare function safeTrackerForStore<T extends Transaction<TransactionTracker>>(
227
190
  * };
228
191
  * ```
229
192
  */
230
- declare function cancelTxAction<T extends Transaction<any>>({ config, tx, }: {
193
+ declare function cancelTxAction<T extends Transaction>({ config, tx }: {
231
194
  config: Config;
232
195
  tx: T;
233
196
  }): Promise<Hex>;
@@ -241,7 +204,7 @@ declare function cancelTxAction<T extends Transaction<any>>({ config, tx, }: {
241
204
  * The parameters required to initialize a tracker.
242
205
  * @template T - The application-specific transaction type.
243
206
  */
244
- type InitializeTrackerParams<T extends Transaction<TransactionTracker>> = Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
207
+ type InitializeTrackerParams<T extends Transaction> = Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
245
208
  chains: Chain[];
246
209
  tx: T;
247
210
  tracker: TransactionTracker;
@@ -255,7 +218,7 @@ type InitializeTrackerParams<T extends Transaction<TransactionTracker>> = Pick<I
255
218
  * @param {InitializeTrackerParams<T>} params - The parameters for initializing the tracker.
256
219
  * @returns {Promise<void>} A promise that resolves once the tracking process has been successfully initiated.
257
220
  */
258
- declare function checkAndInitializeTrackerInStore<T extends Transaction<TransactionTracker>>({ tracker, tx, chains, ...rest }: InitializeTrackerParams<T>): Promise<void>;
221
+ declare function checkAndInitializeTrackerInStore<T extends Transaction>({ tracker, tx, chains, ...rest }: InitializeTrackerParams<T>): Promise<void>;
259
222
 
260
223
  /**
261
224
  * @file This file contains a utility to ensure the user's wallet is connected to the correct chain before proceeding with a transaction.
@@ -431,18 +394,23 @@ declare const SafeTransactionServiceUrls: Record<number, string>;
431
394
  * Generates a URL to a block explorer or Safe UI for a given transaction.
432
395
  * It handles different URL structures for standard EVM transactions and Safe multi-sig transactions.
433
396
  *
434
- * @template TR - The generic type for the tracker identifier.
435
- * @template T - The transaction type.
397
+ * @template T - The transaction type, extending the base `Transaction`.
436
398
  *
437
- * @param {TransactionPool<TR, T>} transactionsPool - The entire pool of transactions from the store.
438
- * @param {Chain[]} chains - An array of supported chain objects, typically from `viem/chains`.
439
- * @param {Hex} txKey - The unique key (`txKey`) of the transaction for which to generate the link.
440
- * @param {Hex} [replacedTxHash] - Optional. If this is a speed-up/cancel transaction, this is the hash of the new transaction.
399
+ * @param {object} params - The parameters for the selection.
400
+ * @param {TransactionPool<T>} params.transactionsPool - The entire pool of transactions from the store.
401
+ * @param {Chain[]} params.chains - An array of supported chain objects, typically from `viem/chains`.
402
+ * @param {Hex} params.txKey - The unique key (`txKey`) of the transaction for which to generate the link.
403
+ * @param {Hex} [params.replacedTxHash] - Optional. If this is a speed-up/cancel transaction, this is the hash of the new transaction.
441
404
  *
442
405
  * @returns {string} The full URL to the transaction on the corresponding block explorer or Safe app,
443
406
  * or an empty string if the transaction or required chain configuration is not found.
444
407
  */
445
- declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>, chains: Chain[], txKey: Hex, replacedTxHash?: Hex) => string;
408
+ declare const selectEvmTxExplorerLink: <T extends Transaction>({ transactionsPool, chains, txKey, replacedTxHash, }: {
409
+ transactionsPool: TransactionPool<T>;
410
+ chains: Chain[];
411
+ txKey: Hex;
412
+ replacedTxHash?: Hex;
413
+ }) => string;
446
414
 
447
415
  /**
448
416
  * @file This file contains a utility function for speeding up a pending EVM transaction.
@@ -452,7 +420,6 @@ declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transacti
452
420
  * Speeds up a pending EVM transaction by resubmitting it with the same nonce but higher gas fees.
453
421
  * This function is designed to work with wagmi's configuration and actions.
454
422
  *
455
- * @template TR - The type of the tracker identifier.
456
423
  * @template T - The transaction type, which must be a valid EVM transaction.
457
424
  *
458
425
  * @param {object} params - The parameters required to speed up the transaction.
@@ -484,9 +451,9 @@ declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transacti
484
451
  * };
485
452
  * ```
486
453
  */
487
- declare function speedUpTxAction<TR, T extends Transaction<TR>>({ config, tx, }: {
454
+ declare function speedUpTxAction<T extends Transaction>({ config, tx }: {
488
455
  config: Config;
489
456
  tx: T;
490
457
  }): Promise<Hex>;
491
458
 
492
- export { type ActionTxKey, type EVMTrackerParams, GelatoTaskState, type GelatoTaskStatusResponse, type GelatoTxKey, SafeTransactionServiceUrls, type SafeTxStatusResponse, TransactionTracker, cancelTxAction, checkAndInitializeTrackerInStore, checkChainForTx, checkIsGelatoAvailable, checkTransactionsTracker, createViemClient, evmAdapter, evmTracker, evmTrackerForStore, gelatoFetcher, gelatoTrackerForStore, getActiveWalletAndClient, getAddress, getAvatar, getName, gnosisSafeLinksHelper, isEnsName, isGelatoTxKey, safeFetcher, safeSdkOptions, safeTrackerForStore, selectEvmTxExplorerLink, speedUpTxAction };
459
+ export { type EVMTrackerParams, GelatoTaskState, type GelatoTaskStatusResponse, SafeTransactionServiceUrls, type SafeTxStatusResponse, cancelTxAction, checkAndInitializeTrackerInStore, checkChainForTx, checkIsGelatoAvailable, checkTransactionsTracker, createViemClient, evmAdapter, evmTracker, evmTrackerForStore, gelatoFetcher, gelatoTrackerForStore, getActiveWalletAndClient, getAddress, getAvatar, getName, gnosisSafeLinksHelper, isEnsName, isGelatoTxKey, safeFetcher, safeSdkOptions, safeTrackerForStore, selectEvmTxExplorerLink, speedUpTxAction };
package/dist/index.d.ts CHANGED
@@ -1,100 +1,9 @@
1
- import { PollingTrackerConfig, Transaction, ITxTrackingStore, TxAdapter, TransactionPool } from '@tuwaio/pulsar-core';
1
+ import { Transaction, TxAdapter, ITxTrackingStore, ActionTxKey, GelatoTxKey, PollingTrackerConfig, TransactionTracker, TransactionPool } from '@tuwaio/pulsar-core';
2
2
  import { Config, GetAccountReturnType, GetClientReturnType } from '@wagmi/core';
3
3
  import * as viem from 'viem';
4
- import { Hex, Chain, GetTransactionReturnType, TransactionReceipt, Client, ReplacementReturnType, WaitForTransactionReceiptParameters, Address } from 'viem';
4
+ import { Chain, GetTransactionReturnType, TransactionReceipt, Client, ReplacementReturnType, WaitForTransactionReceiptParameters, Hex, Address } from 'viem';
5
5
  import { Chain as Chain$1 } from 'viem/chains';
6
6
 
7
- /**
8
- * @file This file implements the transaction tracking logic for meta-transactions relayed via the Gelato Network.
9
- * It uses a polling mechanism to check the status of a Gelato Task ID from the Gelato API.
10
- */
11
-
12
- /**
13
- * Defines the shape of the identifier for a Gelato transaction task.
14
- */
15
- type GelatoTxKey = {
16
- taskId: string;
17
- };
18
- /**
19
- * A type guard to determine if an ActionTxKey is a GelatoTxKey.
20
- * @param {ActionTxKey} txKey - The transaction key to check.
21
- * @returns {boolean} True if the key is for a Gelato transaction.
22
- */
23
- declare function isGelatoTxKey(txKey: ActionTxKey): txKey is GelatoTxKey;
24
- /**
25
- * Enum representing the possible states of a Gelato task.
26
- * @see https://docs.gelato.network/developer-services/relay/api/get-task-status
27
- */
28
- declare enum GelatoTaskState {
29
- CheckPending = "CheckPending",
30
- ExecPending = "ExecPending",
31
- WaitingForConfirmation = "WaitingForConfirmation",
32
- ExecSuccess = "ExecSuccess",
33
- ExecReverted = "ExecReverted",
34
- Cancelled = "Cancelled",
35
- NotFound = "NotFound"
36
- }
37
- /**
38
- * Defines the shape of the response from the Gelato `getTaskStatus` API endpoint.
39
- */
40
- type GelatoTaskStatusResponse = {
41
- task: {
42
- chainId: number;
43
- taskId: string;
44
- taskState: GelatoTaskState;
45
- creationDate?: string;
46
- executionDate?: string;
47
- transactionHash?: Hex;
48
- blockNumber?: number;
49
- lastCheckMessage?: string;
50
- };
51
- };
52
- /**
53
- * A reusable fetcher function for `initializePollingTracker` that queries the Gelato API for a task's status.
54
- * It handles the logic for interpreting Gelato's task states and calls the appropriate polling callbacks.
55
- */
56
- declare const gelatoFetcher: PollingTrackerConfig<GelatoTaskStatusResponse, Transaction<TransactionTracker>, TransactionTracker>['fetcher'];
57
- /**
58
- * A higher-level wrapper that integrates the Gelato polling logic with the Pulsar store.
59
- * It uses the generic `gelatoFetcher` and provides store-specific callbacks.
60
- *
61
- * @template T - The application-specific transaction type.
62
- */
63
- declare function gelatoTrackerForStore<T extends Transaction<TransactionTracker>>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
64
- tx: T;
65
- }): void;
66
-
67
- /**
68
- * @file This file defines types and enums specific to the EVM (Ethereum Virtual Machine) adapter.
69
- * It includes identifiers for different tracking strategies and the shape of transaction keys
70
- * used within the EVM ecosystem.
71
- */
72
-
73
- /**
74
- * Enum representing the different tracking strategies available for EVM transactions.
75
- * Each tracker corresponds to a specific method of monitoring a transaction's lifecycle.
76
- */
77
- declare enum TransactionTracker {
78
- /** For standard on-chain EVM transactions tracked by their hash. */
79
- Ethereum = "ethereum",
80
- /** For multi-signature transactions managed and executed via a Safe contract. */
81
- Safe = "safe",
82
- /** For meta-transactions relayed and executed by the Gelato Network. */
83
- Gelato = "gelato"
84
- }
85
- /**
86
- * A union type representing the unique identifier returned by an `actionFunction`
87
- * after a transaction is submitted to the network or a relay service.
88
- *
89
- * This key is crucial for the EVM adapter to determine which tracker should
90
- * monitor the transaction.
91
- *
92
- * It can be one of the following:
93
- * - A standard `0x...` transaction hash (`Hex`).
94
- * - A structured object from a relay service like Gelato (`GelatoTxKey`).
95
- */
96
- type ActionTxKey = Hex | GelatoTxKey;
97
-
98
7
  /**
99
8
  * @file This file contains the factory function for creating the EVM (Ethereum Virtual Machine) transaction adapter.
100
9
  * This adapter encapsulates all the logic required to interact with EVM-based chains using wagmi.
@@ -111,11 +20,11 @@ type ActionTxKey = Hex | GelatoTxKey;
111
20
  * @param {Config} config - The wagmi configuration object.
112
21
  * @param {Chain[]} appChains - An array of viem `Chain` objects supported by the application.
113
22
  *
114
- * @returns {TxAdapter<TransactionTracker, T, ActionTxKey>} The configured EVM transaction adapter.
23
+ * @returns {TxAdapter<T>} The configured EVM transaction adapter.
115
24
  *
116
25
  * @throws {Error} Throws an error if the wagmi `config` is not provided.
117
26
  */
118
- declare function evmAdapter<T extends Transaction<TransactionTracker>>(config: Config, appChains: Chain[]): TxAdapter<TransactionTracker, T, ActionTxKey>;
27
+ declare function evmAdapter<T extends Transaction>(config: Config, appChains: Chain[]): TxAdapter<T>;
119
28
 
120
29
  /**
121
30
  * @file This file contains the tracker implementation for standard EVM transactions.
@@ -127,7 +36,7 @@ declare function evmAdapter<T extends Transaction<TransactionTracker>>(config: C
127
36
  * Defines the parameters for the low-level EVM transaction tracker.
128
37
  */
129
38
  type EVMTrackerParams = {
130
- tx: Pick<Transaction<TransactionTracker>, 'chainId' | 'txKey'>;
39
+ tx: Pick<Transaction, 'chainId' | 'txKey'>;
131
40
  chains: Chain[];
132
41
  onTxDetailsFetched: (txDetails: GetTransactionReturnType) => void;
133
42
  onSuccess: (txDetails: GetTransactionReturnType, receipt: TransactionReceipt, client: Client) => Promise<void>;
@@ -151,10 +60,64 @@ declare function evmTracker(params: EVMTrackerParams): Promise<void>;
151
60
  *
152
61
  * @template T - The application-specific transaction type.
153
62
  */
154
- declare function evmTrackerForStore<T extends Transaction<TransactionTracker>>(params: Pick<EVMTrackerParams, 'chains'> & Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks'> & {
63
+ declare function evmTrackerForStore<T extends Transaction>(params: Pick<EVMTrackerParams, 'chains'> & Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks'> & {
155
64
  tx: T;
156
65
  }): Promise<void>;
157
66
 
67
+ /**
68
+ * @file This file implements the transaction tracking logic for meta-transactions relayed via the Gelato Network.
69
+ * It uses a polling mechanism to check the status of a Gelato Task ID from the Gelato API.
70
+ */
71
+
72
+ /**
73
+ * A type guard to determine if an ActionTxKey is a GelatoTxKey.
74
+ * @param {ActionTxKey} txKey - The transaction key to check.
75
+ * @returns {boolean} True if the key is for a Gelato transaction.
76
+ */
77
+ declare function isGelatoTxKey(txKey: ActionTxKey): txKey is GelatoTxKey;
78
+ /**
79
+ * Enum representing the possible states of a Gelato task.
80
+ * @see https://docs.gelato.network/developer-services/relay/api/get-task-status
81
+ */
82
+ declare enum GelatoTaskState {
83
+ CheckPending = "CheckPending",
84
+ ExecPending = "ExecPending",
85
+ WaitingForConfirmation = "WaitingForConfirmation",
86
+ ExecSuccess = "ExecSuccess",
87
+ ExecReverted = "ExecReverted",
88
+ Cancelled = "Cancelled",
89
+ NotFound = "NotFound"
90
+ }
91
+ /**
92
+ * Defines the shape of the response from the Gelato `getTaskStatus` API endpoint.
93
+ */
94
+ type GelatoTaskStatusResponse = {
95
+ task: {
96
+ chainId: number;
97
+ taskId: string;
98
+ taskState: GelatoTaskState;
99
+ creationDate?: string;
100
+ executionDate?: string;
101
+ transactionHash?: Hex;
102
+ blockNumber?: number;
103
+ lastCheckMessage?: string;
104
+ };
105
+ };
106
+ /**
107
+ * A reusable fetcher function for `initializePollingTracker` that queries the Gelato API for a task's status.
108
+ * It handles the logic for interpreting Gelato's task states and calls the appropriate polling callbacks.
109
+ */
110
+ declare const gelatoFetcher: PollingTrackerConfig<GelatoTaskStatusResponse, Transaction>['fetcher'];
111
+ /**
112
+ * A higher-level wrapper that integrates the Gelato polling logic with the Pulsar store.
113
+ * It uses the generic `gelatoFetcher` and provides store-specific callbacks.
114
+ *
115
+ * @template T - The application-specific transaction type.
116
+ */
117
+ declare function gelatoTrackerForStore<T extends Transaction>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
118
+ tx: T;
119
+ }): void;
120
+
158
121
  /**
159
122
  * @file This file implements the transaction tracking logic for Safe (formerly Gnosis Safe) multisig transactions.
160
123
  * It uses a polling mechanism to query the Safe Transaction Service API for the status of a `safeTxHash`.
@@ -177,14 +140,14 @@ type SafeTxStatusResponse = {
177
140
  * A reusable fetcher for `initializePollingTracker` that queries the Safe Transaction Service API.
178
141
  * It handles the complex logic of detecting executed, failed, and replaced multisig transactions.
179
142
  */
180
- declare const safeFetcher: PollingTrackerConfig<SafeTxStatusResponse, Transaction<TransactionTracker>, TransactionTracker>['fetcher'];
143
+ declare const safeFetcher: PollingTrackerConfig<SafeTxStatusResponse, Transaction>['fetcher'];
181
144
  /**
182
145
  * A higher-level wrapper that integrates the Safe polling logic with the Pulsar store.
183
146
  * It uses the generic `safeFetcher` and provides store-specific callbacks.
184
147
  *
185
148
  * @template T - The application-specific transaction type.
186
149
  */
187
- declare function safeTrackerForStore<T extends Transaction<TransactionTracker>>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
150
+ declare function safeTrackerForStore<T extends Transaction>({ tx, transactionsPool, updateTxParams, onSucceedCallbacks, removeTxFromPool, }: Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
188
151
  tx: T;
189
152
  }): void;
190
153
 
@@ -227,7 +190,7 @@ declare function safeTrackerForStore<T extends Transaction<TransactionTracker>>(
227
190
  * };
228
191
  * ```
229
192
  */
230
- declare function cancelTxAction<T extends Transaction<any>>({ config, tx, }: {
193
+ declare function cancelTxAction<T extends Transaction>({ config, tx }: {
231
194
  config: Config;
232
195
  tx: T;
233
196
  }): Promise<Hex>;
@@ -241,7 +204,7 @@ declare function cancelTxAction<T extends Transaction<any>>({ config, tx, }: {
241
204
  * The parameters required to initialize a tracker.
242
205
  * @template T - The application-specific transaction type.
243
206
  */
244
- type InitializeTrackerParams<T extends Transaction<TransactionTracker>> = Pick<ITxTrackingStore<TransactionTracker, T, ActionTxKey>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
207
+ type InitializeTrackerParams<T extends Transaction> = Pick<ITxTrackingStore<T>, 'transactionsPool' | 'updateTxParams' | 'onSucceedCallbacks' | 'removeTxFromPool'> & {
245
208
  chains: Chain[];
246
209
  tx: T;
247
210
  tracker: TransactionTracker;
@@ -255,7 +218,7 @@ type InitializeTrackerParams<T extends Transaction<TransactionTracker>> = Pick<I
255
218
  * @param {InitializeTrackerParams<T>} params - The parameters for initializing the tracker.
256
219
  * @returns {Promise<void>} A promise that resolves once the tracking process has been successfully initiated.
257
220
  */
258
- declare function checkAndInitializeTrackerInStore<T extends Transaction<TransactionTracker>>({ tracker, tx, chains, ...rest }: InitializeTrackerParams<T>): Promise<void>;
221
+ declare function checkAndInitializeTrackerInStore<T extends Transaction>({ tracker, tx, chains, ...rest }: InitializeTrackerParams<T>): Promise<void>;
259
222
 
260
223
  /**
261
224
  * @file This file contains a utility to ensure the user's wallet is connected to the correct chain before proceeding with a transaction.
@@ -431,18 +394,23 @@ declare const SafeTransactionServiceUrls: Record<number, string>;
431
394
  * Generates a URL to a block explorer or Safe UI for a given transaction.
432
395
  * It handles different URL structures for standard EVM transactions and Safe multi-sig transactions.
433
396
  *
434
- * @template TR - The generic type for the tracker identifier.
435
- * @template T - The transaction type.
397
+ * @template T - The transaction type, extending the base `Transaction`.
436
398
  *
437
- * @param {TransactionPool<TR, T>} transactionsPool - The entire pool of transactions from the store.
438
- * @param {Chain[]} chains - An array of supported chain objects, typically from `viem/chains`.
439
- * @param {Hex} txKey - The unique key (`txKey`) of the transaction for which to generate the link.
440
- * @param {Hex} [replacedTxHash] - Optional. If this is a speed-up/cancel transaction, this is the hash of the new transaction.
399
+ * @param {object} params - The parameters for the selection.
400
+ * @param {TransactionPool<T>} params.transactionsPool - The entire pool of transactions from the store.
401
+ * @param {Chain[]} params.chains - An array of supported chain objects, typically from `viem/chains`.
402
+ * @param {Hex} params.txKey - The unique key (`txKey`) of the transaction for which to generate the link.
403
+ * @param {Hex} [params.replacedTxHash] - Optional. If this is a speed-up/cancel transaction, this is the hash of the new transaction.
441
404
  *
442
405
  * @returns {string} The full URL to the transaction on the corresponding block explorer or Safe app,
443
406
  * or an empty string if the transaction or required chain configuration is not found.
444
407
  */
445
- declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transactionsPool: TransactionPool<TR, T>, chains: Chain[], txKey: Hex, replacedTxHash?: Hex) => string;
408
+ declare const selectEvmTxExplorerLink: <T extends Transaction>({ transactionsPool, chains, txKey, replacedTxHash, }: {
409
+ transactionsPool: TransactionPool<T>;
410
+ chains: Chain[];
411
+ txKey: Hex;
412
+ replacedTxHash?: Hex;
413
+ }) => string;
446
414
 
447
415
  /**
448
416
  * @file This file contains a utility function for speeding up a pending EVM transaction.
@@ -452,7 +420,6 @@ declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transacti
452
420
  * Speeds up a pending EVM transaction by resubmitting it with the same nonce but higher gas fees.
453
421
  * This function is designed to work with wagmi's configuration and actions.
454
422
  *
455
- * @template TR - The type of the tracker identifier.
456
423
  * @template T - The transaction type, which must be a valid EVM transaction.
457
424
  *
458
425
  * @param {object} params - The parameters required to speed up the transaction.
@@ -484,9 +451,9 @@ declare const selectEvmTxExplorerLink: <TR, T extends Transaction<TR>>(transacti
484
451
  * };
485
452
  * ```
486
453
  */
487
- declare function speedUpTxAction<TR, T extends Transaction<TR>>({ config, tx, }: {
454
+ declare function speedUpTxAction<T extends Transaction>({ config, tx }: {
488
455
  config: Config;
489
456
  tx: T;
490
457
  }): Promise<Hex>;
491
458
 
492
- export { type ActionTxKey, type EVMTrackerParams, GelatoTaskState, type GelatoTaskStatusResponse, type GelatoTxKey, SafeTransactionServiceUrls, type SafeTxStatusResponse, TransactionTracker, cancelTxAction, checkAndInitializeTrackerInStore, checkChainForTx, checkIsGelatoAvailable, checkTransactionsTracker, createViemClient, evmAdapter, evmTracker, evmTrackerForStore, gelatoFetcher, gelatoTrackerForStore, getActiveWalletAndClient, getAddress, getAvatar, getName, gnosisSafeLinksHelper, isEnsName, isGelatoTxKey, safeFetcher, safeSdkOptions, safeTrackerForStore, selectEvmTxExplorerLink, speedUpTxAction };
459
+ export { type EVMTrackerParams, GelatoTaskState, type GelatoTaskStatusResponse, SafeTransactionServiceUrls, type SafeTxStatusResponse, cancelTxAction, checkAndInitializeTrackerInStore, checkChainForTx, checkIsGelatoAvailable, checkTransactionsTracker, createViemClient, evmAdapter, evmTracker, evmTrackerForStore, gelatoFetcher, gelatoTrackerForStore, getActiveWalletAndClient, getAddress, getAvatar, getName, gnosisSafeLinksHelper, isEnsName, isGelatoTxKey, safeFetcher, safeSdkOptions, safeTrackerForStore, selectEvmTxExplorerLink, speedUpTxAction };