diff --git a/docs/pages/sdk/advanced/defi.mdx b/docs/pages/advanced/defi.mdx similarity index 88% rename from docs/pages/sdk/advanced/defi.mdx rename to docs/pages/advanced/defi.mdx index ab31122d..83d3c802 100644 --- a/docs/pages/sdk/advanced/defi.mdx +++ b/docs/pages/advanced/defi.mdx @@ -12,14 +12,14 @@ By allowing you to swap between base tokens and DeFi tokens, you can easily: - Swap between any token pairs. - Entering and exiting DeFi positions (staking, lending, etc.) -ZeroDev leverages [batching](/sdk/core-api/batch-transactions) and [delegatecall](/sdk/core-api/delegatecall) internally to ensure that even complex routes are executed in one atomic UserOp, providing the user with low latency, low gas cost, and high safety. +ZeroDev leverages [batching](/smart-accounts/batch-transactions) and [delegatecall](/advanced/delegatecall) internally to ensure that even complex routes are executed in one atomic UserOp, providing the user with low latency, low gas cost, and high safety. ## Supported Tokens See the full lists of supported base tokens and DeFi tokens: -- [Base tokens](/sdk/advanced/supported-base-tokens) -- [DeFi tokens (protocols)](/sdk/advanced/supported-defi-tokens) +- [Base tokens](/cross-chain/chain-abstraction/supported-base-tokens) +- [DeFi tokens (protocols)](/cross-chain/chain-abstraction/supported-defi-tokens) ## Installation @@ -61,7 +61,7 @@ const defiClient = createKernelDefiClient(kernelClient, projectId) Where: -- `kernelClient` is the [account client](/sdk/core-api/create-account#create-an-account-client) object. +- `kernelClient` is the [account client](/smart-accounts/create-a-smart-account#create-an-account-client) object. - `projectId` is your ZeroDev project ID, obtained from the dashboard. ### Swapping Tokens @@ -161,10 +161,10 @@ const accountBalances = await defiClient.listTokenBalances({ The `gasToken` flag specifies how gas is paid for the UserOp. It can be one of the following values: - `sponsored`: sponsor the UserOp. -- `fromToken`: pays gas in the input token, using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). -- `toToken`: pays gas in the output token, using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). +- `fromToken`: pays gas in the input token, using a [ERC20 paymaster](/smart-accounts/pay-gas-with-erc20s). +- `toToken`: pays gas in the output token, using a [ERC20 paymaster](/smart-accounts/pay-gas-with-erc20s). - `native`: pays gas in the native token, using the account's balance. -- You can also specify an `Address` for a ERC20 token, to pay gas with that token using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). +- You can also specify an `Address` for a ERC20 token, to pay gas with that token using a [ERC20 paymaster](/smart-accounts/pay-gas-with-erc20s). ### Getting the UserOp without sending diff --git a/docs/pages/sdk/core-api/delegatecall.mdx b/docs/pages/advanced/delegatecall.mdx similarity index 100% rename from docs/pages/sdk/core-api/delegatecall.mdx rename to docs/pages/advanced/delegatecall.mdx diff --git a/docs/pages/sdk/core-api/deploy-contract.mdx b/docs/pages/advanced/deploy-contract.mdx similarity index 100% rename from docs/pages/sdk/core-api/deploy-contract.mdx rename to docs/pages/advanced/deploy-contract.mdx diff --git a/docs/pages/sdk/advanced/fallback-providers.mdx b/docs/pages/advanced/fallback-providers.mdx similarity index 97% rename from docs/pages/sdk/advanced/fallback-providers.mdx rename to docs/pages/advanced/fallback-providers.mdx index 2928901b..335ac183 100644 --- a/docs/pages/sdk/advanced/fallback-providers.mdx +++ b/docs/pages/advanced/fallback-providers.mdx @@ -78,7 +78,7 @@ In the previous example, we used different providers as fallbacks through ZeroDe To do that, simply: -- [Set up a Kernel account client with Pimlico](/sdk/infra/pimlico). +- [Set up a Kernel account client with Pimlico](/resources/infrastructure/pimlico). Then combine them with `createFallbackKernelAccountClient`: diff --git a/docs/pages/sdk/advanced/go-sdk.mdx b/docs/pages/advanced/go-sdk.mdx similarity index 100% rename from docs/pages/sdk/advanced/go-sdk.mdx rename to docs/pages/advanced/go-sdk.mdx diff --git a/docs/pages/sdk/advanced/key-storage.mdx b/docs/pages/advanced/key-storage.mdx similarity index 96% rename from docs/pages/sdk/advanced/key-storage.mdx rename to docs/pages/advanced/key-storage.mdx index 21416911..9ed943b8 100644 --- a/docs/pages/sdk/advanced/key-storage.mdx +++ b/docs/pages/advanced/key-storage.mdx @@ -71,7 +71,7 @@ const remoteSigner = await toRemoteSigner({ Since `remoteSigner` is a [Viem account](https://viem.sh/docs/accounts/privateKey), you can use it wherever a Viem account is expected. -For example, to use the remote signer as a [session key](/sdk/permissions/intro): +For example, to use the remote signer as a [session key](/smart-accounts/permissions/intro): ```ts const ecdsaSigner = toECDSASigner({ signer: remoteSigner }) diff --git a/docs/pages/sdk/getting-started/migration.mdx b/docs/pages/advanced/migration.mdx similarity index 98% rename from docs/pages/sdk/getting-started/migration.mdx rename to docs/pages/advanced/migration.mdx index 54ed9e99..a2ef7daf 100644 --- a/docs/pages/sdk/getting-started/migration.mdx +++ b/docs/pages/advanced/migration.mdx @@ -27,7 +27,7 @@ Of course, you can also simply copy the RPC for different chains from the dashbo

-The same RPC can then be used as both the bundler RPC and the paymaster RPC. See [the tutorial](/sdk/getting-started/tutorial#creating-a-kernel-client) for an example. +The same RPC can then be used as both the bundler RPC and the paymaster RPC. See [the tutorial](/get-started/quickstart#creating-a-kernel-client) for an example. ## SDK 5.3.x => 5.4.x diff --git a/docs/pages/sdk/advanced/multi-chain-signing.mdx b/docs/pages/advanced/multi-chain-signing.mdx similarity index 100% rename from docs/pages/sdk/advanced/multi-chain-signing.mdx rename to docs/pages/advanced/multi-chain-signing.mdx diff --git a/docs/pages/sdk/advanced/parallel-orders.mdx b/docs/pages/advanced/parallel-transactions.mdx similarity index 100% rename from docs/pages/sdk/advanced/parallel-orders.mdx rename to docs/pages/advanced/parallel-transactions.mdx diff --git a/docs/pages/react/getting-started.mdx b/docs/pages/advanced/react-hooks/getting-started.mdx similarity index 95% rename from docs/pages/react/getting-started.mdx rename to docs/pages/advanced/react-hooks/getting-started.mdx index e76c1b5f..65e6f369 100644 --- a/docs/pages/react/getting-started.mdx +++ b/docs/pages/advanced/react-hooks/getting-started.mdx @@ -2,7 +2,7 @@ ZeroDev's React SDK is called `@zerodev/waas`, which stands for Wallet-as-a-Service. This is to signal that the React SDK provides higher-level abstractions over the [low-level SDK](/). -The relationship between `@zerodev/waas` and `@zerodev/sdk` is similar to the relationship between Wagmi and Viem. We recommend using `@zerodev/waas` in all React projects, and you can always ["drop down" to the SDK](/react/use-kernelclient) if you want lower-level control. +The relationship between `@zerodev/waas` and `@zerodev/sdk` is similar to the relationship between Wagmi and Viem. We recommend using `@zerodev/waas` in all React projects, and you can always ["drop down" to the SDK](/advanced/react-hooks/use-kernelclient) if you want lower-level control. ## Installation diff --git a/docs/pages/react/use-balance.mdx b/docs/pages/advanced/react-hooks/use-balance.mdx similarity index 94% rename from docs/pages/react/use-balance.mdx rename to docs/pages/advanced/react-hooks/use-balance.mdx index 18848137..447018c3 100644 --- a/docs/pages/react/use-balance.mdx +++ b/docs/pages/advanced/react-hooks/use-balance.mdx @@ -1,4 +1,4 @@ -import QueryResult from "../shared/query-result.mdx" +import QueryResult from "../../shared/query-result.mdx" # useBalance [Hook for getting balance of kernel account] diff --git a/docs/pages/react/use-chainid.mdx b/docs/pages/advanced/react-hooks/use-chainid.mdx similarity index 100% rename from docs/pages/react/use-chainid.mdx rename to docs/pages/advanced/react-hooks/use-chainid.mdx diff --git a/docs/pages/react/use-chains.mdx b/docs/pages/advanced/react-hooks/use-chains.mdx similarity index 100% rename from docs/pages/react/use-chains.mdx rename to docs/pages/advanced/react-hooks/use-chains.mdx diff --git a/docs/pages/react/use-create-basic-session.mdx b/docs/pages/advanced/react-hooks/use-create-basic-session.mdx similarity index 97% rename from docs/pages/react/use-create-basic-session.mdx rename to docs/pages/advanced/react-hooks/use-create-basic-session.mdx index 82478f14..4e629ceb 100644 --- a/docs/pages/react/use-create-basic-session.mdx +++ b/docs/pages/advanced/react-hooks/use-create-basic-session.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useCreateBasicSession [Hook for creating session for kernel v2 account] diff --git a/docs/pages/react/use-create-kernelclient-eoa.mdx b/docs/pages/advanced/react-hooks/use-create-kernelclient-eoa.mdx similarity index 96% rename from docs/pages/react/use-create-kernelclient-eoa.mdx rename to docs/pages/advanced/react-hooks/use-create-kernelclient-eoa.mdx index e150fb90..4729e6a7 100644 --- a/docs/pages/react/use-create-kernelclient-eoa.mdx +++ b/docs/pages/advanced/react-hooks/use-create-kernelclient-eoa.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useCreateKernelClientEOA [Hook for creating kernel client with EOA] diff --git a/docs/pages/react/use-create-kernelclient-passkey.mdx b/docs/pages/advanced/react-hooks/use-create-kernelclient-passkey.mdx similarity index 97% rename from docs/pages/react/use-create-kernelclient-passkey.mdx rename to docs/pages/advanced/react-hooks/use-create-kernelclient-passkey.mdx index e4b3e0fa..cb4a6658 100644 --- a/docs/pages/react/use-create-kernelclient-passkey.mdx +++ b/docs/pages/advanced/react-hooks/use-create-kernelclient-passkey.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useCreateKernelClientPasskey [Hook for creating kernel client with Passkey] diff --git a/docs/pages/react/use-create-kernelclient-social.mdx b/docs/pages/advanced/react-hooks/use-create-kernelclient-social.mdx similarity index 96% rename from docs/pages/react/use-create-kernelclient-social.mdx rename to docs/pages/advanced/react-hooks/use-create-kernelclient-social.mdx index fb458620..b00f7322 100644 --- a/docs/pages/react/use-create-kernelclient-social.mdx +++ b/docs/pages/advanced/react-hooks/use-create-kernelclient-social.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useCreateKernelClientSocial [Hook for creating a kernel client with social login integration] diff --git a/docs/pages/react/use-create-session.mdx b/docs/pages/advanced/react-hooks/use-create-session.mdx similarity index 96% rename from docs/pages/react/use-create-session.mdx rename to docs/pages/advanced/react-hooks/use-create-session.mdx index f55770af..05caf43c 100644 --- a/docs/pages/react/use-create-session.mdx +++ b/docs/pages/advanced/react-hooks/use-create-session.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useCreateSession [Hook for creating session for kernel v3 account] diff --git a/docs/pages/react/use-disconnect-kernelclient.mdx b/docs/pages/advanced/react-hooks/use-disconnect-kernelclient.mdx similarity index 93% rename from docs/pages/react/use-disconnect-kernelclient.mdx rename to docs/pages/advanced/react-hooks/use-disconnect-kernelclient.mdx index 377b0da2..08640084 100644 --- a/docs/pages/react/use-disconnect-kernelclient.mdx +++ b/docs/pages/advanced/react-hooks/use-disconnect-kernelclient.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useDisconnectKernelClient [Hook for disconnecting kernel account client] diff --git a/docs/pages/react/use-kernelclient.mdx b/docs/pages/advanced/react-hooks/use-kernelclient.mdx similarity index 95% rename from docs/pages/react/use-kernelclient.mdx rename to docs/pages/advanced/react-hooks/use-kernelclient.mdx index 7757e6e8..6dc91bf8 100644 --- a/docs/pages/react/use-kernelclient.mdx +++ b/docs/pages/advanced/react-hooks/use-kernelclient.mdx @@ -1,4 +1,4 @@ -import QueryResult from "../shared/query-result.mdx" +import QueryResult from "../../shared/query-result.mdx" # useKernelClient [Hook for getting kernel account client] diff --git a/docs/pages/react/use-send-transaction-with-session.mdx b/docs/pages/advanced/react-hooks/use-send-transaction-with-session.mdx similarity index 97% rename from docs/pages/react/use-send-transaction-with-session.mdx rename to docs/pages/advanced/react-hooks/use-send-transaction-with-session.mdx index 1027f82e..98d864a2 100644 --- a/docs/pages/react/use-send-transaction-with-session.mdx +++ b/docs/pages/advanced/react-hooks/use-send-transaction-with-session.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSendTransactionWithSession [Hooks for sending transactions with session keys] diff --git a/docs/pages/react/use-send-transaction.mdx b/docs/pages/advanced/react-hooks/use-send-transaction.mdx similarity index 97% rename from docs/pages/react/use-send-transaction.mdx rename to docs/pages/advanced/react-hooks/use-send-transaction.mdx index 922410f4..00d06d8f 100644 --- a/docs/pages/react/use-send-transaction.mdx +++ b/docs/pages/advanced/react-hooks/use-send-transaction.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSendTransaction [Hook for sending transaction] diff --git a/docs/pages/react/use-send-useroperation-with-session.mdx b/docs/pages/advanced/react-hooks/use-send-useroperation-with-session.mdx similarity index 98% rename from docs/pages/react/use-send-useroperation-with-session.mdx rename to docs/pages/advanced/react-hooks/use-send-useroperation-with-session.mdx index f902bde4..0be5d956 100644 --- a/docs/pages/react/use-send-useroperation-with-session.mdx +++ b/docs/pages/advanced/react-hooks/use-send-useroperation-with-session.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSendUserOperationWithSession [Hooks for sending user operation with session keys] diff --git a/docs/pages/react/use-send-useroperation.mdx b/docs/pages/advanced/react-hooks/use-send-useroperation.mdx similarity index 97% rename from docs/pages/react/use-send-useroperation.mdx rename to docs/pages/advanced/react-hooks/use-send-useroperation.mdx index 0bb9fa00..8bfa859b 100644 --- a/docs/pages/react/use-send-useroperation.mdx +++ b/docs/pages/advanced/react-hooks/use-send-useroperation.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSendUserOperation [Hook for sending user operation] diff --git a/docs/pages/react/use-session-kernelclient.mdx b/docs/pages/advanced/react-hooks/use-session-kernelclient.mdx similarity index 95% rename from docs/pages/react/use-session-kernelclient.mdx rename to docs/pages/advanced/react-hooks/use-session-kernelclient.mdx index 9f4bbf16..85164f89 100644 --- a/docs/pages/react/use-session-kernelclient.mdx +++ b/docs/pages/advanced/react-hooks/use-session-kernelclient.mdx @@ -1,4 +1,4 @@ -import QueryResult from "../shared/query-result.mdx" +import QueryResult from "../../shared/query-result.mdx" # useSessionKernelClient [Hook for getting kernel account client with session plugin] diff --git a/docs/pages/react/use-sessions.mdx b/docs/pages/advanced/react-hooks/use-sessions.mdx similarity index 100% rename from docs/pages/react/use-sessions.mdx rename to docs/pages/advanced/react-hooks/use-sessions.mdx diff --git a/docs/pages/react/use-set-kernelclient.mdx b/docs/pages/advanced/react-hooks/use-set-kernelclient.mdx similarity index 95% rename from docs/pages/react/use-set-kernelclient.mdx rename to docs/pages/advanced/react-hooks/use-set-kernelclient.mdx index 143d49c3..738b3b3e 100644 --- a/docs/pages/react/use-set-kernelclient.mdx +++ b/docs/pages/advanced/react-hooks/use-set-kernelclient.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSetKernelClient [Hook for setting kernel account client] diff --git a/docs/pages/react/use-switch-chain.mdx b/docs/pages/advanced/react-hooks/use-switch-chain.mdx similarity index 94% rename from docs/pages/react/use-switch-chain.mdx rename to docs/pages/advanced/react-hooks/use-switch-chain.mdx index bcb8e104..032c61c0 100644 --- a/docs/pages/react/use-switch-chain.mdx +++ b/docs/pages/advanced/react-hooks/use-switch-chain.mdx @@ -1,4 +1,4 @@ -import MutationResult from '../shared/mutation-result.mdx' +import MutationResult from '../../shared/mutation-result.mdx' # useSwitchChain [Hook for switching chain] diff --git a/docs/pages/react/use-wallet-connect.mdx b/docs/pages/advanced/react-hooks/use-wallet-connect.mdx similarity index 100% rename from docs/pages/react/use-wallet-connect.mdx rename to docs/pages/advanced/react-hooks/use-wallet-connect.mdx diff --git a/docs/pages/sdk/advanced/run-solidity-code-on-init.mdx b/docs/pages/advanced/track-deployed-accounts.mdx similarity index 100% rename from docs/pages/sdk/advanced/run-solidity-code-on-init.mdx rename to docs/pages/advanced/track-deployed-accounts.mdx diff --git a/docs/pages/sdk/advanced/upgrade-kernel.mdx b/docs/pages/advanced/upgrade-kernel.mdx similarity index 100% rename from docs/pages/sdk/advanced/upgrade-kernel.mdx rename to docs/pages/advanced/upgrade-kernel.mdx diff --git a/docs/pages/sdk/advanced/userop-builder-api.mdx b/docs/pages/advanced/userop-builder-api.mdx similarity index 100% rename from docs/pages/sdk/advanced/userop-builder-api.mdx rename to docs/pages/advanced/userop-builder-api.mdx diff --git a/docs/pages/sdk/advanced/wallet-connect.mdx b/docs/pages/advanced/wallet-connect.mdx similarity index 94% rename from docs/pages/sdk/advanced/wallet-connect.mdx rename to docs/pages/advanced/wallet-connect.mdx index 229b8374..3e94cdb2 100644 --- a/docs/pages/sdk/advanced/wallet-connect.mdx +++ b/docs/pages/advanced/wallet-connect.mdx @@ -50,9 +50,9 @@ await walletConnectKernelService.init({ - `walletConnectProjectId`: Your WalletConnect project ID. You will get this from the [WalletConnect dashboard.](https://cloud.walletconnect.com/sign-in) - `walletConnectMetadata`: Metadata related to the WalletConnect session. - `kernelClient`: An optional kernel client for creating a kernel provider. - - For detailed information on kernel clients, see [the kernel clients documentation.](/sdk/core-api/create-account#create-an-account-client) + - For detailed information on kernel clients, see [the kernel clients documentation.](/smart-accounts/create-a-smart-account#create-an-account-client) - `kernelProvider`: An optional pre-initialized kernel provider. - - If you are using wagmi with the capabilities pattern (for more information, see [the capabilities quickstart](/smart-wallet/quickstart-capabilities)), you can get the `kernelProvider` from wagmi. + - If you are using wagmi with the capabilities pattern (for more information, see [the capabilities quickstart](/get-started/quickstart)), you can get the `kernelProvider` from wagmi. ```typescript import { useAccount } from "wagmi"; diff --git a/docs/pages/sdk/faqs/audits.md b/docs/pages/api-and-toolings/faqs/audits.md similarity index 100% rename from docs/pages/sdk/faqs/audits.md rename to docs/pages/api-and-toolings/faqs/audits.md diff --git a/docs/pages/sdk/faqs/chains.mdx b/docs/pages/api-and-toolings/faqs/chains.mdx similarity index 100% rename from docs/pages/sdk/faqs/chains.mdx rename to docs/pages/api-and-toolings/faqs/chains.mdx diff --git a/docs/pages/sdk/faqs/debug-userop.mdx b/docs/pages/api-and-toolings/faqs/debug-userop.mdx similarity index 100% rename from docs/pages/sdk/faqs/debug-userop.mdx rename to docs/pages/api-and-toolings/faqs/debug-userop.mdx diff --git a/docs/pages/sdk/faqs/use-with-ethers.mdx b/docs/pages/api-and-toolings/faqs/use-with-ethers.mdx similarity index 100% rename from docs/pages/sdk/faqs/use-with-ethers.mdx rename to docs/pages/api-and-toolings/faqs/use-with-ethers.mdx diff --git a/docs/pages/sdk/faqs/use-with-gelato.mdx b/docs/pages/api-and-toolings/faqs/use-with-gelato.mdx similarity index 100% rename from docs/pages/sdk/faqs/use-with-gelato.mdx rename to docs/pages/api-and-toolings/faqs/use-with-gelato.mdx diff --git a/docs/pages/sdk/faqs/use-with-react-native.mdx b/docs/pages/api-and-toolings/faqs/use-with-react-native.mdx similarity index 100% rename from docs/pages/sdk/faqs/use-with-react-native.mdx rename to docs/pages/api-and-toolings/faqs/use-with-react-native.mdx diff --git a/docs/pages/meta-infra/api.mdx b/docs/pages/api-and-toolings/infrastructure/api.mdx similarity index 100% rename from docs/pages/meta-infra/api.mdx rename to docs/pages/api-and-toolings/infrastructure/api.mdx diff --git a/docs/pages/sdk/infra/intro.md b/docs/pages/api-and-toolings/infrastructure/choose-an-infra-provider.md similarity index 94% rename from docs/pages/sdk/infra/intro.md rename to docs/pages/api-and-toolings/infrastructure/choose-an-infra-provider.md index 86e75714..20674356 100644 --- a/docs/pages/sdk/infra/intro.md +++ b/docs/pages/api-and-toolings/infrastructure/choose-an-infra-provider.md @@ -2,8 +2,8 @@ ZeroDev is compatible with any account abstraction infra provider. Check out these guides for integrating with a specific provider: -- [ZeroDev](/meta-infra/intro) -- [Pimlico](/sdk/infra/pimlico) +- [ZeroDev](/resources/infrastructure/intro) +- [Pimlico](/resources/infrastructure/pimlico) Read on to learn how to integrate with a custom provider. diff --git a/docs/pages/sdk/infra/coinbase.md b/docs/pages/api-and-toolings/infrastructure/coinbase.md similarity index 67% rename from docs/pages/sdk/infra/coinbase.md rename to docs/pages/api-and-toolings/infrastructure/coinbase.md index 740bd77a..04e01980 100644 --- a/docs/pages/sdk/infra/coinbase.md +++ b/docs/pages/api-and-toolings/infrastructure/coinbase.md @@ -2,6 +2,6 @@ [Coinbase Developer Platform](https://docs.cdp.coinbase.com/) (CDP) offers bundler and paymaster services that you can use with ZeroDev. -Generally speaking, Coinbase bundlers & paymasters speak the same interface as Pimlico, so you can follow [this guide](/sdk/infra/pimlico) and simply replace the Pimlico bundler/paymaster URLs with the CDP bundler/paymaster URLs. +Generally speaking, Coinbase bundlers & paymasters speak the same interface as Pimlico, so you can follow [this guide](/resources/infrastructure/pimlico) and simply replace the Pimlico bundler/paymaster URLs with the CDP bundler/paymaster URLs. You can also refer to [CDP's official examples for ZeroDev](https://github.com/coinbase/paymaster-bundler-examples/tree/master/examples/zerodev). diff --git a/docs/pages/meta-infra/custom-gas-policies.mdx b/docs/pages/api-and-toolings/infrastructure/custom-gas-policies.mdx similarity index 100% rename from docs/pages/meta-infra/custom-gas-policies.mdx rename to docs/pages/api-and-toolings/infrastructure/custom-gas-policies.mdx diff --git a/docs/pages/meta-infra/gas-policies.mdx b/docs/pages/api-and-toolings/infrastructure/gas-policies.mdx similarity index 86% rename from docs/pages/meta-infra/gas-policies.mdx rename to docs/pages/api-and-toolings/infrastructure/gas-policies.mdx index 7004c7e1..4991954f 100644 --- a/docs/pages/meta-infra/gas-policies.mdx +++ b/docs/pages/api-and-toolings/infrastructure/gas-policies.mdx @@ -2,7 +2,7 @@ You can configure **gas policies** for ZeroDev paymaster to have fine-grained control over what you sponsor, and how much. -Paymaster policies can be configured through either [the dashboard](https://dashboard.zerodev.app/paymasters) or [the API](/meta-infra/api). +Paymaster policies can be configured through either [the dashboard](https://dashboard.zerodev.app/paymasters) or [the API](/resources/infrastructure/api). ## Policy Types @@ -11,7 +11,7 @@ There are four types of gas policies on ZeroDev: - Project policies: policies that apply to the entire project. - Contract policies: policies that apply to specific contracts. - Wallet policies: policies that apply to specific wallet addresses. -- [Custom policies](/meta-infra/custom-gas-policies): if none of the policies above meet your needs, you can program totally custom policies via a webhook. +- [Custom policies](/resources/infrastructure/custom-gas-policies): if none of the policies above meet your needs, you can program totally custom policies via a webhook. ## Rate Limit Types diff --git a/docs/pages/meta-infra/intro.mdx b/docs/pages/api-and-toolings/infrastructure/intro.mdx similarity index 75% rename from docs/pages/meta-infra/intro.mdx rename to docs/pages/api-and-toolings/infrastructure/intro.mdx index e7d946ca..62f203fe 100644 --- a/docs/pages/meta-infra/intro.mdx +++ b/docs/pages/api-and-toolings/infrastructure/intro.mdx @@ -4,7 +4,7 @@ ZeroDev works with major AA infra providers to provide a "meta intrastructure." ZeroDev integrates with the following infra provider: -- [UltraRelay](/sdk/core-api/sponsor-gas#ultrarelay), ZeroDev's own bundler optimized for sponsored transactions +- [UltraRelay](/smart-accounts/sponsor-gas/evm#ultrarelay), ZeroDev's own bundler optimized for sponsored transactions - Alchemy - Gelato - Pimlico @@ -21,10 +21,10 @@ You will need an RPC to start using bundlers & paymasters through ZeroDev. The same RPC can be used as both bundler and paymaster RPCs. -[Learn more about bundler & paymaster RPCs here](/meta-infra/rpcs). +[Learn more about bundler & paymaster RPCs here](/resources/infrastructure/rpcs). ## Setting up sponsoring policies If you would like to sponsor gas for your users, you need to set up gas policies on the dashboard. -[Learn more about gas policies here.](/meta-infra/gas-policies) \ No newline at end of file +[Learn more about gas policies here.](/resources/infrastructure/gas-policies) \ No newline at end of file diff --git a/docs/pages/sdk/infra/pimlico.md b/docs/pages/api-and-toolings/infrastructure/pimlico.md similarity index 93% rename from docs/pages/sdk/infra/pimlico.md rename to docs/pages/api-and-toolings/infrastructure/pimlico.md index 6b7edd1b..35bb9a2d 100644 --- a/docs/pages/sdk/infra/pimlico.md +++ b/docs/pages/api-and-toolings/infrastructure/pimlico.md @@ -4,7 +4,7 @@ You can use the ZeroDev SDK with Pimlico bundlers. ## Using Pimlico bundler -Simply specify Pimlico's bundler RPC when [constructing a Kernel client](/sdk/core-api/create-account#standard-api): +Simply specify Pimlico's bundler RPC when [constructing a Kernel client](/smart-accounts/create-a-smart-account#standard-api): ```typescript import { createKernelAccountClient } from "@zerodev/sdk" diff --git a/docs/pages/meta-infra/rpcs.mdx b/docs/pages/api-and-toolings/infrastructure/rpcs.mdx similarity index 91% rename from docs/pages/meta-infra/rpcs.mdx rename to docs/pages/api-and-toolings/infrastructure/rpcs.mdx index 1faefe01..8ebd8287 100644 --- a/docs/pages/meta-infra/rpcs.mdx +++ b/docs/pages/api-and-toolings/infrastructure/rpcs.mdx @@ -2,7 +2,7 @@ To ensure utmost reliability for our customers, our RPCs use multiple bundlers under the hood, including: -- [UltraRelay](/sdk/core-api/sponsor-gas#ultrarelay), ZeroDev's own bundler optimized for sponsored transactions +- [UltraRelay](/smart-accounts/sponsor-gas/evm#ultrarelay), ZeroDev's own bundler optimized for sponsored transactions - Alchemy - Gelato - Pimlico diff --git a/docs/pages/sdk/infra/zerodev.md b/docs/pages/api-and-toolings/infrastructure/zerodev.md similarity index 73% rename from docs/pages/sdk/infra/zerodev.md rename to docs/pages/api-and-toolings/infrastructure/zerodev.md index 6a27ce6f..1fc7e17e 100644 --- a/docs/pages/sdk/infra/zerodev.md +++ b/docs/pages/api-and-toolings/infrastructure/zerodev.md @@ -1,3 +1,3 @@ # ZeroDev -ZeroDev provides a meta infrastructure that proxies traffic to multiple infra providers including Alchemy, Gelato and Pimlico. [Read more here](/meta-infra/intro). \ No newline at end of file +ZeroDev provides a meta infrastructure that proxies traffic to multiple infra providers including Alchemy, Gelato and Pimlico. [Read more here](/resources/infrastructure/intro). \ No newline at end of file diff --git a/docs/pages/sdk/presets/intro.mdx b/docs/pages/api-and-toolings/presets/intro.mdx similarity index 94% rename from docs/pages/sdk/presets/intro.mdx rename to docs/pages/api-and-toolings/presets/intro.mdx index eb6da90b..82991c61 100644 --- a/docs/pages/sdk/presets/intro.mdx +++ b/docs/pages/api-and-toolings/presets/intro.mdx @@ -6,7 +6,7 @@ Generally speaking, there will be a preset for each ` dapps => users => wallets will dr In the next article, we will dive deeper into the technical side and examine how exactly wallets and dapps will implement support for 7702. -*Update: we have released a tutorial for [using the ZeroDev SDK with EIP-7702](/sdk/getting-started/quickstart-7702).* \ No newline at end of file +*Update: we have released a tutorial for [using the ZeroDev SDK with EIP-7702](/smart-accounts/eip-7702/quickstart).* \ No newline at end of file diff --git a/docs/pages/sdk/advanced/chain-abstraction.mdx b/docs/pages/cross-chain/chain-abstraction/overview.mdx similarity index 97% rename from docs/pages/sdk/advanced/chain-abstraction.mdx rename to docs/pages/cross-chain/chain-abstraction/overview.mdx index 3f1fa10a..b645fad2 100644 --- a/docs/pages/sdk/advanced/chain-abstraction.mdx +++ b/docs/pages/cross-chain/chain-abstraction/overview.mdx @@ -88,7 +88,7 @@ bun add @zerodev/multi-chain-ecdsa-validator ### Setting up the Kernel account -First, make sure you know how to [create ZeroDev accounts](/sdk/core-api/create-account). +First, make sure you know how to [create ZeroDev accounts](/smart-accounts/create-a-smart-account). The flow for creating a chain-abstracted ZeroDev account is the same, with the following exceptions: @@ -179,7 +179,7 @@ console.log(`Intent executed on chain: ${receipt?.executionChainId}`); Here: -- `calls` is a [batch](/sdk/core-api/batch-transactions) of calls to execute atomically. +- `calls` is a [batch](/smart-accounts/batch-transactions) of calls to execute atomically. - `outputTokens` is the chain-abstracted token that your calls require. For example, if your calls are looking to spend 500 USDC to buy an NFT, then you'd specify 500 USDC with the `outputTokens`. - If you want to use ETH as the output token, set the address to `zeroAddress`. @@ -239,7 +239,7 @@ When using intents, you may use the `gasToken` flag to configure how to pay gas. - By default (with no `gasToken` specified), gas is paid in CAB (input tokens) itself. - If you specify `gasToken: 'NATIVE'`, the account will pay gas with the native token (e.g. ETH). -- If you specify `gasToken: 'SPONSORED'`, you will be [sponsoring gas](/sdk/core-api/sponsor-gas) for the account. +- If you specify `gasToken: 'SPONSORED'`, you will be [sponsoring gas](/smart-accounts/sponsor-gas/evm) for the account. - If you specify `gasToken: 'USDC'` or `gasToken: 'USDT'`, you will pay gas with the specified stablecoin. ### Parallel intent execution diff --git a/docs/pages/sdk/advanced/supported-base-tokens.mdx b/docs/pages/cross-chain/chain-abstraction/supported-base-tokens.mdx similarity index 99% rename from docs/pages/sdk/advanced/supported-base-tokens.mdx rename to docs/pages/cross-chain/chain-abstraction/supported-base-tokens.mdx index bd84f151..fc2ebe7f 100644 --- a/docs/pages/sdk/advanced/supported-base-tokens.mdx +++ b/docs/pages/cross-chain/chain-abstraction/supported-base-tokens.mdx @@ -1,6 +1,6 @@ # Supported Base Tokens -This is the full list of base tokens supported by ZeroDev's [DeFi integrations](/sdk/advanced/defi). +This is the full list of base tokens supported by ZeroDev's [DeFi integrations](/advanced/defi). ## Usage diff --git a/docs/pages/sdk/advanced/supported-defi-tokens.mdx b/docs/pages/cross-chain/chain-abstraction/supported-defi-tokens.mdx similarity index 99% rename from docs/pages/sdk/advanced/supported-defi-tokens.mdx rename to docs/pages/cross-chain/chain-abstraction/supported-defi-tokens.mdx index 2b3cda8a..c1f654c2 100644 --- a/docs/pages/sdk/advanced/supported-defi-tokens.mdx +++ b/docs/pages/cross-chain/chain-abstraction/supported-defi-tokens.mdx @@ -1,6 +1,6 @@ # Supported Defi Tokens -This is the full list of DeFi tokens (aka "vaults") supported by ZeroDev's [DeFi integrations](/sdk/advanced/defi). +This is the full list of DeFi tokens (aka "vaults") supported by ZeroDev's [DeFi integrations](/advanced/defi). ## Usage diff --git a/docs/pages/smart-routing-address/index.mdx b/docs/pages/cross-chain/smart-routing-address/index.mdx similarity index 100% rename from docs/pages/smart-routing-address/index.mdx rename to docs/pages/cross-chain/smart-routing-address/index.mdx diff --git a/docs/pages/sdk/getting-started/quickstart.mdx b/docs/pages/get-started/quickstart.mdx similarity index 93% rename from docs/pages/sdk/getting-started/quickstart.mdx rename to docs/pages/get-started/quickstart.mdx index aa70d77d..50fcb256 100644 --- a/docs/pages/sdk/getting-started/quickstart.mdx +++ b/docs/pages/get-started/quickstart.mdx @@ -144,4 +144,4 @@ View completed UserOp here: https://jiffyscan.xyz/userOpHash/0x7a8e0ba961cc0a34f Congrats -- you just sent your first gasless transaction with ZeroDev! -In this example, you used a public ZeroDev API key. Now read [the tutorial](/sdk/getting-started/tutorial) to see how to set up your own ZeroDev project. +In this example, you used a public ZeroDev API key. Now read [Set up a project](/get-started/sdks/setup-project) to see how to set up your own ZeroDev project, then walk through the full [TypeScript / JavaScript tutorial](/get-started/sdks/client-side/typescript). diff --git a/docs/pages/get-started/sdks/client-side/android.mdx b/docs/pages/get-started/sdks/client-side/android.mdx new file mode 100644 index 00000000..a35d8b84 --- /dev/null +++ b/docs/pages/get-started/sdks/client-side/android.mdx @@ -0,0 +1,47 @@ +--- +title: Android (Kotlin) SDK +description: Install and use the ZeroDev Omni SDK Kotlin binding for Android. +--- + +# Android (Kotlin) SDK + +{/* TODO(authoring): fill this stub. The Kotlin binding is part of the Omni SDK monorepo (zerodevapp/zerodev-omni-sdk), published to Maven Central as app.zerodev:zerodev-aa. */} + +:::info +🚧 **This page is a stub.** Content is being written. The Kotlin binding is in alpha. +::: + +The ZeroDev Android SDK is a Kotlin/JVM binding over the Omni SDK core, published to Maven Central. It currently supports smart-account creation, signing, and transactions on EVM chains. + +## Install + +{/* TODO(authoring): Gradle dependency snippet. Confirm artifactId and groupId from Maven Central. */} + +In your module `build.gradle.kts`: + +```kotlin +dependencies { + implementation("app.zerodev:zerodev-aa:0.0.1-alpha.5") // TODO: confirm latest +} +``` + +## Setup + +{/* TODO(authoring): minimal initialization in an Activity or ViewModel. */} + +```kotlin +// TODO: import + initialize ZeroDev client +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction. Reference omni-sdk-android-example repo. */} + +```kotlin +// TODO: end-to-end example +``` + +## Next steps + +- [Create a Smart Account](/smart-accounts/create-a-smart-account) +- [Sample app: omni-sdk-android-example](https://github.com/zerodevapp/omni-sdk-android-example) diff --git a/docs/pages/get-started/sdks/client-side/ios.mdx b/docs/pages/get-started/sdks/client-side/ios.mdx new file mode 100644 index 00000000..614dd8b7 --- /dev/null +++ b/docs/pages/get-started/sdks/client-side/ios.mdx @@ -0,0 +1,51 @@ +--- +title: iOS (Swift) SDK +description: Install and use the ZeroDev Omni SDK Swift binding for iOS. +--- + +# iOS (Swift) SDK + +{/* TODO(authoring): fill this stub. The Swift binding is part of the Omni SDK monorepo (zerodevapp/zerodev-omni-sdk) and is alpha. */} + +:::info +🚧 **This page is a stub.** Content is being written. The Swift binding is in alpha β€” see the [omni-sdk repo](https://github.com/zerodevapp/zerodev-omni-sdk) for current state. +::: + +The ZeroDev Swift SDK ships as a Swift Package binding over the Omni SDK core. It currently supports smart-account creation, signing, and transactions on EVM chains. + +## Install + +{/* TODO(authoring): SPM URL + version constraint, plus any iOS deployment target prerequisites. */} + +In Xcode β†’ File β†’ Add Packages…, add: + +``` +https://github.com/zerodevapp/zerodev-omni-sdk +``` + +Or in `Package.swift`: + +```swift +// TODO: dependencies entry with version +``` + +## Setup + +{/* TODO(authoring): import statement + minimal initialization. Mention RPC/bundler URL config. */} + +```swift +// TODO: import + initialize ZeroDev client +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction. Reference omni-sdk-swift-example repo. */} + +```swift +// TODO: end-to-end example +``` + +## Next steps + +- [Create a Smart Account](/smart-accounts/create-a-smart-account) +- [Sample app: omni-sdk-swift-example](https://github.com/zerodevapp/omni-sdk-swift-example) diff --git a/docs/pages/sdk/getting-started/tutorial.mdx b/docs/pages/get-started/sdks/client-side/typescript.mdx similarity index 86% rename from docs/pages/sdk/getting-started/tutorial.mdx rename to docs/pages/get-started/sdks/client-side/typescript.mdx index 7c9bdcf9..3e09ebff 100644 --- a/docs/pages/sdk/getting-started/tutorial.mdx +++ b/docs/pages/get-started/sdks/client-side/typescript.mdx @@ -1,30 +1,17 @@ -# ZeroDev Tutorial +--- +title: TypeScript / JavaScript SDK +description: Install and use the ZeroDev TypeScript SDK to mint an NFT without paying gas. +--- + +# TypeScript / JavaScript SDK + +The ZeroDev TypeScript SDK (`@zerodev/sdk`) is the core package for building smart-account apps in JavaScript/TypeScript. This tutorial walks you through minting an NFT without paying gas. :::info Impatient? Check out [the complete example here](https://github.com/zerodevapp/zerodev-examples/tree/main/tutorial/completed.ts). ::: -In this tutorial, we will mint an NFT without paying gas. - -## Create a ZeroDev Project - -For this tutorial, we will use [ZeroDev's AA infra](/meta-infra/intro), but you can use ZeroDev with any AA infra provider. - -Go to the [ZeroDev dashboard](https://dashboard.zerodev.app/) and create a project for Sepolia. - -

- -

- -## Set up a gas policy - -To sponsor transactions (UserOps), you need to set up a gas sponsorship policy. - -Go to the `Gas Policies` section of your dashboard, select `Sepolia`, and toggle `Sponsor all transactions`. - -

- -

+Before you start, [set up a ZeroDev project](/get-started/sdks/setup-project) so you have an RPC URL with a gas-sponsorship policy. ## Write the code @@ -34,18 +21,12 @@ Clone the [ZeroDev examples repo](https://github.com/zerodevapp/zerodev-examples npm install ``` -Create a `.env` file with the following line: +Create a `.env` file with the following line, using the RPC URL from your ZeroDev project: ``` ZERODEV_RPC= ``` -Replace `` with the RPC you copy from the dashboard: - -

- -

- If all goes well, you should be able to run: ```bash @@ -226,5 +207,5 @@ In this tutorial, we were able to mint an NFT without paying gas, thanks to gas For next steps: -- Check out [the core API](/sdk/core-api/create-account) to learn more about the SDK -- Read some [code examples](https://github.com/zerodevapp/zerodev-examples) of using ZeroDev \ No newline at end of file +- Check out [the core API](/smart-accounts/create-a-smart-account) to learn more about the SDK +- Read some [code examples](https://github.com/zerodevapp/zerodev-examples) of using ZeroDev diff --git a/docs/pages/get-started/sdks/overview.mdx b/docs/pages/get-started/sdks/overview.mdx new file mode 100644 index 00000000..79d17e14 --- /dev/null +++ b/docs/pages/get-started/sdks/overview.mdx @@ -0,0 +1,33 @@ +--- +title: SDKs Overview +description: Choose the right ZeroDev SDK for your stack β€” client-side, server-side, and per-language. +--- + +# SDKs + +{/* TODO(authoring): rewrite this overview to fit ZeroDev's voice. Below is a placeholder so the navigation has a real landing page. */} + +:::info +🚧 **This page is a stub.** Content is being written. The structure below shows what will live here. +::: + +ZeroDev ships SDKs for browser, mobile, and server-side stacks. Pick the one that matches your runtime. + +## Client-side + +For applications that run in a user's browser or on their device. + +- **[TypeScript / JavaScript](/get-started/sdks/client-side/typescript)** β€” the core `@zerodev/sdk` package, for browser apps. +- **[Embedded Wallet (React)](/smart-accounts/embedded-wallet/quickstart)** β€” `@zerodev/wallet-react` for embedded smart wallet flows. +- **[iOS (Swift)](/get-started/sdks/client-side/ios)** β€” Omni SDK Swift binding. +- **[Android (Kotlin)](/get-started/sdks/client-side/android)** β€” Omni SDK Kotlin binding. + +## Server-side + +For backend services, scripts, and agents. + +- **[Node.js / TypeScript](/get-started/sdks/server-side/nodejs)** β€” `@zerodev/sdk` running server-side. +- **[Go](/advanced/go-sdk)** β€” legacy Go SDK. +- **[Python](/get-started/sdks/server-side/python)** β€” Omni SDK Python binding. +- **[Rust](/get-started/sdks/server-side/rust)** β€” Omni SDK Rust binding. +- **[C](/get-started/sdks/server-side/c)** β€” Omni SDK C FFI for cross-language embedding. diff --git a/docs/pages/get-started/sdks/server-side/c.mdx b/docs/pages/get-started/sdks/server-side/c.mdx new file mode 100644 index 00000000..dd62390a --- /dev/null +++ b/docs/pages/get-started/sdks/server-side/c.mdx @@ -0,0 +1,49 @@ +--- +title: C SDK (FFI) +description: Use the ZeroDev Omni SDK C FFI to embed smart-account functionality in any language. +--- + +# C SDK (FFI) + +{/* TODO(authoring): fill this stub. The C binding is the FFI surface of the Omni SDK Zig core β€” used to embed in any language that can call C. */} + +:::info +🚧 **This page is a stub.** Content is being written. The C FFI is in alpha β€” built from source. +::: + +The ZeroDev C SDK exposes the Omni SDK's Zig core as a C-compatible shared library. Use it to embed ZeroDev smart-account functionality from languages that can call C β€” including those without a first-class Omni binding. + +## Install + +{/* TODO(authoring): confirm build instructions β€” clone, zig build, copy header + .so/.dylib. Or precompiled artifact URLs if any. */} + +Build from source: + +```bash +git clone https://github.com/zerodevapp/zerodev-omni-sdk +cd zerodev-omni-sdk +# TODO: build command and artifact paths +``` + +The header lives at `include/aa.h`. + +## Setup + +{/* TODO(authoring): minimal C example β€” header include, struct initialization. */} + +```c +// TODO: #include "aa.h" + initialize +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction. */} + +```c +// TODO: end-to-end example +``` + +## Next steps + +- [Omni SDK source](https://github.com/zerodevapp/zerodev-omni-sdk) +- [Bundler & Paymaster RPCs](/resources/infrastructure/rpcs) diff --git a/docs/pages/get-started/sdks/server-side/nodejs.mdx b/docs/pages/get-started/sdks/server-side/nodejs.mdx new file mode 100644 index 00000000..acd73c93 --- /dev/null +++ b/docs/pages/get-started/sdks/server-side/nodejs.mdx @@ -0,0 +1,48 @@ +--- +title: Node.js / TypeScript SDK +description: Install and use the ZeroDev TypeScript SDK in a Node.js backend service. +--- + +# Node.js / TypeScript SDK + +{/* TODO(authoring): fill this stub. Same package as browser TypeScript (@zerodev/sdk), but server-specific patterns: signer key handling, no localStorage, RPC config from env. */} + +:::info +🚧 **This page is a stub.** Content is being written. +::: + +The ZeroDev SDK runs in Node.js for backend services, scripts, and agents. The package is the same as the browser SDK (`@zerodev/sdk`) β€” but server-side patterns around signer key handling, RPC configuration, and concurrency differ. + +For browser-side usage, see [TypeScript / JavaScript](/get-started/sdks/client-side/typescript). + +## Install + +{/* TODO(authoring): confirm whether Node version constraints, polyfills, or extra deps (e.g. crypto) are needed. */} + +```bash +npm i @zerodev/sdk +``` + +Requires Node {/* TODO: minimum version */}. + +## Setup + +{/* TODO(authoring): show env-driven config β€” bundler RPC, paymaster RPC, signer private key from process.env. */} + +```ts +// TODO: server-side initialization with env-driven config +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction from a backend service. */} + +```ts +// TODO: end-to-end backend example +``` + +## Next steps + +- [Bundler & Paymaster RPCs](/resources/infrastructure/rpcs) +- [Sponsor Gas](/smart-accounts/sponsor-gas/evm) +- [Create a Smart Account](/smart-accounts/create-a-smart-account) diff --git a/docs/pages/get-started/sdks/server-side/python.mdx b/docs/pages/get-started/sdks/server-side/python.mdx new file mode 100644 index 00000000..78e6c5f5 --- /dev/null +++ b/docs/pages/get-started/sdks/server-side/python.mdx @@ -0,0 +1,46 @@ +--- +title: Python SDK +description: Install and use the ZeroDev Omni SDK Python binding. +--- + +# Python SDK + +{/* TODO(authoring): fill this stub. The Python binding is part of the Omni SDK monorepo, published to PyPI as zerodev-aa. */} + +:::info +🚧 **This page is a stub.** Content is being written. The Python binding is in alpha. +::: + +The ZeroDev Python SDK is a Python binding over the Omni SDK core, published to PyPI. It currently supports smart-account creation, signing, and transactions on EVM chains β€” useful for backend services, scripts, and AI agents. + +## Install + +{/* TODO(authoring): confirm package name and Python version requirements. */} + +```bash +pip install zerodev-aa +``` + +Requires Python {/* TODO: minimum version */}. + +## Setup + +{/* TODO(authoring): minimal initialization snippet. */} + +```python +# TODO: import + initialize ZeroDev client +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction. */} + +```python +# TODO: end-to-end example +``` + +## Next steps + +- [Bundler & Paymaster RPCs](/resources/infrastructure/rpcs) +- [Create a Smart Account](/smart-accounts/create-a-smart-account) +- [Omni SDK source](https://github.com/zerodevapp/zerodev-omni-sdk) diff --git a/docs/pages/get-started/sdks/server-side/rust.mdx b/docs/pages/get-started/sdks/server-side/rust.mdx new file mode 100644 index 00000000..0dcf7ab0 --- /dev/null +++ b/docs/pages/get-started/sdks/server-side/rust.mdx @@ -0,0 +1,47 @@ +--- +title: Rust SDK +description: Install and use the ZeroDev Omni SDK Rust crate. +--- + +# Rust SDK + +{/* TODO(authoring): fill this stub. The Rust binding is part of the Omni SDK monorepo, published to crates.io as zerodev-aa. */} + +:::info +🚧 **This page is a stub.** Content is being written. The Rust crate is in alpha. +::: + +The ZeroDev Rust SDK is a Rust crate over the Omni SDK core, published to crates.io. It currently supports smart-account creation, signing, and transactions on EVM chains. + +## Install + +{/* TODO(authoring): confirm crate name and MSRV. */} + +In `Cargo.toml`: + +```toml +[dependencies] +zerodev-aa = "0.0.1-alpha.2" # TODO: confirm latest +``` + +## Setup + +{/* TODO(authoring): minimal initialization snippet. */} + +```rust +// TODO: use statements + initialize ZeroDev client +``` + +## Example + +{/* TODO(authoring): "Hello World" β€” create a smart account, send a transaction. */} + +```rust +// TODO: end-to-end example +``` + +## Next steps + +- [Bundler & Paymaster RPCs](/resources/infrastructure/rpcs) +- [Create a Smart Account](/smart-accounts/create-a-smart-account) +- [Omni SDK source](https://github.com/zerodevapp/zerodev-omni-sdk) diff --git a/docs/pages/get-started/sdks/setup-project.mdx b/docs/pages/get-started/sdks/setup-project.mdx new file mode 100644 index 00000000..b0f3c2b8 --- /dev/null +++ b/docs/pages/get-started/sdks/setup-project.mdx @@ -0,0 +1,45 @@ +--- +title: Set up a project +description: Create a ZeroDev project and configure a gas policy before integrating with an SDK. +--- + +# Set up a project + +Before integrating any ZeroDev SDK, create a project on the ZeroDev dashboard and configure a gas-sponsorship policy. The project gives you an RPC URL that the SDKs use to talk to ZeroDev's bundler and paymaster. + +This page covers ZeroDev's hosted AA infra, but you can use ZeroDev with [any AA infra provider](/resources/infrastructure/intro). + +## Create a ZeroDev project + +Go to the [ZeroDev dashboard](https://dashboard.zerodev.app/) and create a project for the network you want to build on (Sepolia is a common starting point). + +

+ +

+ +## Set up a gas policy + +To sponsor user operations, you need a gas-sponsorship policy on the project. + +Go to the `Gas Policies` section of your dashboard, select the network you created the project on, and toggle `Sponsor all transactions`. + +

+ +

+ +## Copy your RPC URL + +From the project home page, copy the RPC URL β€” you'll pass it to the SDK when constructing clients (typically as a `ZERODEV_RPC` environment variable). + +

+ +

+ +## Next steps + +Pick the SDK that matches your stack: + +- [TypeScript / JavaScript](/get-started/sdks/client-side/typescript) +- [Node.js / TypeScript (server-side)](/get-started/sdks/server-side/nodejs) +- [iOS (Swift)](/get-started/sdks/client-side/ios) Β· [Android (Kotlin)](/get-started/sdks/client-side/android) +- [Python](/get-started/sdks/server-side/python) Β· [Rust](/get-started/sdks/server-side/rust) Β· [C](/get-started/sdks/server-side/c) diff --git a/docs/pages/global-address/index.mdx b/docs/pages/global-address/index.mdx deleted file mode 100644 index 1ee7b47e..00000000 --- a/docs/pages/global-address/index.mdx +++ /dev/null @@ -1,355 +0,0 @@ -# Smart Routing Address - -**Smart Routing Address** enables users to easily deposit funds to a L2/L3 from any CEXs, fiat onramps, and chains, by simply sending funds to a unique deposit address on any chain. - -Technically, **Smart Routing Address** is an address that encodes a _cross-chain intent_. **When anyone sends funds to a smart routing address on _any chain_, they are funding the intent and thereby triggering the intent on a _specific destination chain_.** In other words, smart routing address is _source-chain agnostic_, but _target-chain specific_. - -## Common Use Cases - -- Sending funds from CEXs directly to an L2/L3. -- Using a fiat onramp with a L2/L3, even if the onramp doesn't directly support the L2/L3. -- Depositing into a token vault with funds from another chain. -- Cross-chain transfers. - -## Try Smart Routing Address - -You can try using smart routing address at [the official portal](https://smart-routing-address.zerodev.app/). - -Should your users send the wrong tokens to their smart routing address, they can also use the portal to retrieve their funds. - -## Installation - -:::code-group - -```bash [npm] -npm i @zerodev/smart-routing-address -``` - -```bash [yarn] -yarn add @zerodev/smart-routing-address -``` - -```bash [pnpm] -pnpm i @zerodev/smart-routing-address -``` - -```bash [bun] -bun add @zerodev/smart-routing-address -``` - -::: - -## Usage - -Smart routing address has a beautifully simple API: just `createSmartRoutingAddress` and then send funds to it. That's really it. - -### Code Example - -We recommend that you take a look at [our code example](https://github.com/zerodevapp/smart-routing-address-example) (even better if you try running it) as you follow along the docs. - -### Creating a smart routing address - -In the following example, we are going to create a smart routing address that, when receiving funds on any chain, will transfer the funds to a specific address on Base. This is helpful when, for instance, you want to create a deposit address for your user, so that they can send funds to the address on any chain (possibly from a CEX), and then they will receive funds in their wallet on the chain that your app runs on. - -First import some types and functions: - -```tsx -import { - createSmartRoutingAddress, - createCall, - FLEX, -} from "@zerodev/smart-routing-address"; -``` - -Then set up some values (explained below): - -```tsx -// Replace with your own address -const owner = "0x244b33858733aab5307B0919D31f73878cAF617B"; - -const destChain = base; -const slippage = 5000; - -// This is the call that will be executed on the destination chain -const call = createCall({ - target: FLEX.TOKEN_ADDRESS, // any tokens - value: 0n, - abi: erc20Abi, - functionName: "transfer", - args: [owner, FLEX.AMOUNT], // any amount -}); -``` - -Finally, create a smart routing address: - -```tsx -const { smartRoutingAddress } = await createSmartRoutingAddress({ - owner, - destChain, - // Source tokens (any ERC20 on arbitrum, ETH on mainnet, USDC on optimism) - srcTokens: [ - { - tokenType: "ERC20", - chain: arbitrum, - }, - { - tokenType: "NATIVE", - chain: mainnet, - }, - { - tokenType: "USDC", - chain: optimism, - }, - ], - actions: { - USDC: { - action: [call], - fallBack: [], - }, - }, - slippage, -}); -``` - -The options are: - -- `owner` is an address that is authorized to recover funds from the smart routing address, in case the smart routing address fails to execute the target action for whatever reason. Typically you would set this to your user's EOA wallet, but you could also set it to your own address if you want to recover funds for users. - -- `destChain` is the chain on which the `actions` are supposed to happen. This is presumably the chain that your app runs on. - -- `srcTokens` is a list of tokens that the smart routing address should be able to receive. Only tokens listed in `srcTokens` will trigger actions on the destination. The other tokens sent to the address will have to be manually recovered by the `owner`. - -- `actions` is a map that records which action will be triggered by which token. In the example above, we specified an action that will be triggered when the smart routing address receives `USDC`. - -- `slippage` is the _maximum_ slippage that the user can expect. `slippage` is an integer, where 1 is equal to 0.01% (so 100 would mean 1% slippage). You can skip this param if you are unsure what to set, and the SDK will estimate a reasonable slippage based on your other settings. - -Once you have created a smart routing address, you can send tokens to it on any of the chains specified in `srcTokens`, and the `actions` will happen on the `destChain`. It's really that simple. - -### Fetching status - -You can fetch the status of a smart routing address to see its deposit history, including the source deposit, bridge transaction, and execution on the destination chain. - -```tsx -import { getSmartRoutingAddressStatus } from "@zerodev/smart-routing-address"; - -const status = await getSmartRoutingAddressStatus({ - smartRoutingAddress: "0x...", // your smart routing address -}); -``` - -The response contains a `deposits` array, where each entry tracks the full lifecycle of a deposit: - -```json -{ - "deposits": [ - { - "deposit": { - "chainId": 42161, - "token": "0xaf88d065e77c8cc2239327c5edb3a432268e5831", - "amount": "600000", - "blockNumber": "414941806", - "transactionHash": "0xebf172e44cd61903aba01c075d884b92c72875bce27afacd63bf06ad84c97ed8" - }, - "bridge": { - "blockNumber": "414941821", - "transactionHash": "0x1d54d7ef15377b98eff47d1d0e52fe7152c4a4b6a98b69927c3f0b407b35cb8f" - }, - "execution": { - "blockNumber": "40011722", - "chainId": 8453, - "outputToken": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913", - "transactionHash": "0x0506423eac1775e20b4b6fcb94b6a177075f9ca027d841e293b0690e51230622", - "outputAmount": "600000" - } - } - ], - "totalCount": 1, - "nextPage": null, - "totalPages": 1 -} -``` - -Each deposit entry includes: - -- `deposit` β€” the source chain transaction where funds were sent to the smart routing address. -- `bridge` β€” the bridge transaction that moves funds cross-chain. -- `execution` β€” the destination chain transaction where the action was executed. - -## Fee Sponsorship - -By default, Smart Routing Address deducts usage fees from the user's transferred tokens. However, as a developer, you can sponsor these fees so your users receive the full amount they deposit. - -**Example**: When a user deposits 10 USDC to their smart routing address, they will receive exactly 10 USDC on the destination chain, while your dapp pays the usage fees separately. - -### Sponsored Fee Configuration - -To set up fee sponsorship, you must perform two steps: - -1. **Configure SDK with Project ID**: Add your ZeroDev project ID to the `baseUrl` in your smart routing address configuration. -2. **Select Tokens in Dashboard**: Go to the [Smart Routing Address Dashboard](https://dashboard.zerodev.app/projects/smart-routing-address) and select the tokens you wish to sponsor for your project. - -```tsx -import { - createSmartRoutingAddress, - createCall, - FLEX, - SMART_ROUTING_ADDRESS_SERVER_URL, -} from "@zerodev/smart-routing-address"; - -const { smartRoutingAddress, estimatedFees } = await createSmartRoutingAddress({ - destChain, - owner, - slippage, - actions: { - USDC: { - action: [erc20Call], - fallBack: [], - }, - WRAPPED_NATIVE: { - action: [erc20Call], - fallBack: [], - }, - NATIVE: { - action: [nativeCall], - fallBack: [], - }, - }, - srcTokens, - config: { - baseUrl: `${SMART_ROUTING_ADDRESS_SERVER_URL}/${ZERODEV_PROJECT_ID}`, - }, -}); -``` - -Only tokens that are **both** configured with the project ID in the code **and** selected in the dashboard will be sponsored. For these tokens, usage fees are charged to your ZeroDev account, ensuring users receive the full deposit amount. - -## Pricing - -- Usage pricing (paid by the user with their transferred tokens, or sponsored by the developer): - - 20 basis points (0.20%) for transfers below $1000 - - 10 basis points (0.10%) for transfers above $1000 - -### Notes - -- Smart Routing Address integrates with bridges under the hood, so the usage pricing is on top of the underlying bridge fees. -- Pricing can be negotiated. Feel free to reach out. - -## Supported chains - -If you want your chain supported, [get in touch](https://forms.gle/sxpsSKnmKuFatm8x8). - -### Ethereum - -- **ETH**: `Native` -- **WETH**: `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` -- **USDC**: `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` -- **USDT**: `0xdAC17F958D2ee523a2206206994597C13D831ec7` -- **DAI**: `0x6B175474E89094C44Da98b954EedeAC495271d0F` -- **WBTC**: `0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599` - -### Optimism - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85` -- **USDT**: `0x94b008aA00579c1307B0EF2c499aD98a8ce58e58` -- **DAI**: `0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1` -- **WBTC**: `0x68f180fcCe6836688e9084f035309E29Bf0A2095` - -### Arbitrum - -- **ETH**: `Native` -- **WETH**: `0x82aF49447D8a07e3bd95BD0d56f35241523fBab1` -- **USDC**: `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` -- **USDT**: `0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9` -- **DAI**: `0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1` -- **WBTC**: `0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f` - -### Base - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` -- **USDT**: `0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2` -- **DAI**: `0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb` - -### Binance Smart Chain (BSC) - -- **WETH**: `0x2170Ed0880ac9A755fd29B2688956BD959F933F8` -- **USDC**: `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` -- **USDT**: `0x55d398326f99059fF775485246999027B3197955` - -### Polygon - -- **WETH**: `0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619` -- **USDC**: `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` -- **USDT**: `0xc2132D05D31c914a87C6611C10748AEb04B58e8F` -- **DAI**: `0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063` -- **WBTC**: `0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6` - -### HyperEVM - -- **USDC**: `0xb88339CB7199b77E23DB6E890353E22632Ba630f` -- **USDT**: `0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb` - -### World Chain - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0x79A02482A880bCE3F13e09Da970dC34db4CD24d1` -- **WBTC**: `0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3` - -### Unichain - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0x078D782b760474a361dDA0AF3839290b0EF57AD6` - -### Linea - -- **ETH**: `Native` -- **WETH**: `0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f` -- **USDC**: `0x176211869cA2b568f2A7D4EE941E073a821EE1ff` -- **USDT**: `0xA219439258ca9da29E9Cc4cE5596924745e12B93` -- **DAI**: `0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5` -- **WBTC**: `0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4` - -### Mode - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0xd988097fb8612cc24eeC14542bC03424c656005f` -- **USDT**: `0xf0F161fDA2712DB8b566946122a5af183995e2eD` -- **WBTC**: `0xcDd475325D6F564d27247D1DddBb0DAc6fA0a5CF` - -### Scroll - -- **ETH**: `Native` -- **WETH**: `0x5300000000000000000000000000000000000004` -- **USDC**: `0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4` -- **USDT**: `0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df` -- **WBTC**: `0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1` - -### Blast - -- **WBTC**: `0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692` - -### Zora - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` - -### Soneium - -- **ETH**: `Native` -- **WETH**: `0x4200000000000000000000000000000000000006` -- **USDC**: `0xbA9986D2381edf1DA03B0B9c1f8b00dc4AacC369` - -### Monad - -- **USDC**: `0x754704Bc059F8C67012fEd69BC8A327a5aafb603` -- **USDT**: `0xe7cd86e13AC4309349F30B3435a9d337750fC82D` - -### Tempo - -- **USDC.e**: `0x20C000000000000000000000b9537d11c60E8b50` diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx index 91c5cb0a..cfa7c8fa 100644 --- a/docs/pages/index.mdx +++ b/docs/pages/index.mdx @@ -1,24 +1,24 @@ # ZeroDev Introduction -**ZeroDev is the most powerful smart account solution**, with support for both ERC-4337 and [EIP-7702](/sdk/getting-started/quickstart-7702). +**ZeroDev is the most powerful smart account solution**, with support for both ERC-4337 and [EIP-7702](/smart-accounts/eip-7702/quickstart). ZeroDev improves Web3 UX by enabling: - Key abstraction - - Login with [passkeys](/sdk/advanced/passkeys) or [social accounts](/sdk/signers/intro). - - [Recover user accounts](/sdk/advanced/recovery) if they lose their login. + - Login with [passkeys](/smart-accounts/use-plugins/passkeys/overview) or [social accounts](/smart-accounts/use-plugins/signers-intro). + - [Recover user accounts](/smart-accounts/account-recovery/sdk-recovery) if they lose their login. - Gas abstraction - - [Sponsor gas](/sdk/core-api/sponsor-gas) for users. - - Let users [pay gas with ERC20 tokens](/sdk/core-api/pay-gas-with-erc20s). + - [Sponsor gas](/smart-accounts/sponsor-gas/evm) for users. + - Let users [pay gas with ERC20 tokens](/smart-accounts/pay-gas-with-erc20s). - Transaction abstraction - - [Batch multiple transactions](/sdk/core-api/batch-transactions) into one. No more tedious approvals. - - [Automate transactions](/sdk/permissions/intro) with session keys. Great for AI agents. + - [Batch multiple transactions](/smart-accounts/batch-transactions) into one. No more tedious approvals. + - [Automate transactions](/smart-accounts/permissions/intro) with session keys. Great for AI agents. - Chain abstraction - - [Spend tokens on any chain](/sdk/advanced/chain-abstraction), without bridging. - - [On/offramp with any exchanges](/smart-routing-address), even on L2s. + - [Spend tokens on any chain](/cross-chain/chain-abstraction/overview), without bridging. + - [On/offramp with any exchanges](/cross-chain/smart-routing-address), even on L2s. ZeroDev can be used as a standalone embedded smart account, or used alongside WaaS solutions such as Privy and Dynamic. @@ -26,4 +26,4 @@ ZeroDev is the most trusted solution in AA, powering more than 6 million smart a ## Getting Started -To start coding with ZeroDev, check out [the quickstart](/sdk/getting-started/quickstart) or [the tutorial](/sdk/getting-started/tutorial). +To start coding with ZeroDev, check out [the quickstart](/get-started/quickstart) or [the tutorial](/get-started/quickstart). diff --git a/docs/pages/sdk/permissions/1-click-trading.mdx b/docs/pages/sdk/permissions/1-click-trading.mdx deleted file mode 100644 index 3c3f9f3e..00000000 --- a/docs/pages/sdk/permissions/1-click-trading.mdx +++ /dev/null @@ -1,169 +0,0 @@ -# Tutorial -- Transaction Automation - -In this tutorial, you will learn how to enable 1-click trading for your app using session keys. - -Refer to [this code example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/1-click-trading.ts) while you follow along the tutorial. You can run the example by following instructions of [the examples repo](https://github.com/zerodevapp/zerodev-examples). - -## Installation - -The examples repo already installed this, but normally you would install permissions with: - -:::code-group - -```bash [npm] -npm i @zerodev/permissions -``` - -```bash [yarn] -yarn add @zerodev/permissions -``` - -```bash [pnpm] -pnpm i @zerodev/permissions -``` - -```bash [bun] -bun add @zerodev/permissions -``` - -::: - -## Owner-Agent Architecture - -There are multiple ways to use session keys. In this tutorial, we will use the popular "owner-agent" pattern: - -- The "owner" is the owner of the master key. -- The "agent" is the entity that wants to use the session key. - -In a typical setup, you might be wishing to automate transactions for your users from your server. - -your user's master key might be connected to your DApp frontend, in which case your frontend is the "owner." You might be wishing - -## API - -:::info -You can reference this [complete code example](https://github.com/zerodevapp/zerodev-examples/blob/main/permissions/main.ts) as you go through the tutorial. -::: - -With a permissions validator, you are putting together: - -- One signer -- Any number of policies -- (optionally) one action - -### Creating a signer - -Start by creating a [ECDSA signer](/sdk/permissions/signers/ecdsa): - -```ts -const sessionPrivateKey = generatePrivateKey() -const sessionKeyAccount = privateKeyToAccount(sessionPrivateKey) - -const sessionKeySigner = await toECDSASigner({ - signer: sessionKeyAccount, -}) -``` - -### Creating a number of policies - -Now, let's create two policies: - -- A "call policy" that checks that the user is minting an NFT. -- A "rate limit policy" that checks that the user executes this action once per month. - -```ts -const sessionPrivateKey = generatePrivateKey() -const sessionKeyAccount = privateKeyToAccount(sessionPrivateKey) - -const callPolicy = toCallPolicy({ - policyVersion: CallPolicyVersion.V0_0_2, - permissions: [ - { - target: contractAddress, - valueLimit: BigInt(0), - abi: contractABI, - functionName: "mint", - }, - ], -}) - -const rateLimitPolicy = toRateLimitPolicy({ - count: 1, - interval: 60 * 60 * 24 * 30, // month in seconds -}), -``` - -### Composing signer and policies - -Here comes the fun part -- we "compose" the signer and policies together into a single validator: - -```ts -const sessionKeyValidator = await toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: sessionKeySigner, - policies: [ - callPolicy, - rateLimitPolicy, - ], -}), -``` - -Now, we have created a ECDSA session key that's subject to a call policy and a rate limit policy. Just like that! - -### Using the session key - -Finally, we can set up the account with this session key as the signer. Note that if this is the first time that the session key is used, we need to [enable the plugin](/sdk/core-api/using-plugins#enabling-a-regular-validator). - -```ts -const account = await createKernelAccount(publicClient, { - plugins: { - sudo: ecdsaValidator, - regular: sessionKeyValidator, - }, - entryPoint, - kernelVersion, -}) -``` - -Now you can [set up a Kernel client](/sdk/core-api/create-account#create-an-account-client) using this account, and start minting NFTs with this session key -- but only up to once a month! - -Try running [this script](https://github.com/zerodevapp/zerodev-examples/blob/main/permissions/main.ts) and see for yourself. - -## Storing Session Keys - -Session keys (and permission validators in general) can be stored, by serializing them and then deserializing them later. - -### Code examples - -There are two general patterns with storing session keys. - -- The owner creates a session key for another agent to store & use. Check out [this example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/owner-created.ts). -- The agent creates a session key and asks the owner to "approve" it as a session key. Check out [this example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/agent-created.ts). - - In this flow, the owner never sees the private part of the session key, so it may be better for security. - -### Serializing a session key - -```ts -const serializedSessionKey = await serializePermissionAccount(sessionKeyAccount, sessionPrivateKey) -``` - -Note that `sessionPrivateKey` is optional. If the private key is not included, then you must provide the private key when you deserialize the session key. - -### De-serializing a session key - -```ts -const sessionKeySigner = await toECDSASigner({ - signer: privateKeyToAccount(sessionPrivateKey), -}) - -const sessionKeyAccount = await deserializePermissionAccount( - publicClient, - entryPoint, - kernelVersion, - serializedSessionKey, - sessionKeySigner, -) -``` - -Note that `sessionKeySigner` is only needed if you did not include the private key in the serialized session key. diff --git a/docs/pages/sdk/permissions/signers/multisig.mdx b/docs/pages/sdk/permissions/signers/multisig.mdx deleted file mode 100644 index cf8ae05f..00000000 --- a/docs/pages/sdk/permissions/signers/multisig.mdx +++ /dev/null @@ -1,32 +0,0 @@ -# Multisig Signer - -The weighted ECDSA (multisig) signer signs with a collection of ECDSA keys. Each key is weighted, so that the signature will pass as long as enough signers with enough weight have signed. - -Read [the multisig doc](/sdk/advanced/multisig) for more details. - -## API - -```typescript -import { toWeightedECDSASigner } from "@zerodev/permissions/signers" - -const multisigSigner = await toWeightedECDSASigner(publicClient, { - config: { - threshold: 100, - delay: 0, - signers: [ - { address: signer1.address, weight: 50 }, - { address: signer2.address, weight: 50 } - ] - }, - signers: [signer1, signer2] -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: multisigSigner, - policies: [ - // ... - ], -}) -``` \ No newline at end of file diff --git a/docs/pages/sdk/v5_3_x/advanced/fallback-providers.mdx b/docs/pages/sdk/v5_3_x/advanced/fallback-providers.mdx index 79e2c6fd..cceb02da 100644 --- a/docs/pages/sdk/v5_3_x/advanced/fallback-providers.mdx +++ b/docs/pages/sdk/v5_3_x/advanced/fallback-providers.mdx @@ -8,7 +8,7 @@ import VersionWarning from "../VersionWarning" Impatient? Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/blob/main/fallback-clients/main.ts). ::: -When you use ZeroDev, you can pick [a specific infrastructure provider](/meta-infra/rpcs#bundler-rpc). If you don't pick one, we pick one for you. +When you use ZeroDev, you can pick [a specific infrastructure provider](/resources/infrastructure/rpcs#bundler-rpc). If you don't pick one, we pick one for you. However, sometimes an infra provider may experience downtime. We have developed a "fallbacks" feature that allows you to set up multiple providers, so that when one fails, another takes over. diff --git a/docs/pages/sdk/v5_3_x/advanced/recovery.mdx b/docs/pages/sdk/v5_3_x/advanced/recovery.mdx index b903076e..1fbbfd30 100644 --- a/docs/pages/sdk/v5_3_x/advanced/recovery.mdx +++ b/docs/pages/sdk/v5_3_x/advanced/recovery.mdx @@ -16,7 +16,7 @@ There are two ways to use recovery: through a pre-built recovery flow or build a ## Pre-built Recovery Flow -[Check out the recovery flow docs.](/recovery-flow/intro) +[Check out the recovery flow docs.](/smart-accounts/account-recovery/flow-intro) ## Recovery Plugin diff --git a/docs/pages/sdk/v5_3_x/advanced/wallet-connect.mdx b/docs/pages/sdk/v5_3_x/advanced/wallet-connect.mdx index 502b110d..ec1fb784 100644 --- a/docs/pages/sdk/v5_3_x/advanced/wallet-connect.mdx +++ b/docs/pages/sdk/v5_3_x/advanced/wallet-connect.mdx @@ -56,7 +56,7 @@ await walletConnectKernelService.init({ - `kernelClient`: An optional kernel client for creating a kernel provider. - For detailed information on kernel clients, see [the kernel clients documentation.](/sdk/v5_3_x/core-api/create-account#create-an-account-client) - `kernelProvider`: An optional pre-initialized kernel provider. - - If you are using wagmi with the capabilities pattern (for more information, see [the capabilities quickstart](/smart-wallet/quickstart-capabilities)), you can get the `kernelProvider` from wagmi. + - If you are using wagmi with the capabilities pattern (for more information, see [the capabilities quickstart](/get-started/quickstart)), you can get the `kernelProvider` from wagmi. ```typescript import { useAccount } from "wagmi"; diff --git a/docs/pages/sdk/v5_3_x/core-api/sponsor-gas.mdx b/docs/pages/sdk/v5_3_x/core-api/sponsor-gas.mdx index c13ce7dd..cb66048b 100644 --- a/docs/pages/sdk/v5_3_x/core-api/sponsor-gas.mdx +++ b/docs/pages/sdk/v5_3_x/core-api/sponsor-gas.mdx @@ -14,7 +14,7 @@ When you sponsor gas through ZeroDev, there are two ways to pay for the gas: ## Setting up gas sponsoring policies -To avoid over-spending gas on sponsoring, you must set up gas-sponsoring policies. Sign up on the ZeroDev dashboard if you haven't already, then [set up gas policies](/meta-infra/gas-policies). +To avoid over-spending gas on sponsoring, you must set up gas-sponsoring policies. Sign up on the ZeroDev dashboard if you haven't already, then [set up gas policies](/resources/infrastructure/gas-policies). ## API diff --git a/docs/pages/sdk/v5_3_x/getting-started/tutorial.mdx b/docs/pages/sdk/v5_3_x/getting-started/tutorial.mdx index 8a8e40d6..97cbe95f 100644 --- a/docs/pages/sdk/v5_3_x/getting-started/tutorial.mdx +++ b/docs/pages/sdk/v5_3_x/getting-started/tutorial.mdx @@ -12,7 +12,7 @@ In this tutorial, we will mint an NFT without paying gas. We assume that you hav ## Create a ZeroDev Project -For this tutorial, we will use [ZeroDev's AA infra](/meta-infra/intro), but you can use ZeroDev with any AA infra provider. +For this tutorial, we will use [ZeroDev's AA infra](/resources/infrastructure/intro), but you can use ZeroDev with any AA infra provider. Go to the [ZeroDev dashboard](https://dashboard.zerodev.app/) and create a project for Sepolia. diff --git a/docs/pages/sdk/v5_3_x/infra/intro.mdx b/docs/pages/sdk/v5_3_x/infra/intro.mdx index 5c4e8e11..36a60bd7 100644 --- a/docs/pages/sdk/v5_3_x/infra/intro.mdx +++ b/docs/pages/sdk/v5_3_x/infra/intro.mdx @@ -6,7 +6,7 @@ import VersionWarning from "../VersionWarning" ZeroDev is compatible with any account abstraction infra provider. Check out these guides for integrating with a specific provider: -- [ZeroDev](/meta-infra/intro) +- [ZeroDev](/resources/infrastructure/intro) - [Pimlico](/sdk/v5_3_x/infra/pimlico) Read on to learn how to integrate with a custom provider. diff --git a/docs/pages/sdk/v5_3_x/infra/zerodev.mdx b/docs/pages/sdk/v5_3_x/infra/zerodev.mdx index 01ca365b..87b22071 100644 --- a/docs/pages/sdk/v5_3_x/infra/zerodev.mdx +++ b/docs/pages/sdk/v5_3_x/infra/zerodev.mdx @@ -4,4 +4,4 @@ import VersionWarning from "../VersionWarning" # ZeroDev -ZeroDev provides a meta infrastructure that proxies traffic to multiple infra providers including Alchemy, Gelato and Pimlico. [Read more here](/meta-infra/intro). \ No newline at end of file +ZeroDev provides a meta infrastructure that proxies traffic to multiple infra providers including Alchemy, Gelato and Pimlico. [Read more here](/resources/infrastructure/intro). \ No newline at end of file diff --git a/docs/pages/sdk/v5_3_x/presets/zerodev.mdx b/docs/pages/sdk/v5_3_x/presets/zerodev.mdx index d3ccccb2..6d9b64cb 100644 --- a/docs/pages/sdk/v5_3_x/presets/zerodev.mdx +++ b/docs/pages/sdk/v5_3_x/presets/zerodev.mdx @@ -28,11 +28,11 @@ const kernelClient = await createEcdsaKernelAccountClient({ - `chain` is a [Viem chain object](https://viem.sh/docs/clients/chains.html) - `projectId` is a ZeroDev project ID from the [ZeroDev dashboard](https://dashboard.zerodev.app/). - `signer` is a [Viem account](https://viem.sh/docs/accounts/local.html). -- (optional) `provider` can be [any provider that ZeroDev supports](/meta-infra/intro). +- (optional) `provider` can be [any provider that ZeroDev supports](/resources/infrastructure/intro). - (optional) `index` can be any positive integer. Different indexes will yield different accounts. - (optional) `paymaster` can be: - `'NONE'`: not using any paymaster (the user pays their own gas). - - `'SPONSOR'` (default): sponsor gas for users according to [gas policies](/meta-infra/gas-policies). + - `'SPONSOR'` (default): sponsor gas for users according to [gas policies](/resources/infrastructure/gas-policies). - A ERC20 token address: use the specified ERC20 token as gas tokens. See the [ERC20 gas token docs](/sdk/v5_3_x/core-api/pay-gas-with-erc20s) for details. -is a boolean flag that determines whether ZeroDev will use [the sponsoring paymaster](/meta-infra/intro). +is a boolean flag that determines whether ZeroDev will use [the sponsoring paymaster](/resources/infrastructure/intro). diff --git a/docs/pages/recovery-flow/intro.md b/docs/pages/smart-accounts/account-recovery/flow-intro.md similarity index 70% rename from docs/pages/recovery-flow/intro.md rename to docs/pages/smart-accounts/account-recovery/flow-intro.md index 985642bb..6f28b5c6 100644 --- a/docs/pages/recovery-flow/intro.md +++ b/docs/pages/smart-accounts/account-recovery/flow-intro.md @@ -4,10 +4,10 @@ ZeroDev provides a set of pre-built UIs to quickly integrate account recovery in The recovery flow works with Kernel accounts that have set up recovery using the official recovery plugin. There are two ways to set up recovery: -- [Using our pre-built recovery setup UI.](/recovery-flow/setup) +- [Using our pre-built recovery setup UI.](/smart-accounts/account-recovery/flow-setup) - This is super easy to integrate with. -- [Using ZeroDev.](/sdk/advanced/recovery) +- [Using ZeroDev.](/smart-accounts/account-recovery/sdk-recovery) - This is harder to integrate with but allows you to customize your user experience. -In either case, once an account has been set up for recovery, the guardian (which may be the user themselves) can recover the user's account through [the recovery portal](/recovery-flow/portal). +In either case, once an account has been set up for recovery, the guardian (which may be the user themselves) can recover the user's account through [the recovery portal](/smart-accounts/account-recovery/portal). diff --git a/docs/pages/recovery-flow/setup.md b/docs/pages/smart-accounts/account-recovery/flow-setup.md similarity index 100% rename from docs/pages/recovery-flow/setup.md rename to docs/pages/smart-accounts/account-recovery/flow-setup.md diff --git a/docs/pages/recovery-flow/portal.md b/docs/pages/smart-accounts/account-recovery/portal.md similarity index 100% rename from docs/pages/recovery-flow/portal.md rename to docs/pages/smart-accounts/account-recovery/portal.md diff --git a/docs/pages/sdk/advanced/recovery.mdx b/docs/pages/smart-accounts/account-recovery/sdk-recovery.mdx similarity index 80% rename from docs/pages/sdk/advanced/recovery.mdx rename to docs/pages/smart-accounts/account-recovery/sdk-recovery.mdx index e55bf593..e9c79527 100644 --- a/docs/pages/sdk/advanced/recovery.mdx +++ b/docs/pages/smart-accounts/account-recovery/sdk-recovery.mdx @@ -1,6 +1,6 @@ # Recovery -With Kernel's [permissions system](/sdk/permissions/intro), it's possible to set up a guardian (or multiple guardians) for a smart account, so that if the owner loses their key, the guardian(s) can recover the key for the owner. +With Kernel's [permissions system](/smart-accounts/permissions/intro), it's possible to set up a guardian (or multiple guardians) for a smart account, so that if the owner loses their key, the guardian(s) can recover the key for the owner. There are two typical types of recovery: @@ -32,11 +32,11 @@ const guardianValidator = await signerToEcdsaValidator(publicClient, { }) ``` -If you want multiple guardians, set up a [multisig validator](/sdk/advanced/multisig) instead. +If you want multiple guardians, set up a [multisig validator](/smart-accounts/use-plugins/multisig) instead. ### Setting up account with the recovery action -We have deployed a simple recovery executor that can recover any accounts using [the ECDSA validator](/sdk/permissions/signers/ecdsa). You can set it up with the following values: +We have deployed a simple recovery executor that can recover any accounts using [the ECDSA validator](/smart-accounts/permissions/signers/ecdsa). You can set it up with the following values: ```ts import { toFunctionSelector } from "viem" @@ -67,7 +67,7 @@ you only need to set the sudo validator if you are enabling the guardian validat ### Executing recovery -After you [construct the account client from the account](/sdk/core-api/create-account#create-an-account-client), you can execute recovery as such: +After you [construct the account client from the account](/smart-accounts/create-a-smart-account#create-an-account-client), you can execute recovery as such: ```ts import { encodeFunctionData } from "viem" @@ -84,7 +84,7 @@ const userOpHash = await kernelClient.sendUserOperation({ ### Using account with the new owner -After you update the account owner, the account address can no longer by computed from the new owner. Therefore, you should use the `address` option to manually set the account address when you [create the account object](/sdk/core-api/create-account#create-a-kernel-account). For example: +After you update the account owner, the account address can no longer by computed from the new owner. Therefore, you should use the `address` option to manually set the account address when you [create the account object](/smart-accounts/create-a-smart-account#create-a-kernel-account). For example: ```ts const account = await createKernelAccount(publicClient, { diff --git a/docs/pages/sdk/signers/arcana.mdx b/docs/pages/smart-accounts/authentication/arcana.mdx similarity index 98% rename from docs/pages/sdk/signers/arcana.mdx rename to docs/pages/smart-accounts/authentication/arcana.mdx index cd2ad2f0..0182bbf8 100644 --- a/docs/pages/sdk/signers/arcana.mdx +++ b/docs/pages/smart-accounts/authentication/arcana.mdx @@ -28,7 +28,7 @@ const authProvider = new AuthProvider(clientId, params); ### Use with ZeroDev -Use the provider from Arcana to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Arcana to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/capsule.mdx b/docs/pages/smart-accounts/authentication/capsule.mdx similarity index 98% rename from docs/pages/sdk/signers/capsule.mdx rename to docs/pages/smart-accounts/authentication/capsule.mdx index d4cea223..1ae46dd4 100644 --- a/docs/pages/sdk/signers/capsule.mdx +++ b/docs/pages/smart-accounts/authentication/capsule.mdx @@ -29,7 +29,7 @@ const para = new Para(env, apiKey, opts); ### Use with ZeroDev -Use the WalletClient from Para to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the WalletClient from Para to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/custom-signer.mdx b/docs/pages/smart-accounts/authentication/custom-signer.mdx similarity index 83% rename from docs/pages/sdk/signers/custom-signer.mdx rename to docs/pages/smart-accounts/authentication/custom-signer.mdx index 041c6862..501bbd02 100644 --- a/docs/pages/sdk/signers/custom-signer.mdx +++ b/docs/pages/smart-accounts/authentication/custom-signer.mdx @@ -2,7 +2,7 @@ ZeroDev offers the flexibility to integrate various types of signers, catering to diverse application requirements. ## Using Externally Owned Accounts (EOAs) -Most commonly used signers are Externally Owned Accounts (EOAs). If you're using a signer that falls under this category and isn't explicitly covered in our documentation, we recommend visiting our dedicated [EOA integration section](/sdk/signers/eoa). This section provides detailed guidance on integrating EOAs with ZeroDev. +Most commonly used signers are Externally Owned Accounts (EOAs). If you're using a signer that falls under this category and isn't explicitly covered in our documentation, we recommend visiting our dedicated [EOA integration section](/smart-accounts/authentication/eoa). This section provides detailed guidance on integrating EOAs with ZeroDev. ## Implementing Custom Signers @@ -10,4 +10,4 @@ If your requirements extend beyond standard EOAs, ZeroDev supports the integrati One easy way to implement a `SmartAccountSigner` is to implement Viem's account type, [by following this guide](https://viem.sh/docs/accounts/local/toAccount). -Once you've implemented the signer, you should be able to [use it with a validator](/sdk/core-api/create-account#creating-a-ecdsa-validator). +Once you've implemented the signer, you should be able to [use it with a validator](/smart-accounts/create-a-smart-account#creating-a-ecdsa-validator). diff --git a/docs/pages/sdk/signers/dfns.mdx b/docs/pages/smart-accounts/authentication/dfns.mdx similarity index 98% rename from docs/pages/sdk/signers/dfns.mdx rename to docs/pages/smart-accounts/authentication/dfns.mdx index 7a77b2e5..54d7c9fc 100644 --- a/docs/pages/sdk/signers/dfns.mdx +++ b/docs/pages/smart-accounts/authentication/dfns.mdx @@ -52,7 +52,7 @@ const initDfnsWallet = (walletId: string) => { ### Use with ZeroDev -Use the WalletClient from Dfns to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the WalletClient from Dfns to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/dynamic.mdx b/docs/pages/smart-accounts/authentication/dynamic.mdx similarity index 98% rename from docs/pages/sdk/signers/dynamic.mdx rename to docs/pages/smart-accounts/authentication/dynamic.mdx index 32525728..4ce1abce 100644 --- a/docs/pages/sdk/signers/dynamic.mdx +++ b/docs/pages/smart-accounts/authentication/dynamic.mdx @@ -35,7 +35,7 @@ const dynamicWalletClient = await primaryWallet?.connector?.getWalletClient(); ### Use with ZeroDev -Use the WalletClient from Dynamic to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the WalletClient from Dynamic to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/eoa.mdx b/docs/pages/smart-accounts/authentication/eoa.mdx similarity index 100% rename from docs/pages/sdk/signers/eoa.mdx rename to docs/pages/smart-accounts/authentication/eoa.mdx diff --git a/docs/pages/sdk/signers/fireblocks.mdx b/docs/pages/smart-accounts/authentication/fireblocks.mdx similarity index 98% rename from docs/pages/sdk/signers/fireblocks.mdx rename to docs/pages/smart-accounts/authentication/fireblocks.mdx index bf8113ea..d98dec9c 100644 --- a/docs/pages/sdk/signers/fireblocks.mdx +++ b/docs/pages/smart-accounts/authentication/fireblocks.mdx @@ -25,7 +25,7 @@ const fireblocksWeb3Provider = new FireblocksWeb3Provider(fireblocksProviderConf ### Use with ZeroDev -Use the provider from Fireblocks to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Fireblocks to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/lit-protocol.mdx b/docs/pages/smart-accounts/authentication/lit-protocol.mdx similarity index 98% rename from docs/pages/sdk/signers/lit-protocol.mdx rename to docs/pages/smart-accounts/authentication/lit-protocol.mdx index c8b3f532..56cacde8 100644 --- a/docs/pages/sdk/signers/lit-protocol.mdx +++ b/docs/pages/smart-accounts/authentication/lit-protocol.mdx @@ -75,7 +75,7 @@ const pkpWallet = new PKPEthersWallet({ ### Use with ZeroDev -Use the provider from Lit Protocol to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Lit Protocol to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/magic.mdx b/docs/pages/smart-accounts/authentication/magic.mdx similarity index 98% rename from docs/pages/sdk/signers/magic.mdx rename to docs/pages/smart-accounts/authentication/magic.mdx index 7b650d26..723752b3 100644 --- a/docs/pages/sdk/signers/magic.mdx +++ b/docs/pages/smart-accounts/authentication/magic.mdx @@ -39,7 +39,7 @@ const magic = new MagicBase(process.env.MAGIC_API_KEY as string, { ### Use with ZeroDev -Use the provider from Magic to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Magic to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/particle.mdx b/docs/pages/smart-accounts/authentication/particle.mdx similarity index 97% rename from docs/pages/sdk/signers/particle.mdx rename to docs/pages/smart-accounts/authentication/particle.mdx index c8923284..175ca723 100644 --- a/docs/pages/sdk/signers/particle.mdx +++ b/docs/pages/smart-accounts/authentication/particle.mdx @@ -34,7 +34,7 @@ const particleProvider = new ParticleProvider(particle.auth) ### Use with ZeroDev -Use the provider from Particle Network to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Particle Network to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/portal.mdx b/docs/pages/smart-accounts/authentication/portal.mdx similarity index 98% rename from docs/pages/sdk/signers/portal.mdx rename to docs/pages/smart-accounts/authentication/portal.mdx index bd89ba49..bbf3bb73 100644 --- a/docs/pages/sdk/signers/portal.mdx +++ b/docs/pages/smart-accounts/authentication/portal.mdx @@ -31,7 +31,7 @@ const portal = new Portal(portalOptions); ### Use with ZeroDev -Use the provider from Portal to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Portal to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/privy.mdx b/docs/pages/smart-accounts/authentication/privy.mdx similarity index 98% rename from docs/pages/sdk/signers/privy.mdx rename to docs/pages/smart-accounts/authentication/privy.mdx index 3011d964..72ff957a 100644 --- a/docs/pages/sdk/signers/privy.mdx +++ b/docs/pages/smart-accounts/authentication/privy.mdx @@ -46,7 +46,7 @@ const privyProvider = await embeddedWallet.getEthereumProvider(); ### Use with ZeroDev -Use the provider from Privy to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Privy to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/smart-wallet.mdx b/docs/pages/smart-accounts/authentication/smart-wallet.mdx similarity index 100% rename from docs/pages/sdk/signers/smart-wallet.mdx rename to docs/pages/smart-accounts/authentication/smart-wallet.mdx diff --git a/docs/pages/sdk/advanced/social-login.mdx b/docs/pages/smart-accounts/authentication/social-login.mdx similarity index 96% rename from docs/pages/sdk/advanced/social-login.mdx rename to docs/pages/smart-accounts/authentication/social-login.mdx index e910e579..3cd220b0 100644 --- a/docs/pages/sdk/advanced/social-login.mdx +++ b/docs/pages/smart-accounts/authentication/social-login.mdx @@ -4,7 +4,7 @@ import SocialLoginSetup from '../../shared/social-login-setup.mdx' Social login allows users to authenticate using their existing social media accounts such as Google or Facebook. -ZeroDev supports social logins natively, but you can also use ZeroDev with [third-party auth providers](/sdk/signers/intro) such as Privy, Dynamic, and Magic if you prefer their UI. +ZeroDev supports social logins natively, but you can also use ZeroDev with [third-party auth providers](/smart-accounts/use-plugins/signers-intro) such as Privy, Dynamic, and Magic if you prefer their UI. ## Setup diff --git a/docs/pages/sdk/signers/turnkey.mdx b/docs/pages/smart-accounts/authentication/turnkey.mdx similarity index 97% rename from docs/pages/sdk/signers/turnkey.mdx rename to docs/pages/smart-accounts/authentication/turnkey.mdx index a4230743..d6752699 100644 --- a/docs/pages/sdk/signers/turnkey.mdx +++ b/docs/pages/smart-accounts/authentication/turnkey.mdx @@ -33,7 +33,7 @@ const turnkeyAccount = createAccount({ ### Use with ZeroDev -Use the WalletClient from Turnkey to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the WalletClient from Turnkey to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/signers/web3auth.mdx b/docs/pages/smart-accounts/authentication/web3auth.mdx similarity index 98% rename from docs/pages/sdk/signers/web3auth.mdx rename to docs/pages/smart-accounts/authentication/web3auth.mdx index bc8f7b11..ae3bcf15 100644 --- a/docs/pages/sdk/signers/web3auth.mdx +++ b/docs/pages/smart-accounts/authentication/web3auth.mdx @@ -31,7 +31,7 @@ const web3auth = new Web3Auth({ ### Use with ZeroDev -Use the provider from Web3Auth to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api). +Use the provider from Web3Auth to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/smart-accounts/create-a-smart-account#api). ```typescript import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" diff --git a/docs/pages/sdk/core-api/batch-transactions.mdx b/docs/pages/smart-accounts/batch-transactions.mdx similarity index 95% rename from docs/pages/sdk/core-api/batch-transactions.mdx rename to docs/pages/smart-accounts/batch-transactions.mdx index ea090b2a..4c3ca64e 100644 --- a/docs/pages/sdk/core-api/batch-transactions.mdx +++ b/docs/pages/smart-accounts/batch-transactions.mdx @@ -38,7 +38,7 @@ const txHash = await kernelClient.sendTransaction({ ### `sendUserOperation` -You can learn more about the `sendUserOperation` API [here](/sdk/core-api/send-transactions#sending-raw-userops). +You can learn more about the `sendUserOperation` API [here](/smart-accounts/send-transactions#sending-raw-userops). To send a UserOp with batching, simply pass an array of calls into `encodeCalls`. diff --git a/docs/pages/sdk/core-api/create-account.mdx b/docs/pages/smart-accounts/create-a-smart-account.mdx similarity index 96% rename from docs/pages/sdk/core-api/create-account.mdx rename to docs/pages/smart-accounts/create-a-smart-account.mdx index e3033678..89680d3c 100644 --- a/docs/pages/sdk/core-api/create-account.mdx +++ b/docs/pages/smart-accounts/create-a-smart-account.mdx @@ -6,9 +6,9 @@ Impatient? Check out [a complete example here](https://github.com/zerodevapp/ze At the core of account abstraction is the *smart account* -- an account powered by a smart contract. ZeroDev is built on [Kernel](https://github.com/zerodevapp/kernel), a *modular smart account* that can be customized with plugins. -When you create a Kernel account, you set it up with a *validator*, which is a type of plugin that handles how the account validates UserOps. In this tutorial, we will be using the ECDSA validator, which works like a normal EOA by validating signatures from a ECDSA private key. ZeroDev supports other validators such as [passkeys](/sdk/advanced/passkeys) and [multisig](/sdk/advanced/multisig). +When you create a Kernel account, you set it up with a *validator*, which is a type of plugin that handles how the account validates UserOps. In this tutorial, we will be using the ECDSA validator, which works like a normal EOA by validating signatures from a ECDSA private key. ZeroDev supports other validators such as [passkeys](/smart-accounts/use-plugins/passkeys/overview) and [multisig](/smart-accounts/use-plugins/multisig). -We will be using a local private key, but the ECDSA validator also works with [third-party auth providers](/sdk/signers/intro). +We will be using a local private key, but the ECDSA validator also works with [third-party auth providers](/smart-accounts/use-plugins/signers-intro). ## Installation @@ -154,9 +154,9 @@ Note that: - You need to replace the `ZERODEV_RPC` with the RPC found on your ZeroDev dashboard. - You need to make sure to set the right `chain`. -- `paymaster` only needs to be specified if you want to [use a paymaster](/sdk/core-api/sponsor-gas). +- `paymaster` only needs to be specified if you want to [use a paymaster](/smart-accounts/sponsor-gas/evm). -Now you are ready to do things with your smart account, like [sending UserOps](/sdk/core-api/send-transactions)! +Now you are ready to do things with your smart account, like [sending UserOps](/smart-accounts/send-transactions)! ## FAQs diff --git a/docs/pages/sdk/getting-started/quickstart-7702.mdx b/docs/pages/smart-accounts/eip-7702/quickstart.mdx similarity index 100% rename from docs/pages/sdk/getting-started/quickstart-7702.mdx rename to docs/pages/smart-accounts/eip-7702/quickstart.mdx diff --git a/docs/pages/wallets/auth/email-otp.mdx b/docs/pages/smart-accounts/embedded-wallet/auth/email-otp.mdx similarity index 93% rename from docs/pages/wallets/auth/email-otp.mdx rename to docs/pages/smart-accounts/embedded-wallet/auth/email-otp.mdx index c7aaf379..a27579a5 100644 --- a/docs/pages/wallets/auth/email-otp.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/auth/email-otp.mdx @@ -8,8 +8,8 @@ Email OTP is a two-step flow: send a verification code to the user's email, then ## Hooks -- [`useSendOTP`](/wallets/hooks/use-send-otp) β€” Send a one-time code to an email address -- [`useVerifyOTP`](/wallets/hooks/use-verify-otp) β€” Verify the code and authenticate +- [`useSendOTP`](/smart-accounts/embedded-wallet/hooks/use-send-otp) β€” Send a one-time code to an email address +- [`useVerifyOTP`](/smart-accounts/embedded-wallet/hooks/use-verify-otp) β€” Verify the code and authenticate ## Example diff --git a/docs/pages/wallets/auth/google-oauth.mdx b/docs/pages/smart-accounts/embedded-wallet/auth/google-oauth.mdx similarity index 96% rename from docs/pages/wallets/auth/google-oauth.mdx rename to docs/pages/smart-accounts/embedded-wallet/auth/google-oauth.mdx index 03be8e3a..1e5d127a 100644 --- a/docs/pages/wallets/auth/google-oauth.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/auth/google-oauth.mdx @@ -12,7 +12,7 @@ By default, the Google OAuth flow uses a Zerodev-managed Google account for auth ## Hook -- [`useAuthenticateOAuth`](/wallets/hooks/use-authenticate-oauth) β€” Trigger the OAuth flow +- [`useAuthenticateOAuth`](/smart-accounts/embedded-wallet/hooks/use-authenticate-oauth) β€” Trigger the OAuth flow ## Example diff --git a/docs/pages/wallets/auth/magic-link.mdx b/docs/pages/smart-accounts/embedded-wallet/auth/magic-link.mdx similarity index 93% rename from docs/pages/wallets/auth/magic-link.mdx rename to docs/pages/smart-accounts/embedded-wallet/auth/magic-link.mdx index 8bd808cc..dd46193e 100644 --- a/docs/pages/wallets/auth/magic-link.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/auth/magic-link.mdx @@ -8,8 +8,8 @@ Magic links let users authenticate by clicking a link in their email. The link r ## Hooks -- [`useSendMagicLink`](/wallets/hooks/use-send-magic-link) β€” Send a magic link to an email address -- [`useVerifyMagicLink`](/wallets/hooks/use-verify-magic-link) β€” Verify the magic link and authenticate +- [`useSendMagicLink`](/smart-accounts/embedded-wallet/hooks/use-send-magic-link) β€” Send a magic link to an email address +- [`useVerifyMagicLink`](/smart-accounts/embedded-wallet/hooks/use-verify-magic-link) β€” Verify the magic link and authenticate ## Example diff --git a/docs/pages/wallets/auth/passkeys.mdx b/docs/pages/smart-accounts/embedded-wallet/auth/passkeys.mdx similarity index 93% rename from docs/pages/wallets/auth/passkeys.mdx rename to docs/pages/smart-accounts/embedded-wallet/auth/passkeys.mdx index 2e9c5255..0eed1cb2 100644 --- a/docs/pages/wallets/auth/passkeys.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/auth/passkeys.mdx @@ -20,8 +20,8 @@ zeroDevWallet({ ## Hooks -- [`useRegisterPasskey`](/wallets/hooks/use-register-passkey) β€” Create a new wallet with a passkey -- [`useLoginPasskey`](/wallets/hooks/use-login-passkey) β€” Sign in to an existing wallet +- [`useRegisterPasskey`](/smart-accounts/embedded-wallet/hooks/use-register-passkey) β€” Create a new wallet with a passkey +- [`useLoginPasskey`](/smart-accounts/embedded-wallet/hooks/use-login-passkey) β€” Sign in to an existing wallet ## Example diff --git a/docs/pages/wallets/export.mdx b/docs/pages/smart-accounts/embedded-wallet/export.mdx similarity index 93% rename from docs/pages/wallets/export.mdx rename to docs/pages/smart-accounts/embedded-wallet/export.mdx index 256f62f4..32b37e60 100644 --- a/docs/pages/wallets/export.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/export.mdx @@ -8,8 +8,8 @@ The SDK supports exporting the user's wallet as a seed phrase or private key. Th ## Hooks -- [`useExportWallet`](/wallets/hooks/use-export-wallet) β€” Export the wallet seed phrase -- [`useExportPrivateKey`](/wallets/hooks/use-export-private-key) β€” Export a single private key +- [`useExportWallet`](/smart-accounts/embedded-wallet/hooks/use-export-wallet) β€” Export the wallet seed phrase +- [`useExportPrivateKey`](/smart-accounts/embedded-wallet/hooks/use-export-private-key) β€” Export a single private key ## Example diff --git a/docs/pages/wallets/hooks/use-authenticate-oauth.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-authenticate-oauth.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-authenticate-oauth.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-authenticate-oauth.mdx diff --git a/docs/pages/wallets/hooks/use-export-private-key.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-export-private-key.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-export-private-key.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-export-private-key.mdx diff --git a/docs/pages/wallets/hooks/use-export-wallet.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-export-wallet.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-export-wallet.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-export-wallet.mdx diff --git a/docs/pages/wallets/hooks/use-get-user-email.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-get-user-email.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-get-user-email.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-get-user-email.mdx diff --git a/docs/pages/wallets/hooks/use-login-passkey.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-login-passkey.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-login-passkey.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-login-passkey.mdx diff --git a/docs/pages/wallets/hooks/use-refresh-session.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-refresh-session.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-refresh-session.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-refresh-session.mdx diff --git a/docs/pages/wallets/hooks/use-register-passkey.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-register-passkey.mdx similarity index 100% rename from docs/pages/wallets/hooks/use-register-passkey.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-register-passkey.mdx diff --git a/docs/pages/wallets/hooks/use-send-magic-link.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-send-magic-link.mdx similarity index 93% rename from docs/pages/wallets/hooks/use-send-magic-link.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-send-magic-link.mdx index 1d2690b5..ea9232d6 100644 --- a/docs/pages/wallets/hooks/use-send-magic-link.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/hooks/use-send-magic-link.mdx @@ -62,7 +62,7 @@ function SendMagicLink() { `string` -**Required.** The URL the user will be redirected to after clicking the magic link. This should be a page in your app that calls [`useVerifyMagicLink`](/wallets/hooks/use-verify-magic-link). +**Required.** The URL the user will be redirected to after clicking the magic link. This should be a page in your app that calls [`useVerifyMagicLink`](/smart-accounts/embedded-wallet/hooks/use-verify-magic-link). ### otpCodeCustomization @@ -109,6 +109,6 @@ Similar to [`mutate`](#mutate) but returns a promise. `string` -The identifier for this magic link verification. Store this value and pass it to [`useVerifyMagicLink`](/wallets/hooks/use-verify-magic-link) on the redirect page. +The identifier for this magic link verification. Store this value and pass it to [`useVerifyMagicLink`](/smart-accounts/embedded-wallet/hooks/use-verify-magic-link) on the redirect page. diff --git a/docs/pages/wallets/hooks/use-send-otp.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-send-otp.mdx similarity index 96% rename from docs/pages/wallets/hooks/use-send-otp.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-send-otp.mdx index ffb2fb12..ca1750a7 100644 --- a/docs/pages/wallets/hooks/use-send-otp.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/hooks/use-send-otp.mdx @@ -110,6 +110,6 @@ Similar to [`mutate`](#mutate) but returns a promise. `string` -The identifier for this OTP verification attempt. Pass this to [`useVerifyOTP`](/wallets/hooks/use-verify-otp) to complete authentication. +The identifier for this OTP verification attempt. Pass this to [`useVerifyOTP`](/smart-accounts/embedded-wallet/hooks/use-verify-otp) to complete authentication. diff --git a/docs/pages/wallets/hooks/use-verify-magic-link.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-magic-link.mdx similarity index 97% rename from docs/pages/wallets/hooks/use-verify-magic-link.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-magic-link.mdx index 5810d1b8..b21fac39 100644 --- a/docs/pages/wallets/hooks/use-verify-magic-link.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-magic-link.mdx @@ -48,7 +48,7 @@ function VerifyPage() { `string` -**Required.** The OTP identifier returned by [`useSendMagicLink`](/wallets/hooks/use-send-magic-link). +**Required.** The OTP identifier returned by [`useSendMagicLink`](/smart-accounts/embedded-wallet/hooks/use-send-magic-link). ### code diff --git a/docs/pages/wallets/hooks/use-verify-otp.mdx b/docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-otp.mdx similarity index 95% rename from docs/pages/wallets/hooks/use-verify-otp.mdx rename to docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-otp.mdx index 4ee8832b..bdd7e701 100644 --- a/docs/pages/wallets/hooks/use-verify-otp.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/hooks/use-verify-otp.mdx @@ -60,7 +60,7 @@ function VerifyCode({ otpId }: { otpId: string }) { `string` -**Required.** The OTP identifier returned by [`useSendOTP`](/wallets/hooks/use-send-otp). +**Required.** The OTP identifier returned by [`useSendOTP`](/smart-accounts/embedded-wallet/hooks/use-send-otp). ## Return Types diff --git a/docs/pages/wallets/index.mdx b/docs/pages/smart-accounts/embedded-wallet/index.mdx similarity index 96% rename from docs/pages/wallets/index.mdx rename to docs/pages/smart-accounts/embedded-wallet/index.mdx index 10fde545..088bf130 100644 --- a/docs/pages/wallets/index.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/index.mdx @@ -34,4 +34,4 @@ On the other hand, ZeroDev Wallet is a complete embedded wallet solution that bu ## Getting Started -Check out [the quickstart](/wallets/quickstart) to get started! +Check out [the quickstart](/smart-accounts/embedded-wallet/quickstart) to get started! diff --git a/docs/pages/wallets/quickstart.mdx b/docs/pages/smart-accounts/embedded-wallet/quickstart.mdx similarity index 84% rename from docs/pages/wallets/quickstart.mdx rename to docs/pages/smart-accounts/embedded-wallet/quickstart.mdx index b1c1f17b..d939c60e 100644 --- a/docs/pages/wallets/quickstart.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/quickstart.mdx @@ -122,9 +122,9 @@ After authentication, the user's wallet is available through standard Wagmi hook ## Next Steps -- [Passkey Authentication](/wallets/auth/passkeys) β€” Full passkey guide -- [Email OTP](/wallets/auth/email-otp) β€” Authenticate with email codes -- [Google OAuth](/wallets/auth/google-oauth) β€” Social login with Google -- [Send Transactions](/wallets/wallet-api/send-transaction) β€” Send gasless transactions -- [Sign Messages](/wallets/wallet-api/sign-message) β€” Sign messages with the wallet -- [Session Management](/wallets/session-management) β€” Session lifecycle and refresh +- [Passkey Authentication](/smart-accounts/embedded-wallet/auth/passkeys) β€” Full passkey guide +- [Email OTP](/smart-accounts/embedded-wallet/auth/email-otp) β€” Authenticate with email codes +- [Google OAuth](/smart-accounts/embedded-wallet/auth/google-oauth) β€” Social login with Google +- [Send Transactions](/smart-accounts/embedded-wallet/wallet-api/send-transaction) β€” Send gasless transactions +- [Sign Messages](/smart-accounts/embedded-wallet/wallet-api/sign-message) β€” Sign messages with the wallet +- [Session Management](/smart-accounts/embedded-wallet/session-management) β€” Session lifecycle and refresh diff --git a/docs/pages/wallets/session-management.mdx b/docs/pages/smart-accounts/embedded-wallet/session-management.mdx similarity index 96% rename from docs/pages/wallets/session-management.mdx rename to docs/pages/smart-accounts/embedded-wallet/session-management.mdx index 34c02ffa..952073d2 100644 --- a/docs/pages/wallets/session-management.mdx +++ b/docs/pages/smart-accounts/embedded-wallet/session-management.mdx @@ -22,7 +22,7 @@ Authenticate β†’ Session Created β†’ Auto-refresh β†’ Expiry β†’ Re-authenticate ## Refreshing sessions -Use the [`useRefreshSession`](/wallets/hooks/use-refresh-session) hook to manually refresh the current session: +Use the [`useRefreshSession`](/smart-accounts/embedded-wallet/hooks/use-refresh-session) hook to manually refresh the current session: ```tsx import { useRefreshSession } from '@zerodev/wallet-react' diff --git a/docs/pages/wallets/shared/mutation-result.mdx b/docs/pages/smart-accounts/embedded-wallet/shared/mutation-result.mdx similarity index 100% rename from docs/pages/wallets/shared/mutation-result.mdx rename to docs/pages/smart-accounts/embedded-wallet/shared/mutation-result.mdx diff --git a/docs/pages/wallets/shared/query-result.mdx b/docs/pages/smart-accounts/embedded-wallet/shared/query-result.mdx similarity index 100% rename from docs/pages/wallets/shared/query-result.mdx rename to docs/pages/smart-accounts/embedded-wallet/shared/query-result.mdx diff --git a/docs/pages/wallets/wallet-api/send-transaction.mdx b/docs/pages/smart-accounts/embedded-wallet/wallet-api/send-transaction.mdx similarity index 100% rename from docs/pages/wallets/wallet-api/send-transaction.mdx rename to docs/pages/smart-accounts/embedded-wallet/wallet-api/send-transaction.mdx diff --git a/docs/pages/wallets/wallet-api/sign-message.mdx b/docs/pages/smart-accounts/embedded-wallet/wallet-api/sign-message.mdx similarity index 100% rename from docs/pages/wallets/wallet-api/sign-message.mdx rename to docs/pages/smart-accounts/embedded-wallet/wallet-api/sign-message.mdx diff --git a/docs/pages/wallets/wallet-api/sign-typed-message.mdx b/docs/pages/smart-accounts/embedded-wallet/wallet-api/sign-typed-message.mdx similarity index 100% rename from docs/pages/wallets/wallet-api/sign-typed-message.mdx rename to docs/pages/smart-accounts/embedded-wallet/wallet-api/sign-typed-message.mdx diff --git a/docs/pages/sdk/core-api/pay-gas-with-erc20s.mdx b/docs/pages/smart-accounts/pay-gas-with-erc20s.mdx similarity index 96% rename from docs/pages/sdk/core-api/pay-gas-with-erc20s.mdx rename to docs/pages/smart-accounts/pay-gas-with-erc20s.mdx index a8f70d38..24479106 100644 --- a/docs/pages/sdk/core-api/pay-gas-with-erc20s.mdx +++ b/docs/pages/smart-accounts/pay-gas-with-erc20s.mdx @@ -20,7 +20,7 @@ Let's go through these two steps next. ### Set up Kernel Client -When you [set up an account](/sdk/core-api/create-account#create-an-account-client), do this: +When you [set up an account](/smart-accounts/create-a-smart-account#create-an-account-client), do this: ```typescript import { @@ -69,7 +69,7 @@ const userOpHash = await kernelClient.sendUserOperation({ }) ``` -Thanks to [batching](/sdk/core-api/batch-transactions), it's possible to batch the approval with the UserOp you want to send: +Thanks to [batching](/smart-accounts/batch-transactions), it's possible to batch the approval with the UserOp you want to send: ```typescript const userOpHash = await kernelClient.sendUserOperation({ diff --git a/docs/pages/smart-wallet/permissions/1-click-trading.mdx b/docs/pages/smart-accounts/permissions/1-click-trading.mdx similarity index 92% rename from docs/pages/smart-wallet/permissions/1-click-trading.mdx rename to docs/pages/smart-accounts/permissions/1-click-trading.mdx index c0cd1eae..2b9aa3d8 100644 --- a/docs/pages/smart-wallet/permissions/1-click-trading.mdx +++ b/docs/pages/smart-accounts/permissions/1-click-trading.mdx @@ -53,7 +53,7 @@ With a permissions validator, you are putting together: ### Creating a signer -Start by creating a [ECDSA signer](/smart-wallet/permissions/signers/ecdsa): +Start by creating a [ECDSA signer](/smart-accounts/permissions/signers/ecdsa): ```ts const sessionPrivateKey = generatePrivateKey() @@ -113,7 +113,7 @@ Now, we have created a ECDSA session key that's subject to a call policy and a r ### Using the session key -Finally, we can set up the account with this session key as the signer. Note that if this is the first time that the session key is used, we need to [enable the plugin](/sdk/core-api/using-plugins#enabling-a-regular-validator). +Finally, we can set up the account with this session key as the signer. Note that if this is the first time that the session key is used, we need to [enable the plugin](/smart-accounts/use-plugins/overview#enabling-a-regular-validator). ```ts const account = await createKernelAccount(publicClient, { @@ -126,7 +126,7 @@ const account = await createKernelAccount(publicClient, { }) ``` -Now you can [set up a Kernel client](/sdk/core-api/create-account#create-an-account-client) using this account, and start minting NFTs with this session key -- but only up to once a month! +Now you can [set up a Kernel client](/smart-accounts/create-a-smart-account#create-an-account-client) using this account, and start minting NFTs with this session key -- but only up to once a month! Try running [this script](https://github.com/zerodevapp/zerodev-examples/blob/main/permissions/main.ts) and see for yourself. diff --git a/docs/pages/sdk/permissions/actions/build-your-own.mdx b/docs/pages/smart-accounts/permissions/actions/build-your-own.mdx similarity index 100% rename from docs/pages/sdk/permissions/actions/build-your-own.mdx rename to docs/pages/smart-accounts/permissions/actions/build-your-own.mdx diff --git a/docs/pages/sdk/getting-started/quickstart-agentkit.mdx b/docs/pages/smart-accounts/permissions/agentkit.mdx similarity index 100% rename from docs/pages/sdk/getting-started/quickstart-agentkit.mdx rename to docs/pages/smart-accounts/permissions/agentkit.mdx diff --git a/docs/pages/sdk/permissions/install-with-init-config.mdx b/docs/pages/smart-accounts/permissions/install-with-init-config.mdx similarity index 100% rename from docs/pages/sdk/permissions/install-with-init-config.mdx rename to docs/pages/smart-accounts/permissions/install-with-init-config.mdx diff --git a/docs/pages/sdk/permissions/intro.mdx b/docs/pages/smart-accounts/permissions/intro.mdx similarity index 79% rename from docs/pages/sdk/permissions/intro.mdx rename to docs/pages/smart-accounts/permissions/intro.mdx index e4bf7abf..58a07cca 100644 --- a/docs/pages/sdk/permissions/intro.mdx +++ b/docs/pages/smart-accounts/permissions/intro.mdx @@ -59,12 +59,12 @@ Signers specify the keys and the algorithms the keys use. ZeroDev provides sign Policies are the conditions under which the keys can be used. ZeroDev provides the following policies: -- [Sudo policy](/sdk/permissions/policies/sudo): you can do anything -- [Call policy](/sdk/permissions/policies/call): you can only call certain contracts or functions (and only with certain params) -- [Gas policy](/sdk/permissions/policies/gas): you can only spend up to X amount of gas -- [Signature policy](/sdk/permissions/policies/signature): you can only sign certain messages -- [Rate limit policy](/sdk/permissions/policies/rate-limit): you can only send UserOps within a given rate limit -- [Timestamp policy](/sdk/permissions/policies/timestamp): you can only send UserOps within certain timeframes +- [Sudo policy](/smart-accounts/permissions/policies/sudo): you can do anything +- [Call policy](/smart-accounts/permissions/policies/call): you can only call certain contracts or functions (and only with certain params) +- [Gas policy](/smart-accounts/permissions/policies/gas): you can only spend up to X amount of gas +- [Signature policy](/smart-accounts/permissions/policies/signature): you can only sign certain messages +- [Rate limit policy](/smart-accounts/permissions/policies/rate-limit): you can only send UserOps within a given rate limit +- [Timestamp policy](/smart-accounts/permissions/policies/timestamp): you can only send UserOps within certain timeframes ### Actions @@ -76,4 +76,4 @@ If that's confusing, just forget about actions. Mostly commonly you will only b ## Next Steps -- [Learn to automate transactions for users with permissions.](/sdk/permissions/transaction-automation) \ No newline at end of file +- [Learn to automate transactions for users with permissions.](/smart-accounts/permissions/transaction-automation) \ No newline at end of file diff --git a/docs/pages/sdk/permissions/policies/build-your-own.mdx b/docs/pages/smart-accounts/permissions/policies/build-your-own.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/build-your-own.mdx rename to docs/pages/smart-accounts/permissions/policies/build-your-own.mdx diff --git a/docs/pages/sdk/permissions/policies/call.mdx b/docs/pages/smart-accounts/permissions/policies/call.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/call.mdx rename to docs/pages/smart-accounts/permissions/policies/call.mdx diff --git a/docs/pages/sdk/permissions/policies/gas.mdx b/docs/pages/smart-accounts/permissions/policies/gas.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/gas.mdx rename to docs/pages/smart-accounts/permissions/policies/gas.mdx diff --git a/docs/pages/sdk/permissions/policies/rate-limit.mdx b/docs/pages/smart-accounts/permissions/policies/rate-limit.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/rate-limit.mdx rename to docs/pages/smart-accounts/permissions/policies/rate-limit.mdx diff --git a/docs/pages/sdk/permissions/policies/signature.mdx b/docs/pages/smart-accounts/permissions/policies/signature.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/signature.mdx rename to docs/pages/smart-accounts/permissions/policies/signature.mdx diff --git a/docs/pages/sdk/permissions/policies/sudo.mdx b/docs/pages/smart-accounts/permissions/policies/sudo.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/sudo.mdx rename to docs/pages/smart-accounts/permissions/policies/sudo.mdx diff --git a/docs/pages/sdk/permissions/policies/timestamp.mdx b/docs/pages/smart-accounts/permissions/policies/timestamp.mdx similarity index 100% rename from docs/pages/sdk/permissions/policies/timestamp.mdx rename to docs/pages/smart-accounts/permissions/policies/timestamp.mdx diff --git a/docs/pages/sdk/advanced/session-keys.mdx b/docs/pages/smart-accounts/permissions/session-keys.mdx similarity index 93% rename from docs/pages/sdk/advanced/session-keys.mdx rename to docs/pages/smart-accounts/permissions/session-keys.mdx index ec18e108..15736cd8 100644 --- a/docs/pages/sdk/advanced/session-keys.mdx +++ b/docs/pages/smart-accounts/permissions/session-keys.mdx @@ -6,7 +6,7 @@ Impatient? Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys). ::: -In EntryPoint 0.7 (Kernel v3), session keys have been upgraded into a more powerful "permissions system." [Please refer to these docs.](/sdk/permissions/intro) +In EntryPoint 0.7 (Kernel v3), session keys have been upgraded into a more powerful "permissions system." [Please refer to these docs.](/smart-accounts/permissions/intro) ## EntryPoint v0.6 (Kernel v2) @@ -14,7 +14,7 @@ In EntryPoint 0.7 (Kernel v3), session keys have been upgraded into a more power Impatient? Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/tree/main/session-keys/v2-old). ::: -The following document is for session keys for EntryPoint 0.6 (Kernel v2). If you are using EntryPoint 0.7 (Kernel v3), [please refer to permissions instead.](/sdk/permissions/intro) +The following document is for session keys for EntryPoint 0.6 (Kernel v2). If you are using EntryPoint 0.7 (Kernel v3), [please refer to permissions instead.](/smart-accounts/permissions/intro) Session keys are keys assigned with specific permissions. Some examples are: @@ -80,7 +80,7 @@ Let's walk through how each flow works. Check out [the code example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/owner-created.ts) for the owner-created pattern. ::: -We assume that you have [created a Kernel account](/sdk/core-api/create-account#create-a-kernel-account). If you only have a `kernelClient`, the Kernel account can be accessed as `kernelClient.account`. +We assume that you have [created a Kernel account](/smart-accounts/create-a-smart-account#create-a-kernel-account). If you only have a `kernelClient`, the Kernel account can be accessed as `kernelClient.account`. First, create a signer for the session key: @@ -121,7 +121,7 @@ const sessionKeyAccount = await createKernelAccount(publicClient, { In this example, the sudo validator is `ecdsaValidator`. -If you want to use the session key on the same node, you can already [construct a Kernel client from this Kernel account](/sdk/core-api/create-account#create-an-account-client) and start using it. If you want to share the session key with an agent or store it for use later, you can serialize the session key: +If you want to use the session key on the same node, you can already [construct a Kernel client from this Kernel account](/smart-accounts/create-a-smart-account#create-an-account-client) and start using it. If you want to share the session key with an agent or store it for use later, you can serialize the session key: ```typescript import { serializeSessionKeyAccount } from "@zerodev/session-key" @@ -135,7 +135,7 @@ Now, when the agent needs to use the session key (or when you want to use your s const sessionKeyAccount = await deserializeSessionKeyAccount(publicClient, serializedSessionKey) ``` -Now you can [create a Kernel client](/sdk/core-api/create-account#create-an-account-client) using the `sessionKeyAccount` as you normally would. +Now you can [create a Kernel client](/smart-accounts/create-a-smart-account#create-an-account-client) using the `sessionKeyAccount` as you normally would. ### Agent-created @@ -204,7 +204,7 @@ const sessionKeyAccount = await deserializeSessionKeyAccount(publicClient, seria Note how we pass `sessionKeySigner` to `deserializeSessionKeyAccount`. This is the private part of the session key that only the agent knows about. -Now you can [create a Kernel client](/sdk/core-api/create-account#create-an-account-client) using the `sessionKeyAccount` as you normally would. +Now you can [create a Kernel client](/smart-accounts/create-a-smart-account#create-an-account-client) using the `sessionKeyAccount` as you normally would. ### Revoking Session Keys @@ -355,7 +355,7 @@ Here's what each flag means: ### Batching and Delegatecall -To use session keys with [batching](/sdk/core-api/batch-transactions), specify the following `action` when constructing the account: +To use session keys with [batching](/smart-accounts/batch-transactions), specify the following `action` when constructing the account: ```ts import { zeroAddress, toFunctionSelector } from "viem" diff --git a/docs/pages/sdk/permissions/signers/build-your-own.mdx b/docs/pages/smart-accounts/permissions/signers/build-your-own.mdx similarity index 100% rename from docs/pages/sdk/permissions/signers/build-your-own.mdx rename to docs/pages/smart-accounts/permissions/signers/build-your-own.mdx diff --git a/docs/pages/sdk/permissions/signers/ecdsa.mdx b/docs/pages/smart-accounts/permissions/signers/ecdsa.mdx similarity index 100% rename from docs/pages/sdk/permissions/signers/ecdsa.mdx rename to docs/pages/smart-accounts/permissions/signers/ecdsa.mdx diff --git a/docs/pages/smart-wallet/permissions/signers/multisig.mdx b/docs/pages/smart-accounts/permissions/signers/multisig.mdx similarity index 90% rename from docs/pages/smart-wallet/permissions/signers/multisig.mdx rename to docs/pages/smart-accounts/permissions/signers/multisig.mdx index cf8ae05f..e661a411 100644 --- a/docs/pages/smart-wallet/permissions/signers/multisig.mdx +++ b/docs/pages/smart-accounts/permissions/signers/multisig.mdx @@ -2,7 +2,7 @@ The weighted ECDSA (multisig) signer signs with a collection of ECDSA keys. Each key is weighted, so that the signature will pass as long as enough signers with enough weight have signed. -Read [the multisig doc](/sdk/advanced/multisig) for more details. +Read [the multisig doc](/smart-accounts/use-plugins/multisig) for more details. ## API diff --git a/docs/pages/sdk/permissions/signers/passkeys.mdx b/docs/pages/smart-accounts/permissions/signers/passkeys.mdx similarity index 78% rename from docs/pages/sdk/permissions/signers/passkeys.mdx rename to docs/pages/smart-accounts/permissions/signers/passkeys.mdx index 64656710..c3e4a867 100644 --- a/docs/pages/sdk/permissions/signers/passkeys.mdx +++ b/docs/pages/smart-accounts/permissions/signers/passkeys.mdx @@ -1,6 +1,6 @@ # WebAuthn Signer -The WebAuthn (passkeys) signer signs with a single passkey. Read [the passkeys doc](/sdk/advanced/passkeys) for a more detailed intro to passkeys. +The WebAuthn (passkeys) signer signs with a single passkey. Read [the passkeys doc](/smart-accounts/use-plugins/passkeys/overview) for a more detailed intro to passkeys. ## API @@ -36,5 +36,5 @@ const validator = toPermissionValidator(publicClient, { For the params: - `passkeyName` can be any name -- `passkeyServerUrl` is a [passkey server URL](/sdk/advanced/passkeys#setting-up-passkey-server). You can get it from the ZeroDev dashboard. +- `passkeyServerUrl` is a [passkey server URL](/smart-accounts/use-plugins/passkeys/overview#setting-up-passkey-server). You can get it from the ZeroDev dashboard. - `mode` is either `register` or `login`, depending on whether you are creating a new key or using an existing key. \ No newline at end of file diff --git a/docs/pages/sdk/permissions/transaction-automation.mdx b/docs/pages/smart-accounts/permissions/transaction-automation.mdx similarity index 94% rename from docs/pages/sdk/permissions/transaction-automation.mdx rename to docs/pages/smart-accounts/permissions/transaction-automation.mdx index c81ec68f..ee2ddaec 100644 --- a/docs/pages/sdk/permissions/transaction-automation.mdx +++ b/docs/pages/smart-accounts/permissions/transaction-automation.mdx @@ -1,6 +1,6 @@ # Tutorial -- Transaction Automation -In this tutorial, you will learn how to automate transactions for your users using [session keys](/sdk/permissions/intro). This is useful when you want to send transactions for your users from your server, for instance. +In this tutorial, you will learn how to automate transactions for your users using [session keys](/smart-accounts/permissions/intro). This is useful when you want to send transactions for your users from your server, for instance. Refer to [this code example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/transaction-automation.ts) while you follow along the tutorial. You can run the example by following instructions of [the examples repo](https://github.com/zerodevapp/zerodev-examples). @@ -49,7 +49,7 @@ From a high level, this is how transaction automation works: ### Agent: creating a session key -From the agent's side, create a [ECDSA signer](/sdk/permissions/signers/ecdsa) as the session key: +From the agent's side, create a [ECDSA signer](/smart-accounts/permissions/signers/ecdsa) as the session key: ```ts const sessionPrivateKey = generatePrivateKey() @@ -86,7 +86,7 @@ Send this address to the owner. ### Owner: approving the session key -Now, on the owner side, approve the session key with [policies](/sdk/permissions/intro#policies): +Now, on the owner side, approve the session key with [policies](/smart-accounts/permissions/intro#policies): ```ts const ecdsaValidator = await signerToEcdsaValidator(publicClient, { @@ -202,7 +202,7 @@ const txHash = await sudoKernelClient.uninstallPlugin({ ### Creating multiple session keys on multiple chains in one signature -[Refer to this page.](/sdk/advanced/multi-chain-signing) +[Refer to this page.](/advanced/multi-chain-signing) ### Using session keys with 7702 diff --git a/docs/pages/sdk/core-api/send-transactions.mdx b/docs/pages/smart-accounts/send-transactions.mdx similarity index 98% rename from docs/pages/sdk/core-api/send-transactions.mdx rename to docs/pages/smart-accounts/send-transactions.mdx index 32857eca..434b6aa0 100644 --- a/docs/pages/sdk/core-api/send-transactions.mdx +++ b/docs/pages/smart-accounts/send-transactions.mdx @@ -13,7 +13,7 @@ There are two ways to send UserOps: The former enables the highest degree of flexibility, whereas the latter is more interoperable with existing libraries like Viem that deal only with transactions and not UserOps. -We will now describe both approaches. We assume that you have already [created a Kernel account](/sdk/core-api/create-account). +We will now describe both approaches. We assume that you have already [created a Kernel account](/smart-accounts/create-a-smart-account). ## Using the Viem API diff --git a/docs/pages/sdk/core-api/sign-and-verify.mdx b/docs/pages/smart-accounts/sign-and-verify.mdx similarity index 93% rename from docs/pages/sdk/core-api/sign-and-verify.mdx rename to docs/pages/smart-accounts/sign-and-verify.mdx index 18e0b50a..a6fc7fb7 100644 --- a/docs/pages/sdk/core-api/sign-and-verify.mdx +++ b/docs/pages/smart-accounts/sign-and-verify.mdx @@ -18,7 +18,7 @@ TODO ### Signing messages -Both [the account and account client objects](/sdk/core-api/create-account#create-a-kernel-account) are able to sign messages: +Both [the account and account client objects](/smart-accounts/create-a-smart-account#create-a-kernel-account) are able to sign messages: ```ts const signature = await account.signMessage({ diff --git a/docs/pages/sdk/core-api/sponsor-gas.mdx b/docs/pages/smart-accounts/sponsor-gas/evm.mdx similarity index 89% rename from docs/pages/sdk/core-api/sponsor-gas.mdx rename to docs/pages/smart-accounts/sponsor-gas/evm.mdx index 1a02e83c..5465d6a5 100644 --- a/docs/pages/sdk/core-api/sponsor-gas.mdx +++ b/docs/pages/smart-accounts/sponsor-gas/evm.mdx @@ -10,7 +10,7 @@ When you sponsor gas through ZeroDev, there are two ways to pay for the gas: ## Setting up gas sponsoring policies -To avoid over-spending gas on sponsoring, you must set up gas-sponsoring policies. Sign up on the ZeroDev dashboard if you haven't already, then [set up gas policies](/meta-infra/gas-policies). +To avoid over-spending gas on sponsoring, you must set up gas-sponsoring policies. Sign up on the ZeroDev dashboard if you haven't already, then [set up gas policies](/resources/infrastructure/gas-policies). Note that you MUST set up a gas policy to begin sponsoring. Without setting up a gas policy, there won't be any gas sponsored. @@ -20,7 +20,7 @@ Note that you MUST set up a gas policy to begin sponsoring. Without setting up Impatient? Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/blob/main/create-account/main.ts). ::: -When [setting up an account](/sdk/core-api/create-account), you can specify a `getPaymasterData` function in `paymaster` when you [create the account client](/sdk/core-api/create-account#create-an-account-client). +When [setting up an account](/smart-accounts/create-a-smart-account), you can specify a `getPaymasterData` function in `paymaster` when you [create the account client](/smart-accounts/create-a-smart-account#create-an-account-client). The `getPaymasterData` function essentially takes a UserOp and then returns a UserOp with the `paymasterAndData` field set. For example, if you are using the ZeroDev paymaster, use the `createZeroDevPaymasterClient` helper function: @@ -52,7 +52,7 @@ const kernelClient = createKernelAccountClient({ ### What happens when you reach the sponsorship limit? -If you have reached the sponsorship limit, either because of the [policies](/meta-infra/gas-policies) you set up or because you have reached an account-level limit, sending UserOp will fail. +If you have reached the sponsorship limit, either because of the [policies](/resources/infrastructure/gas-policies) you set up or because you have reached an account-level limit, sending UserOp will fail. If, instead of failing, you want the UserOp to proceed but use the user's own native tokens (e.g. ETH), then you can set up your `paymaster` middleware like this: diff --git a/docs/pages/sdk/solana/sponsor-gas.mdx b/docs/pages/smart-accounts/sponsor-gas/solana.mdx similarity index 99% rename from docs/pages/sdk/solana/sponsor-gas.mdx rename to docs/pages/smart-accounts/sponsor-gas/solana.mdx index f32ca24b..c301dc5e 100644 --- a/docs/pages/sdk/solana/sponsor-gas.mdx +++ b/docs/pages/smart-accounts/sponsor-gas/solana.mdx @@ -28,7 +28,7 @@ When you sponsor gas through ZeroDev, there are two ways to pay for the gas: ## Setting up gas sponsoring policies -To avoid over-spending on sponsoring, you must set up gas-sponsoring policies. Sign up on the [ZeroDev dashboard](https://dashboard.zerodev.app/) if you haven't already, then [set up gas policies](/meta-infra/gas-policies). +To avoid over-spending on sponsoring, you must set up gas-sponsoring policies. Sign up on the [ZeroDev dashboard](https://dashboard.zerodev.app/) if you haven't already, then [set up gas policies](/resources/infrastructure/gas-policies). Note that you MUST set up a gas policy to begin sponsoring. Without setting up a gas policy, there won't be any gas sponsored. diff --git a/docs/pages/sdk/advanced/multisig.mdx b/docs/pages/smart-accounts/use-plugins/multisig.mdx similarity index 98% rename from docs/pages/sdk/advanced/multisig.mdx rename to docs/pages/smart-accounts/use-plugins/multisig.mdx index fc3f6f76..e951f8ca 100644 --- a/docs/pages/sdk/advanced/multisig.mdx +++ b/docs/pages/smart-accounts/use-plugins/multisig.mdx @@ -118,7 +118,7 @@ const multiSigValidator = await createWeightedValidator(publicClient, { }) ``` -After creating the validator, you can [set up a Kernel account using the validator](/sdk/core-api/create-account#create-a-kernel-account) as usual: +After creating the validator, you can [set up a Kernel account using the validator](/smart-accounts/create-a-smart-account#create-a-kernel-account) as usual: ```ts const account = await createKernelAccount(publicClient, { diff --git a/docs/pages/sdk/core-api/using-plugins.mdx b/docs/pages/smart-accounts/use-plugins/overview.mdx similarity index 85% rename from docs/pages/sdk/core-api/using-plugins.mdx rename to docs/pages/smart-accounts/use-plugins/overview.mdx index f1a55694..70f1bdc1 100644 --- a/docs/pages/sdk/core-api/using-plugins.mdx +++ b/docs/pages/smart-accounts/use-plugins/overview.mdx @@ -14,7 +14,7 @@ For any given Kernel account, it will have one **sudo validator** and any number - The **sudo validator** is the "owner" of the account. It's the only validator that can enable other validators. - A **regular validator** represents an alternative form of access to the smart account. For example, a session key or a guardian would be a regular validator. Regular validators cannot enable other validators. -When you set up a [Kernel account object](/sdk/core-api/create-account#create-a-kernel-account) with the SDK, you must specify a sudo validator, a regular validator, or both. Let's walk through the three cases: +When you set up a [Kernel account object](/smart-accounts/create-a-smart-account#create-a-kernel-account) with the SDK, you must specify a sudo validator, a regular validator, or both. Let's walk through the three cases: ### Using only a sudo validator @@ -34,7 +34,7 @@ Here, when you send a UserOp, the ECDSA key will be used for signing the UserOp, ### Enabling a regular validator -If you have access to the sudo validator, you can enable a regular validator. For example, to enable a [session key](/sdk/advanced/session-keys): +If you have access to the sudo validator, you can enable a regular validator. For example, to enable a [session key](/smart-accounts/permissions/session-keys): ```ts const account = await createKernelAccount(publicClient, { @@ -69,4 +69,4 @@ const account = await createKernelAccount(publicClient, { ## Next Steps -Learn more about plugins such as [passkeys](/sdk/advanced/passkeys) and [permissions](/sdk/permissions/intro). +Learn more about plugins such as [passkeys](/smart-accounts/use-plugins/passkeys/overview) and [permissions](/smart-accounts/permissions/intro). diff --git a/docs/pages/sdk/advanced/passkeys.mdx b/docs/pages/smart-accounts/use-plugins/passkeys/overview.mdx similarity index 99% rename from docs/pages/sdk/advanced/passkeys.mdx rename to docs/pages/smart-accounts/use-plugins/passkeys/overview.mdx index bc1901b8..93e7a3d6 100644 --- a/docs/pages/sdk/advanced/passkeys.mdx +++ b/docs/pages/smart-accounts/use-plugins/passkeys/overview.mdx @@ -33,7 +33,7 @@ ZeroDev implements passkey supports through a **progressive passkey validator**, ## Quickstart -[Follow this tutorial](/sdk/getting-started/tutorial-passkeys) to get started with passkey smart accounts. +[Follow this tutorial](/smart-accounts/use-plugins/passkeys/tutorial) to get started with passkey smart accounts. ## Installation diff --git a/docs/pages/sdk/getting-started/tutorial-passkeys.mdx b/docs/pages/smart-accounts/use-plugins/passkeys/tutorial.mdx similarity index 96% rename from docs/pages/sdk/getting-started/tutorial-passkeys.mdx rename to docs/pages/smart-accounts/use-plugins/passkeys/tutorial.mdx index 947aa741..6db214a5 100644 --- a/docs/pages/sdk/getting-started/tutorial-passkeys.mdx +++ b/docs/pages/smart-accounts/use-plugins/passkeys/tutorial.mdx @@ -1,6 +1,6 @@ # ZeroDev Tutorial -- Passkeys -In this tutorial, we will be building a Next.js app where your users can create smart accounts and send UserOps with [passkeys](/sdk/advanced/passkeys). +In this tutorial, we will be building a Next.js app where your users can create smart accounts and send UserOps with [passkeys](/smart-accounts/use-plugins/passkeys/overview). ## Clone the template @@ -176,6 +176,6 @@ In this tutorial, you were able to create smart accounts and send UserOps with p For next steps: -- Check out [the core API](/sdk/core-api/create-account) to learn more about the SDK -- Learn more about [passkeys](/sdk/advanced/passkeys) +- Check out [the core API](/smart-accounts/create-a-smart-account) to learn more about the SDK +- Learn more about [passkeys](/smart-accounts/use-plugins/passkeys/overview) - Read some [code examples](https://github.com/zerodevapp/zerodev-examples) of using ZeroDev diff --git a/docs/pages/sdk/signers/intro.mdx b/docs/pages/smart-accounts/use-plugins/signers-intro.mdx similarity index 89% rename from docs/pages/sdk/signers/intro.mdx rename to docs/pages/smart-accounts/use-plugins/signers-intro.mdx index 2142b940..a431d385 100644 --- a/docs/pages/sdk/signers/intro.mdx +++ b/docs/pages/smart-accounts/use-plugins/signers-intro.mdx @@ -6,4 +6,4 @@ It's possible to use third-party "wallet services" as signers for smart accounts ZeroDev has been integrated natively with many leading wallet services such as [Privy](https://docs.privy.io/guide/frontend/account-abstraction/zerodev), [Dynamic](https://docs.dynamic.xyz/account-abstraction/aa-providers/zerodev), [Portal](https://docs.portalhq.io/resources/account-abstraction-alpha), [JoyID](https://docs.joyid.dev/guide/evm/evm-aa), etc. However, even when a native integration doesn't exist, it's generally very easy to integrate ZeroDev with a wallet service as long as it's able to sign messages. -Check out the wallet services that are known to work with ZeroDev using the left sidebar. If the wallet service you want to use is not listed, check out the general guide for [integrating with EOA signers](/sdk/signers/eoa), or try [building your own integration](/sdk/signers/custom-signer). +Check out the wallet services that are known to work with ZeroDev using the left sidebar. If the wallet service you want to use is not listed, check out the general guide for [integrating with EOA signers](/smart-accounts/authentication/eoa), or try [building your own integration](/smart-accounts/authentication/custom-signer). diff --git a/docs/pages/smart-wallet/account-recovery.mdx b/docs/pages/smart-wallet/account-recovery.mdx deleted file mode 100644 index 59ff0173..00000000 --- a/docs/pages/smart-wallet/account-recovery.mdx +++ /dev/null @@ -1,101 +0,0 @@ -# Account Recovery - -With ZeroDev's [permissions system](/smart-wallet/permissions/intro), it's possible to set up a guardian (or multiple guardians) for a smart account, so that if the owner loses their key, the guardian(s) can recover the key for the owner. - -There are two typical types of recovery: - -- **Self-recovery**: your user can set up recovery for their account with another auth factor they own, such as a passkey or another wallet they own. - -- **DApp-assisted recovery**: your user might set you (the DApp) as their guardian. When they lose their account, they would contact you and you would recover the account for them. - -There are two ways to use recovery: through a pre-built recovery flow or build a totally custom flow using the Kernel recovery plugin. - -## Core API - -:::info -Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/tree/main/guardians/recovery.ts). -::: - -Here we go through the process of using the recovery plugin: - -### Setting up the guardian validator - -Start by creating a permissions validator. Let's say you want a single key to be your guardian: - -```ts -const guardianSigner = privateKeyToAccount(GUARDIAN_KEY) - -const guardianValidator = await signerToEcdsaValidator(publicClient, { - signer: guardianSigner, - entryPoint, - kernelVersion -}) -``` - -If you want multiple guardians, set up a [multisig validator](/sdk/advanced/multisig) instead. - -### Setting up account with the recovery action - -We have deployed a simple recovery executor that can recover any accounts using [the ECDSA validator](/sdk/permissions/signers/ecdsa). You can set it up with the following values: - -```ts -import { toFunctionSelector } from "viem" - -const recoveryExecutorAddress = '0x2f65dB8039fe5CAEE0a8680D2879deB800F31Ae1' -const recoveryExecutorFunction = 'function doRecovery(address _validator, bytes calldata _data)' -const recoveryExecutorSelector = toFunctionSelector(recoveryExecutorFunction) -``` - -Then, set up the account with the executor: - -```ts -const account = await createKernelAccount(publicClient, { - entryPoint, - kernelVersion, - plugins: { - sudo: sudoValidator, - regular: guardianValidator, - action: { - address: recoveryExecutorAddress, - selector: recoveryExecutorSelector, - }, - } -}) -``` - -you only need to set the sudo validator if you are enabling the guardian validator, i.e. that it's the first time you are using the guardian. - -### Executing recovery - -After you [construct the account client from the account](/sdk/core-api/create-account#create-an-account-client), you can execute recovery as such: - -```ts -import { encodeFunctionData } from "viem" -import { ECDSA_VALIDATOR_ADDRESS } from "@zerodev/ecdsa-validator" - -const userOpHash = await kernelClient.sendUserOperation({ - userOperation: { - callData: encodeFunctionData({ - abi: parseAbi([recoveryExecutorFunction]), - functionName: 'doRecovery', - args: [ECDSA_VALIDATOR_ADDRESS, newSigner.address], - }) - }, -}) -``` - -### Using account with the new owner - -After you update the account owner, the account address can no longer by computed from the new owner. Therefore, you should use the `address` option to manually set the account address when you [create the account object](/sdk/core-api/create-account#create-a-kernel-account). For example: - -```ts -const account = await createKernelAccount(publicClient, { - address: "the smart account address", - - // ...other options -}) -``` - -## React API - -TODO \ No newline at end of file diff --git a/docs/pages/smart-wallet/batching-transactions.mdx b/docs/pages/smart-wallet/batching-transactions.mdx deleted file mode 100644 index f5f0f59d..00000000 --- a/docs/pages/smart-wallet/batching-transactions.mdx +++ /dev/null @@ -1,99 +0,0 @@ -# Batching - -Smart accounts support *batching* transactions -- rolling multiple transactions into one. This is very useful for simplifying Web3 interactions for your users. For instance, instead of doing `approve()` followed by `transfer()`, your user can do both in one transaction. - -Batching transactions has a number of important benefits: - -- Your user waits for only 1 transaction instead of multiple. -- Your user pays less gas. -- If any transaction in the batch reverts, the entire batch reverts. This ensures that your user won't be stuck in an inconsistent state. - - This is known as "atomicity." - -## Capabilities API - -Thanks to [the new capabilities standard](/smart-wallet/quickstart-capabilities), you can batch transactions in a standard way regardless of the smart wallet implementation. - -To batch transactions, simply use the `wallet_sendCalls` API. We will be using [Wagmi](https://wagmi.sh/react/api/hooks/useSendCalls) here but you can find the same API in [Viem](https://viem.sh/experimental/eip5792/sendCalls): - -## React API - -Simply pass an array of transactions (UserOps) when using the `useSendUserOperation` hook: - -```tsx -import { useSendUserOperation, useKernelClient } from '@zerodev/waas' -import { parseAbi } from 'viem' - -function App() { - const { write } = useSendUserOperation() - const { address } = useKernelClient() - const abi = parseAbi(['function mint(address _to) public']) - - return ( - - ) -} -``` - -## Core API - -:::info -Impatient? Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/tree/main/batch-transactions). -::: - -There are two ways to send batched transactions. `sendTransaction` is a simple API that's good enough for most use cases. If you need fine-grained control over your UserOp, you can use `sendUserOperation`. - -### `sendTransaction` - -```typescript -const txHash = await kernelClient.sendTransaction({ - calls: [ - { - to: "0xADDRESS", - value: value, - data: "0xDATA", - }, - { - to: "0xADDRESS", - value: value, - data: "0xDATA", - }, - ], -}) -``` - -### `sendUserOperation` - -You can learn more about the `sendUserOperation` API [here](/sdk/core-api/send-transactions#sending-raw-userops). - -To send a UserOp with batching, simply pass an array of calls into `encodeCalls`. - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - callData: account.encodeCalls([ - { - to, - value, - data, - }, - { - to, - value, - data, - }, - ]), - // other UserOp params -}) -``` \ No newline at end of file diff --git a/docs/pages/smart-wallet/code-examples.mdx b/docs/pages/smart-wallet/code-examples.mdx deleted file mode 100644 index c87e6da9..00000000 --- a/docs/pages/smart-wallet/code-examples.mdx +++ /dev/null @@ -1,9 +0,0 @@ -# Code Examples - -ZeroDev has extensive code examples that you can run. They are the best way to learn how to use ZeroDev. - -Check out the examples here: - -- [Capabilities Examples](https://github.com/zerodevapp/capabilities-examples) (for `@zerodev/wallet`) -- [React Examples](https://github.com/zerodevapp/waas-examples) (for `@zerodev/waas`) -- [Core SDK Examples](https://github.com/zerodevapp/zerodev-examples) (for `@zerodev/sdk`) diff --git a/docs/pages/smart-wallet/creating-wallets.mdx b/docs/pages/smart-wallet/creating-wallets.mdx deleted file mode 100644 index 73e74157..00000000 --- a/docs/pages/smart-wallet/creating-wallets.mdx +++ /dev/null @@ -1,149 +0,0 @@ -import SocialLoginSetup from '../shared/social-login-setup.mdx' - -# Creating wallets - -ZeroDev supports three types of wallet creation: - -- Passkeys - - ZeroDev supports on-chain passkeys, where transactions are signed directly with passkeys on your user's device, and the signatures are validated on-chain with either [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md) (if supported by the network) or smart contracts, without reliance on centralized infrastructure. [Learn more here](/sdk/advanced/passkeys). -- Socials - - ZeroDev supports social logins natively, but you can also use ZeroDev with [third-party auth providers](/sdk/signers/intro) such as Dynamic, Privy, and Magic if your prefer their UI. -- EOA - - It's important to note that when a user signs in with an EOA (e.g. MetaMask) through ZeroDev, the EOA is not used as a wallet, but rather as the *signer* of the ZeroDev smart wallet. Therefore, the address of the smart wallet is different than the address of the user's EOA. - -## Capabilities API - -[Capabilities](/smart-wallet/quickstart-capabilities) (ERC-5792) are the new standard for DApps to communicate with smart wallets. If you are building a DApp and looking to use ZeroDev as an embedded smart wallet, we recommend that you do it through the capabilities API, in order to be compatible with other smart wallets. - -:::info -Check out this [code example](https://github.com/zerodevapp/capabilities-examples/tree/main/create-account). -::: - -### Passkeys -```tsx -import { useConnect, useConnectors } from "wagmi" - -function App() { - const { connect } = useConnect(); - const connectors = useConnectors(); - - // zerodev passkey connector - const connector = connectors.find((c) => c.id === 'zerodevPasskeySDK'); - if (!connector) return

Connector not found

- - return ( - - ) -} -``` - -### EOA -```tsx -import { useConnect, useConnectors } from "wagmi" - -function App() { - const { connect } = useConnect(); - const connectors = useConnectors(); - - // wrapped connector - const connector = connectors.find((c) => c.id === 'metaMaskSDK'); - if (!connector) return

Connector not found

- - return ( - - ) -} -``` - -### Social - -TODO - -## React API - -:::info -Check out this [code example](https://github.com/zerodevapp/waas-examples/tree/main/create-account). -::: - -### Passkeys - -You can learn more about [how ZeroDev's on-chain passkeys work here](/sdk/advanced/passkeys). - -Create the wallet using [`useCreateKernelClientPasskey`](/react/use-create-kernelclient-passkey). Use `connectRegister` to create a new passkey, or `connectLogin` to use an existing key. - -```tsx -import { useCreateKernelClientPasskey } from "@zerodev/waas" - -function App() { - const { connectRegister, connectLogin } = useCreateKernelClientPasskey( - { version: "v3" } - ); - - return ( -
- // username of the passkey - - -
- ) -} - -``` - -### Socials - -Use `useCreateKernelClientSocial`. Note that you can also use ZeroDev with a [third-party auth provider](/sdk/signers/intro) (e.g. Privy/Dynamic) to enable social logins. - -```tsx -import { useCreateKernelClientSocial } from "@zerodev/waas" - -function App() { - const { login } = useCreateKernelClientSocial({ version: "v3" }); - - return ( - - ) -} -``` - -#### Set Up Social Login - - - -### EOA - -If you want to use an EOA wallet as signer to your ZeroDev smart wallet, wrap the `ZeroDevProvider` inside a Wagmi provider, then use [`useCreateKernelClientEOA`](/react/use-create-kernelclient-eoa). - -```tsx -import { useCreateKernelClientEOA } from "@zerodev/waas" -import { useConnect } from "wagmi" - -function App() { - const { connectors } = useConnect(); - const { connect } = useCreateKernelClientEOA({ version: "v3" }); - - return ( - - ) -} -``` - -## Core API - -Check out these links for using the Core SDK directly: - -- [Passkeys](/sdk/advanced/passkeys) -- [Socials](/sdk/advanced/social-login) -- [EOA](/sdk/core-api/create-account) diff --git a/docs/pages/smart-wallet/defi-integrations.md b/docs/pages/smart-wallet/defi-integrations.md deleted file mode 100644 index 0c774a23..00000000 --- a/docs/pages/smart-wallet/defi-integrations.md +++ /dev/null @@ -1,186 +0,0 @@ -# DeFi Integrations - -ZeroDev partners with [Enso](https://www.enso.finance/) to support seamless token swaps and DeFi integrations, even across chains. - -The API deals with two types of tokens: - -- **Base tokens** are normal tokens that do not represent a DeFi position. Examples are ETH, USDC, etc. -- **DeFi tokens** are ERC20 tokens that represent a DeFi position, such as in a [ERC-4626 vault](https://ethereum.org/en/developers/docs/standards/tokens/erc-4626/). For example, depositing ETH into Lido gets you `stETH` that represents staked ETH. - -By allowing you to swap between base tokens and DeFi tokens, you can easily: - -- Swap between any token pairs. -- Entering and exiting DeFi positions (staking, lending, etc.) - -ZeroDev leverages [batching](/sdk/core-api/batch-transactions) and [delegatecall](/sdk/core-api/delegatecall) internally to ensure that even complex routes are executed in one atomic UserOp, providing the user with low latency, low gas cost, and high safety. - -## Supported Tokens - -See the full lists of supported base tokens and DeFi tokens: - -- [Base tokens](/sdk/advanced/supported-base-tokens) -- [DeFi tokens (protocols)](/sdk/advanced/supported-defi-tokens) - -## Installation - -:::code-group - -```bash [npm] -npm i @zerodev/defi -``` - -```bash [yarn] -yarn add @zerodev/defi -``` - -```bash [pnpm] -pnpm i @zerodev/defi -``` - -```bash [bun] -bun add @zerodev/defi -``` - -::: - -## Core API - -:::info -Check out [these code examples](https://github.com/zerodevapp/zerodev-examples/tree/main/defi). -::: - -### Creating a DeFi client - -All DeFi APIs are exposed through a "DeFi client": - -```ts -import { createKernelDefiClient } from "@zerodev/defi" - -const defiClient = createKernelDefiClient(kernelClient, projectId) -``` - -Where: - -- `kernelClient` is the [account client](/sdk/core-api/create-account#create-an-account-client) object. -- `projectId` is your ZeroDev project ID, obtained from the dashboard. - -### Swapping Tokens - -Suppose you want to swap 100 USDC to USDT: - -```ts -import { baseTokenAddresses } from "@zerodev/defi" -import { parseUnits } from "viem" -import { arbitrum } from "viem/chains" - -// Replace this with your network -const chain = arbitrum - -const userOpHash = await defiClient.sendSwapUserOp({ - fromToken: baseTokenAddresses[chain.id].USDC, - fromAmount: parseUnits('100', 6), // USDC uses 6 decimals - - toToken: baseTokenAddresses[chain.id].USDT, - - gasToken: 'sponsored', -}) -``` - -Where: - -- `fromToken` is the input token. -- `fromAmount` is a `bigint` representing the input token amount. Note that this uses the smallest unit for the token, e.g. Wei for Ether. -- `toToken` is the output token. -- `toAddress`: defaults to the account's own address. If specified, it will send the output token to that address instead. -- `gasToken`: [see below.](#gas-tokens) - -### Entering / Exiting DeFi positions - -Entering a DeFi position simply means swapping a token into a DeFi token. - -You can get a DeFi token address through the `defiTokenAddresses` constant, which is a map with three keys: `chainId => tokenName => protocolName`. For example, the DeFi token representing the USDC vault on AAVE v3 on Arbitrum would be `defiTokenAddresses[arbitrum.id]['USDC']['aave-v3']`. So, to enter the vault: - -```ts -import { defiTokenAddresses } from "@zerodev/defi" -import { arbitrum } from "viem/chains" - -const chain = arbitrum - -const userOpHash = await defiClient.sendSwapUserOp({ - fromToken: baseTokenAddresses[chain.id].USDC, - fromAmount: 1_000_000, - - toToken: defiTokenAddresses[chain.id]['USDC']['aave-v3'], - - gasToken: 'sponsored', -}) -``` - -Similarly, exiting a DeFi position is just swapping a DeFi token into another token. - -### Cross-chain Swaps - -To swap tokens across chains, use `sendSwapUserOpCrossChain`. For example, to swap USDC on Arbitrum to DAI on Polygon: - -```ts -// Convert mainnet DAI to USDC, and lend it through AAVE on Arbitrum -const userOpHash = await defiClient.sendSwapUserOpCrossChain({ - fromToken: baseTokenAddresses[mainnet.id].DAI, - fromAmount: 1_000_000, - - toToken: defiTokenAddresses[arbitrum.id]['USDC']['aave-v3'], - toChainId: arbitrum.id, - - // Pay gas with input token - gasToken: "fromToken" -}) -``` - -Where: - -- `fromToken` is the input token. -- `fromAmount` is a `bigint` representing the input token amount. Note that this uses the smallest unit for the token, e.g. Wei for Ether. -- `toToken` is the output token. -- `toChainId`: the chain for `toToken`, -- `toAddress`: defaults to the account's own address. If specified, it will send the output token to that address instead. -- `gasToken`: [see below.](#gas-tokens) - -### Listing Tokens - -You can list all ERC20 tokens an account owns with the `listTokenBalances` function: - -```ts -const accountBalances = await defiClient.listTokenBalances({ - account: account.address, - chainId: chain.id, -}) -``` - -### Gas Tokens - -The `gasToken` flag specifies how gas is paid for the UserOp. It can be one of the following values: - -- `sponsored`: sponsor the UserOp. -- `fromToken`: pays gas in the input token, using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). -- `toToken`: pays gas in the output token, using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). -- `native`: pays gas in the native token, using the account's balance. -- You can also specify an `Address` for a ERC20 token, to pay gas with that token using a [ERC20 paymaster](/sdk/core-api/pay-gas-with-erc20s). - -### Getting the UserOp without sending - -If you want to just construct a UserOp but not send it immediately (perhaps because you want to show the user a gas estimate), use: - -- `getSwapUserOp` instead of `sendSwapUserOp` -- `getSwapUserOpCrossChain` instead of `sendSwapUserOpCrossChain` - -The functions above will get a signed UserOp but not sending it. If you want to get an unsigned UserOp, use: - -- `getSwapData`, [like this](https://github.com/zerodevapp/zerodev-examples/blob/8cd83fd5e588a11414d1eb946622eda864e2b044/defi/get-swap-data.ts#L67-L84). - -If you want to get regular transaction data instead of UserOps (presumably because you want to send the transaction through a EOA), use: - -- `getSwapUserOpCrossChain` - -## React API - -TODO diff --git a/docs/pages/smart-wallet/delegatecall.mdx b/docs/pages/smart-wallet/delegatecall.mdx deleted file mode 100644 index 7f819509..00000000 --- a/docs/pages/smart-wallet/delegatecall.mdx +++ /dev/null @@ -1,31 +0,0 @@ -# Delegatecall - -:::warning -`delegatecall` is very dangerous. Unless you know exactly what you are doing, don't do it, or you might risk losing all your funds. -::: - -`delegatecall` is a powerful EVM opcode that allows the calling contract to execute code in another contract, while keeping the storage context. [You can read more about `delegatecall` here](https://solidity-by-example.org/delegatecall/). - -## Core API - -:::info -Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/blob/main/delegatecall/main.ts). -::: - - -To send a UserOp that uses `delegatecall`, simply specify the `callType` of the UserOp: - - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - callData: await kernelClient.account.encodeCalls([{ - to: targetAdress, - data: callData, - value: 0n, - }], "delegatecall"), -}) -``` - -## React API - -TODO \ No newline at end of file diff --git a/docs/pages/smart-wallet/importing-assets.md b/docs/pages/smart-wallet/importing-assets.md deleted file mode 100644 index e084106e..00000000 --- a/docs/pages/smart-wallet/importing-assets.md +++ /dev/null @@ -1,170 +0,0 @@ -# Importing Assets - -Generally there are two ways to get assets into the smart wallet: - -- Fiat onramp -- Importing assets from another wallet - -ZeroDev works with any fiat onramp solution -- you simply specify the smart wallet address as the destination address. - -In this doc, we describe how to use ZeroDev's routing function to help users transfer their assets from another wallet (presumably an EOA) into the smart account. We support both same-chain and cross-chain transfers. - -## Installation -:::code-group - -```bash [npm] -npm install @zerodev/defi -``` - -```bash [pnpm] -pnpm add @zerodev/defi -``` - -```bash [yarn] -yarn add @zerodev/defi -``` - -```bash [bun] -bun install @zerodev/defi -``` - -::: - -## React API - -### Same Chain -```tsx -import { useKernelClient } from "@zerodev/waas" -import { createKernelDefiClient, baseTokenAddresses } from "@zerodev/defi" -import { useSendTransaction, useAccount, useChainId } from "wagmi" - -function App() { - // eoa state - const chainId = useChainId() - const { address: eoaAddress } = useAccount() - const { sendTransactionAsync } = useSendTransaction() - // smart account state - const { kernelClient, address: smartAccountAddress } = useKernelClient() - - const onClickImportAsset = async () => { - if (!kernelClient || !eoaAddress || !smartAccountAddress) return - - const defiClient = createKernelDefiClient(kernelClient, ZERODEV_PROJECT_ID) - const importTxData = await defiClient.getSwapData({ - chainId: chainId, - fromAddress: eoaAddress, - toAddress: smartAccountAddress, - fromToken: baseTokenAddresses[chainId].USDC, - toToken: baseTokenAddresses[chainId].DAI, - fromAmount: 10000000n, - }) - await sendTransactionAsync({ - to: importTxData.targetAddress, - value: BigInt(importTxData.value), - data: importTxData.callData - }) - } - - return ( - - ) -} -``` - -### Cross Chain - -Please see the [example](#same-chain) above for guidance on skipping imports and using hooks. - -```tsx -/// skip some import... -import { createKernelDefiClient, baseTokenAddresses } from "@zerodev/defi" - -function App() { - /// hooks to get account state... - - const onClickImportAsset = async () => { - const defiClient = createKernelDefiClient(kernelClient, ZERODEV_PROJECT_ID) - const importTxData = await defiClient.getSwapDataCrossChain({ // [!code focus] - fromChainId: chainId, // [!code focus] - toChainId: TO_CHAIN_ID, // [!code focus] - fromAddress: eoaAddress, // [!code focus] - toAddress: smartAccountAddress, // [!code focus] - fromToken: baseTokenAddresses[chainId].USDC, // [!code focus] - toToken: baseTokenAddresses[TO_CHAIN_ID].DAI, // [!code focus] - fromAmount: 10000000n, // [!code focus] - }) // [!code focus] - /// send transactions - } - - return ( - - ) -} -``` - -## Core API - -### Same Chain - -Refer to the [page](/smart-wallet/creating-wallets#creating-wallets) for instructions on how to construct a kernel client. - -```ts -import { createWalletClient, http } from 'viem' -import { privateKeyToAccount } from 'viem/accounts' -import { createKernelDefiClient, baseTokenAddresses } from "@zerodev/defi" - -/// construct kernel client... -const defiClient = createKernelDefiClient(kernelClient, ZERODEV_PROJECT_ID) -const chain = defiClient.chain - -// construct the wallet used to import assets -const account = privateKeyToAccount(PRIVATE_KEY) -const walletClient = createWalletClient({ - account: account, - chain: chain, - transport: http() -}) - -const importTxData = await defiClient.getSwapData({ - chainId: defiClient.chain.id, - fromAddress: account.address, - toAddress: defiClient.account.address, - fromToken: baseTokenAddresses[chain.id].USDC, - toToken: baseTokenAddresses[chain.id].DAI, - fromAmount: BigInt(10000000), -}) -await walletClient.sendTransaction({ - to: importTxData.targetAddress, - value: BigInt(importTxData.value), - data: importTxData.callData -}) - -``` - -### Cross Chain - -Please see the [example](#same-chain-1) above for guidance on skipping imports and constructing wallets. - -```ts -/// skip some import ... -import { createKernelDefiClient, baseTokenAddresses } from "@zerodev/defi" - -/// constuct wallet and kernel client... - -const defiClient = createKernelDefiClient(kernelClient, ZERODEV_PROJECT_ID) -const importTxData = await defiClient.getSwapDataCrossChain({ // [!code focus] - fromChainId: FROM_CHAIN_ID, // [!code focus] - toChainId: chain.id, // [!code focus] - fromAddress: account.address, // [!code focus] - toAddress: defiClient.account.address, // [!code focus] - fromToken: baseTokenAddresses[FROM_CHAIN_ID].USDC, // [!code focus] - toToken: baseTokenAddresses[chain.id].DAI, // [!code focus] - fromAmount: 10000000n, // [!code focus] -}) // [!code focus] - -/// send transaction... -``` \ No newline at end of file diff --git a/docs/pages/smart-wallet/infra-fallbacks.mdx b/docs/pages/smart-wallet/infra-fallbacks.mdx deleted file mode 100644 index 5c05df27..00000000 --- a/docs/pages/smart-wallet/infra-fallbacks.mdx +++ /dev/null @@ -1,91 +0,0 @@ -# Infra Fallbacks - -:::info -Impatient? Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/blob/main/fallback-clients/main.ts). -::: - -ZeroDev offers a "[meta infrastructure](/meta-infra/intro)" that integrates with all leading AA infra providers. When you use ZeroDev, you can pick [a specific infrastructure provider](/meta-infra/rpcs#bundler-rpc). If you don't pick one, we pick one for you. - -However, sometimes an infra provider may experience downtime. We have developed a "fallbacks" feature that allows you to set up multiple providers, so that when one fails, another takes over. - -## Core API - -Start by creating multiple account clients: - -```ts -// Get these from your ZeroDev dashboard -const PAYMASTER_RPC = 'your ZeroDev paymaster RPC' -const BUNDLER_RPC = 'your ZeroDev bundler RPC' - -const PAYMASTER_RPC_ALCHEMY = PAYMASTER_RPC + '?provider=ALCHEMY' -const BUNDLER_RPC_ALCHEMY = BUNDLER_RPC + '?provider=ALCHEMY' - -const PAYMASTER_RPC_PIMLICO = PAYMASTER_RPC + '?provider=PIMLICO' -const BUNDLER_RPC_PIMLICO = BUNDLER_RPC + '?provider=PIMLICO' - -const zeroDevPaymasterClient1 = createZeroDevPaymasterClient({ - chain, - transport: http(PAYMASTER_RPC_ALCHEMY), -}) - -// Create an account client with Alchemy as provider -const kernelClient1 = createKernelAccountClient({ - account, - chain, - bundlerTransport: http(BUNDLER_RPC_ALCHEMY), - paymaster: { - getPaymasterData(userOperation) { - return zeroDevPaymasterClient1.sponsorUserOperation({userOperation}) - } - }, -}) - -const zeroDevPaymasterClient2 = createZeroDevPaymasterClient({ - chain, - transport: http(PAYMASTER_RPC_PIMLICO), -}) - -// Create an account client with pimlico as provider -const kernelClient2 = createKernelAccountClient({ - account, - chain, - bundlerTransport: http(BUNDLER_RPC_PIMLICO), - paymaster: { - getPaymasterData(userOperation) { - return zeroDevPaymasterClient2.sponsorUserOperation({userOperation}) - } - }, -}) -``` - -Then combine the Kernel clients with the `createFallbackKernelAccountClient` function: - -```ts -const kernelClient = createFallbackKernelAccountClient([ - kernelClient1, - kernelClient2, -]) -``` - -Now you can use `kernelClient` as usual. Your `kernelClient` will use `kernelClient1` by default, and if it runs into any issues with it, it will fallback to `kernelClient2`. - -### Using non-ZeroDev infra as fallbacks - -In the previous example, we used different providers as fallbacks through ZeroDev. If you are worried that ZeroDev itself might go down, you can also sign up directly with providers like Pimlico and set them up as fallback providers. - -To do that, simply: - -- [Set up a Kernel account client with Pimlico](/sdk/infra/pimlico). - -Then combine them with `createFallbackKernelAccountClient`: - -```ts -const kernelClient = createFallbackKernelAccountClient([ - zerodevKernelClient, - pimlicoKernelClient, -]) -``` - -## React API - -TODO \ No newline at end of file diff --git a/docs/pages/smart-wallet/multisig.mdx b/docs/pages/smart-wallet/multisig.mdx deleted file mode 100644 index 8b03d541..00000000 --- a/docs/pages/smart-wallet/multisig.mdx +++ /dev/null @@ -1,116 +0,0 @@ -# Multisig - -With ZeroDev, it's possible to configure multiple signers for your smart account. The plugin that supports this functionality is named `WeightedECDSAValidator`, for the fact that it supports multiple ECDSA signers, each having a specific "weight." - -## How it works - -Each signer is set up with a **weight**, and for any given signature, there must be enough combined weight to reach or surpass the **threshold** for the signature to be considered valid. - -For example, let's say we have: - -- Threshold: 100 -- Weights: - - Signer A: 100 - - Signer B: 50 - - Signer C: 50 - -In this case, we are setting up a multisig where either signer A alone (100 = 100), or signer B and C together (50 + 50 = 100) can provide a valid signature. - -## Core API - -:::info -Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/tree/main/multisig). -::: - -### Installation - -:::code-group -```bash [npm] -npm i @zerodev/weighted-ecdsa-validator -``` - -```bash [yarn] -yarn add @zerodev/weighted-ecdsa-validator -``` - -```bash [pnpm] -pnpm i @zerodev/weighted-ecdsa-validator -``` - -```bash [bun] -bun i @zerodev/weighted-ecdsa-validator -``` - -::: - -### Setting up a new multisig account - -To set up a new multisig account, start by creating a validator: - -```ts -import { createWeightedECDSAValidator } from "@zerodev/weighted-ecdsa-validator" - -const multisigValidator = await createWeightedECDSAValidator(publicClient, { - entryPoint, - kernelVersion, - config: { - threshold: 100, - signers: [ - { address: signerA.address, weight: 100 }, - { address: signerB.address, weight: 50 }, - { address: signerC.address, weight: 50 }, - ] - }, - signers: [signerB, signerC], -}) -``` - -In `config`, you specify the `threshold` and an list of signer addresses, as well as their weights. - -In `signers`, you specify the list of signers ([Viem accounts](https://viem.sh/docs/accounts/local)) that will be signing for this account. The combined weight of these signers must reach the threshold. - -After creating the validator, you can [set up a Kernel account using the validator](/sdk/core-api/create-account#create-a-kernel-account) as usual. - -### Using an existing multisig account - -If a multisig account has already been deployed, you can skip the multisig config but specify the deployed multisig address when you create the account: - -```ts -const multisigValidator = await createWeightedECDSAValidator(publicClient, { - entryPoint, - kernelVersion, - signers: [signerB, signerC], -}) - -const account = await createKernelAccount(publicClient, { - entryPoint, - kernelVersion, - address: '', - plugins: { - sudo: multisigValidator, - } -}) -``` - -### Updating multisig config - -In many use cases, you may need to add and remove signers over time. To do so, send a UserOp that updates the config: - -```ts -import { getUpdateConfigCall } from "@zerodev/weighted-ecdsa-validator" - -// getUpdateConfigCall can be used with either sendTransaction or sendUserOperation - -await kernelClient.sendTransaction( - getUpdateConfigCall({ - threshold: 100, - signers: [ - { address: signer1.address, weight: 50 }, - { address: signer2.address, weight: 50 }, - { address: signer3.address, weight: 50 }, - ] - }), -) -``` - -Note that `kernelClient` here must itself be a correctly set-up instance of a multisig account client. \ No newline at end of file diff --git a/docs/pages/smart-wallet/one-click-trading.md b/docs/pages/smart-wallet/one-click-trading.md deleted file mode 100644 index b8f062f7..00000000 --- a/docs/pages/smart-wallet/one-click-trading.md +++ /dev/null @@ -1,152 +0,0 @@ -# One-click Trading - -Signing every transaction gets annoying if you expect users to do frequent trades. The solution is "1-click trading" aka 1CT. - -## How 1CT Works - -The reason why transactions normally need to be confirmed is that each transaction has *unlimited permissions* -- any transaction can do anything. That's why the user needs to look at each transaction and confirm it. - -ZeroDev enables 1CT through *session keys*. Session keys are **temporary keys with limited permissions**. For example, you might create a session key that: - -- Lasts 24 hours. -- Can only interact with Uniswap. -- Can only spend up to 100 USDC. - -Since the session key cannot do *everything*, but rather only do specific things, there's no need for the user to confirm every transaction. The user would only confirm the *permissions* when the session key is created. - -## Capabilities API - -:::info -Check out [a complete code example here](https://github.com/zerodevapp/capabilities-examples/tree/main/session-keys). -::: - -With [the capabilities API](/smart-wallet/quickstart-capabilities), you can create a "session" with the wallet by requesting permissions. Then, transactions can be sent within those permissions, without asking the user for further confirmations. - -First, request permissions from the connected wallet using Viem: - -```tsx -import { parseAbi } from "viem" -import { walletActionsErc7715 } from "viem/experimental" -import { useWalletClient } from "wagmi" - -function App() { - const {data: walletClient} = useWalletClient() - - const handleIssuePermissions = async () => { - const session = await walletClient?.extend(walletActionsErc7715()).issuePermissions({ - permissions: [ - { - type: "contract-call", - data: { - permissions: [ - onlyMintToken - // more policies... - ] - } - }, - ], - expiry: Math.floor(Date.now().valueOf() / 1000) + 3600, - }) - } - - return ( - - ); -} -``` - -Now, every time you want to send a transaction with this session, use the `permissions` capability and include the `permissionsContext` in the `sendCalls` request: - -```tsx -import { useSendCalls } from "wagmi/experimental" - -function App() { - const { data, sendCalls } = useSendCalls(); - - return ( - - ); -} -``` - -## React API - -:::info -Check out [a complete code example here](https://github.com/zerodevapp/waas-examples/tree/main/session-keys). -::: - -### Creating Sessions - -Use [the `useCreateSession` hook](/react/use-create-session) to create a session. When you create a session, ZeroDev generates a random session key and stores it in local storage. The key is then assigned with a list of policies. [Learn more about policies here.](/smart-wallet/permissions/intro) - -```tsx -import { useCreateSession } from '@zerodev/waas'; - -function App() { - const { write } = useCreateSession(); - - return ( - - ) -} -``` - -### Using Sessions - -Now, you can send transactions with [`useSendUserOperationWithSession`](/react/use-send-useroperation-with-session): - -```tsx -import { useSendUserOperationWithSession, useKernelClient } from '@zerodev/waas'; -import { parseAbi } from 'viem'; - -function App() { - const { write } = useSendUserOperationWithSession(); - const { address } = useKernelClient(); - - return ( - - ) -} -``` - -Sessions are automatically stored inside local storage, so they will persist even after your user closes their tab, until they expire due to policies. - -## Core API - -Refer to [Permissions docs](/smart-wallet/permissions/intro). \ No newline at end of file diff --git a/docs/pages/smart-wallet/parallel-transactions.md b/docs/pages/smart-wallet/parallel-transactions.md deleted file mode 100644 index bc47fec7..00000000 --- a/docs/pages/smart-wallet/parallel-transactions.md +++ /dev/null @@ -1,97 +0,0 @@ -# Parallel Transactions - -With a EOA, the nonce is sequential: 1, 2, 3, ... This means that transactions must be ordered sequentially, and a transaction cannot be processed unless a previous transaction was completed. - -With smart accounts, the nonce can be two-dimensional, which allows for *parallel UserOps*. Imagine that your user wants to place three trades: - -1. Swap 100 USDC to DAI -2. Swap 100 DAI to USDT -3. Swap 1WETH to USDT - -In this example, assuming the user did not have DAI to start with, the first two trades have dependencies, since the user needs to wait for the first trade to complete before they can do the second trade. However, the third trade doesn't depend on either of the first two trades, so it ought to be able to be placed in parallel. - -## How 2D Nonces Work - -With a smart account, the nonce has two components: a "nonce key" and a "nonce value." - -UserOps with the same nonce key will be ordered sequentially. For example, by default all UserOps use the a nonce key of `0`, which is why by default all UserOps are ordered sequentially. - -To send UserOps in parallel, simply assign them with different nonce keys. - -## React API - -When sending UserOps with `useSendUserOperation` or `useSendUserOperationWithSession`, you can specify a `nonceKey` which is a string. - -```tsx -import { useSendUserOperation, useKernelClient } from '@zerodev/waas' -import { parseAbi } from 'viem' - -function App() { - const { write } = useSendUserOperation({ - nonceKey: '0' - }) - const { address } = useKernelClient() - const abi = parseAbi(['function mint(address _to) public']) - - return ( - - ) -} -``` - -UserOps with the same `nonceKey` will be ordered sequentially. UserOps with different `nonceKey`s will be ordered in parallel. All UserOps use a nonceKey of `0` by default. - -## Core API - -:::info -Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/blob/main/send-transactions/with-2d-nonce.ts). -::: - -To send parallel UserOps, use "nonce keys" to compute nonces: - -```ts -const nonceKey = getCustomNonceKeyFromString( - "nonce key", - entryPoint, -) - -const nonce = await account.getNonce({ key: nonceKey }) - -await kernelClient.sendUserOperation({ - callData, - nonce: nonce, -}) - -// This UserOp won't wait for the previous one, because it uses -// a different nonce key. -const nonceKey2 = getCustomNonceKeyFromString( - "nonce key 2", - entryPoint, -) - -const nonce2 = await account.getNonce({ key:nonceKey2 }) - - -await kernelClient.sendUserOperation({ - callData, - nonce: nonce2, -}) -``` - -All UserOps using the same nonce key will be ordered sequentially. UserOps using different nonce keys will be parallel to each other. - -For example, if you want to order all UserOps that interact with Uniswap, and order all UserOps that interact with AAVE, but you want the Uniswap UserOps and the AAVE UserOps to be parallel to each other, you can use the string "Uniswap" and "AAVE" as the nonce keys for their UserOps respectively. \ No newline at end of file diff --git a/docs/pages/smart-wallet/pay-gas-in-erc20s.mdx b/docs/pages/smart-wallet/pay-gas-in-erc20s.mdx deleted file mode 100644 index ff6da7c5..00000000 --- a/docs/pages/smart-wallet/pay-gas-in-erc20s.mdx +++ /dev/null @@ -1,172 +0,0 @@ -# Paying Gas in ERC20s - -A smart account can pay gas with ERC20 tokens. As a result, your users don't have to own any native gas tokens (e.g. ETH) in order to use Web3. Instead, they can just use stablecoins or even your project's own tokens. When your users pay gas with ERC20 tokens, we add 5% to the exchange rate to make a profit. - -:::warning -Using your project's own tokens to pay for gas is a beta feature. If you are interested, please reach out. -::: - -On a high level, you need to do two things to enable a smart account to pay gas in a particular ERC20 token: - -- Set up the Kernel client with the ERC20 paymaster. -- Ensure that enough ERC20 tokens have been approved for the ERC20 paymaster. - - This step is necessary because the ERC20 paymaster needs to withdraw ERC20 tokens from the smart account. - -Let's go through these two steps next. We will be using mainnet USDC in the following examples, but you can use any of [these supported tokens](https://docs.pimlico.io/infra/paymaster/erc20-paymaster/supported-tokens) thanks to our integration with Pimlico. - -## React API - -Set the `paymaster` param when fetching the `kernelClient` through `useKernelClient`: - -```ts -import { useKernelClient } from "@zerodev/waas" - -function App() { - const { kernelClient } = useKernelClient({ - paymaster: { type: "ERC20", gasToken: "USDC" } - }) -} -``` - -If you have not approved tokens for the paymaster, you also need to do this: - -```tsx -import { parseEther, http } from "viem"; -import { useKernelClient, useSendTransaction } from "@zerodev/waas"; -import { - gasTokenAddresses, - getERC20PaymasterApproveCall, - createZeroDevPaymasterClient -} from "@zerodev/sdk" - -function App() { - const { kernelClient } = useKernelClient({ - paymaster: { type: "ERC20", gasToken: "USDC" } - }); - const { write } = useSendTransaction({ - paymaster: { type: "SPONSOR" } - }) - - const approve = async () => { // [!code focus] - const paymasterClient = createZeroDevPaymasterClient({ // [!code focus] - chain: chain, // [!code focus] - entryPoint: kernelClient?.account.entryPoint, // [!code focus] - transport: http('ZERODEV_PAYMASTER_RPC'), // get the RPC on ZeroDev dashboard // [!code focus] - }) // [!code focus] - - const approveTx = await getERC20PaymasterApproveCall(paymasterClient, { // [!code focus] - gasToken: gasTokenAddresses[chain.id]['USDC'], // [!code focus] - approveAmount: parseEther('0.1'), // [!code focus] - }); // [!code focus] - write([approveTx]) // [!code focus] - } // [!code focus] - - return ( - - ) -} -``` - -## Core API - -:::info -Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/tree/main/pay-gas-with-erc20). -::: - -### Setting up Kernel Client - -When you [set up an account](/smart-wallet/creating-wallets#create-an-account-client), do this: - -```typescript -import { - createZeroDevPaymasterClient, - createKernelAccountClient, - gasTokenAddresses, -} from "@zerodev/sdk" - -import { mainnet } from "viem/chains" - - -// use whatever chain you want -const chain = mainnet.id -const entryPoint = ENTRYPOINT_ADDRESS_V06 - -const paymasterClient = createZeroDevPaymasterClient({ - chain, - transport: http('ZERODEV_PAYMASTER_RPC'), // get the RPC on ZeroDev dashboard -}) - -const kernelClient = createKernelAccountClient({ - // other options... - - paymaster: paymasterClient, - paymasterContext: { token: gasTokenAddresses[chain.id]['USDC'] } -}) -``` - -### Approving ERC20 tokens for paymaster - -Use the `getERC20PaymasterApproveCall` function to construct a call that approves the paymaster with the ERC20 tokens: - -```typescript -import { getERC20PaymasterApproveCall } from "@zerodev/sdk" - -const userOpHash = await kernelClient.sendUserOperation({ - callData: await kernelClient.account.encodeCalls([ - await getERC20PaymasterApproveCall(paymasterClient, { - gasToken: gasTokenAddresses[chain.id]['USDC'], - approveAmount: parseEther('0.1'), - }), - ]), -}) -``` - -Thanks to [batching](/sdk/core-api/batch-transactions), it's possible to batch the approval with the UserOp you want to send: - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - callData: await account.encodeCalls([ - // The approval - await getERC20PaymasterApproveCall(paymasterClient, { - gasToken: gasTokenAddresses[chain.id]['USDC'], - approveAmount: parseEther('0.1'), - }), - // The actual call - { - to: '0x...' - data: "0x...", - value: BigInt(0), - }, - ]), -}) -``` - -Note that you only have to approve once, as long as the approval amount is sufficient for many UserOps. The [paymaster contract by Pimlico](https://github.com/pimlicolabs/erc20-paymaster/blob/main/src/ERC20PaymasterV06.sol) has been audited, it's widely used and generally considered safe. - -### Estimating Gas in ERC20s - -If you need to estimate gas in terms of a ERC20 token, do this: - -```ts -const userOperation = await kernelClient.prepareUserOperation({ - // replace this with your actual calldata - callData: await account.encodeCalls([{ - to: zeroAddress, - value: BigInt(0), - data: "0x" - }]) -}) - -const erc20Amount = await paymasterClient.estimateGasInERC20({ - userOperation, - - // replace this with the token you want - gasTokenAddress: gasTokenAddresses[chain.id]["USDC"] -}) -``` - -You can also see [a code example for estimating gas here](https://github.com/zerodevapp/zerodev-examples/blob/main/pay-gas-with-erc20/estimate-gas.ts). - -## Supported Tokens - -We support [these tokens](https://docs.pimlico.io/infra/paymaster/erc20-paymaster/supported-tokens) thanks to our integration with Pimlico. diff --git a/docs/pages/smart-wallet/permissions/actions/build-your-own.mdx b/docs/pages/smart-wallet/permissions/actions/build-your-own.mdx deleted file mode 100644 index c3ebd31e..00000000 --- a/docs/pages/smart-wallet/permissions/actions/build-your-own.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Build Your Own Action - -Guide coming soon. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/intro.mdx b/docs/pages/smart-wallet/permissions/intro.mdx deleted file mode 100644 index 49bd16fc..00000000 --- a/docs/pages/smart-wallet/permissions/intro.mdx +++ /dev/null @@ -1,79 +0,0 @@ -# Permissions (Session Keys) - -ZeroDev is built on [Kernel](https://github.com/zerodevapp/kernel), the most widely-deployed ERC-4337 smart account. With Kernel, you can assign different permissions to different keys. Some of these keys might be owned by the owner(s) of the smart account, and some might be short-lived keys that you share with others to delegate transactions. The latter are also commonly known as "session keys." - -To set up permissions for a key, you must answer three questions: who, when, and what. - -- **Who** (what key) can perform the action? -- **When** (under what condition) can the action be performed? -- **What** is the action anyways? - -These three questions correspond to three types of "permissions plugins": - -- **Signers** (who) specify the key and the algorithm (ECDSA, WebAuthn) it uses. -- **Policies** (when) specify the *conditions* under which the keys can be used. Some example conditions are: - - Only if interacting with Uniswap - - Only if spending USDC - - Only once a month -- **Actions** (what) specify the execution function the key uses. - -## Composing Permissions - -Kernel is the first smart account to support *composable permissions*. That is, you can build up fine-grained permissions from putting together signers, policies, and actions. Here's the formula: - -``` -Permission = 1 signer + N policies + 1 action -``` - -In pseudo-code, this is what it looks like: - -```ts -const account = createKernelAccount({ - signer: passkeySigner, - policies: [ - onlyUSDC, - onlyUniswap, - oncePerMonth, - ], - action, -}) -``` - -Here, the `signer` will be able to perform `action` if all `policies` are met. - -Now let's dive into these plugin types. - -## Permission Plugins - -Because permissions are plugins, **you can write your own permissions** if the default ones provided by ZeroDev don't meet your needs. - -### Signers - -Signers specify the keys and the algorithms the keys use. ZeroDev provides signers for: - -- ECDSA -- WebAuthn (passkeys) -- Multisig - -### Policies - -Policies are the conditions under which the keys can be used. ZeroDev provides the following policies: - -- [Sudo policy](/smart-wallet/permissions/policies/sudo): you can do anything -- [Call policy](/smart-wallet/permissions/policies/call): you can only call certain contracts or functions (and only with certain params) -- [Gas policy](/smart-wallet/permissions/policies/gas): you can only spend up to X amount of gas -- [Signature policy](/smart-wallet/permissions/policies/signature): you can only sign certain messages -- [Rate limit policy](/smart-wallet/permissions/policies/rate-limit): you can only send UserOps within a given rate limit -- [Timestamp policy](/smart-wallet/permissions/policies/timestamp): you can only send UserOps within certain timeframes - -### Actions - -Actions are arbitrary functions that the smart account will `delegatecall` to. They give you perfect flexibility over the execution logic. - -Note that actions are NOT to be confused with the calls you actually want to execute. For example, if you want to interact with Uniswap, that's just the call you want to execute. "Action" here specifically refers to the execution function by which Uniswap is called. - -If that's confusing, just forget about actions. Mostly commonly you will only be setting up signers and policies, and the `action` will default to Kernel's default `execute()` function, which is enough for most needs. - -## Next Steps - -- [Learn to automate transactions for users with permissions.](/smart-wallet/permissions/transaction-automation) diff --git a/docs/pages/smart-wallet/permissions/policies/build-your-own.mdx b/docs/pages/smart-wallet/permissions/policies/build-your-own.mdx deleted file mode 100644 index 28d0b4ce..00000000 --- a/docs/pages/smart-wallet/permissions/policies/build-your-own.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Build Your Own Policy - -Guide coming soon. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/policies/call.mdx b/docs/pages/smart-wallet/permissions/policies/call.mdx deleted file mode 100644 index 64834499..00000000 --- a/docs/pages/smart-wallet/permissions/policies/call.mdx +++ /dev/null @@ -1,68 +0,0 @@ -# Call Policy - -The call policy limits the target (either contract or EOA) that the UserOp can interact with. If the target is a contract, then you can further specify the functions the UserOp can interact with, as well as putting constraints on the values of the function arguments. - -## API - -```ts -import { ParamCondition, toCallPolicy, CallPolicyVersion } from "@zerodev/permissions/policies" - -const callPolicy = toCallPolicy({ - policyVersion: CallPolicyVersion.V0_0_3, - permissions: [ - { - // target address - target: contractAddress, - // Maximum value that can be transferred. In this case we - // set it to zero so that no value transfer is possible. - valueLimit: BigInt(0), - // Contract abi - abi: contractABI, - // Function name - functionName: "mint", - // An array of conditions, each corresponding to an argument for - // the function. - args: [ - { - condition: ParamCondition.EQUAL, - value: value, - }, - ], - }, - ], -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - callPolicy, - // ...other policies - ], -}) -``` - -- `target`: the target contract to call or address to send ETH to. If this is `zeroAddress`, then the target can be any contract as long as the ABI matches (or it can be any address if no ABI is specified). -- `valueLimit`: the maximum value. that can be transmitted. -- `abi`: the contract ABI -- `functionName`: the function name -- `selector`: if you have multiple functions with the same name, you can distinguish them with `selector`. For example: `selector: toFunctionSelector("transfer(uint256, uint256)")`. -- `args`: an array of conditions, each corresponding to an argument, in the order that the arguments are laid out. use `null` to skip an argument. - - `operator`: this can be `EQUAL`, `GREATER_THAN`, `LESS_THAN`, `GREATER_THAN_OR_EQUAL`, `LESS_THAN_OR_EQUAL`, `NOT_EQUAL`. - - `value`: the value of the argument to use with the operator. For instance, `operator = EQUAL` and `value = 2` would mean "the argument must be equal to 2". -- `operation`: whether this is a call or a delegatecall. Defaults to call. - -## Transferring ETH - -If you want to transfer ETH given a call policy, specify the `data` field as such: - -```ts -import { pad } from 'viem' - -await kernelClient.sendTransaction({ - to: address, - data: pad("0x", { size: 4 }), - value: amountToTransfer, -}) -``` diff --git a/docs/pages/smart-wallet/permissions/policies/gas.mdx b/docs/pages/smart-wallet/permissions/policies/gas.mdx deleted file mode 100644 index 1d29f3a2..00000000 --- a/docs/pages/smart-wallet/permissions/policies/gas.mdx +++ /dev/null @@ -1,40 +0,0 @@ -# Gas Policy - -The gas policy specifies how much gas the signer can use in total, across all UserOps it sends. It can also enforce that the UserOps must use paymasters, or use a specific paymaster. - -## API - -```ts -import { toGasPolicy } from "@zerodev/permissions/policies" - -// Set a total amount -const gasPolicy = toGasPolicy({ - allowed: parseEther('0.1'), -}) - -// Or enforce that a paymaster must be used -const gasPolicy = toGasPolicy({ - enforcePaymaster: true, -}) - -// Or enforce that a specific paymaster is used -const gasPolicy = toGasPolicy({ - allowedPaymaster: "PAYMASTER_ADDRESS", -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - gasPolicy, - // ...other policies - ], -}) -``` - -`toGasPolicy` takes one or more of the following arguments: - -- `allowed`: an amount, in wei, of the ETH (or whatever native token) that the signer can spend on gas, in total across all UserOps it sends. -- `enforcePaymaster`: a boolean value. If set to true, enforce that a paymaster must be used. -- `allowedPaymaster`: a paymaster address. If set, enforce that the specific paymaster is used. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/policies/rate-limit.mdx b/docs/pages/smart-wallet/permissions/policies/rate-limit.mdx deleted file mode 100644 index 3db9fb35..00000000 --- a/docs/pages/smart-wallet/permissions/policies/rate-limit.mdx +++ /dev/null @@ -1,95 +0,0 @@ -# Rate Limit Policy - -The rate limit policy specifies the frequency at which the signer is allowed to send UserOps. - -## API - -```ts -import { toRateLimitPolicy } from "@zerodev/permissions/policies" - -// In this example, the signer can send one UserOp per month -const rateLimitPolicy = toRateLimitPolicy({ - count: 1, - interval: 60 * 60 * 24 * 30, // one month in seconds -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - rateLimitPolicy, - // ...other policies - ], -}) -``` - -Arguments to `toRateLimitPolicy`: - -- `count`: the number of times the signer can send UserOps in the given internal. -- (optional) `interval`: the length of the interval, in seconds. - - If not specified, then the interval is infinite, which means that you can use `count` to specify the number of times the signer can send UserOps in total. -- (optional) `startAt`: the starting UNIX timestamp for when the rate limit should take effect. Before that, the signer cannot send any UserOps. - -## Using RateLimitPolicy with reset - -### API - -The Rate Limit Policy with reset allows you to define a recurring allowance of UserOps that refreshes after each interval period. This is useful for creating recurring permissions that automatically renew, such as monthly subscription payments or regular administrative actions. - -Unlike the standard Rate Limit Policy which counts down a total number of allowed operations, the reset version gives the signer a fresh allocation of operations after each interval passes. - - -```ts -import { toRateLimitPolicy, RATE_LIMIT_POLICY_WITH_RESET_CONTRACT } from "@zerodev/permissions/policies" - -// In this example, the signer can send one UserOp per month -const rateLimitPolicy = toRateLimitPolicy({ - count: 1, - interval: 60 * 60 * 24 * 30, // one month in seconds -}) - -// only difference from non-reset is using RATE_LIMIT_POLICY_WITH_RESET_CONTRACT for policyAddress -const validator = toPermissionValidator(publicClient, { - policyAddress : RATE_LIMIT_POLICY_WITH_RESET_CONTRACT, - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - rateLimitPolicy, - // ...other policies - ], -}) -``` - -### Comparison with Rate Limit Policy without reset - -- With reset - - userOps can be called up to `count` times within a given `interval`. - - The amount of available userOps resets when the current `interval` expires (meaning you get `count` uses again). - -- Without reset - - userOps can be called a total of `count` times, and the available amount only decreases with use (no reset over time). - - Each userOps call must have at least an `interval` of time between it and the next call. - -#### example - -if you want to set recurring payment logic for every month without reset and expect to live for next 2 years, paramters will be - -``` - count : 24, - interval : 60 * 60 * 24 * 30 // 30 days for month - startAt : -``` - -if you want to set it with reset, parameters will be - -``` - count : 1, - interval : 60 * 60 * 24 * 30 // 30 days for month - startAt : 0 or undefined -``` - -### Notice - -Although RateLimitWithReset is powerful, it violates erc4337 opcode rule to access `block.timestamp` this will only work with bundlers that accepts this opcode \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/policies/signature.mdx b/docs/pages/smart-wallet/permissions/policies/signature.mdx deleted file mode 100644 index d57a7663..00000000 --- a/docs/pages/smart-wallet/permissions/policies/signature.mdx +++ /dev/null @@ -1,27 +0,0 @@ -# Signature Caller Policy - -The signature caller policy specifies a list of addresses that are allowed to validate messages signed by the signer. - -This is useful when you want the signer to sign messages for a set of particular protocols only. For example, if you want to create a signer that can only sign USDC [permits](https://eips.ethereum.org/EIPS/eip-2612), then you can use this policy to ensure that only the USDC contract can validate its messages. - -## API - -```ts -import { toSignatureCallerPolicy } from "@zerodev/permissions/policies" - -const signaturePolicy = toSignatureCallerPolicy({ - allowedCallers: [address1, address2] -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - signaturePolicy, - // ...other policies - ], -}) -``` - -- `allowedCallers` is a list of addresses that are allowed to validate messages signed by the signer. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/policies/sudo.mdx b/docs/pages/smart-wallet/permissions/policies/sudo.mdx deleted file mode 100644 index 1a0f83de..00000000 --- a/docs/pages/smart-wallet/permissions/policies/sudo.mdx +++ /dev/null @@ -1,21 +0,0 @@ -# Sudo Policy - -The sudo policy gives full permission to the signer. The signer will be able to send any UserOps and sign any messages. - -## API - -```ts -import { toSudoPolicy } from "@zerodev/permissions/policies" - -const sudoPolicy = toSudoPolicy({}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - sudoPolicy, - // ...other policies - ], -}) -``` \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/policies/timestamp.mdx b/docs/pages/smart-wallet/permissions/policies/timestamp.mdx deleted file mode 100644 index dbb3336a..00000000 --- a/docs/pages/smart-wallet/permissions/policies/timestamp.mdx +++ /dev/null @@ -1,30 +0,0 @@ -# Timestamp Policy - -The timestamp policy specifies the start and end time for when the signer is valid. - -## API - -```ts -import { toTimestampPolicy } from "@zerodev/permissions/policies" - -// In this example, the signer can send one UserOp per month -const timestampPolicy = toTimestampPolicy({ - validAfter: 1704085200, // January 1, 2024 12:00 AM UTC - validUntil: 1735707599, // December 31, 2024 11:59 PM UTC -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: someSigner, - policies: [ - timestampPolicy, - // ...other policies - ], -}) -``` - -Arguments to `toTimestampPolicy`: - -- `validAfter`: the time after which the signer becomes valid. If not specified, the signer is immediately valid. -- `validUntil`: the time before which the signer is valid. If not specified, the signer never expires. diff --git a/docs/pages/smart-wallet/permissions/signers/build-your-own.mdx b/docs/pages/smart-wallet/permissions/signers/build-your-own.mdx deleted file mode 100644 index 1d977189..00000000 --- a/docs/pages/smart-wallet/permissions/signers/build-your-own.mdx +++ /dev/null @@ -1,3 +0,0 @@ -# Build Your Own Signer - -Guide coming soon. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/signers/ecdsa.mdx b/docs/pages/smart-wallet/permissions/signers/ecdsa.mdx deleted file mode 100644 index 939be06e..00000000 --- a/docs/pages/smart-wallet/permissions/signers/ecdsa.mdx +++ /dev/null @@ -1,25 +0,0 @@ -# ECDSA Signer - -The ECDSA signer signs with a single ECDSA key, specifically with the `secp256k1` curve, which is the same algorithm that EOAs use. - -## API - -```typescript -import { toECDSASigner } from "@zerodev/permissions/signers" - -// Use any Viem account -const signer = privateKeyToAccount(generatePrivateKey()) - -const ecdsaSigner = await toECDSASigner({ - signer, -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: ecdsaSigner, - policies: [ - // ... - ], -}) -``` \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/signers/passkeys.mdx b/docs/pages/smart-wallet/permissions/signers/passkeys.mdx deleted file mode 100644 index d7647c1e..00000000 --- a/docs/pages/smart-wallet/permissions/signers/passkeys.mdx +++ /dev/null @@ -1,39 +0,0 @@ -# WebAuthn Signer - -The WebAuthn (passkeys) signer signs with a single passkey. Read [the passkeys doc](/sdk/advanced/passkeys) for a more detailed intro to passkeys. - -## API - -```typescript -import { toWebAuthnSigner, toWebAuthnKey, WebAuthnMode, WebAuthnSignerVersion} from "@zerodev/permissions/signers" - -const passkeyName = "Key Name" // any name you want -const passkeyServerUrl = "..." // get this from ZeroDev dashboard -const mode = WebAuthnMode.Register // can also be WebAuthnMode.Login if you are using an existing key - -const webAuthnKey = await toWebAuthnKey({ - passkeyName, - passkeyServerUrl, - mode, -}) - -const webAuthnSigner = await toWebAuthnSigner(publicClient, { - webAuthnKey, - webAuthnSignerVersion: WebAuthnSignerVersion.V0_0_2 -}) - -const validator = toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: webAuthnSigner, - policies: [ - // ... - ], -}) -``` - -For the params: - -- `passkeyName` can be any name -- `passkeyServerUrl` is a [passkey server URL](/sdk/advanced/passkeys#setting-up-passkey-server). You can get it from the ZeroDev dashboard. -- `mode` is either `register` or `login`, depending on whether you are creating a new key or using an existing key. \ No newline at end of file diff --git a/docs/pages/smart-wallet/permissions/transaction-automation.mdx b/docs/pages/smart-wallet/permissions/transaction-automation.mdx deleted file mode 100644 index ccfd6cfc..00000000 --- a/docs/pages/smart-wallet/permissions/transaction-automation.mdx +++ /dev/null @@ -1,205 +0,0 @@ -# Tutorial -- Transaction Automation - -In this tutorial, you will learn how to automate transactions for your users using [session keys](/smart-wallet/permissions/intro). This is useful when you want to send transactions for your users from your server, for instance. - -Refer to [this code example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/transaction-automation.ts) while you follow along the tutorial. You can run the example by following instructions of [the examples repo](https://github.com/zerodevapp/zerodev-examples). - -## Installation - -Session keys are enabled through the `@zerodev/permissions` package. The examples repo already installed this, but normally you would install permissions with: - -:::code-group - -```bash [npm] -npm i @zerodev/permissions -``` - -```bash [yarn] -yarn add @zerodev/permissions -``` - -```bash [pnpm] -pnpm i @zerodev/permissions -``` - -```bash [bun] -bun add @zerodev/permissions -``` - -::: - -## The Architecture of Transaction Automation - -In the typical architecture for transaction automation, there's an "owner" and an "agent": - -- The "owner" is the entity that controls the user's master key. -- The "agent" is the entity that automates transactions for the owner. - -For instance, your user might be using an embedded wallet (master key) with your frontend, and you might want to automate transactions for your users from your server. In this case, the frontend would be the "owner" and your server would be the "agent." - -From a high level, this is how transaction automation works: - -- The agent creates a session key. - - At this point, the session key has not been approved by the owner. -- The agent sends the "address" of the session key to the owner for approval. -- The owner signs the address and returns the approval (signature) to the agent. -- The agent can now send transactions for users using the approval and the session key. - -## Code Flow - -### Agent: creating a session key - -From the agent's side, create a [ECDSA signer](/smart-wallet/permissions/signers/ecdsa) as the session key: - -```ts -const sessionPrivateKey = generatePrivateKey() - -const sessionKeySigner = await toECDSASigner({ - signer: privateKeyToAccount(sessionPrivateKey), -}) -``` - -Note that if you do not wish to store the private key of the session key, you could use a [remote signer](/sdk/advanced/key-storage) instead: - -```ts -const remoteSigner = await toRemoteSigner({ - apiKey, - mode: RemoteSignerMode.Create -}) - -const sessionKeySigner = toECDSASigner({ - signer: remoteSigner, -}) -``` - -### Agent: send session key "address" to the owner - -For the owner to approve the session key, the agent must send the "address" of the session key to the owner. Note that the private key is never sent -- it's only the address which is the public key of the session key that's sent. - -To obtain the session key address: - -```ts -const sessionKeyAddress = sessionKeySigner.account.address -``` - -Send this address to the owner. - -### Owner: approving the session key - -Now, on the owner side, approve the session key with [policies](/smart-wallet/permissions/intro#policies): - -```ts -const ecdsaValidator = await signerToEcdsaValidator(publicClient, { - entryPoint, - kernelVersion, - signer, -}) - -// Create an "empty account" as the signer -- you only need the public -// key (address) to do this. -const emptyAccount = addressToEmptyAccount(sessionKeyAddress) -const emptySessionKeySigner = await toECDSASigner({ signer: emptyAccount }) - -const permissionPlugin = await toPermissionValidator(publicClient, { - entryPoint, - kernelVersion, - signer: emptySessionKeySigner, - policies: [ - // your policies - ], -}) - -const sessionKeyAccount = await createKernelAccount(publicClient, { - entryPoint, - kernelVersion, - plugins: { - sudo: ecdsaValidator, - regular: permissionPlugin, - }, -}) - -const approval = await serializePermissionAccount(sessionKeyAccount) -``` - -Now, send the serialized approval back to the agent. - -### Agent: using the session key - -When the agent wants to use the session key, first recreate the signer. Presumably, you would've stored the session key somewhere: - -```ts -// Using a stored private key -const sessionKeySigner = await toECDSASigner({ - signer: privateKeyToAccount(sessionPrivateKey), -}) -``` - -Or if you were using a remote signer: - -```ts -const remoteSignerWithGet = await toRemoteSigner({ - apiKey, - keyAddress: remoteSignerAddress // you should've stored this - mode: RemoteSignerMode.Get -}) - -const sessionKeySigner = toECDSASigner({ - signer: remoteSigner, -}) -``` - -Now create an account object by combining the approval (which you should've stored somewhere) with the `sessionKeySigner`: - -```ts -const sessionKeyAccount = await deserializePermissionAccount( - publicClient, - entryPoint, - kernelVersion, - approval, - sessionKeySigner -) -``` - -Finally, [construct a Kernel client](/sdk/core-api/create-account#create-an-account-client) as usual: - -```ts -const kernelClient = createKernelAccountClient({ - account: sessionKeyAccount, - - // the other params -}) -``` - -Now you can send transactions with the Kernel client. - -## Revoking a Session Key - -:::info -Here's a [code example](https://github.com/zerodevapp/zerodev-examples/blob/main/session-keys/transaction-automation.ts#L114-L158) for revoking session keys. -::: - -After a session key has been used, or if it's no longer needed, it's a good security practice to revoke it to ensure it cannot be used for any further transactions. Here's how you can revoke a session key: - -First, prepare your environment for the revocation process. This involves creating a "sudo" account capable of performing privileged operations, such as uninstalling plugins. - -```ts -const sudoAccount = await createKernelAccount(publicClient, { - plugins: { - sudo: ecdsaValidator, - }, - // other params -}); - -const sudoKernelClient = createKernelAccountClient({ - account: sudoAccount, - // other params -}) -``` - -Now to revoke the session key by uninstalling its associated permission plugin, call `uninstallPlugin` on `sudoKernelClient`. - -```ts -const userOpHash = await sudoKernelClient.uninstallPlugin({ - plugin: permissionPlugin, -}); -``` diff --git a/docs/pages/smart-wallet/quickstart-capabilities.mdx b/docs/pages/smart-wallet/quickstart-capabilities.mdx deleted file mode 100644 index ddb3ea31..00000000 --- a/docs/pages/smart-wallet/quickstart-capabilities.mdx +++ /dev/null @@ -1,186 +0,0 @@ -# Quickstart -- Capabilities - -Capabilities ([ERC-5792](https://eips.ethereum.org/EIPS/eip-5792)) is the [new standard way for DApps to interact with smart wallets](/blog/hello-capabilities). On a high level, it comes down to two steps: - -- The DApp *discovers* capabilities of the connected wallet through the `wallet_getCapabilities` RPC. -- The DApp *uses* capabilities through the `wallet_sendCalls` RPC. - -By standardizing smart wallet features such as gas sponsorship, transaction batching, and permissions (session keys), capabilities enable DApps to interact with any smart wallets through standard APIs. This means that: - -- If you are building a DApp, you can write your code once and it will work with any AA wallets, whether it's embedded wallets like ZeroDev or standalone wallets like Coinbase Smart Wallet. - -- If you are building a wallet, you can write your code once and it will work with any AA accounts, whether it's ZeroDev (Kernel) or another smart account. - -**TLDR: capabilities standardize smart wallet features and thereby improve interoperability between smart wallets, reducing vendor lock-in for developers.** - -In this tutorial, we will guide you through setting up a ZeroDev embedded wallet in your DApp, and communicate with it through the standard capability API using Viem/Wagmi. - -## Code Example - -Use [this example repo](https://github.com/zerodevapp/capabilities-examples/tree/main/quick-start) as a reference as you go through this tutorial. - -## Create an embedded Passkey Wallet - -ZeroDev has created a number of Wagmi connectors that speak the capabilities API. In this tutorial, we will use the [passkey](/sdk/advanced/passkeys) connector. You can find [other connectors here](/smart-wallet/creating-wallets). - -## 1. Create a Wagmi project with Next.js: - -In this tutorial, we will be using [Next.js](https://nextjs.org/docs/getting-started/installation). Start by creating a Next.js project: - -```bash -npx create-next-app@latest -``` - -## 2. Install ZeroDev and dependencies - -Install `@zerodev/wallet` and its dependencies: - -:::code-group - -```bash [npm] -npm install @zerodev/wallet viem@latest wagmi @tanstack/react-query -``` - -```bash [pnpm] -pnpm add @zerodev/wallet viem@latest wagmi @tanstack/react-query -``` - -```bash [yarn] -yarn add @zerodev/wallet viem@latest wagmi @tanstack/react-query -``` - -```bash [bun] -bun add @zerodev/wallet viem@latest wagmi @tanstack/react-query -``` - -::: - -## 3. Setup a ZeroDev connector - -For this tutorial, we will let the user create smart wallets with [passkeys](https://docs.zerodev.app/smart-wallet/creating-wallets). - -Create a Wagmi provider and set it up with ZeroDev's passkey connector. You will need to [create a project ID from the dashboard](/smart-wallet/setting-up-zerodev-projects), and make sure you are using the right `chain` object corresponding to your ZeroDev project. - -:::code-group - -```tsx [config.ts] -import { passkeyConnector } from '@zerodev/wallet' -import { sepolia } from 'viem/chains'; -import { http, createConfig } from 'wagmi' - -const PROJECT_ID = '98fd43a8-fb2f-4948-a7ae-069f53969f73' - -export const config = createConfig({ - chains: [sepolia], - connectors: [ - passkeyConnector(PROJECT_ID, sepolia, "v3", "zerodev_quickstart") - ], - transports: { - [sepolia.id]: http(), - }, -}) -``` - -```tsx [Providers.tsx] -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { WagmiProvider } from 'wagmi' -import { config } from './config.ts' - -function Providers({ children }: { children: React.ReactNode}) { - const queryClient = new QueryClient() - - return ( - - - {children} - - - ) -} -``` -::: - -Then, create a button for creating the wallet: - -```tsx filename=page.tsx // [page.tsx] -import { useConnect, useConnectors } from 'wagmi' - -function App() { - const connectors = useConnectors(); - const { connect, isPending } = useConnect(); - - return ( - - ) -} -``` - -## 4. Send sponsored & batched transactions - -Now let's try using two capabilities together: gas sponsorship and batching. We will send a batch of two transactions, and sponsor gas for them: - -```tsx filename=page.tsx // [page.tsx] -import { parseAbi } from 'viem' -import { useAccount } from 'wagmi' -import { useWriteContracts } from 'wagmi/experimental'; - -const PROJECT_ID = '98fd43a8-fb2f-4948-a7ae-069f53969f73' -const tokenAddress = "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" -const abi = parseAbi(["function mint(address _to, uint256 amount) public"]) -const paymasterUrl = `https://rpc.zerodev.app/api/v2/paymaster/${PROJECT_ID}` - -function App() { - const { address } = useAccount() - const { data, writeContracts, isPending } = useWriteContracts(); - - return ( - /* ...Create & Get Smart Account */ -
- - {data &&

{`UserOp Hash: ${data}`}

} -
- ) -} -``` - -## Next Steps - -Congrats -- you just sent your first gasless transaction with ZeroDev, through the standard capability API! - -In this example, you used a public ZeroDev API key. Now learn how to [set up your own ZeroDev project](/smart-wallet/setting-up-zerodev-projects). Then browse the ZeroDev features using the sidebar and see what you'd like to use! diff --git a/docs/pages/smart-wallet/quickstart-core.mdx b/docs/pages/smart-wallet/quickstart-core.mdx deleted file mode 100644 index 2fa3c3ab..00000000 --- a/docs/pages/smart-wallet/quickstart-core.mdx +++ /dev/null @@ -1,151 +0,0 @@ -# Quickstart -- Core SDK - -ZeroDev has two main packages: `@zerodev/waas` which is designed for React projects, and `@zerodev/sdk` which is our core SDK that can be used in any JavaScript environment. - -In this tutorial, we will walk you through using the core SDK. If you are building a React project, we recommend [getting started with the React SDK](/smart-wallet/quickstart-react). - -## Getting Started - -Create a new project with `npm` (or whatever package manager you use): - -```bash -mkdir zerodev -cd zerodev -npm init -y -``` - -Install the ZeroDev SDK and presets: - -```bash -npm i @zerodev/sdk @zerodev/ecdsa-validator -``` - -Install dev packages for TypeScript: - -```bash -npm i --save-dev @types/node tslib -``` - -Create the following `tsconfig.json` (TypeScript config): - -```json -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "declaration": true, - "outDir": "./lib", - "strict": true, - "esModuleInterop": true - }, - "include": ["./**/*.ts"] -} -``` - -Create a script `index.ts` with the following code: - -```ts -import { createKernelAccount, createKernelAccountClient, createZeroDevPaymasterClient } from "@zerodev/sdk" -import { KERNEL_V3_1, getEntryPoint } from "@zerodev/sdk/constants" -import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator" -import { http, createPublicClient, zeroAddress } from "viem" -import { generatePrivateKey, privateKeyToAccount } from "viem/accounts" -import { sepolia } from "viem/chains" - -const PROJECT_ID = '98fd43a8-fb2f-4948-a7ae-069f53969f73' -const BUNDLER_RPC = `https://rpc.zerodev.app/api/v2/bundler/${PROJECT_ID}` -const PAYMASTER_RPC = `https://rpc.zerodev.app/api/v2/paymaster/${PROJECT_ID}` - -const chain = sepolia -const entryPoint = getEntryPoint("0.7") -const kernelVersion = KERNEL_V3_1 - -const main = async () => { - // Construct a signer - const privateKey = generatePrivateKey() - const signer = privateKeyToAccount(privateKey) - - // Construct a public client - const publicClient = createPublicClient({ - // Use your own RPC provider (e.g. Infura/Alchemy). - transport: http(RPC_URL), - chain, - }) - - // Construct a validator - const ecdsaValidator = await signerToEcdsaValidator(publicClient, { - signer, - entryPoint, - kernelVersion - }) - - // Construct a Kernel account - const account = await createKernelAccount(publicClient, { - plugins: { - sudo: ecdsaValidator, - }, - entryPoint, - kernelVersion - }) - - // Construct a Kernel account client - const kernelClient = createKernelAccountClient({ - account, - chain, - bundlerTransport: http(BUNDLER_RPC), - paymaster: { - getPaymasterData: (userOperation) => { - const zerodevPaymaster = createZeroDevPaymasterClient({ - chain, - transport: http(PAYMASTER_RPC), - }) - return zerodevPaymaster.sponsorUserOperation({ - userOperation, - }) - }, - }, - }) - - const accountAddress = kernelClient.account.address - console.log("My account:", accountAddress) - - // Send a UserOp - const userOpHash = await kernelClient.sendUserOperation({ - callData: await kernelClient.account.encodeCalls([{ - to: zeroAddress, - value: BigInt(0), - data: "0x", - }]), - }) - - console.log("UserOp hash:", userOpHash) - console.log("Waiting for UserOp to complete...") - - await kernelClient.waitForUserOperationReceipt({ - hash: userOpHash, - }) - - console.log("View completed UserOp here: https://jiffyscan.xyz/userOpHash/" + userOpHash) -} - -main() -``` - -Run it: - -```bash -npx ts-node index.ts -``` - -You should see an output like this: - -```txt -My account: 0xaf731E22Fe96979C5D864B07bad0EB999cDBbE76 -UserOp hash: 0x7a8e0ba961cc0a34f745b81d64766f033269fee831104fee0269fa5bcc397dcb -Waiting for UserOp to complete... -View completed UserOp here: https://jiffyscan.xyz/userOpHash/0x7a8e0ba961cc0a34f745b81d64766f033269fee831104fee0269fa5bcc397dcb -``` - -Congrats -- you just sent your first gasless transaction with ZeroDev! - -In this example, you used a public ZeroDev API key. Now learn [how to set up your own ZeroDev project](/smart-wallet/setting-up-zerodev-projects). \ No newline at end of file diff --git a/docs/pages/smart-wallet/quickstart-react.mdx b/docs/pages/smart-wallet/quickstart-react.mdx deleted file mode 100644 index a0955709..00000000 --- a/docs/pages/smart-wallet/quickstart-react.mdx +++ /dev/null @@ -1,172 +0,0 @@ -# Quickstart -- React - -:::info -Check out the [complete quickstart code here](https://github.com/zerodevapp/waas-examples/tree/main/quick-start). -::: - -ZeroDev has two main packages: `@zerodev/waas` which is designed for React projects, and `@zerodev/sdk` which is our core SDK that can be used in any JavaScript environment. - -If you are building a React project, we recommend starting with `@zerodev/waas`, which is what we will walk you through in this tutorial. You can always ["dropping down" to the core SDK](#interop-with-the-core-sdk) when necessary. - -## 0. Clone the code - -Since React has a lot of boilerplate, we will only focus on the ZeroDev-specific code. We recommend cloning the [complete quickstart code](https://github.com/zerodevapp/waas-examples/tree/main/quick-start) and refer to it if you get lost as you follow along this tutorial. - -## 1. Create a Next.js project - -In this tutorial, we will be using [Next.js](https://nextjs.org/docs/getting-started/installation). Start by creating a Next.js project: - -```bash -npx create-next-app@latest -``` - -## 2. Install ZeroDev and dependencies - -Install `@zerodev/waas` and its dependencies: - -:::code-group - -```bash [npm] -npm install @zerodev/waas viem@2.x @tanstack/react-query -``` - -```bash [pnpm] -pnpm add @zerodev/waas viem@2.x @tanstack/react-query -``` - -```bash [yarn] -yarn add @zerodev/waas viem@2.x @tanstack/react-query -``` - -```bash [bun] -bun add @zerodev/waas viem@2.x @tanstack/react-query -``` - -::: - -## 3. Setup context provider - -Create a provider in typical React style. You will need to [create a project ID from the dashboard](/smart-wallet/setting-up-zerodev-projects), and make sure you are using the right `chain` object corresponding to your ZeroDev project. - -```ts filename=Providers.tsx // [Providers.tsx] -import { http } from "viem" -import { sepolia } from "viem/chains" -import { ZeroDevProvider, createConfig } from "@zerodev/waas" - -function Providers({ children }: { children: React.ReactNode}) { - const PROJECT_ID = '98fd43a8-fb2f-4948-a7ae-069f53969f73' - - const config = createConfig({ - chains: [sepolia], - transports: { - [sepolia.id]: http() - }, - projectIds: { - [sepolia.id]: PROJECT_ID - } - }) - - return ( - // [!code focus] - {children} - // [!code focus] - ) -} -``` - -## 4. Use ZeroDev waas - -### Create a Smart Account - -Let's start by creating an account: - -```tsx filename=page.tsx // [page.tsx] -import { useCreateKernelClientPasskey } from "@zerodev/waas" - -function App() { - const { connectRegister, isPending } = useCreateKernelClientPasskey({ version: "v3" }); - - return ( - - ) -} -``` - -### Get the Smart Account Address - -Now you can get the account address as such: - -```tsx filename=page.tsx // [page.tsx] -import { useKernelClient } from "@zerodev/waas" - -function App() { - const { address } = useKernelClient() - - return ( - /* ...Create Smart Account */ -

{`Smart Account Address: ${address}`}

- ) -} -``` - -### Send Sponsored User Operation - -And here's how you send transactions: - -```tsx filename=page.tsx // [page.tsx] -import { parseAbi } from "viem" -import { useKernelClient, useSendUserOperation } from "@zerodev/waas" - -function App() { - const { address } = useKernelClient() - const { data: userOpHash, write, isPending } = useSendUserOperation({ - paymaster: { - type: "SPONSOR" - } - }) - const tokenAddress = "0x3870419Ba2BBf0127060bCB37f69A1b1C090992B" - const abi = parseAbi(["function mint(address _to, uint256 amount) public"]) - - return ( - /* ...Create & Get Smart Account */ -
- - {userOpHash &&

{`UserOp Hash: ${userOpHash}`}

} -
- ) -} -``` - -### Interop with the Core SDK - -If you ever want to use the Core SDK (perhaps because a feature is only supported in the core SDK but not through the React API), you can "drop down" to the SDK with [the `useKernelClient` hook](/react/use-kernelclient#usekernelclient). - -Similarly, if you have created a Kernel client object with the core SDK, you can "embed" it inside the React SDK using [the `useSetKernelClient` hook](https://docs.zerodev.app/react/use-set-kernelclient). - -## Next Steps - -Congrats -- you just sent your first gasless transaction with ZeroDev! - -In this example, you used a public ZeroDev API key. Now learn [how to set up your own ZeroDev project](/smart-wallet/setting-up-zerodev-projects). diff --git a/docs/pages/smart-wallet/sending-transactions.mdx b/docs/pages/smart-wallet/sending-transactions.mdx deleted file mode 100644 index 5056aab1..00000000 --- a/docs/pages/smart-wallet/sending-transactions.mdx +++ /dev/null @@ -1,198 +0,0 @@ -# Sending Transactions - -In ERC-4337, a transaction is known as a "UserOp." A UserOp looks mostly like a regular transaction, but it contains some extra information specific to AA, such as whether the UserOp should be sponsored. - -There are two ways to send UserOps: - -- Sending raw UserOps -- Sending regular transactions through the Viem API, which ZeroDev then "translates" into UserOps - -The former enables the highest degree of flexibility, whereas the latter is more interoperable with existing libraries like Viem that deal only with transactions and not UserOps. - -We will now describe both approaches. We assume that you have already [created a Kernel account](/sdk/core-api/create-account). - -## React API - -Use the `useSendUserOperation` hook: - -```tsx -import { useSendUserOperation, useKernelClient } from '@zerodev/waas' -import { parseAbi } from 'viem' - -function App() { - const { write } = useSendUserOperation() - const { address } = useKernelClient() - const abi = parseAbi(['function mint(address _to) public']) - - return ( - - ) -} -``` - -The argument to `write` is an array of UserOps. The format of each UserOp is the same as the argument to Wagmi's [`writeContract`](https://wagmi.sh/core/api/actions/writeContract#writecontract). - -If you pass more than one UserOps, you'd be sending them all in a [batch](/smart-wallet/batching-transactions). - -## Core API - -:::info -Impatient? Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/tree/main/send-transactions). -::: - -### UserOp API - -Sending raw UserOps affords you with the highest degree of control. To send a raw UserOp, use `sendUserOperation`: - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - callData: "0x..." -}) -``` - -While `callData` is the only required field, there are many other fields that you can read about on the [ERC-4337 spec](https://github.com/eth-infinitism/account-abstraction/blob/develop/erc/ERCS/erc-4337.md): - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - sender: "0x0C123D90Da0a640fFE54a2359D159629065775C5", - nonce: 3n, - initCode: "0x", - callData: "0x18dfb3c7000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000d2f598c826429eee7c071c02735549acd88f2c09000000000000000000000000d2f598c826429eee7c071c02735549acd88f2c090000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000043a4eacb7839f202d9cab465dbdd77d4fabe0a1800000000000000000000000000000000000000000000000003782dace9d90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044a9059cbb000000000000000000000000982e148216e3aa6b38f9d901ef578b5c06dd750200000000000000000000000000000000000000000000000005d423c655aa000000000000000000000000000000000000000000000000000000000000", - callGasLimit: 50305n, - verificationGasLimit: 80565n, - preVerificationGas: 56135n, - maxFeePerGas: 113000000n, - maxPriorityFeePerGas: 113000100n, - paymasterAndData: "0xe93eca6595fe94091dc1af46aac2a8b5d79907700000000000000000000000000000000000000000000000000000000065133b6f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d3d07ae8973ba1b8a26d0d72d8882dfa97622942a63c4b655f4928385ce587f6aa2fa1ab347e615d5f39e1214d18f426375da8a01514fb126eb0bb29f0c319d1b", - signature: "0xf1513a8537a079a4d728bb87099b2c901e2c9034e60c95a4d41ac1ed75d6ee90270d52b48af30aa036e9a205ea008e1c62b317e7b3f88b3f302d45fb1ba76a191b" -}) -``` - -Other than `callData`, every field has a sensible default: - -- `sender` defaults to the Kernel account address -- `nonce` defaults to the next available nonce -- `initCode` defaults to `0x` if the account has been deployed, or the correct `initCode` if not. -- `callGasLimit`, `verificationGasLimit`, and `preVerificationGas` default to estimations provided by the underlying bundler and paymaster. -- `maxFeePerGas` and `maxPriorityFeePerGas` default to estimations provided by the public client. -- `paymasterAndData` defaults to `0x` if no paymaster was specified when you created the Kernel account object, or it will use the value provided by the paymaster. -- `signature` defaults to the signature provided by the signer. - -### Encoding callData - -To encode the calldata, use the `encodeCalls` function from the account object: - -```typescript -const userOpHash = await kernelClient.sendUserOperation({ - callData: kernelClient.account.encodeCalls([{ - to, - value, - data, - }]), -}) -``` - -You can use Viem's helper functions such as `encodeFunctionData` to encode function calls. For example: - -```ts -const userOpHash = await kernelClient.sendUserOperation({ - callData: await kernelClient.account.encodeCalls([{ - to: contractAddress, - value: BigInt(0), - data: encodeFunctionData({ - abi: contractABI, - functionName: "functionName", - args: [args1, args2], - }), - }]), -}) -``` - -### Waiting for a UserOp to complete - -To wait for a UserOp to complete, call `waitForUserOperationReceipt` using a kernel client: - -```typescript -const receipt = await kernelClient.waitForUserOperationReceipt({ - hash: userOpHash, -}) -``` - -### Constructing a UserOp for sending later - -In some applications, you might want to construct a UserOp but not immediately send it. There are two possible flows: - -- If you want to separate signing and sending: - - Create and sign a UserOp with `kernelClient.signUserOperation()` - - Send the UserOp with `kernelClient.sendUserOperation()` - -- If you want to separate the constructing, signing, and sending: - - Create an unsigned UserOp with `kernelClient.prepareUserOperation()` - - Sign the UserOp with `kernelClient.account.signUserOperation()` and manually set the `userOp.signature` field - - Send the UserOp with `kernelClient.sendUserOperation()` - -## Viem API - -Since the Kernel account client implements [Viem's wallet client interface](https://viem.sh/docs/clients/wallet.html), you can send UserOps with standard Viem methods. - -### Sending Transactions - -```typescript -const txnHash = await kernelClient.sendTransaction({ - to: "TO_ADDRESS", - value: VALUE, // default to 0 - data: "0xDATA", // default to 0x -}) -``` - -This function returns the transaction hash of the ERC-4337 bundle that contains the UserOp. Due to the way that ERC-4337 works, by the time we get the transaction hash, the ERC-4337 bundle (and therefore the UserOps includeded within) will have already been mined, meaning that you don't have to [wait with the hash](https://viem.sh/docs/actions/public/waitForTransactionReceipt.html). - -If you need to separate the sending from the waiting of the UserOp, try [sending raw UserOps](#sending-raw-userops). - -### Interacting with Contracts - -First, construct a [Viem contract instance](https://viem.sh/docs/contract/getContract.html) by passing the Kernel account client as the `walletClient`: - -```typescript -import { getContract } from 'viem' - -const contract = getContract({ - address: '0xADDRESS', - abi: abi, - publicClient: publicClient, - walletClient: kernelClient, -}) -``` - -Then, interact with the contract like how you normally would: - -```typescript -// Example code from Viem - -const balance = await contract.read.balanceOf([ - '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC', -]) -const hash = await contract.write.mint([69420]) -const logs = await contract.getEvents.Transfer() -const unwatch = contract.watchEvent.Transfer( - { - from: '0xd8da6bf26964af9d7eed9e03e53415d37aa96045', - to: '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac' - }, - { onLogs: logs => console.log(logs) } -) -``` diff --git a/docs/pages/smart-wallet/setting-up-zerodev-projects.mdx b/docs/pages/smart-wallet/setting-up-zerodev-projects.mdx deleted file mode 100644 index e624991c..00000000 --- a/docs/pages/smart-wallet/setting-up-zerodev-projects.mdx +++ /dev/null @@ -1,34 +0,0 @@ -# Setting up a ZeroDev Project - -ZeroDev provides the necessary [infrastructure](/meta-infra/intro) to power your smart accounts. To start using ZeroDev, you need to create a *project*. - -## Creating a Project - -Sign up at the [ZeroDev dashboard](https://dashboard.zerodev.app/), then create a project for your target network. - -

- -

- -You will then see your "Project Home" with a number of configs. - -

- -

- -These configs give you access to ZeroDev infra. When you [create wallets](/smart-wallet/creating-wallets), you will be using these values with the SDK. - -## Setting up Billing - -You can use ZeroDev for free on testnets. - -If you want to use ZeroDev on a mainnet, you must sign up for a billing plan. You can [see the billing plans here](https://dashboard.zerodev.app/billing). - -## Next Steps - -If you haven't already, check out these tutorials according to your needs: - -- [React SDK](/smart-wallet/quickstart-react) -- [Core SDK](/smart-wallet/quickstart-core) - -Otherwise, start looking into specific features you need, such as [creating wallets](/smart-wallet/creating-wallets). \ No newline at end of file diff --git a/docs/pages/smart-wallet/sponsoring-gas.mdx b/docs/pages/smart-wallet/sponsoring-gas.mdx deleted file mode 100644 index 96aa309b..00000000 --- a/docs/pages/smart-wallet/sponsoring-gas.mdx +++ /dev/null @@ -1,72 +0,0 @@ -# Sponsoring Gas - -You can sponsor gas for your users so they don't have to acquire gas tokens (e.g. ETH) before using your app. - -## How to pay for gas - -When you sponsor gas through ZeroDev, we "front" the gas for you, and then charge your credit card at the end of your billing cycle. If you prefer to pay upfront, you can also purchase gas credits from us. - -## Set up gas policies - -To start sponsoring gas, you need to set up "gas policies." Gas policies are security measures to ensure that you don't overspend on gas. - -You can set up gas policies on the ZeroDev dashboard or through the admin API. [Read this document to learn how to set up gas policies.](/meta-infra/gas-policies) - -## Capabilities API - -Thanks to [the new capabilities standard](/smart-wallet/quickstart-capabilities), you can use ZeroDev paymasters to sponsor gas for any smart wallets, and use any paymaster to sponsor gas for ZeroDev smart wallets. - -In this tutorial, we will be using the ZeroDev paymaster. Make sure you have [set up gas policies](#set-up-gas-policies). Then copy the paymaster URL from [your dashboard](https://dashboard.zerodev.app/). - -Now, you can send sponsored transactions using the `wallet_sendCalls` API with the `paymasterService` capability. We will be using [Wagmi](https://wagmi.sh/react/api/hooks/useSendCalls) here but you can find the same API in [Viem](https://viem.sh/experimental/eip5792/sendCalls): - -## React API - -Set the `paymaster` param when fetching the `kernelClient` through `useKernelClient`: - -```ts -import { useKernelClient } from "@zerodev/waas" - -function App() { - const { kernelClient } = useKernelClient({ - paymaster: { - type: "SPONSOR" - } - }) -} -``` - -## Core API - -:::info -Check out [a complete example here](https://github.com/zerodevapp/zerodev-examples/blob/main/create-account/main.ts). -::: - -When [creating an account](/smart-wallet/creating-wallets), you can specify a `sponsorUserOperation` function when you create the account client. - -The `sponsorUserOperation` function essentially takes a UserOp and then returns a UserOp with the `paymasterAndData` field set. You can use the `createZeroDevPaymasterClient` helper function: - -```typescript -import { http } from "viem" -import { createZeroDevPaymasterClient, createKernelAccountClient } from "@zerodev/sdk" -import { getEntryPoint } from "@zerodev/sdk/constants" - -const entryPoint = getEntryPoint("0.7") - -const kernelClient = createKernelAccountClient({ - // other options... - - paymaster: { - getPaymasterData: (userOperation) => { - const zerodevPaymaster = createZeroDevPaymasterClient({ - chain, - // Get this RPC from ZeroDev dashboard - transport: http(PAYMASTER_RPC), - }) - return zerodevPaymaster.sponsorUserOperation({ - userOperation, - }) - } - } -}) -``` diff --git a/docs/pages/smart-wallet/transaction-automation.md b/docs/pages/smart-wallet/transaction-automation.md deleted file mode 100644 index 2a87f650..00000000 --- a/docs/pages/smart-wallet/transaction-automation.md +++ /dev/null @@ -1,17 +0,0 @@ -# Transaction Automation - -With smart accounts, you can automate transactions for your users. Some example use cases are: - -- Subscriptions. -- Trading bots. -- Automatic order execution, e.g. limit orders & trailing orders. - -In general, any time you wish to execute a transaction for your user, you can use transaction automation. - -## How Transaction Automation Works - -Thanks to smart accounts, transaction automation is *safe* with ZeroDev. Your users delegate to you a specific set of [*permissions*](https://docs.zerodev.app/smart-wallet/permissions/intro) through [session keys](https://docs.zerodev.app/blog/session-keys-are-the-jwts-of-web3), so even if your server is hacked, your users's assets will be safe. - -## Getting Started - -[Follow this tutorial to get started with transaction automation.](/smart-wallet/permissions/transaction-automation) diff --git a/docs/pages/smart-wallet/wallet-connect.md b/docs/pages/smart-wallet/wallet-connect.md deleted file mode 100644 index 42abd0c8..00000000 --- a/docs/pages/smart-wallet/wallet-connect.md +++ /dev/null @@ -1,11 +0,0 @@ -# Connecting Wallet with Other DApps - -If you want your users to be able to use your embedded wallet on other DApps, you can use our WalletConnect integration. - -## React SDK `@zerodev/waas` - -If you are using our `@zerodev/waas` React SDK to build your DApp, you can use the `useWalletConnect` hook to connect your wallet to other DApps. [Read the docs for `useWalletConnect` to learn more.](/react/use-wallet-connect) - -## Core SDK `@zerodev/walletconnect` - -If you are not using our React SDK, you can use the `@zerodev/walletconnect` Core SDK to integrate WalletConnect functionality with your DApp. This SDK provides a comprehensive interface for integrating WalletConnect functionality with a kernel provider, allowing for session management, request handling, and interaction with blockchain networks. [Read the docs for `@zerodev/walletconnect` to learn more.](/sdk/advanced/wallet-connect) \ No newline at end of file diff --git a/docs/pages/smart-wallet/which-sdk.mdx b/docs/pages/smart-wallet/which-sdk.mdx deleted file mode 100644 index 25af7232..00000000 --- a/docs/pages/smart-wallet/which-sdk.mdx +++ /dev/null @@ -1,31 +0,0 @@ -# Which SDK should I use? - -ZeroDev currently offers three SDKs for different use cases: - -- `@zerodev/wallet` packages the ZeroDev smart wallet into [Wagmi connectors](https://wagmi.sh/react/api/connectors) and [EIP-1193 providers](https://eips.ethereum.org/EIPS/eip-1193), so you can easily plug ZeroDev into any application as an embedded wallet. - -- `@zerodev/core` implements the core logic of the ZeroDev smart embedded wallet (powered by [Kernel](https://github.com/zerodevapp/kernel)). This library has the most complete functionality and offers the most low-level and fine-grained control. - -- `@zerodev/waas` is a React SDK built on top of `@zerodev/core`. It can be viewed as the equivalent of Wagmi but for smart wallets. - -To decide which SDK to use, first decide what you are building: - -## Are you building a wallet or a DApp? - -The line between a wallet and a DApp can be a bit blurry in Web3. For the purpose of this discussion, we define wallets and DApps as follows: - -- Wallets: you want your users to use your app as their primary wallet, as opposed to bringing wallets to your app. - -- DApps: you want your users to bring wallets to your app, or spin up a wallet for them if they don't have one. - -## If you are building a DApp - -If you are building a DApp, we recommend that you use `@zerodev/wallet` to spin up a smart embedded wallet for users who don't bring their own smart wallet (which are most users today). - -Then, you can program your DApp with Viem/Wagmi as usual, while using smart wallet features (e.g. gas sponsoring) through [the capabilities API](/smart-wallet/quickstart-capabilities). - -## If you are building a wallet - -[Use `@zerodev/core`](/smart-wallet/quickstart-core) if you want all the ZeroDev features and the most fine-grained control. - -[Use `@zerodev/waas`](/smart-wallet/quickstart-react) if you are building the wallet using React. \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 514b74cf..179f9e22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -340,6 +340,7 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", + "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/vocs.config.tsx b/vocs.config.tsx index d0e4eaab..ccd67cbc 100644 --- a/vocs.config.tsx +++ b/vocs.config.tsx @@ -3,6 +3,276 @@ import dotenv from "dotenv"; dotenv.config(); +// Map of legacy URL paths to their new homes. +// Used by the Vite middleware below for dev redirects, and exported so +// production hosting (Vercel/Netlify/etc.) can pick them up at deploy time. +const REDIRECTS: Record = { + // Get Started + "/sdk/getting-started/quickstart": "/get-started/quickstart", + "/sdk/getting-started/tutorial": "/get-started/quickstart", + "/sdk/getting-started/tutorial-passkeys": + "/smart-accounts/use-plugins/passkeys/tutorial", + "/sdk/getting-started/quickstart-7702": + "/smart-accounts/eip-7702/quickstart", + "/sdk/getting-started/quickstart-agentkit": + "/smart-accounts/permissions/agentkit", + "/sdk/getting-started/migration": "/advanced/migration", + + // Core API β†’ Smart Accounts (build) + Advanced + Resources/Tools + "/sdk/core-api/create-account": "/smart-accounts/create-a-smart-account", + "/sdk/core-api/using-plugins": "/smart-accounts/use-plugins/overview", + "/sdk/core-api/send-transactions": "/smart-accounts/send-transactions", + "/sdk/core-api/batch-transactions": "/smart-accounts/batch-transactions", + "/sdk/core-api/sponsor-gas": "/smart-accounts/sponsor-gas/evm", + "/sdk/core-api/pay-gas-with-erc20s": "/smart-accounts/pay-gas-with-erc20s", + "/sdk/core-api/sign-and-verify": "/smart-accounts/sign-and-verify", + "/sdk/core-api/deploy-contract": "/advanced/deploy-contract", + "/sdk/core-api/delegatecall": "/advanced/delegatecall", + "/sdk/core-api/status": "/resources/tools/status", + "/sdk/core-api/debugger": "/resources/tools/debugger", + + // Advanced β†’ split between Smart Accounts, Cross-Chain, and Advanced + "/sdk/advanced/chain-abstraction": "/cross-chain/chain-abstraction/overview", + "/sdk/advanced/passkeys": "/smart-accounts/use-plugins/passkeys/overview", + "/sdk/advanced/multisig": "/smart-accounts/use-plugins/multisig", + "/sdk/advanced/social-login": "/smart-accounts/authentication/social-login", + "/sdk/advanced/session-keys": "/smart-accounts/permissions/session-keys", + "/sdk/advanced/recovery": "/smart-accounts/account-recovery/sdk-recovery", + "/sdk/advanced/multi-chain-signing": "/advanced/multi-chain-signing", + "/sdk/advanced/key-storage": "/advanced/key-storage", + "/sdk/advanced/defi": "/advanced/defi", + "/sdk/advanced/parallel-orders": "/advanced/parallel-transactions", + "/sdk/advanced/wallet-connect": "/advanced/wallet-connect", + "/sdk/advanced/fallback-providers": "/advanced/fallback-providers", + "/sdk/advanced/run-solidity-code-on-init": + "/advanced/track-deployed-accounts", + "/sdk/advanced/upgrade-kernel": "/advanced/upgrade-kernel", + "/sdk/advanced/go-sdk": "/advanced/go-sdk", + "/sdk/advanced/userop-builder-api": "/advanced/userop-builder-api", + "/sdk/advanced/supported-base-tokens": + "/cross-chain/chain-abstraction/supported-base-tokens", + "/sdk/advanced/supported-defi-tokens": + "/cross-chain/chain-abstraction/supported-defi-tokens", + + // Permissions (preserved structure) + "/sdk/permissions/intro": "/smart-accounts/permissions/intro", + "/sdk/permissions/transaction-automation": + "/smart-accounts/permissions/transaction-automation", + "/sdk/permissions/install-with-init-config": + "/smart-accounts/permissions/install-with-init-config", + "/sdk/permissions/1-click-trading": + "/smart-accounts/permissions/1-click-trading", + "/sdk/permissions/signers/ecdsa": + "/smart-accounts/permissions/signers/ecdsa", + "/sdk/permissions/signers/passkeys": + "/smart-accounts/permissions/signers/passkeys", + "/sdk/permissions/signers/multisig": + "/smart-accounts/permissions/signers/multisig", + "/sdk/permissions/signers/build-your-own": + "/smart-accounts/permissions/signers/build-your-own", + "/sdk/permissions/policies/sudo": + "/smart-accounts/permissions/policies/sudo", + "/sdk/permissions/policies/call": + "/smart-accounts/permissions/policies/call", + "/sdk/permissions/policies/gas": "/smart-accounts/permissions/policies/gas", + "/sdk/permissions/policies/signature": + "/smart-accounts/permissions/policies/signature", + "/sdk/permissions/policies/rate-limit": + "/smart-accounts/permissions/policies/rate-limit", + "/sdk/permissions/policies/timestamp": + "/smart-accounts/permissions/policies/timestamp", + "/sdk/permissions/policies/build-your-own": + "/smart-accounts/permissions/policies/build-your-own", + "/sdk/permissions/actions/build-your-own": + "/smart-accounts/permissions/actions/build-your-own", + + // Signers (auth providers + intro) + "/sdk/signers/intro": "/smart-accounts/use-plugins/signers-intro", + "/sdk/signers/dynamic": "/smart-accounts/authentication/dynamic", + "/sdk/signers/privy": "/smart-accounts/authentication/privy", + "/sdk/signers/magic": "/smart-accounts/authentication/magic", + "/sdk/signers/web3auth": "/smart-accounts/authentication/web3auth", + "/sdk/signers/smart-wallet": "/smart-accounts/authentication/smart-wallet", + "/sdk/signers/portal": "/smart-accounts/authentication/portal", + "/sdk/signers/turnkey": "/smart-accounts/authentication/turnkey", + "/sdk/signers/fireblocks": "/smart-accounts/authentication/fireblocks", + "/sdk/signers/capsule": "/smart-accounts/authentication/capsule", + "/sdk/signers/lit-protocol": "/smart-accounts/authentication/lit-protocol", + "/sdk/signers/particle": "/smart-accounts/authentication/particle", + "/sdk/signers/dfns": "/smart-accounts/authentication/dfns", + "/sdk/signers/arcana": "/smart-accounts/authentication/arcana", + "/sdk/signers/eoa": "/smart-accounts/authentication/eoa", + "/sdk/signers/custom-signer": + "/smart-accounts/authentication/custom-signer", + + // Solana + "/sdk/solana/sponsor-gas": "/smart-accounts/sponsor-gas/solana", + + // Infra (formerly orphan in main sidebar) + "/sdk/infra/intro": "/resources/infrastructure/choose-an-infra-provider", + "/sdk/infra/zerodev": "/resources/infrastructure/zerodev", + "/sdk/infra/pimlico": "/resources/infrastructure/pimlico", + "/sdk/infra/coinbase": "/resources/infrastructure/coinbase", + + // Presets (formerly orphan) + "/sdk/presets/intro": "/resources/presets/intro", + "/sdk/presets/zerodev": "/resources/presets/zerodev", + + // FAQs + "/sdk/faqs/chains": "/resources/faqs/chains", + "/sdk/faqs/audits": "/resources/faqs/audits", + "/sdk/faqs/debug-userop": "/resources/faqs/debug-userop", + "/sdk/faqs/use-with-ethers": "/resources/faqs/use-with-ethers", + "/sdk/faqs/use-with-gelato": "/resources/faqs/use-with-gelato", + "/sdk/faqs/use-with-react-native": "/resources/faqs/use-with-react-native", + + // Meta-infra β†’ Resources β€Ί Infrastructure + "/meta-infra/intro": "/resources/infrastructure/intro", + "/meta-infra/gas-policies": "/resources/infrastructure/gas-policies", + "/meta-infra/custom-gas-policies": + "/resources/infrastructure/custom-gas-policies", + "/meta-infra/rpcs": "/resources/infrastructure/rpcs", + "/meta-infra/api": "/resources/infrastructure/api", + + // Recovery flow β†’ Smart Accounts β€Ί Account Recovery + "/recovery-flow/intro": "/smart-accounts/account-recovery/flow-intro", + "/recovery-flow/setup": "/smart-accounts/account-recovery/flow-setup", + "/recovery-flow/portal": "/smart-accounts/account-recovery/portal", + + // Smart Routing Address (and global-address duplicate) + "/smart-routing-address": "/cross-chain/smart-routing-address", + "/global-address": "/cross-chain/smart-routing-address", + + // Embedded Wallet (formerly /wallets) + "/wallets": "/smart-accounts/embedded-wallet", + "/wallets/quickstart": "/smart-accounts/embedded-wallet/quickstart", + "/wallets/export": "/smart-accounts/embedded-wallet/export", + "/wallets/session-management": + "/smart-accounts/embedded-wallet/session-management", + "/wallets/auth/passkeys": "/smart-accounts/embedded-wallet/auth/passkeys", + "/wallets/auth/email-otp": "/smart-accounts/embedded-wallet/auth/email-otp", + "/wallets/auth/magic-link": + "/smart-accounts/embedded-wallet/auth/magic-link", + "/wallets/auth/google-oauth": + "/smart-accounts/embedded-wallet/auth/google-oauth", + "/wallets/wallet-api/send-transaction": + "/smart-accounts/embedded-wallet/wallet-api/send-transaction", + "/wallets/wallet-api/sign-message": + "/smart-accounts/embedded-wallet/wallet-api/sign-message", + "/wallets/wallet-api/sign-typed-message": + "/smart-accounts/embedded-wallet/wallet-api/sign-typed-message", + "/wallets/hooks/use-register-passkey": + "/smart-accounts/embedded-wallet/hooks/use-register-passkey", + "/wallets/hooks/use-login-passkey": + "/smart-accounts/embedded-wallet/hooks/use-login-passkey", + "/wallets/hooks/use-authenticate-oauth": + "/smart-accounts/embedded-wallet/hooks/use-authenticate-oauth", + "/wallets/hooks/use-send-otp": + "/smart-accounts/embedded-wallet/hooks/use-send-otp", + "/wallets/hooks/use-verify-otp": + "/smart-accounts/embedded-wallet/hooks/use-verify-otp", + "/wallets/hooks/use-send-magic-link": + "/smart-accounts/embedded-wallet/hooks/use-send-magic-link", + "/wallets/hooks/use-verify-magic-link": + "/smart-accounts/embedded-wallet/hooks/use-verify-magic-link", + "/wallets/hooks/use-get-user-email": + "/smart-accounts/embedded-wallet/hooks/use-get-user-email", + "/wallets/hooks/use-refresh-session": + "/smart-accounts/embedded-wallet/hooks/use-refresh-session", + "/wallets/hooks/use-export-wallet": + "/smart-accounts/embedded-wallet/hooks/use-export-wallet", + "/wallets/hooks/use-export-private-key": + "/smart-accounts/embedded-wallet/hooks/use-export-private-key", + + // React WaaS hooks β†’ Advanced β€Ί React Hooks (legacy) + "/react/getting-started": "/advanced/react-hooks/getting-started", + "/react/use-balance": "/advanced/react-hooks/use-balance", + "/react/use-chainid": "/advanced/react-hooks/use-chainid", + "/react/use-chains": "/advanced/react-hooks/use-chains", + "/react/use-create-basic-session": + "/advanced/react-hooks/use-create-basic-session", + "/react/use-create-kernelclient-eoa": + "/advanced/react-hooks/use-create-kernelclient-eoa", + "/react/use-create-kernelclient-passkey": + "/advanced/react-hooks/use-create-kernelclient-passkey", + "/react/use-create-kernelclient-social": + "/advanced/react-hooks/use-create-kernelclient-social", + "/react/use-create-session": "/advanced/react-hooks/use-create-session", + "/react/use-disconnect-kernelclient": + "/advanced/react-hooks/use-disconnect-kernelclient", + "/react/use-kernelclient": "/advanced/react-hooks/use-kernelclient", + "/react/use-send-transaction": + "/advanced/react-hooks/use-send-transaction", + "/react/use-send-transaction-with-session": + "/advanced/react-hooks/use-send-transaction-with-session", + "/react/use-send-useroperation": + "/advanced/react-hooks/use-send-useroperation", + "/react/use-send-useroperation-with-session": + "/advanced/react-hooks/use-send-useroperation-with-session", + "/react/use-sessions": "/advanced/react-hooks/use-sessions", + "/react/use-session-kernelclient": + "/advanced/react-hooks/use-session-kernelclient", + "/react/use-set-kernelclient": + "/advanced/react-hooks/use-set-kernelclient", + "/react/use-switch-chain": "/advanced/react-hooks/use-switch-chain", + "/react/use-wallet-connect": "/advanced/react-hooks/use-wallet-connect", + + // Orphan /smart-wallet/* (deleted) β†’ canonical homes in the new tree + "/smart-wallet/which-sdk": "/smart-accounts/create-a-smart-account", + "/smart-wallet/quickstart-core": "/get-started/quickstart", + "/smart-wallet/quickstart-react": "/get-started/quickstart", + "/smart-wallet/quickstart-capabilities": "/get-started/quickstart", + "/smart-wallet/creating-wallets": "/smart-accounts/create-a-smart-account", + "/smart-wallet/setting-up-zerodev-projects": "/", + "/smart-wallet/sending-transactions": "/smart-accounts/send-transactions", + "/smart-wallet/batching-transactions": "/smart-accounts/batch-transactions", + "/smart-wallet/pay-gas-in-erc20s": "/smart-accounts/pay-gas-with-erc20s", + "/smart-wallet/sponsoring-gas": "/smart-accounts/sponsor-gas/evm", + "/smart-wallet/delegatecall": "/advanced/delegatecall", + "/smart-wallet/multisig": "/smart-accounts/use-plugins/multisig", + "/smart-wallet/account-recovery": + "/smart-accounts/account-recovery/sdk-recovery", + "/smart-wallet/importing-assets": "/smart-accounts/create-a-smart-account", + "/smart-wallet/defi-integrations": "/advanced/defi", + "/smart-wallet/one-click-trading": + "/smart-accounts/permissions/transaction-automation", + "/smart-wallet/parallel-transactions": "/advanced/parallel-transactions", + "/smart-wallet/transaction-automation": + "/smart-accounts/permissions/transaction-automation", + "/smart-wallet/wallet-connect": "/advanced/wallet-connect", + "/smart-wallet/infra-fallbacks": "/advanced/fallback-providers", + "/smart-wallet/code-examples": "/", + "/smart-wallet/permissions/intro": "/smart-accounts/permissions/intro", + "/smart-wallet/permissions/transaction-automation": + "/smart-accounts/permissions/transaction-automation", + "/smart-wallet/permissions/signers/ecdsa": + "/smart-accounts/permissions/signers/ecdsa", + "/smart-wallet/permissions/signers/passkeys": + "/smart-accounts/permissions/signers/passkeys", + "/smart-wallet/permissions/signers/multisig": + "/smart-accounts/permissions/signers/multisig", + "/smart-wallet/permissions/signers/build-your-own": + "/smart-accounts/permissions/signers/build-your-own", + "/smart-wallet/permissions/policies/sudo": + "/smart-accounts/permissions/policies/sudo", + "/smart-wallet/permissions/policies/call": + "/smart-accounts/permissions/policies/call", + "/smart-wallet/permissions/policies/gas": + "/smart-accounts/permissions/policies/gas", + "/smart-wallet/permissions/policies/signature": + "/smart-accounts/permissions/policies/signature", + "/smart-wallet/permissions/policies/rate-limit": + "/smart-accounts/permissions/policies/rate-limit", + "/smart-wallet/permissions/policies/timestamp": + "/smart-accounts/permissions/policies/timestamp", + "/smart-wallet/permissions/policies/build-your-own": + "/smart-accounts/permissions/policies/build-your-own", + "/smart-wallet/permissions/actions/build-your-own": + "/smart-accounts/permissions/actions/build-your-own", + "/smart-wallet/permissions/1-click-trading": + "/smart-accounts/permissions/1-click-trading", +}; + export default defineConfig({ iconUrl: "/favicon.ico", logoUrl: { @@ -50,400 +320,607 @@ export default defineConfig({ /> ), + // Pillars (Get Started, Smart Accounts & Wallets, Cross-Chain Workflows, + // Advanced, Resources) are rendered by the `inject-pillar-bar` Vite plugin + // below as a separate horizontal bar BELOW this top nav. Only utility links + // live in topNav itself. topNav: [ - { text: "SDK", link: "/", match: "/sdk" }, - { - text: "Smart Routing", - link: "/smart-routing-address", - match: "/smart-routing-address", - }, - { text: "Debugger", link: "https://debug.zerodev.app" }, - { text: "API", link: "https://zerodev-api.readme.io" }, - { - link: "https://dashboard.zerodev.app/", - text: "Dashboard", - }, - { - link: "https://calendly.com/zerodev/30min", - text: "Contact Us", - }, + { text: "API Reference", link: "https://zerodev-api.readme.io" }, + { text: "Dashboard", link: "https://dashboard.zerodev.app/" }, { text: "Blog", link: "/blog", match: "/blog" }, ], socials: [ - { - icon: "github", - link: "https://github.com/zerodevapp", - }, - { - icon: "discord", - link: "https://discord.gg/KS9MRaTSjx", - }, - { - icon: "x", - link: "https://twitter.com/zerodev_app", - }, + { icon: "github", link: "https://github.com/zerodevapp" }, + { icon: "discord", link: "https://discord.gg/KS9MRaTSjx" }, + { icon: "x", link: "https://twitter.com/zerodev_app" }, ], sidebar: { "/": [ { - text: "Getting Started", + text: "Get Started", collapsed: false, items: [ + { text: "Introduction", link: "/" }, + { text: "Quickstart", link: "/get-started/quickstart" }, { - text: "Introduction", - link: "/", - }, - { - text: "Quickstart", - link: "/sdk/getting-started/quickstart", - }, - { - text: "Tutorial", - link: "/sdk/getting-started/tutorial", - }, - { - text: "Tutorial β€” Passkeys", - link: "/sdk/getting-started/tutorial-passkeys", + text: "SDKs", + collapsed: false, + items: [ + { text: "Overview", link: "/get-started/sdks/overview" }, + { + text: "Set up a project", + link: "/get-started/sdks/setup-project", + }, + { + text: "Client-side", + collapsed: false, + items: [ + { + text: "TypeScript / JavaScript", + link: "/get-started/sdks/client-side/typescript", + }, + { + text: "iOS (Swift)", + link: "/get-started/sdks/client-side/ios", + }, + { + text: "Android (Kotlin)", + link: "/get-started/sdks/client-side/android", + }, + ], + }, + { + text: "Server-side", + collapsed: false, + items: [ + { + text: "Node.js / TypeScript", + link: "/get-started/sdks/server-side/nodejs", + }, + { + text: "Go (legacy)", + link: "/advanced/go-sdk", + }, + { + text: "Python", + link: "/get-started/sdks/server-side/python", + }, + { + text: "Rust", + link: "/get-started/sdks/server-side/rust", + }, + { + text: "C", + link: "/get-started/sdks/server-side/c", + }, + ], + }, + ], }, { text: "Code Examples", link: "https://github.com/zerodevapp/zerodev-examples", }, - { - text: "Migration Guide", - link: "/sdk/getting-started/migration", - }, - { - text: "Docs for SDK v5.3.x", - link: "/sdk/v5_3_x/", - }, - ], - }, - { - text: "EIP-7702", - collapsed: false, - items: [ - { - text: "Quickstart", - link: "/sdk/getting-started/quickstart-7702", - }, - { - text: "Examples", - link: "https://7702.zerodev.app/", - }, ], }, + ], + "/smart-accounts": [ { - text: "Core API", + text: "Smart Account", collapsed: false, items: [ { text: "Create a Smart Account", - link: "/sdk/core-api/create-account", + link: "/smart-accounts/create-a-smart-account", }, { - text: "Using Plugins", - link: "/sdk/core-api/using-plugins", + text: "Authentication", + collapsed: true, + items: [ + { + text: "Social Login", + link: "/smart-accounts/authentication/social-login", + }, + { + text: "EOA Wallets", + link: "/smart-accounts/authentication/eoa", + }, + { + text: "Custom Signer", + link: "/smart-accounts/authentication/custom-signer", + }, + { + text: "Dynamic", + link: "/smart-accounts/authentication/dynamic", + }, + { + text: "Privy", + link: "/smart-accounts/authentication/privy", + }, + { + text: "Magic", + link: "/smart-accounts/authentication/magic", + }, + { + text: "Web3Auth", + link: "/smart-accounts/authentication/web3auth", + }, + { + text: "Particle", + link: "/smart-accounts/authentication/particle", + }, + { + text: "Arcana", + link: "/smart-accounts/authentication/arcana", + }, + { + text: "Turnkey", + link: "/smart-accounts/authentication/turnkey", + }, + { + text: "Fireblocks", + link: "/smart-accounts/authentication/fireblocks", + }, + { + text: "Dfns", + link: "/smart-accounts/authentication/dfns", + }, + { + text: "Lit Protocol", + link: "/smart-accounts/authentication/lit-protocol", + }, + { + text: "Para", + link: "/smart-accounts/authentication/capsule", + }, + { + text: "Portal", + link: "/smart-accounts/authentication/portal", + }, + { + text: "Coinbase Smart Wallet", + link: "/smart-accounts/authentication/smart-wallet", + }, + ], }, { text: "Send Transactions", - link: "/sdk/core-api/send-transactions", - }, - { - text: "Sponsor Gas", - link: "/sdk/core-api/sponsor-gas", - }, - { - text: "Pay Gas with ERC20s", - link: "/sdk/core-api/pay-gas-with-erc20s", + link: "/smart-accounts/send-transactions", }, { text: "Batch Transactions", - link: "/sdk/core-api/batch-transactions", - }, - { - text: "Deploy Contracts", - link: "/sdk/core-api/deploy-contract", + link: "/smart-accounts/batch-transactions", }, - { - text: "Delegatecall", - link: "/sdk/core-api/delegatecall", - }, - { - text: "Sign and Verify Messages", - link: "/sdk/core-api/sign-and-verify", - }, - { - text: "Status & Uptime API", - link: "/sdk/core-api/status", - }, - { - text: "UserOp Debugger", - link: "/sdk/core-api/debugger", - }, - ], - }, - { - text: "Solana", - collapsed: false, - items: [ { text: "Sponsor Gas", - link: "/sdk/solana/sponsor-gas", - }, - ], - }, - { - text: "Advanced", - collapsed: false, - items: [ - { - text: "Chain Abstraction", - link: "/sdk/advanced/chain-abstraction", - }, - { - text: "Passkeys", - link: "/sdk/advanced/passkeys", - }, - { - text: "Social Login", - link: "/sdk/advanced/social-login", - }, - { - text: "Session Keys", - link: "/sdk/advanced/session-keys", - }, - { - text: "Multisig", - link: "/sdk/advanced/multisig", - }, - { - text: "Recovery", - link: "/sdk/advanced/recovery", - }, - { - text: "Multi-chain Signing", - link: "/sdk/advanced/multi-chain-signing", - }, - { - text: "Key Storage", - link: "/sdk/advanced/key-storage", - }, - { - text: "DeFi Integrations", - link: "/sdk/advanced/defi", - }, - { - text: "Parallel Transactions (2D Nonces)", - link: "/sdk/advanced/parallel-orders", + collapsed: false, + items: [ + { text: "EVM", link: "/smart-accounts/sponsor-gas/evm" }, + { text: "Solana", link: "/smart-accounts/sponsor-gas/solana" }, + ], }, { - text: "Connect Wallet with Other DApps", - link: "/sdk/advanced/wallet-connect", + text: "Pay Gas with ERC-20s", + link: "/smart-accounts/pay-gas-with-erc20s", }, { - text: "Fallback Providers", - link: "/sdk/advanced/fallback-providers", + text: "Sign and Verify Messages", + link: "/smart-accounts/sign-and-verify", }, { - text: "Track deployed smart accounts", - link: "/sdk/advanced/run-solidity-code-on-init", + text: "Permissions (Session Keys)", + collapsed: true, + items: [ + { + text: "Introduction", + link: "/smart-accounts/permissions/intro", + }, + { + text: "Session Keys", + link: "/smart-accounts/permissions/session-keys", + }, + { + text: "Tutorial: Transaction Automation", + link: "/smart-accounts/permissions/transaction-automation", + }, + { + text: "Install with initConfig", + link: "/smart-accounts/permissions/install-with-init-config", + }, + { + text: "Code Example: AgentKit", + link: "/smart-accounts/permissions/agentkit", + }, + { + text: "Signers", + collapsed: true, + items: [ + { + text: "ECDSA", + link: "/smart-accounts/permissions/signers/ecdsa", + }, + { + text: "Passkeys", + link: "/smart-accounts/permissions/signers/passkeys", + }, + { + text: "Multisig", + link: "/smart-accounts/permissions/signers/multisig", + }, + { + text: "Build your own signer", + link: "/smart-accounts/permissions/signers/build-your-own", + }, + ], + }, + { + text: "Policies", + collapsed: true, + items: [ + { + text: "Sudo policy", + link: "/smart-accounts/permissions/policies/sudo", + }, + { + text: "Call policy", + link: "/smart-accounts/permissions/policies/call", + }, + { + text: "Gas policy", + link: "/smart-accounts/permissions/policies/gas", + }, + { + text: "Signature policy", + link: "/smart-accounts/permissions/policies/signature", + }, + { + text: "Rate Limit policy", + link: "/smart-accounts/permissions/policies/rate-limit", + }, + { + text: "Timestamp policy", + link: "/smart-accounts/permissions/policies/timestamp", + }, + { + text: "Build your own policy", + link: "/smart-accounts/permissions/policies/build-your-own", + }, + ], + }, + { + text: "Actions", + collapsed: true, + items: [ + { + text: "Build your own action", + link: "/smart-accounts/permissions/actions/build-your-own", + }, + ], + }, + ], }, { - text: "Upgrading Kernel", - link: "/sdk/advanced/upgrade-kernel", + text: "Account Recovery", + collapsed: true, + items: [ + { + text: "SDK Recovery", + link: "/smart-accounts/account-recovery/sdk-recovery", + }, + { + text: "Flow Intro", + link: "/smart-accounts/account-recovery/flow-intro", + }, + { + text: "Flow Setup", + link: "/smart-accounts/account-recovery/flow-setup", + }, + { + text: "Portal", + link: "/smart-accounts/account-recovery/portal", + }, + ], }, { - text: "Go SDK", - link: "/sdk/advanced/go-sdk", + text: "EIP-7702", + collapsed: true, + items: [ + { + text: "Code Example: Quickstart", + link: "/smart-accounts/eip-7702/quickstart", + }, + { + text: "Examples (external)", + link: "https://7702.zerodev.app/", + }, + ], }, { - text: "UserOp Builder API", - link: "/sdk/advanced/userop-builder-api", + text: "Use Plugins", + collapsed: true, + items: [ + { + text: "Overview", + link: "/smart-accounts/use-plugins/overview", + }, + { + text: "Signers Introduction", + link: "/smart-accounts/use-plugins/signers-intro", + }, + { + text: "Passkeys", + link: "/smart-accounts/use-plugins/passkeys/overview", + collapsed: true, + items: [ + { + text: "Code Example: Tutorial", + link: "/smart-accounts/use-plugins/passkeys/tutorial", + }, + ], + }, + { + text: "Multisig", + link: "/smart-accounts/use-plugins/multisig", + }, + ], }, ], }, { - text: "Permissions (Session Keys)", + text: "Embedded Wallet", collapsed: false, items: [ { text: "Introduction", - link: "/sdk/permissions/intro", + link: "/smart-accounts/embedded-wallet", }, - // { - // "text": "Tutorial: 1-Click Trading", - // "link": "/sdk/permissions/1-click-trading" - // }, { - text: "Tutorial: Transaction Automation", - link: "/sdk/permissions/transaction-automation", + text: "Quickstart", + link: "/smart-accounts/embedded-wallet/quickstart", }, { - text: "Install Permissions with initConfig", - link: "/sdk/permissions/install-with-init-config", + text: "Demo", + link: "https://zerodev-signer-demo.vercel.app/", }, { - text: "Signers", - collapsed: false, + text: "Authentication", + collapsed: true, items: [ { - text: "ECDSA", - link: "/sdk/permissions/signers/ecdsa", + text: "Passkeys", + link: "/smart-accounts/embedded-wallet/auth/passkeys", }, { - text: "Passkeys", - link: "/sdk/permissions/signers/passkeys", + text: "Email OTP", + link: "/smart-accounts/embedded-wallet/auth/email-otp", }, { - text: "Multisig", - link: "/sdk/permissions/signers/multisig", + text: "Magic Link", + link: "/smart-accounts/embedded-wallet/auth/magic-link", }, { - text: "Build your own signer", - link: "/sdk/permissions/signers/build-your-own", + text: "Google OAuth", + link: "/smart-accounts/embedded-wallet/auth/google-oauth", }, ], }, { - text: "Policies", - collapsed: false, + text: "Features", + collapsed: true, items: [ { - text: "Sudo policy", - link: "/sdk/permissions/policies/sudo", - }, - { - text: "Call policy", - link: "/sdk/permissions/policies/call", + text: "Session Management", + link: "/smart-accounts/embedded-wallet/session-management", }, { - text: "Gas policy", - link: "/sdk/permissions/policies/gas", - }, - { - text: "Signature policy", - link: "/sdk/permissions/policies/signature", + text: "Export Wallet", + link: "/smart-accounts/embedded-wallet/export", }, + ], + }, + { + text: "Wallet API", + collapsed: true, + items: [ { - text: "Rate Limit policy", - link: "/sdk/permissions/policies/rate-limit", + text: "Send a Transaction", + link: "/smart-accounts/embedded-wallet/wallet-api/send-transaction", }, { - text: "Timestamp policy", - link: "/sdk/permissions/policies/timestamp", + text: "Sign a Message", + link: "/smart-accounts/embedded-wallet/wallet-api/sign-message", }, { - text: "Build your own policy", - link: "/sdk/permissions/policies/build-your-own", + text: "Sign a Typed Message", + link: "/smart-accounts/embedded-wallet/wallet-api/sign-typed-message", }, ], }, { - text: "Actions", + text: "Hooks", collapsed: true, items: [ { - text: "Build your own action", - link: "/sdk/permissions/actions/build-your-own", + text: "useRegisterPasskey", + link: "/smart-accounts/embedded-wallet/hooks/use-register-passkey", + }, + { + text: "useLoginPasskey", + link: "/smart-accounts/embedded-wallet/hooks/use-login-passkey", + }, + { + text: "useAuthenticateOAuth", + link: "/smart-accounts/embedded-wallet/hooks/use-authenticate-oauth", + }, + { + text: "useSendOTP", + link: "/smart-accounts/embedded-wallet/hooks/use-send-otp", + }, + { + text: "useVerifyOTP", + link: "/smart-accounts/embedded-wallet/hooks/use-verify-otp", + }, + { + text: "useSendMagicLink", + link: "/smart-accounts/embedded-wallet/hooks/use-send-magic-link", + }, + { + text: "useVerifyMagicLink", + link: "/smart-accounts/embedded-wallet/hooks/use-verify-magic-link", + }, + { + text: "useGetUserEmail", + link: "/smart-accounts/embedded-wallet/hooks/use-get-user-email", + }, + { + text: "useRefreshSession", + link: "/smart-accounts/embedded-wallet/hooks/use-refresh-session", + }, + { + text: "useExportWallet", + link: "/smart-accounts/embedded-wallet/hooks/use-export-wallet", + }, + { + text: "useExportPrivateKey", + link: "/smart-accounts/embedded-wallet/hooks/use-export-private-key", }, ], }, ], }, + ], + "/cross-chain": [ { - text: "Auth Providers", + text: "Cross-Chain Workflows", collapsed: false, items: [ { - text: "Introduction", - link: "/sdk/signers/intro", + text: "Smart Routing Address", + link: "/cross-chain/smart-routing-address", }, { - link: "/sdk/signers/dynamic", - text: "Dynamic", - }, - { - link: "/sdk/signers/privy", - text: "Privy", - }, - { - link: "/sdk/signers/magic", - text: "Magic", - }, - { - link: "/sdk/signers/web3auth", - text: "Web3Auth", - }, - { - link: "/sdk/signers/smart-wallet", - text: "Smart Wallet", - }, - { - link: "/sdk/signers/portal", - text: "Portal", - }, - { - link: "/sdk/signers/turnkey", - text: "Turnkey", - }, - { - link: "/sdk/signers/fireblocks", - text: "Fireblocks", - }, - { - link: "/sdk/signers/capsule", - text: "Capsule", + text: "Chain Abstraction", + collapsed: true, + items: [ + { + text: "Overview", + link: "/cross-chain/chain-abstraction/overview", + }, + { + text: "Supported Base Tokens", + link: "/cross-chain/chain-abstraction/supported-base-tokens", + }, + { + text: "Supported DeFi Tokens", + link: "/cross-chain/chain-abstraction/supported-defi-tokens", + }, + ], }, + ], + }, + ], + "/advanced": [ + { + text: "Advanced", + collapsed: false, + items: [ + { text: "Migration Guide", link: "/advanced/migration" }, { - link: "/sdk/signers/lit-protocol", - text: "Lit Protocol", + text: "Multi-chain Signing", + link: "/advanced/multi-chain-signing", }, { - link: "/sdk/signers/particle", - text: "Particle Network", + text: "Parallel Transactions (2D Nonces)", + link: "/advanced/parallel-transactions", }, { - link: "/sdk/signers/dfns", - text: "Dfns", + text: "Fallback Providers", + link: "/advanced/fallback-providers", }, + { text: "Key Storage", link: "/advanced/key-storage" }, + { text: "DeFi Integrations", link: "/advanced/defi" }, { - link: "/sdk/signers/arcana", - text: "Arcana Auth", + text: "Connect Wallet with Other DApps", + link: "/advanced/wallet-connect", }, + { text: "Deploy Contracts", link: "/advanced/deploy-contract" }, + { text: "Delegatecall", link: "/advanced/delegatecall" }, { - link: "/sdk/signers/eoa", - text: "EOA Wallets (e.g. MetaMask)", + text: "Track deployed smart accounts", + link: "/advanced/track-deployed-accounts", }, + { text: "Upgrading Kernel", link: "/advanced/upgrade-kernel" }, { - link: "/sdk/signers/custom-signer", - text: "Custom Signer Integration", + text: "UserOp Builder API", + link: "/advanced/userop-builder-api", }, + { text: "Go SDK (legacy)", link: "/advanced/go-sdk" }, ], }, + ], + "/api-and-toolings": [ { - text: "FAQs", + text: "API & Toolings", collapsed: false, items: [ { - text: "What networks do you support?", - link: "/sdk/faqs/chains", - }, - { - text: "Can I use a KernelClient with ethers.js?", - link: "/sdk/faqs/use-with-ethers", - }, - { - text: "Can you use ZeroDev with React Native?", - link: "/sdk/faqs/use-with-react-native", + text: "Infrastructure", + collapsed: false, + items: [ + { + text: "Gas Policies", + link: "/resources/infrastructure/gas-policies", + }, + { + text: "Custom Gas Policies", + link: "/resources/infrastructure/custom-gas-policies", + }, + { + text: "Admin API", + link: "/resources/infrastructure/api", + }, + ], }, { - text: "Is ZeroDev Audited?", - link: "/sdk/faqs/audits", + text: "Tools", + collapsed: false, + items: [ + { text: "UserOp Debugger", link: "https://debug.zerodev.app/" }, + { + text: "Status & Uptime API", + link: "https://status.zerodev.app/", + }, + ], }, { - text: "How to use ZeroDev with Gelato", - link: "/sdk/faqs/use-with-gelato", + text: "FAQs", + collapsed: true, + items: [ + { + text: "Supported networks", + link: "/resources/faqs/chains", + }, + { + text: "Audits", + link: "/resources/faqs/audits", + }, + { + text: "Use with ethers.js", + link: "/resources/faqs/use-with-ethers", + }, + { + text: "Use with React Native", + link: "/resources/faqs/use-with-react-native", + }, + { + text: "Use with Gelato", + link: "/resources/faqs/use-with-gelato", + }, + { + text: "Debug a UserOp", + link: "/resources/faqs/debug-userop", + }, + ], }, ], }, @@ -583,10 +1060,6 @@ export default defineConfig({ text: "Introduction", link: "/sdk/v5_3_x/permissions/intro", }, - // { - // "text": "Tutorial: 1-Click Trading", - // "link": "/sdk/v5_3_x/permissions/1-click-trading" - // }, { text: "Tutorial: Transaction Automation", link: "/sdk/v5_3_x/permissions/transaction-automation", @@ -663,58 +1136,19 @@ export default defineConfig({ text: "Auth Providers", collapsed: false, items: [ - { - text: "Introduction", - link: "/sdk/v5_3_x/signers/intro", - }, - { - link: "/sdk/v5_3_x/signers/dynamic", - text: "Dynamic", - }, - { - link: "/sdk/v5_3_x/signers/privy", - text: "Privy", - }, - { - link: "/sdk/v5_3_x/signers/magic", - text: "Magic", - }, - { - link: "/sdk/v5_3_x/signers/web3auth", - text: "Web3Auth", - }, - { - link: "/sdk/v5_3_x/signers/portal", - text: "Portal", - }, - { - link: "/sdk/v5_3_x/signers/turnkey", - text: "Turnkey", - }, - { - link: "/sdk/v5_3_x/signers/fireblocks", - text: "Fireblocks", - }, - { - link: "/sdk/v5_3_x/signers/capsule", - text: "Capsule", - }, - { - link: "/sdk/v5_3_x/signers/lit-protocol", - text: "Lit Protocol", - }, - { - link: "/sdk/v5_3_x/signers/particle", - text: "Particle Network", - }, - { - link: "/sdk/v5_3_x/signers/dfns", - text: "Dfns", - }, - { - link: "/sdk/v5_3_x/signers/arcana", - text: "Arcana Auth", - }, + { text: "Introduction", link: "/sdk/v5_3_x/signers/intro" }, + { link: "/sdk/v5_3_x/signers/dynamic", text: "Dynamic" }, + { link: "/sdk/v5_3_x/signers/privy", text: "Privy" }, + { link: "/sdk/v5_3_x/signers/magic", text: "Magic" }, + { link: "/sdk/v5_3_x/signers/web3auth", text: "Web3Auth" }, + { link: "/sdk/v5_3_x/signers/portal", text: "Portal" }, + { link: "/sdk/v5_3_x/signers/turnkey", text: "Turnkey" }, + { link: "/sdk/v5_3_x/signers/fireblocks", text: "Fireblocks" }, + { link: "/sdk/v5_3_x/signers/capsule", text: "Capsule" }, + { link: "/sdk/v5_3_x/signers/lit-protocol", text: "Lit Protocol" }, + { link: "/sdk/v5_3_x/signers/particle", text: "Particle Network" }, + { link: "/sdk/v5_3_x/signers/dfns", text: "Dfns" }, + { link: "/sdk/v5_3_x/signers/arcana", text: "Arcana Auth" }, { link: "/sdk/v5_3_x/signers/eoa", text: "EOA Wallets (e.g. MetaMask)", @@ -729,22 +1163,10 @@ export default defineConfig({ text: "Infra", collapsed: false, items: [ - { - text: "Introduction", - link: "/sdk/v5_3_x/infra/intro", - }, - { - text: "ZeroDev", - link: "/meta-infra/intro", - }, - { - text: "Pimlico", - link: "/sdk/v5_3_x/infra/pimlico", - }, - { - text: "Coinbase", - link: "/sdk/v5_3_x/infra/coinbase", - }, + { text: "Introduction", link: "/sdk/v5_3_x/infra/intro" }, + { text: "ZeroDev", link: "/resources/infrastructure/intro" }, + { text: "Pimlico", link: "/sdk/v5_3_x/infra/pimlico" }, + { text: "Coinbase", link: "/sdk/v5_3_x/infra/coinbase" }, ], }, { @@ -755,14 +1177,8 @@ export default defineConfig({ text: "Why chain abstraction?", link: "/sdk/v5_3_x/faqs/why-chain-abstraction", }, - { - text: "What networks do you support?", - link: "/sdk/v5_3_x/faqs/chains", - }, - { - text: "How to debug a UserOp?", - link: "/sdk/v5_3_x/faqs/debug-userop", - }, + { text: "What networks do you support?", link: "/sdk/v5_3_x/faqs/chains" }, + { text: "How to debug a UserOp?", link: "/sdk/v5_3_x/faqs/debug-userop" }, { text: "Can I use a KernelClient with ethers.js?", link: "/sdk/v5_3_x/faqs/use-with-ethers", @@ -771,10 +1187,7 @@ export default defineConfig({ text: "Can you use ZeroDev with React Native?", link: "/sdk/v5_3_x/faqs/use-with-react-native", }, - { - text: "Is ZeroDev Audited?", - link: "/sdk/v5_3_x/faqs/audits", - }, + { text: "Is ZeroDev Audited?", link: "/sdk/v5_3_x/faqs/audits" }, { text: "How to use ZeroDev with Gelato", link: "/sdk/v5_3_x/faqs/use-with-gelato", @@ -782,253 +1195,260 @@ export default defineConfig({ ], }, ], - "/meta-infra": [ - { - text: "Getting Started", - collapsed: false, - items: [ - { - text: "Introduction", - link: "/meta-infra/intro", - }, - { - text: "Gas Policies", - link: "/meta-infra/gas-policies", - }, - { - text: "Custom Gas Policies", - link: "/meta-infra/custom-gas-policies", - }, - { - text: "Bundler & Paymaster RPCs", - link: "/meta-infra/rpcs", - }, - { - text: "Admin API", - link: "/meta-infra/api", - }, - ], - }, - ], - "/wallets": [ - { - text: "Getting Started", - collapsed: false, - items: [ - { - text: "Introduction", - link: "/wallets", - }, - { - text: "Quickstart", - link: "/wallets/quickstart", - }, - { - text: "Demo", - link: "https://zerodev-signer-demo.vercel.app/", - }, - ], - }, - { - text: "Authentication", - collapsed: false, - items: [ - { - text: "Passkeys", - link: "/wallets/auth/passkeys", - }, - { - text: "Email OTP", - link: "/wallets/auth/email-otp", - }, - { - text: "Magic Link", - link: "/wallets/auth/magic-link", - }, - { - text: "Google OAuth", - link: "/wallets/auth/google-oauth", - }, - ], - }, - { - text: "Features", - collapsed: false, - items: [ - { - text: "Session Management", - link: "/wallets/session-management", - }, - { - text: "Export Wallet", - link: "/wallets/export", - }, - ], - }, - { - text: "Wallet API", - collapsed: false, - items: [ - { - text: "Send a Transaction", - link: "/wallets/wallet-api/send-transaction", - }, - { - text: "Sign a Message", - link: "/wallets/wallet-api/sign-message", - }, - { - text: "Sign a Typed Message", - link: "/wallets/wallet-api/sign-typed-message", - }, - ], - }, - { - text: "Hooks", - collapsed: false, - items: [ - { - text: "useRegisterPasskey", - link: "/wallets/hooks/use-register-passkey", - }, - { - text: "useLoginPasskey", - link: "/wallets/hooks/use-login-passkey", - }, - { - text: "useAuthenticateOAuth", - link: "/wallets/hooks/use-authenticate-oauth", - }, - { - text: "useSendOTP", - link: "/wallets/hooks/use-send-otp", - }, - { - text: "useVerifyOTP", - link: "/wallets/hooks/use-verify-otp", - }, - { - text: "useSendMagicLink", - link: "/wallets/hooks/use-send-magic-link", - }, - { - text: "useVerifyMagicLink", - link: "/wallets/hooks/use-verify-magic-link", - }, - { - text: "useGetUserEmail", - link: "/wallets/hooks/use-get-user-email", - }, - { - text: "useRefreshSession", - link: "/wallets/hooks/use-refresh-session", - }, - { - text: "useExportWallet", - link: "/wallets/hooks/use-export-wallet", - }, - { - text: "useExportPrivateKey", - link: "/wallets/hooks/use-export-private-key", - }, - ], - }, - ], - "/react": [ + }, + vite: { + plugins: [ { - text: "Getting Started", - link: "/react/getting-started", + name: "ia-revamp-redirects", + configureServer(server) { + server.middlewares.use((req, res, next) => { + if (!req.url) return next(); + const url = new URL(req.url, "http://localhost"); + const target = REDIRECTS[url.pathname]; + if (target) { + res.statusCode = 301; + res.setHeader("Location", target + url.search); + res.end(); + return; + } + next(); + }); + }, }, { - text: "Code Examples", - link: "https://github.com/zerodevapp/waas-examples", + name: "inject-pillar-bar", + transformIndexHtml(html) { + const pillarBarStyles = ` +`; + + const pillarBarScript = ` +`; + + return html.replace( + "", + `${pillarBarStyles}\n${pillarBarScript}\n`, + ); + }, }, { - text: "Hooks", - collapsed: false, - items: [ - { - text: "useBalance", - link: "/react/use-balance", - }, - { - text: "useChainId", - link: "/react/use-chainid", - }, - { - text: "useChains", - link: "/react/use-chains", - }, - { - text: "useCreateBasicSession", - link: "/react/use-create-basic-session", - }, - { - text: "useCreateSession", - link: "/react/use-create-session", - }, - { - text: "useCreateKernelClientEOA", - link: "/react/use-create-kernelclient-eoa", - }, - { - text: "useCreateKernelClientPasskey", - link: "/react/use-create-kernelclient-passkey", - }, - { - text: "useCreateKernelClientSocial", - link: "/react/use-create-kernelclient-social", - }, - { - text: "useDisconnectKernelClient", - link: "/react/use-disconnect-kernelclient", - }, - { - text: "useKernelClient", - link: "/react/use-kernelclient", - }, - { - text: "useSendTransaction", - link: "/react/use-send-transaction", - }, - { - text: "useSendTransactionWithSession", - link: "/react/use-send-transaction-with-session", - }, - { - text: "useSendUserOperation", - link: "/react/use-send-useroperation", - }, - { - text: "useSendUserOperationWithSession", - link: "/react/use-send-useroperation-with-session", - }, - { - text: "useSessions", - link: "/react/use-sessions", - }, - { - text: "useSessionKernelClient", - link: "/react/use-session-kernelclient", - }, - { - text: "useSetKernelClient", - link: "/react/use-set-kernelclient", - }, - { - text: "useSwitchChain", - link: "/react/use-switch-chain", - }, - { - text: "useWalletConnect", - link: "/react/use-wallet-connect", - }, - ], + name: "inject-external-link-handler", + transformIndexHtml(html) { + const externalLinkScript = ` +`; + + return html.replace( + "", + `${externalLinkScript}\n`, + ); + }, }, - ], - }, - vite: { - plugins: [ { name: "inject-posthog-plugin", transformIndexHtml(html) {