Skip to main content
All PSR admin methods take chain: "ethereum" | "solana" as the first argument and return chain-neutral types.

Types

CreateSchemaParams

{
  name: string;
  fieldDefinitions: string | FieldDef[];
  revocable: boolean;
  resolver?: string;           // EVM address or Solana program pubkey
  schemaExpiry?: PsrExpiryInput;
}

IssueAttestationParams

{
  schemaId: string;            // 0x bytes32 hex
  recipient: string;           // meta-address, stealth address, or hash
  fieldValues: Record<string, string>;
  expiration?: PsrExpiryInput;
  refUid?: string;
  announce?: boolean;          // default true for meta-address recipients
}

PsrExpiryInput

{ slotOrBlock?: number } | { dateTime?: string }  // ISO datetime

Schema lifecycle

createSchema(chain, params)

Register a new schema. Returns tx hash and derived schemaId.
const { txHash, schemaId } = await client.createSchema("ethereum", {
  name: "kyc-v1",
  fieldDefinitions: "bool passed, u64 score",
  revocable: true,
});
Signers: EVM wallet or Solana wallet per chain.

getMySchemas(chain)

List schemas where this wallet is authority or delegate.
const schemas: SchemaV2[] = await client.getMySchemas("ethereum");
Read-only; no signer required beyond RPC / Solana connection.

deprecateSchema(chain, schemaId)

Authority-only. Irreversibly blocks new attestations.
await client.deprecateSchema("ethereum", schemaId);

addSchemaDelegate(chain, schemaId, delegate)

Authorize another address to issue under this schema (max 10).
await client.addSchemaDelegate("ethereum", schemaId, delegateAddress);

removeSchemaDelegate(chain, schemaId, delegate)

Revoke delegate issuance rights.
await client.removeSchemaDelegate("solana", schemaId, delegatePubkey);

Attestations

issueAttestation(chain, params)

Issue a schema-bound V2 attestation to a stealth identity. Resolves the recipient, encodes fields, submits attest, and optionally announces with V2 0xB2 metadata so the recipient can discover it with discoverTraitsV2.
const { txHash, uid, stealthAddressHash } = await client.issueAttestation("ethereum", {
  schemaId,
  recipient: client.getMetaAddressHex(),
  fieldValues: { passed: "true", score: "100" },
});

getMyIssuedAttestations(chain)

List attestations issued by this wallet.
const list: AttestationV2[] = await client.getMyIssuedAttestations("ethereum");

Legacy V1 issuer helpers

encodeReputationMetadata(viewTag, attestationId)

Encode legacy V1 PSR metadata bytes for announce (viewTag || 0xA7 || attestationId). New schema-bound attestations issued by issueAttestation use V2 metadata instead.
const metadata = client.encodeReputationMetadata(viewTag, 42n);

prepareReputationAssignment(recipientMetaAddressHex, attestationId)

Derive stealth send material with legacy V1 PSR metadata embedded.
const prep = client.prepareReputationAssignment(metaHex, attestationId);

buildAssignReputationTransaction(recipientMetaAddressHex, attestationId)

Calldata for a legacy V1 announce-with-PSR-metadata transaction (no asset transfer).
const req = client.buildAssignReputationTransaction(metaHex, attestationId);

Full issuer E2E (Ethereum)

const { schemaId } = await client.createSchema("ethereum", {
  name: `demo-${Date.now()}`,
  fieldDefinitions: "bool passed, string note",
  revocable: true,
});

await client.issueAttestation("ethereum", {
  schemaId,
  recipient: client.getMetaAddressHex(),
  fieldValues: { passed: "true", note: "hello" },
});

const issued = await client.getMyIssuedAttestations("ethereum");
See Create a schema and Issue an attestation for step-by-step guides.