Skip to content

Commit 9e2270d

Browse files
authored
Sponsored EOA Transactions (native AA on zksync chains) (#827)
* upgrade SDK * add header to all v5 endpoints + fix SDK upgrade type incompatibilities * autogen SDK changes * fix typo Signed-off-by: Prithvish Baidya <deformercoding@gmail.com> --------- Signed-off-by: Prithvish Baidya <deformercoding@gmail.com>
1 parent 68c0a4d commit 9e2270d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+455
-57
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"prisma": "^5.14.0",
6868
"prom-client": "^15.1.3",
6969
"superjson": "^2.2.1",
70-
"thirdweb": "^5.80.1-nightly-c948e71a16b5e27e10b417cd0ef9cece70179a57-20250104000328",
70+
"thirdweb": "^5.83.0",
7171
"uuid": "^9.0.1",
7272
"viem": "^2.21.54",
7373
"winston": "^3.14.1",

sdk/src/services/AccountFactoryService.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export class AccountFactoryService {
167167
* @param requestBody
168168
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
169169
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
170+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
170171
* @param xAccountAddress Smart account address
171172
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
172173
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -215,6 +216,7 @@ export class AccountFactoryService {
215216
},
216217
simulateTx: boolean = false,
217218
xIdempotencyKey?: string,
219+
xTransactionMode?: 'sponsored',
218220
xAccountAddress?: string,
219221
xAccountFactoryAddress?: string,
220222
xAccountSalt?: string,
@@ -237,6 +239,7 @@ export class AccountFactoryService {
237239
headers: {
238240
'x-backend-wallet-address': xBackendWalletAddress,
239241
'x-idempotency-key': xIdempotencyKey,
242+
'x-transaction-mode': xTransactionMode,
240243
'x-account-address': xAccountAddress,
241244
'x-account-factory-address': xAccountFactoryAddress,
242245
'x-account-salt': xAccountSalt,

sdk/src/services/AccountService.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ export class AccountService {
8888
* @param requestBody
8989
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
9090
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
91+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
9192
* @param xAccountAddress Smart account address
9293
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
9394
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -132,6 +133,7 @@ export class AccountService {
132133
},
133134
simulateTx: boolean = false,
134135
xIdempotencyKey?: string,
136+
xTransactionMode?: 'sponsored',
135137
xAccountAddress?: string,
136138
xAccountFactoryAddress?: string,
137139
xAccountSalt?: string,
@@ -153,6 +155,7 @@ export class AccountService {
153155
headers: {
154156
'x-backend-wallet-address': xBackendWalletAddress,
155157
'x-idempotency-key': xIdempotencyKey,
158+
'x-transaction-mode': xTransactionMode,
156159
'x-account-address': xAccountAddress,
157160
'x-account-factory-address': xAccountFactoryAddress,
158161
'x-account-salt': xAccountSalt,
@@ -179,6 +182,7 @@ export class AccountService {
179182
* @param requestBody
180183
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
181184
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
185+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
182186
* @param xAccountAddress Smart account address
183187
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
184188
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -223,6 +227,7 @@ export class AccountService {
223227
},
224228
simulateTx: boolean = false,
225229
xIdempotencyKey?: string,
230+
xTransactionMode?: 'sponsored',
226231
xAccountAddress?: string,
227232
xAccountFactoryAddress?: string,
228233
xAccountSalt?: string,
@@ -244,6 +249,7 @@ export class AccountService {
244249
headers: {
245250
'x-backend-wallet-address': xBackendWalletAddress,
246251
'x-idempotency-key': xIdempotencyKey,
252+
'x-transaction-mode': xTransactionMode,
247253
'x-account-address': xAccountAddress,
248254
'x-account-factory-address': xAccountFactoryAddress,
249255
'x-account-salt': xAccountSalt,
@@ -270,6 +276,7 @@ export class AccountService {
270276
* @param requestBody
271277
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
272278
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
279+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
273280
* @param xAccountAddress Smart account address
274281
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
275282
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -318,6 +325,7 @@ export class AccountService {
318325
},
319326
simulateTx: boolean = false,
320327
xIdempotencyKey?: string,
328+
xTransactionMode?: 'sponsored',
321329
xAccountAddress?: string,
322330
xAccountFactoryAddress?: string,
323331
xAccountSalt?: string,
@@ -339,6 +347,7 @@ export class AccountService {
339347
headers: {
340348
'x-backend-wallet-address': xBackendWalletAddress,
341349
'x-idempotency-key': xIdempotencyKey,
350+
'x-transaction-mode': xTransactionMode,
342351
'x-account-address': xAccountAddress,
343352
'x-account-factory-address': xAccountFactoryAddress,
344353
'x-account-salt': xAccountSalt,
@@ -365,6 +374,7 @@ export class AccountService {
365374
* @param requestBody
366375
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
367376
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
377+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
368378
* @param xAccountAddress Smart account address
369379
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
370380
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -409,6 +419,7 @@ export class AccountService {
409419
},
410420
simulateTx: boolean = false,
411421
xIdempotencyKey?: string,
422+
xTransactionMode?: 'sponsored',
412423
xAccountAddress?: string,
413424
xAccountFactoryAddress?: string,
414425
xAccountSalt?: string,
@@ -430,6 +441,7 @@ export class AccountService {
430441
headers: {
431442
'x-backend-wallet-address': xBackendWalletAddress,
432443
'x-idempotency-key': xIdempotencyKey,
444+
'x-transaction-mode': xTransactionMode,
433445
'x-account-address': xAccountAddress,
434446
'x-account-factory-address': xAccountFactoryAddress,
435447
'x-account-salt': xAccountSalt,
@@ -456,6 +468,7 @@ export class AccountService {
456468
* @param requestBody
457469
* @param simulateTx Simulates the transaction before adding it to the queue, returning an error if it fails simulation. Note: This step is less performant and recommended only for debugging purposes.
458470
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
471+
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
459472
* @param xAccountAddress Smart account address
460473
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
461474
* @param xAccountSalt Smart account salt as string or hex. This is used to predict the smart account address. Useful when creating multiple accounts with the same admin and only needed when deploying the account as part of a userop.
@@ -504,6 +517,7 @@ export class AccountService {
504517
},
505518
simulateTx: boolean = false,
506519
xIdempotencyKey?: string,
520+
xTransactionMode?: 'sponsored',
507521
xAccountAddress?: string,
508522
xAccountFactoryAddress?: string,
509523
xAccountSalt?: string,
@@ -525,6 +539,7 @@ export class AccountService {
525539
headers: {
526540
'x-backend-wallet-address': xBackendWalletAddress,
527541
'x-idempotency-key': xIdempotencyKey,
542+
'x-transaction-mode': xTransactionMode,
528543
'x-account-address': xAccountAddress,
529544
'x-account-factory-address': xAccountFactoryAddress,
530545
'x-account-salt': xAccountSalt,

0 commit comments

Comments
 (0)