When the connected owner is a parent Safe,
deploySafe(parent, chainId) deploys the child. That call does not put the on-chain session enable in the safe-deploy typed-data intent. Include it by passing true as the last argument: deploySafe(parent, chainId, undefined, true). Without that flag, the account record (hasActiveSessionKey) is written when you call sendDeposit afterwards. The SDK posts POST /session-keys/add during that deposit, so you do not add a separate register call in your UI. createSessionKey stays available for manual retries or non-deploy flows. EOA callers are unchanged: the fourth deploySafe argument still defaults to false.
Check status
After connect, callgetNestedSafeOnboardingStatus with the parent address and the same chainId you use for deploy and deposit. Use it to label progress in your UI and to enable the right action.
sessionActive is for the chainId you pass. If the child is deployed but the session is inactive on that chain, suggestedStep is still deploy (call deploySafe again). Re-fetch status after deploy, deposit credit, or when the user changes chain.
Full method reference: getNestedSafeOnboardingStatus.
1. Connect the parent Safe
Use WalletConnect (wagmi or Reown AppKit), or the Safe App provider when your app is embedded in Safe. Open the parent Safe before approving the connection. Do not connect an owner EOA or the Zyfai child.connectAccount before enabling the later buttons. Use this same address for deploy, deposit, portfolio, and withdraw. When the account or chain changes, call disconnectAccount() and connect again. The parent must already have code on the selected chain. See API key and CORS.
2. Deploy the child
safe-deploy), not a raw userOp personal_sign. The child address comes back on deployed.safeAddress. For a parent Safe, this step deploys the child. The on-chain session enable is in that typed data only when the fourth argument is true. Otherwise the session record is written on the following sendDeposit. A second call on an already deployed child finishes any remaining enable and does not deploy again.
3. Deposit from the parent
Amounts are least units (100 USDC is"100000000"). Check supported assets and minimums. The parent proposes an ERC-20 transfer into the child.
savePendingProposal, saveDepositId, and clearPendingProposal are your storage, not SDK methods. A returned sendDeposit is the registered transfer, not a finished yield allocation.
For a threshold above 1, one owner cannot finish deploy or deposit alone. Co-owners confirm the same item in Safe. The SDK waits on the Safe Transaction Service before it treats the deposit as submitted.
If
onSafeProposal already returned a reference, a timeout is not a failure. Reconnect as the same parent on the same chain and resume that proposal. Do not send a second transfer for the same operation.
4. Withdraw to the parent
Once the session is active, the agent submits the withdrawal. Owners do not normally sign another parent-Safe transaction for that payout. Omit the amount for a full withdraw.Methods
Working UI: nested Safe demo.