Back to Home

INVORA SDK

The INVORA SDK enables developers to integrate invoice issuance, credit access, and loan execution into their applications with a simple, type-safe API.

SDK Repository: In Progress

The INVORA SDK is currently under active development. Check back soon for the official release.

Coming Soon

Overview

The INVORA SDK provides a comprehensive toolkit for integrating digital invoice management and invoice-backed credit into any application. Built with TypeScript, the SDK offers full type safety, extensive documentation, and a developer-friendly API.

Whether you're building a business management platform, an accounting system, or a financial services application, the INVORA SDK handles all the complexity of blockchain interactions, credit evaluations, and loan management behind a clean, intuitive interface.

Planned Capabilities

Invoice Creation & Management

Create, update, and manage digital invoices with full on-chain verification. The SDK handles all blockchain interactions, signature requirements, and validation logic.

const invoice = await invoraClient.createInvoice({
amount: 1000,
recipient: "wallet_address",
dueDate: Date.now() + 30 * 24 * 60 * 60 * 1000
})

Credit Evaluation & Submission

Submit invoices for credit evaluation and receive real-time creditworthiness assessments. Access detailed scoring breakdowns and eligible loan terms.

const evaluation = await invoraClient.evaluateCredit({
invoiceId
})

// Returns: { score, loanAmount, interestRate, terms }

Loan Request Execution

Execute loan requests against verified invoices with a single function call. The SDK manages transaction signing, error handling, and confirmation tracking.

const loan = await invoraClient.requestLoan({
invoiceId,
amount: 800,
terms: "30_days"
})

Wallet-Based Authorization

Seamless integration with Solana wallet adapters. The SDK automatically handles wallet connection, transaction signing, and user authorization flows.

const client = new InvoraClient({
wallet,
network: "mainnet"
})

// All operations require wallet signature

Loan Lifecycle Tracking

Monitor active loans, track repayment schedules, and receive real-time updates on loan status. Subscribe to events for automated notifications.

const loans = await invoraClient.getActiveLoans()

loans.forEach(loan => {
console.log(loan.status, loan.dueDate)
})

API Reference

InvoraClient

The main client class for interacting with the INVORA protocol. All operations require a connected Solana wallet.

Constructor

new InvoraClient(config: InvoraConfig)

Configuration parameters:

wallet- WalletContextState | Wallet adapter instance
network- "mainnet-beta" | "devnet" | "testnet"
rpcEndpoint?- Custom RPC endpoint (optional)
programId?- Custom program ID (optional)

Invoice Methods

createInvoice(params: CreateInvoiceParams): Promise<Invoice>

Creates a new on-chain invoice with verification.

interface CreateInvoiceParams {
amount: number
recipient: string // Wallet address
dueDate: number // Unix timestamp
description: string
metadata?: Record<string, any>
currency?: "USDC" | "SOL"
}
getInvoice(invoiceId: string): Promise<Invoice>

Retrieves invoice details by ID from the blockchain.

listInvoices(filters?: InvoiceFilters): Promise<Invoice[]>

Lists all invoices for the connected wallet with optional filters.

cancelInvoice(invoiceId: string): Promise<Transaction>

Cancels an unpaid invoice. Only invoice issuer can cancel.

Credit & Scoring Methods

evaluateCredit(params: CreditEvalParams): Promise<CreditEvaluation>

Evaluates creditworthiness for an invoice or wallet address.

interface CreditEvaluation {
score: number // 0-1000
grade: "AAA" | "AA" | "A" | "BBB" | "BB" | "B" | "C"
maxLoanAmount: number
interestRate: number // Annual percentage
loanToValueRatio: number
factors: CreditFactors
timestamp: number
}
getCreditScore(walletAddress?: string): Promise<CreditScore>

Gets the credit score for a wallet. Uses connected wallet if address not provided.

getCreditHistory(): Promise<CreditHistory[]>

Retrieves complete credit history including all evaluations and score changes.

Loan Methods

requestLoan(params: LoanRequestParams): Promise<Loan>

Requests a loan against a verified invoice.

interface LoanRequestParams {
invoiceId: string
amount: number
term: number // Days
interestRate?: number // Override suggested rate
collateralAmount?: number
}
getActiveLoans(): Promise<Loan[]>

Lists all active loans for the connected wallet.

getLoanDetails(loanId: string): Promise<LoanDetails>

Gets comprehensive details for a specific loan including payment schedule.

repayLoan(loanId: string, amount?: number): Promise<Transaction>

Makes a payment towards a loan. Pays full amount if not specified.

getLoanHistory(): Promise<Loan[]>

Retrieves complete loan history including closed and defaulted loans.

Event Subscription

on(event: string, callback: Function): void

Subscribe to protocol events for real-time updates.

// Available events
client.on('invoice:created', callback)
client.on('invoice:paid', callback)
client.on('loan:approved', callback)
client.on('loan:repaid', callback)
client.on('credit:updated', callback)

Integration Examples

Complete Invoice-to-Loan Flow

Full example showing invoice creation, credit evaluation, and loan request execution.

import { InvoraClient } from '@invora/sdk'
import { useWallet } from '@solana/wallet-adapter-react'

async function processInvoiceFinancing() {
const { wallet } = useWallet()
const client = new InvoraClient({ wallet, network: 'mainnet-beta' })

// Step 1: Create invoice
const invoice = await client.createInvoice({
amount: 5000,
recipient: 'recipient_wallet',
dueDate: Date.now() + 30 * 24 * 60 * 60 * 1000,
description: 'Q1 Consulting Services',
currency: 'USDC'
})

// Step 2: Evaluate credit
const evaluation = await client.evaluateCredit({
invoiceId: invoice.id
})

// Step 3: Request loan if qualified
if (evaluation.score > 600) {
const loan = await client.requestLoan({
invoiceId: invoice.id,
amount: evaluation.maxLoanAmount * 0.8, // 80% LTV
term: 30
})

console.log('Loan approved:', loan.id)
}
}

Real-Time Event Monitoring

Subscribe to protocol events for instant notifications and UI updates.

const client = new InvoraClient({ wallet, network: 'mainnet-beta' })

// Listen for invoice payments
client.on('invoice:paid', (event) => {
console.log('Invoice paid:', event.invoiceId)
notifyUser('Payment received!')
})

// Listen for loan approvals
client.on('loan:approved', (event) => {
updateDashboard(event.loanDetails)
})

// Listen for credit score updates
client.on('credit:updated', (event) => {
refreshCreditScore(event.newScore)
})

Error Handling Best Practices

Robust error handling for production applications with user-friendly messages.

try {
const loan = await client.requestLoan(params)
} catch (error) {
if (error instanceof InsufficientCreditError) {
// Credit score too low
showMessage('Credit score insufficient for this loan amount')
} else if (error instanceof WalletNotConnectedError) {
// User needs to connect wallet
promptWalletConnection()
} else if (error instanceof InsufficientFundsError) {
// Protocol liquidity issue
showMessage('Insufficient protocol liquidity. Try again later.')
} else {
// Generic error
console.error('Loan request failed:', error)
showMessage('Transaction failed. Please try again.')
}
}

React Hook Integration

Custom React hooks for seamless integration in React applications.

import { useInvora } from '@invora/sdk/react'

function InvoiceManager() {
const {
client,
connected,
createInvoice,
getActiveLoans
} = useInvora()

const handleCreate = async () => {
const invoice = await createInvoice({
amount: 1000,
recipient: recipientAddress,
dueDate: Date.now() + 2592000000
})
}

return <div>...</div>
}

Testing & Development

Development Environment

The SDK supports both testnet and devnet for development. Use devnet for rapid iteration and testnet for pre-production testing.

const client = new InvoraClient({
wallet,
network: 'devnet', // or 'testnet'
rpcEndpoint: 'https://api.devnet.solana.com'
})

Mock Data & Testing

The SDK includes mock providers for unit testing without blockchain interactions.

import { MockInvoraClient } from '@invora/sdk/testing'

describe('Invoice Flow', () => {
it('creates invoice successfully', async () => {
const client = new MockInvoraClient()
const invoice = await client.createInvoice(params)
expect(invoice.id).toBeDefined()
})
})

Production Deployment

Best practices for deploying INVORA-integrated applications to production.

RPC Endpoints:Use dedicated RPC endpoints (e.g., QuickNode, Alchemy) for production reliability
Error Monitoring:Integrate with Sentry or similar services to track SDK errors and transaction failures
Rate Limiting:Implement client-side rate limiting to avoid RPC throttling
Transaction Confirmation:Always wait for transaction confirmation before updating UI state

Installation

Once available, the SDK will be distributed via npm and can be installed with your preferred package manager:

npm install @invora/sdk
yarn add @invora/sdk
pnpm add @invora/sdk