[SDK] Viem's sendEip712Transaction
not working with hoisted Local Account
#807
-
Team or ProjectLens Network Select the SDKJavaScript EnvironmentTestnet Issue DescriptionAlthough mentioned in the TS doc, the It errors with: file://[OMITTED]/node_modules/.pnpm/[email protected][email protected]/node_modules/viem/_esm/zksync/actions/sendEip712Transaction.js:54
throw new AccountNotFoundError({
^
AccountNotFoundError: Could not find an Account to execute with this Action.
Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client.
Docs: https://viem.sh/docs/actions/wallet/sendTransaction#account
Version: [email protected]
at Module.sendEip712Transaction (file://[OMITTED]/node_modules/.pnpm/[email protected][email protected]/node_modules/viem/zksync/actions/sendEip712Transaction.ts:98:11)
at [OMITTED]/index.ts:32:20
at ViteNodeRunner.runModule (file://[OMITTED]/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/client.mjs:362:5)
at ViteNodeRunner.directRequest (file://[OMITTED]/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/client.mjs:346:5)
at ViteNodeRunner.cachedRequest (file://[OMITTED]/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/client.mjs:189:14)
at ViteNodeRunner.executeFile (file://[OMITTED]/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/client.mjs:161:12)
at CAC.run (file://[OMITTED]/node_modules/.pnpm/[email protected]/node_modules/vite-node/dist/cli.mjs:91:5) {
details: undefined,
docsPath: '/docs/actions/wallet/sendTransaction',
metaMessages: undefined,
shortMessage: 'Could not find an Account to execute with this Action.\n' +
'Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client.',
version: '2.21.53'
} Expected BehaviorIt should sign and send the transaction. Code Exampleimport { chains } from '@lens-network/sdk/viem';
import { parseAbi, Hex, createWalletClient, http, encodeFunctionData } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { eip712WalletActions, getGeneralPaymasterInput, sendEip712Transaction } from 'viem/zksync';
const chain = chains.testnet;
const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
const walletClient = createWalletClient({
account,
chain,
transport: http(),
}).extend(eip712WalletActions())
const abi = parseAbi([
"function ping()"
]);
const hash = await sendEip712Transaction(walletClient, {
to: '0x06a71429d153026a0F3bAdf481c216FDfe2d0629',
data: encodeFunctionData({
abi: abi,
functionName: 'ping'
}),
paymaster: '0xE6b37F099439ED1Eb38a97b909E9AD0ad74270Af',
paymasterInput: getGeneralPaymasterInput({
innerInput: '0x',
})
}) deps:
Repo Link (Optional)No response |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
It appears that the error you're encountering with the Here are a few steps to troubleshoot and potentially resolve this issue:
If after these checks the issue still persists, it might be beneficial to reach out directly to the Viem support or check if there are any open issues in their repository that might be related to this problem. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
Will check this out and get back to you |
Beta Was this translation helpful? Give feedback.
-
@cesarenaldi https://github.com/ondefy/paymaster-mobile-workaround/blob/07ab86fec551dacd3458d55be6b9d41ae2a33cc5/src/app/page.tsx#L66-L85 |
Beta Was this translation helpful? Give feedback.
-
There is an open PR for fixing account hoisting with |
Beta Was this translation helpful? Give feedback.
There is an open PR for fixing account hoisting with
sendEip712Transaction
andsignEip712Transaction
actions.