approval.getOperator
Checks whether an operator may manage everything an owner holds on an ENS contract (isApprovedForAll). Options, errors and examples for approval.getOperator.
Checks whether an operator may manage everything an owner holds on an ENS contract
(isApprovedForAll).
When to use
Use to see whether a marketplace, manager or contract wallet is already approved.
Details
contract: the ENSv1"registry","registrar"(BaseRegistrar) or"wrapper"(NameWrapper), or any ENSv2 registry or resolver by address.
Signature
function getOperator(
client: Like,
options: getOperator.Options,
): Promise<getOperator.ReturnType>Call it as ens.approval.getOperator(options) on a client, or Actions.approval.getOperator(client, options).
approval.getOperator.request(options) builds a deferred read for Actions.batch. See Look up many at once.
Parameters
| Option | Type | Default | Description |
|---|---|---|---|
owner (required) | string | Account that granted the approval. | |
operator (required) | string | Account that may be approved. | |
contract (required) | ApprovalContract | "registry", "registrar", "wrapper", or a registry or resolver address. |
Also takes the read options.
Returns
Resolves to boolean. Whether operator is approved for all of owner's names on the contract.
Errors
| Error | Codes | When |
|---|---|---|
InvalidInputError | INVALID_ADDRESS | invalid addresses. |
UnsupportedError | UNSUPPORTED_ON_DEPLOYMENT | ENSv1 contracts without ENSv1. |
NetworkError | RPC_REQUEST_FAILED, RPC_TIMEOUT, RATE_LIMITED | the RPC request fails. |
It can also fail with the errors every read can (Errors.CommonError: ConfigError, ContractRevertError, InternalError, NetworkError).
See How errors work.
Examples
const approved = await ens.approval.getOperator({ owner, operator, contract: "wrapper" })See also
approval.setOperatorto change it
Was this page helpful?