1
1
import type * as ox__TypedData from "ox/TypedData" ;
2
+ import { trackTransaction } from "../../analytics/track/transaction.js" ;
2
3
import type { Chain } from "../../chains/types.js" ;
3
4
import { getCachedChain } from "../../chains/utils.js" ;
4
5
import type { ThirdwebClient } from "../../client/client.js" ;
@@ -251,7 +252,8 @@ async function createSmartAccount(
251
252
transaction,
252
253
executeOverride : options . overrides ?. execute ,
253
254
} ) ;
254
- return _sendUserOp ( {
255
+
256
+ const result = await _sendUserOp ( {
255
257
executeTx,
256
258
options : {
257
259
...options ,
@@ -263,21 +265,39 @@ async function createSmartAccount(
263
265
} ,
264
266
} ,
265
267
} ) ;
268
+ trackTransaction ( {
269
+ client : options . client ,
270
+ chainId : options . chain . id ,
271
+ transactionHash : result . transactionHash ,
272
+ walletAddress : options . accountContract . address ,
273
+ walletType : "smart" ,
274
+ contractAddress : transaction . to ?? undefined ,
275
+ } ) ;
276
+ return result ;
266
277
} ,
267
278
async sendBatchTransaction ( transactions : SendTransactionOption [ ] ) {
268
279
const executeTx = prepareBatchExecute ( {
269
280
accountContract,
270
281
transactions,
271
282
executeBatchOverride : options . overrides ?. executeBatch ,
272
283
} ) ;
273
- return _sendUserOp ( {
284
+ const result = await _sendUserOp ( {
274
285
executeTx,
275
286
options : {
276
287
...options ,
277
288
chain : getCachedChain ( transactions [ 0 ] ?. chainId ?? options . chain . id ) ,
278
289
accountContract,
279
290
} ,
280
291
} ) ;
292
+ trackTransaction ( {
293
+ client : options . client ,
294
+ chainId : options . chain . id ,
295
+ transactionHash : result . transactionHash ,
296
+ walletAddress : options . accountContract . address ,
297
+ walletType : "smart" ,
298
+ contractAddress : transactions [ 0 ] ?. to ?? undefined ,
299
+ } ) ;
300
+ return result ;
281
301
} ,
282
302
async signMessage ( { message } : { message : SignableMessage } ) {
283
303
if ( options . overrides ?. signMessage ) {
@@ -433,6 +453,16 @@ function createZkSyncAccount(args: {
433
453
transaction : serializableTransaction ,
434
454
signedTransaction,
435
455
} ) ;
456
+
457
+ trackTransaction ( {
458
+ client : connectionOptions . client ,
459
+ chainId : chain . id ,
460
+ transactionHash : txHash . transactionHash ,
461
+ walletAddress : account . address ,
462
+ walletType : "smart" ,
463
+ contractAddress : transaction . to ?? undefined ,
464
+ } ) ;
465
+
436
466
return {
437
467
transactionHash : txHash . transactionHash ,
438
468
client : connectionOptions . client ,
0 commit comments