Schemas
Types
Schema (Onchain)
name
string
Schema name.
description?
string
Schema description.
revocable?
boolean
Whether Attestations that adopt this Schema can be revoked.
maxValidFor?
number
The maximum number of seconds that an Attestation can remain valid. 0 means Attestations can be valid forever. This is enforced through Attestation.validUntil
.
hook?
address
The contract address of the hook for this schema.
registrant
address
The wallet address of the user that registered this schema.
dataLocation?
DataLocationOnChain
Where Schema.data
is stored. See DataLocation.DataLocation
.
data
SchemaItem[]
or string
The data format defining this schema's data structure. When dataLocation=ONCHAIN
, data is SchemaItem[]
, when dataLocation=ARWEAVE or IPFS
, data is id of the data.
Schema (Offchain)
name
string
Schema name.
description?
string
Schema description.
revocable?
boolean
Whether Attestations that adopt this Schema can be revoked.
maxValidFor?
number
The maximum number of seconds that an Attestation can remain valid. 0 means Attestations can be valid forever. This is enforced through Attestation.validUntil
.
dataLocation?
DataLocationOffChain
Where Schema.data
is stored. See DataLocation.DataLocation
.
data
SchemaItem[]
The data format defining this schema's data structure.
Usage
Registering a Schema
Parameters
schema
Schema
The schema being registered.
options?
CreateSchemaOptions
Options for creating a schema.
CreateSchemaOptions
delegationSignature?
string
The user's delegate signature for creating a schema on their behalf. Call delegateSignSchema
to get this signature.
getTxHash?
(txHash: `0x${string}`) => void
An optional callback that immediately returns the transaction hash.
Example
Retrieving a Schema
Parameters
schemaId
string
The ID of the schema we are trying to retrieve.
Example
Delegating On-chain Schema Registration via ECDSA
Parameters
schema
OnChainSchema
An on-chain schema.
options
DelegateSignSchemaOptions
Options for delegate signing the schema.
DelegateSignSchemaOptions
chain
EvmChains
The EVM chain you are targetting.
delegationAccount?
PrivateKeyAccount
The signer account that signs the message. See viem/accounts
. If this is null, a signer from window.ethereum
will be used.
rpcUrl?
string
Optional RPC URL.
walletClient?
WalletClient
Optional WalletClient
from viem to use for transactions.
Last updated