| description | Learn how to use the ownership transfer scope for a delegation. | ||||
|---|---|---|---|---|---|
| keywords |
|
import GlossaryTerm from '@theme/GlossaryTerm';
The ownership transfer scope restricts a delegation to ownership transfer calls only. For example, Alice has deployed a smart contract, and she delegates to Bob the ability to transfer ownership of that contract.
- Install and set up the Smart Accounts Kit.
- Configure the Smart Accounts Kit.
- Create a delegator account.
- Create a delegate account.
This scope requires a contractAddress, which represents the address of the deployed contract.
Internally, this scope uses the ownershipTransfer caveat enforcer.
See the ownership transfer scope reference for more details.
import { createDelegation, ScopeType } from '@metamask/smart-accounts-kit'
const contractAddress = '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238'
const delegation = createDelegation({
scope: {
type: ScopeType.OwnershipTransfer,
contractAddress,
},
to: delegateAccount,
from: delegatorAccount,
environment: delegatorAccount.environment,
})See how to further constrain the authority of a delegation using caveat enforcers.