Skip to content

Sponsored EOA Transactions (native AA on zksync chains) #827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"prisma": "^5.14.0",
"prom-client": "^15.1.3",
"superjson": "^2.2.1",
"thirdweb": "^5.80.1-nightly-c948e71a16b5e27e10b417cd0ef9cece70179a57-20250104000328",
"thirdweb": "^5.83.0",
"uuid": "^9.0.1",
"viem": "^2.21.54",
"winston": "^3.14.1",
Expand Down
3 changes: 3 additions & 0 deletions sdk/src/services/AccountFactoryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export class AccountFactoryService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was thinking it could also be used to turn sponsoring on/off for smart wallets. Fine for now though

* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -215,6 +216,7 @@ export class AccountFactoryService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -237,6 +239,7 @@ export class AccountFactoryService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand Down
15 changes: 15 additions & 0 deletions sdk/src/services/AccountService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class AccountService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -132,6 +133,7 @@ export class AccountService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -153,6 +155,7 @@ export class AccountService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand All @@ -179,6 +182,7 @@ export class AccountService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -223,6 +227,7 @@ export class AccountService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -244,6 +249,7 @@ export class AccountService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand All @@ -270,6 +276,7 @@ export class AccountService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -318,6 +325,7 @@ export class AccountService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -339,6 +347,7 @@ export class AccountService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand All @@ -365,6 +374,7 @@ export class AccountService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -409,6 +419,7 @@ export class AccountService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -430,6 +441,7 @@ export class AccountService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand All @@ -456,6 +468,7 @@ export class AccountService {
* @param requestBody
* @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.
* @param xIdempotencyKey Transactions submitted with the same idempotency key will be de-duplicated. Only the last 100000 transactions are compared.
* @param xTransactionMode Transaction mode to use for EOA transactions. Will be ignored if using a smart wallet. If omitted, defaults to regular EOA transactions.
* @param xAccountAddress Smart account address
* @param xAccountFactoryAddress Smart account factory address. If omitted, Engine will try to resolve it from the contract.
* @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.
Expand Down Expand Up @@ -504,6 +517,7 @@ export class AccountService {
},
simulateTx: boolean = false,
xIdempotencyKey?: string,
xTransactionMode?: 'sponsored',
xAccountAddress?: string,
xAccountFactoryAddress?: string,
xAccountSalt?: string,
Expand All @@ -525,6 +539,7 @@ export class AccountService {
headers: {
'x-backend-wallet-address': xBackendWalletAddress,
'x-idempotency-key': xIdempotencyKey,
'x-transaction-mode': xTransactionMode,
'x-account-address': xAccountAddress,
'x-account-factory-address': xAccountFactoryAddress,
'x-account-salt': xAccountSalt,
Expand Down
Loading
Loading