Schemas

Registering a Schema

async function createSchema(
  schema: Schema,
  options?: { getTxHash?: (txHash: `0x${string}`) => void }
): Promise<SchemaResult>;

Parameters

NameTypeDescription

schema

Schema

The schema being registered.

getTxHash?

(txHash: `0x${string}`) => void

An optional callback that immediately returns the transaction hash.

Example

const res = await client.createSchema({
  name: "Example",
  data: [{ name: "name", type: "string" }]
});

Retrieving a Schema

async function getSchema(schemaId: string): Promise<Schema>;

Parameters

NameTypeDescription

schemaId

string

The ID of the schema we are trying to retrieve.

Example

const res = await client.getSchema('0x3e');

Delegating On-chain Schema Registration via ECDSA

async function delegateSignSchema(
  schema: OnChainSchema,
  options: {
    chain: EvmChains;
    delegationAccount?: PrivateKeyAccount;
  }
): Promise<SchemaDelegationSignature>;

Parameters

NameTypeDescription

schema

OnChainSchema

An on-chain schema.

chain

EvmChains

The EVM chain we are targeting.

delegationAccount?

PrivateKeyAccount

The signer account that signs the message. See viem/accounts. If this is null, a signer from window.ethereum will be used.

Last updated