Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/widget/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock.json
node_modules/
dist/
21 changes: 21 additions & 0 deletions packages/widget/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Nirium Protocol contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
70 changes: 70 additions & 0 deletions packages/widget/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# `@nirium-protocol/audit-trail-viewer`

Standalone, **zero-runtime-dependency** React widget that surfaces Nirium
anchored audit-trail receipts inside any third-party Web3 dashboard.

Built against the bounty described in [nirium-sdk#12](https://github.com/nirium-protocol/nirium-sdk/issues/12):
> *Standalone React AuditTrail Viewer Widget — Bounty ($50 USDC).*

## What it does

- Accepts an `appId` and fetches anchored receipts via `GET /api/audit/info`.
- Displays each receipt's **IPFS CID** and **Stellar tx hash** with working
external links (defaulting to `https://ipfs.io/ipfs/<cid>` and
`stellar.expert/explorer/public/tx/<hash>` — overridable).
- Ships Tailwind-friendly class hooks so host apps can restyle freely.
- Includes a full NPM build setup (`tsup` dual ESM/CJS + TypeScript types).
- Exposes a dependency-free `fetchAuditInfo()` helper for non-React hosts.
- Tested with `vitest` + `@testing-library/react` (success / loading / error /
empty + click interactions).

## Install

```bash
npm install @nirium-protocol/audit-trail-viewer
```

## Usage

```tsx
import { AuditTrailViewer } from '@nirium-protocol/audit-trail-viewer'

export function Dashboard() {
return (
<AuditTrailViewer
appId="<your-nirium-app-id>"
title="Anchored Audit Trail"
// Optional: override default Stellar Expert link with custom CTA
renderExternalLink={(r) => (
<a href={`https://my-explorer.local/tx/${r.stellarTxHash}`}>
Verify on My Explorer
</a>
)}
/>
)
}
```

### Non-React usage

```ts
import { fetchAuditInfo } from '@nirium-protocol/audit-trail-viewer'

const info = await fetchAuditInfo('demo', {
baseUrl: 'https://my-nirium-proxy.test',
})
console.log(info.receipts)
```

## Build & test

```bash
npm install
npm run build # tsup → dist/{index.mjs,index.cjs,index.d.ts}
npm test # vitest run
npm run typecheck
```

## License

MIT.
Loading