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:
ethersand@ethereum-attestation-service/eas-sdkare peer dependencies. npm v7+ installs peer dependencies automatically, but will only warn (not error) if they're missing — so double-check they're in yournode_modulesif you use--legacy-peer-deps. If you use pnpm or yarn, you may need to install them explicitly.The
canonicalizepackage (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:
- Verify Reputation — Read and verify an on-chain attestation
- Publish an Attestation — Submit a verifiable attestation to EAS
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 path | Description | EAS SDK required? |
|---|---|---|
@oma3/omatrust/reputation | Attestation submission, querying, verification, proofs, controller witness | Yes |
@oma3/omatrust/identity | DID normalization, hashing, CAIP utilities, JSON canonicalization | No |
@oma3/omatrust/app-registry | ERC-8004 helpers: traits, interfaces, status, versioning, data hash | No |
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
- Reputation SDK Overview — Workflow examples for attestation and verification
- Reputation SDK Reference — Canonical function signatures and types
- Identity SDK Reference — DID, CAIP, and data utility functions
- App Registry Reference — Canonical function signatures for app registry
- Attestation Types — End-to-end proof workflow documentation
- OMATrust Specification — Formal protocol specification