UI Component
Privy provides a UI component that you can use to prompt users to provision server sessions for their wallets and revoke server-side access.
Provision server-side access
To prompt users to delegate their wallets with a consent screen, use the delegateWallet
method from the useDelegatedActions
hook:
Parameters
Address of the embedded wallet to delegate.
Chain type of the embedded wallet to delegate.
When invoked, the delegateWallet
method will open a Privy modal where the user can either approve or reject the delegation.
If the user approves, Privy will initiate the process to provision a server session for the wallet. If the user refuses or there is another error during provisioning, this method will throw an error.
Usage
To prompt users to delegate their wallets with a consent screen, use the delegateWallet
method from the useDelegatedActions
hook:
Parameters
Address of the embedded wallet to delegate.
Chain type of the embedded wallet to delegate.
When invoked, the delegateWallet
method will open a Privy modal where the user can either approve or reject the delegation.
If the user approves, Privy will initiate the process to provision a server session for the wallet. If the user refuses or there is another error during provisioning, this method will throw an error.
Usage
To prompt users to provision a server session for their wallets with a consent screen, use the delegateWallet
method from the useDelegatedActions
hook:
Parameters
Address of the embedded wallet to delegate.
Chain type of the embedded wallet to provision a server session for.
When invoked, the delegateWallet
method will open a Privy modal where the user can either approve or reject the provisioning of a server session.
If the user approves, Privy will initiate the process to provision a server session for the wallet. If the user refuses or there is another error during provisioning, this method will throw an error.
Usage
Revoke server-side access
To prompt users to revoke a server session with a revocation screen, use the revokeWallets
method from the useDelegatedActions
hook:
When invoked, the revokeWallets
method will open a Privy modal where the user can either confirm the revocation of their server session. If the user has no server sessions, this method will error.
Once a user confirms revocation, your app will no longer be able to take actions on behalf of the user with their wallet unless the user provisions a server session.
If a user has provisioned multiple server sessions, they will all be revoked.
Usage
To prompt users to revoke a server session with a revocation screen, use the revokeWallets
method from the useDelegatedActions
hook:
When invoked, the revokeWallets
method will open a Privy modal where the user can either confirm the revocation of their server session. If the user has no server sessions, this method will error.
Once a user confirms revocation, your app will no longer be able to take actions on behalf of the user with their wallet unless the user provisions a server session.
If a user has provisioned multiple server sessions, they will all be revoked.
Usage
To prompt users to revoke a server session with a revocation screen, use the revokeWallets
method from the useDelegatedActions
hook:
When invoked, the revokeWallets
method will open a Privy modal where the user can either confirm the revocation of their server session. If the user has no server sessions, this method will error.
Once a user confirms revocation, your app will no longer be able to take actions on behalf of the user with their wallet unless the user provisions a server session.
If a user has provisioned multiple server sessions, they will all be revoked.