Delegated access lets your backend sign for a user’s embedded wallet without a prompt every time — useful for automations, scheduled actions, or server-side flows the user has opted into. You’ll build:
Status — show whether delegated access is on.
Grant — turn it on, with the user’s explicit consent.
Revoke — let the user turn it off at any time.
Showing delegation status
hasDelegatedAccess is a synchronous check for whether the wallet currently has delegated access.
TypeScript
React
import { hasDelegatedAccess } from '@dynamic-labs-sdk/client/waas';import type { WalletAccount } from '@dynamic-labs-sdk/client';function renderDelegationStatus(walletAccount: WalletAccount, el: HTMLElement) { el.textContent = hasDelegatedAccess({ walletAccount }) ? 'Delegated access is on' : 'Delegated access is off';}
import { hasDelegatedAccess } from '@dynamic-labs-sdk/client/waas';import type { WalletAccount } from '@dynamic-labs-sdk/client';function DelegationStatus({ walletAccount }: { walletAccount: WalletAccount }) { const isDelegated = hasDelegatedAccess({ walletAccount }); return <span>{isDelegated ? 'Delegated access is on' : 'Delegated access is off'}</span>;}
Granting delegated access
Only grant after clear, explicit consent — you’re letting your backend act on the user’s behalf. Pass the wallet password when your project protects wallets with one.
TypeScript
React
import { delegateWaasKeyShares } from '@dynamic-labs-sdk/client/waas';import type { WalletAccount } from '@dynamic-labs-sdk/client';async function grant(walletAccount: WalletAccount, password?: string) { await delegateWaasKeyShares({ password, walletAccount }); // showGranted is your implementation. showGranted();}
import type { WalletAccount } from '@dynamic-labs-sdk/client';import { useDelegateWaasKeyShares } from '@dynamic-labs-sdk/react-hooks';function GrantAccess({ walletAccount, password,}: { walletAccount: WalletAccount; password?: string;}) { const { mutateAsync: delegate, isPending } = useDelegateWaasKeyShares(); return ( <button type="button" disabled={isPending} // Pass password when your project protects wallets with one. onClick={() => delegate({ password, walletAccount })} > {isPending ? 'Enabling…' : 'Enable delegated access'} </button> );}
Delegated access means your backend can sign without the user present. Explain exactly what it enables, keep it opt-in, and make revoking easy.
Revoking delegated access
TypeScript
React
import { revokeWaasDelegation } from '@dynamic-labs-sdk/client/waas';import type { WalletAccount } from '@dynamic-labs-sdk/client';async function revoke(walletAccount: WalletAccount, password?: string) { await revokeWaasDelegation({ password, walletAccount }); // showRevoked is your implementation. showRevoked();}
import type { WalletAccount } from '@dynamic-labs-sdk/client';import { useRevokeWaasDelegation } from '@dynamic-labs-sdk/react-hooks';function RevokeAccess({ walletAccount, password,}: { walletAccount: WalletAccount; password?: string;}) { const { mutateAsync: revoke, isPending } = useRevokeWaasDelegation(); return ( <button type="button" disabled={isPending} // Pass password when your project protects wallets with one. onClick={() => revoke({ password, walletAccount })} > {isPending ? 'Revoking…' : 'Revoke delegated access'} </button> );}
Handling errors
Situation
What to do
hasDelegatedAccess already true
Show the revoke action instead of grant.
Wrong password on grant/revoke
Ask the user to re-enter the wallet password; nothing changes.
Grant rejected by the user
Leave delegated access off and don’t proceed with the automation that needed it.