Getting Started
Learn how to integrate ZKsync SSO into your app.
Integrating ZKsync SSO into your app requires minimal amount of changes.
ZKsync SSO can be used standalone or added as one of the options in the onboarding library of your choice.
Quick Start
Just 2 steps:
- Install the ZKsync SSO SDK package.
npm i zksync-sso
- Add ZKsync SSO connector to your app.
import { zksyncSepoliaTestnet } from "viem/chains"; import { createConfig, connect } from "@wagmi/core"; import { zksyncAccountConnector } from "zksync-sso/connector"; const ssoConnector = zksyncAccountConnector({ // Optional session configuration, if omitted user will have to sign every transaction via Auth Server session: { feeLimit: parseEther("0.1"), // Allow ETH transfers to a specific address: transfers: [ { to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A", valueLimit: parseEther("0.1"), }, ], // Allow calling specific smart contracts (e.g. ERC20 transfer): contractCalls: [ { address: "0xa1cf087DB965Ab02Fb3CFaCe1f5c63935815f044", // Contract address function: "transfer(address,uint256)", // Optional call constraints (unconstrained othewise): constraints: [ { index: 0, condition: "Equal", refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", // Only allow transfers to this address }, { index: 1, condition: "LessEqual", refValue: toHex(parseUnits("0.1", TOKEN.decimals), { size: 32 }), // Limit the transfer amount to 0.1 tokens }, ], } ], }, }); const wagmiConfig = createConfig({ connectors: [ssoConnector], ..., // your wagmi config https://wagmi.sh/core/api/createConfig }); const connectWithSSO = () => { connect(wagmiConfig, { connector: ssoConnector, chainId: zksyncSepoliaTestnet.id, // or another chain id that has SSO support }); };
Interfaces
You can find the full list of options and their descriptions in the Interfaces section.
Examples
We provide several example apps to help you get started quickly. Find them on our GitHub repository.