-
Notifications
You must be signed in to change notification settings - Fork 91
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
Conversation
We're building your pull request over on Zeet. |
@@ -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. |
There was a problem hiding this comment.
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
@@ -1652,6 +1687,7 @@ export class Erc20Service { | |||
headers: { | |||
'x-backend-wallet-address': xBackendWalletAddress, | |||
'x-idempotency-key': xIdempotencyKey, | |||
'x-transaction-mode': xTransactionMode, | |||
'x-account-address': xAccountAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mam so much repetition to add a header. Feels like it should be centralized
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fully agreed. My hono + zod refactor fixes a bunch of these issues
src/server/schemas/wallet/index.ts
Outdated
Type.Union( | ||
[ | ||
Type.Literal("sponsored", { | ||
description: "Attmpt to use native AA on ZKSync chains", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in Attempt
import { hashTypedData } from "viem"; | ||
import { getChain } from "../../../shared/utils/chain"; // Adjust import path as needed | ||
|
||
type SendTransactionResult = { | ||
transactionHash: Hex; | ||
}; | ||
|
||
type SendTransactionOption = TransactionSerializable & { | ||
type SerializableTransaction = Awaited< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we already have this type exported in the SDK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exported, hance the struggle 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just export it! Put up a PR we can get it out today
chainId, | ||
from, | ||
}); | ||
|
||
if (transaction.transactionMode === "sponsored") { | ||
if (!isZkSyncChain(chain)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we could let it through if using a smart backend wallet for example
closes TOOL-3001
PR-Codex overview
This PR focuses on updating the
thirdweb
dependency and enhancing transaction handling by introducing a newx-transaction-mode
header to manage transaction modes more effectively, particularly for sponsored transactions.Detailed summary
thirdweb
version from5.80.1-nightly
to5.83.0
.transactionMode
property intypes.ts
for transaction handling.x-transaction-mode
header across multiple routes to specify transaction mode.transactionMode
in their parameters.sponsored
transaction mode in various services.