Skip to main content

SDK Getting Started

This guide is for the npm package:

@oma3/omatrust

Install

npm install @oma3/omatrust ethers

If you use the reputation module (submitAttestation, getAttestation, etc.), you also need the EAS SDK:

npm install @ethereum-attestation-service/eas-sdk

The identity and app-registry modules (normalizeDid, didToAddress, CAIP utilities, registry helpers) work with just ethers — no EAS SDK required.

Note: ethers and @ethereum-attestation-service/eas-sdk are peer dependencies. npm v7+ installs peer dependencies automatically, but will only warn (not error) if they're missing — so double-check they're in your node_modules if you use --legacy-peer-deps. If you use pnpm or yarn, you may need to install them explicitly.

The canonicalize package (used internally for JCS / RFC 8785 canonicalization) is a regular dependency and is bundled automatically — you don't need to install it separately.

Quick Start

For hands-on code walkthroughs, see the quickstart guides:

Gas Funding for Direct Attestations

If you use direct on-chain submission (submitAttestation), the signing wallet must have enough native gas token on the target chain to pay transaction fees.

  • On OMAChain Testnet, fund the signer with OMA using the OMAChain Testnet faucet
  • If the wallet has insufficient balance, submission will fail before the attestation is recorded
  • User review attestations can avoid gas fees on OMAChain by using submitDelegatedAttestation (see Delegated Attestation API)

Module Map

Import pathDescriptionEAS SDK required?
@oma3/omatrust/reputationAttestation submission, querying, verification, proofs, controller witnessYes
@oma3/omatrust/identityDID normalization, hashing, CAIP utilities, JSON canonicalizationNo
@oma3/omatrust/app-registryERC-8004 helpers: traits, interfaces, status, versioning, data hashNo

Error Handling

All SDK functions throw OmaTrustError with a stable code property:

try {
await submitAttestation(params);
} catch (err) {
if (err.code === "NETWORK_ERROR") {
// retry or switch RPC
}
}

See the Reputation Reference and Identity Reference for the full error code tables.

Further Reading