🚀 Stablecoin Accounts are live! Learn more
Learn how to use zkSync account abstraction with global wallets and sessions
import { createGlobalWalletClient } from '@dynamic-labs/global-wallet-client'; const globalWalletClient = createGlobalWalletClient({ environmentId: '<GLOBAL WALLET ENVIRONMENT ID>', popup: { url: '<GLOBAL WALLET DOMAIN>', width: 400, height: 600, }, }); const globalWalletClient = useMemo(() => getGlobalWalletClient(), [getGlobalWalletClient]); const wallet = globalWalletClient.wallets[0];
import { createZksyncSession, } from '@dynamic-labs/global-wallet-client/zksync'; ... const createSession = async () => { if (!wallet) { return; } const { sessionId, // session hash expiresAt, session: { sessionConfiguration, // session configuration w/ bigints as string sessionKey, // registered session private key sessionKeyValidator // session key validator contract address } } = await createZksyncSession(wallet, { sessionConfig: <YOUR SESSION CONFIGURATION HERE> }); } ...
import { listZksyncSessions, } from '@dynamic-labs/global-wallet-client/zksync'; ... const listSessions = async () => { if (!wallet) { return; } const sessions = listZksyncSessions(wallet); ... }
import { revokeZksyncSession } from '@dynamic-labs/global-wallet-client/zksync'; const revokeSession = async (sessionId: string) => { if (!wallet) { return; } await revokeZksyncSession(wallet, { sessionId }); alert('session revoked'); }
Was this page helpful?