JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q53267F
  • License MIT

Beginner-friendly SDK for ProofRails ISO 20022 Middleware - Create blockchain-verifiable payment receipts with zero coding knowledge

Package Exports

  • @proofrails/sdk
  • @proofrails/sdk/react

Readme

# ProofRails SDK

**Beginner friendly SDK for creating blockchain verifiable ISO 20022 payment receipts**

Create compliant, auditable payment receipts with just a few lines of code. No blockchain expertise required.

## Features

- **Zero coding knowledge required**, use simple templates  
- **ISO 20022 compliant**, generates standard banking messages  
- **Blockchain verified**, receipts anchored on Flare blockchain  
- **Tamper proof**, cryptographic evidence bundles  
- **Real time updates**, live receipt status via SSE  
- **Works everywhere**, TypeScript, JavaScript, Node.js, browsers  

## Installation

```bash
npm i @proofrails-sdk/sdk
# or
yarn add @proofrails/sdk

Quick Start

Option 1, Create New Project (Easiest)

import ProofRails from '@proofrails/sdk';

// Create a new project automatically
const { client, apiKey, projectId } = await ProofRails.createProject({
  label: 'My App'
});

console.log('Your API Key:', apiKey); // Save this
console.log('Your Project ID:', projectId);

Option 2, Use Existing API Key

import ProofRails from '@proofrails/sdk';

const proofrails = new ProofRails({
  apiKey: 'your-api-key-here'
});

Templates (Beginner Friendly)

Payment Receipt

const receipt = await proofrails.templates.payment({
  amount: 100,
  from: 'Alice',
  to: 'Bob',
  purpose: 'Freelance web development',
  transactionHash: '0x123...'
});

console.log('Receipt ID:', receipt.id);
console.log('Status:', receipt.status);

Donation Receipt

const receipt = await proofrails.templates.donation({
  amount: 50,
  donor: 'John Doe',
  organization: 'Red Cross',
  campaign: 'Disaster Relief 2024',
  transactionHash: '0x456...'
});

Escrow Release

const receipt = await proofrails.templates.escrow({
  amount: 1000,
  buyer: 'Alice',
  seller: 'Bob',
  escrowId: 'ESC-2024-001',
  releaseReason: 'Milestone 1 completed',
  transactionHash: '0x789...'
});

Grant Disbursement

const receipt = await proofrails.templates.grant({
  amount: 5000,
  grantee: 'Research Lab',
  grantor: 'Science Foundation',
  grantId: 'GR-2024-001',
  purpose: 'Climate change research',
  transactionHash: '0xabc...'
});

Refund

const receipt = await proofrails.templates.refund({
  amount: 25,
  originalPayment: 'receipt-id-123',
  reason: 'Product returned',
  customer: 'Jane Smith',
  transactionHash: '0xdef...'
});

Core Operations

Get Receipt

const receipt = await proofrails.receipts.get('receipt-id');

console.log(receipt.status);
console.log(receipt.amount);
console.log(receipt.anchorTx);

List Receipts

const { items, total } = await proofrails.receipts.list({
  limit: 10,
  status: 'anchored'
});

items.forEach(r => {
  console.log(r.id, r.amount);
});

Download Artifacts

const artifacts = await proofrails.receipts.getArtifacts('receipt-id');

console.log('ISO XML:', artifacts.pain001Url);
console.log('Bundle:', artifacts.bundleUrl);
console.log('Manifest:', artifacts.manifestUrl);

Verification

Verify Receipt

const verification = await proofrails.verify.byReceiptId('receipt-id');

if (verification.valid && verification.onChain) {
  console.log('Receipt is valid and on chain');
  console.log('Anchor TX:', verification.anchorTx);
}

Verify by Bundle Hash

const verification = await proofrails.verify.byHash('0x123...');

Get Verification Proof

const proof = await proofrails.verify.getProof('receipt-id');

console.log('Bundle Hash:', proof.bundleHash);
console.log('Block Number:', proof.blockNumber);
console.log('Timestamp:', proof.timestamp);

Live Updates

const listener = proofrails.events.listen('receipt-id', update => {
  console.log('Status:', update.status);

  if (update.status === 'anchored') {
    console.log('Receipt is now on chain');
    listener.stop();
  }
});

Embeddable Widgets

Generate Widget

const widget = proofrails.embed.widget('receipt-id', {
  theme: 'light',
  width: '100%',
  height: '400px'
});

document.getElementById('receipt').innerHTML = widget.iframeHtml;

Full Page URL

const pageUrl = proofrails.embed.fullPage('receipt-id');

Networks

const proofrails = new ProofRails({
  apiKey: 'your-key',
  network: 'coston2'
});
const proofrails = new ProofRails({
  apiKey: 'your-key',
  network: 'flare'
});

License

MIT

Support

Made with ❤️ by ProofRails