Skip to content

AT : Rust & TS Examples#242

Merged
itsyaasir merged 27 commits intofeat/audit-trails-devfrom
feat/audit-trails-dev-examples-and-docs
Apr 13, 2026
Merged

AT : Rust & TS Examples#242
itsyaasir merged 27 commits intofeat/audit-trails-devfrom
feat/audit-trails-dev-examples-and-docs

Conversation

@itsyaasir
Copy link
Copy Markdown
Contributor

Description of change

Links to any relevant issues

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes
  • I have updated the CHANGELOG.md, if my changes are significant enough

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I have very little knowledge regarding customs-clearance processes, I have been struggling to understand which purpose the different roles in this example have.

Would be awesome to have an explanation of the involved actors/roles.

Did some research on this but still have no clue what i.e. the Docs operator is.

npm run example:node -- 01_create_trail
npm run example:node -- 01_create_audit_trail
```

Copy link
Copy Markdown
Contributor

@chrisgitiota chrisgitiota Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also add a section for localnet users here:

  Using `locanet`, the publish script prints the required `export` statements, so use `eval` to set the variables in one step:
  ```bash
  // In the `bindings/wasm/audit_trail_wasm/examples` folder
  eval $(../../../audit-trail-move/scripts/publish_package.sh)
  npm run example:node -- 01_create_audit_trail
  ```

.output;

let trail = client.trail(created.trail_id);
let records = trail.records();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining accessor variables (like records, role, trailHandle, ...) should be done as late as possible (ALAP). Otherwise the definition of those accessor variables will be not known in the example snippets of the wiki docs that reference this example code.

- Introduce named actor clients across all audit trail examples so each
  client signs with its own key and capabilities are bound to specific
  addresses (issued_to) rather than left unrestricted
- Add //! ## Actors module-level doc to every example describing each
  actor's role and permissions
- Refactor 01_customs_clearance and 02_clinical_trial to use fully
  distinct clients per operational role (DocsOperator, ExportBroker,
  Inspector, Monitor, DataSafetyBoard, etc.)
- Replace plain-text document data with SHA-256 hash in customs
  clearance; add comment about off-chain TWIN node storage
- Add section-title comments to customs clearance for easier navigation
- Add capability auto-lookup comment to 09_tagged_records
- Move records accessor definition ALAP in 06_delete_records
- Add localnet eval-based quickstart section to WASM examples README
…amples

Each actor now uses its own funded client with a distinct keypair, so
capability objects are bound to per-actor addresses and the Move-level
access-control is exercised as intended. All examples have structured
JSDoc ## Actors sections. The issueTaggedRecordRole helper accepts an
explicit issuedTo address parameter.
@itsyaasir itsyaasir merged commit a49de71 into feat/audit-trails-dev Apr 13, 2026
16 checks passed
@itsyaasir itsyaasir deleted the feat/audit-trails-dev-examples-and-docs branch April 13, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants