audit_trail_wasm exposes the audit_trails Rust crate to JavaScript and TypeScript consumers through wasm-bindgen.
It is designed for browser and other wasm32 environments that need:
- read-only and signing audit-trail clients
- typed wrappers for trail handles, records, locking, access control, and tags
- serializable value and event types that map cleanly into JS/TS
- transaction wrappers that integrate with the shared
product_commonwasm transaction helpers
AuditTrailClientReadOnlyfor reads and inspected transactionsAuditTrailClientfor signed write flowsAuditTrailBuilderfor creating new trailsAuditTrailHandlefor trail-scoped APIsTrailRecords,TrailLocking,TrailAccess, andTrailTagsfor subsystem-specific operations
- Use
AuditTrailClientReadOnlywhen you need reads, package resolution, or inspected transactions. - Use
AuditTrailClientwhen you also need typed write transaction builders. - Use
AuditTrailHandleafter you already know the trail object ID and want to stay scoped to that trail. - Use
AuditTrailBuilderwhen you are preparing a create-trail transaction.
The bindings expose JS-friendly wrappers for the most important Rust value types:
DataPermissionandPermissionSetRoleTags,RoleMap, andCapabilityIssueOptionsTimeLock,LockingWindow, andLockingConfigRecord,PaginatedRecord, andOnChainAuditTrail- event payloads such as
RecordAdded,RoleCreated, andCapabilityIssued
- Create an
AuditTrailClientReadOnlyorAuditTrailClient. - Resolve a trail handle with
.trail(trailId). - Read state with
.get(),.records().get(...),.records().listPage(...), or.locking().isRecordLocked(...).
- Create an
AuditTrailClientwith a transaction signer. - Build a transaction from
client.createTrail(),client.trail(trailId), or one of the trail subsystem handles. - Convert that transaction wrapper into programmable transaction bytes.
- Submit it through your surrounding JS transaction flow and feed the effects and events back into the typed
applyWithEvents(...)helper.
The package intentionally separates transaction construction from submission so browser apps, wallet integrations, and server-side signing flows can keep transport and execution policy outside the package.
import { AuditTrailClientReadOnly } from "@iota/audit-trails";
const client = await AuditTrailClientReadOnly.create(iotaClient);
const trail = client.trail(trailId);
const state = await trail.get();
console.log(state.sequenceNumber);npm install
npm run buildSee examples/README.md for runnable node and web example flows.