Account Managers
This guide explains how to delegate social activities to an Account Manager.
An Account Manager is an EVM address authorized to sign social operations on behalf of an Account.
This allows the Account owner to maintain control while delegating the execution of social operations to one or more Account Managers.
Security Considerations
An Account Manager can sign most Account operations, except for those that, for security reasons, require the Account owner's signature.
The Tiered Transaction Model described in the Transaction Lifecycle guide specifies that Social Operations will fall back to a signed execution mode if the operation specifics require it.
For example, free collects can be signless, while paid collects will require a user signature.
Updating Account Managers is considered a sensitive operation and thus always requires the Account owner's signature. For this reason, all mutations involving Account Managers are Restricted Operations.
Add Account Managers
- GraphQL
- React
- TypeScript
You can use the addAccountManager mutation to add an Account Manager for the logged-in Account.
You MUST be authenticated as Account Owner to make this request.
AddAccountManager.graphql
mutation { addAccountManager( request: { address: "0x5071DeEcD24EBFA6161107e9a875855bF79f7b21" permissions: { canExecuteTransactions: true canTransferTokens: false canTransferNative: false canSetMetadataUri: true } } ) { ... on SponsoredTransactionRequest { ...SponsoredTransactionRequest }
... on SelfFundedTransactionRequest { ...SelfFundedTransactionRequest }
... on TransactionWillFail { reason } }}
where:
canExecuteTransactions: Indicates whether the new Account Manager can execute transactions.
canTransferTokens: Indicates whether the new Account Manager can transfer tokens.
canTransferNative: Indicates whether the new Account Manager can transfer native tokens.
canSetMetadataUri: Indicates whether the new Account Manager can set the Account's Metadata URI.
Now, you can submit and monitor the transaction as explained in the Transaction Lifecycle guide.
Remove Account managers
- GraphQL
- React
- TypeScript
You can use the removeAccountManager mutation to remove an Account Manager from the logged-in Account.
You MUST be authenticated as Account Owner to make this request.
RemoveAccountManager.graphql
mutation { removeAccountManager( request: { manager: "0x5071DeEcD24EBFA6161107e9a875855bF79f7b21" } ) { ... on SponsoredTransactionRequest { ...SponsoredTransactionRequest }
... on SelfFundedTransactionRequest { ...SelfFundedTransactionRequest }
... on TransactionWillFail { reason } }}
Now, you can submit and monitor the transaction as explained in the Transaction Lifecycle guide.
Update Account Manager Permissions
- GraphQL
- React
- TypeScript
You can use the updateAccountManager mutation to update an Account Manager's permissions.
You MUST be authenticated as Account Owner to make this request.
UpdateAccountManager.graphql
mutation { updateAccountManager( request: { manager: "0x5071DeEcD24EBFA6161107e9a875855bF79f7b21" permissions: { canExecuteTransactions: true canTransferTokens: false canTransferNative: false canSetMetadataUri: true } } ) { ... on SponsoredTransactionRequest { ...SponsoredTransactionRequest }
... on SelfFundedTransactionRequest { ...SelfFundedTransactionRequest }
... on TransactionWillFail { reason } }}
Now, you can submit and monitor the transaction as explained in the Transaction Lifecycle guide.
Signless Experience
By leveraging the Account Manager feature, you can enable a signless experience for social interactions through the Lens API.
- TypeScript
- GraphQL
- React
Use the enableSignless action:
import { enableSignless } from "@lens-protocol/client/actions";
to get transaction details to set up the Lens API as Account Manager.
const result = await enableSignless(sessionClient);
if (result.isErr()) { return console.error(result.error);}
const session = result.value;
Then, submit and monitor the transaction as explained in the Transaction Lifecycle guide.
Use the removeSignless action:
import { removeSignless } from "@lens-protocol/client/actions";
to get transaction details to remove the Lens API as Account Manager.
const result = await removeSignless(sessionClient);
if (result.isErr()) { return console.error(result.error);}
const session = result.value;
And submit and monitor the transaction as explained in the Transaction Lifecycle guide.
List Account Managers
- TypeScript
- GraphQL
- React
Use the paginated fetchAccountManagers action to list the Account Managers for the logged-in Account.
You MUST be authenticated as Account Owner or Account Manager to make this request.
See the Pagination guide for more information on how to handle paginated results.