Skip to content
 
 

Repository files navigation

TrustFlow SDK

The official TypeScript SDK for the TrustFlow B2B Escrow Protocol. This library abstracts the complexities of the Stellar RPC, allowing developers to easily integrate decentralized milestone payments into their Node.js or browser applications.

Installation

npm install @trustflow/sdk

Quickstart

Initialize the client and create a new escrow agreement.

import { TrustFlowClient } from '@trustflow/sdk';
import { Networks, Keypair } from '@stellar/stellar-sdk';

// Initialize the client
const buyerKeypair = Keypair.fromSecret('S_BUYER_SECRET');
const client = new TrustFlowClient({
  rpcUrl: '[https://soroban-testnet.stellar.org:443](https://soroban-testnet.stellar.org:443)',
  networkPassphrase: Networks.TESTNET,
  contractId: 'C_TRUSTFLOW_CONTRACT_ID',
  keypair: buyerKeypair
});

async function createEscrow() {
  const sellerPubKey = 'G_SELLER...';
  const arbiterPubKey = 'G_ARBITER...';
  const usdcTokenId = 'C_USDC_CONTRACT_ID';
  const amount = 5000;

  try {
    // 1. Initialize terms
    const txHash = await client.escrow.initialize(sellerPubKey, arbiterPubKey, usdcTokenId, amount);
    console.log('Escrow Initialized. Tx:', txHash);
    
    // Note: The SDK will soon support returning the parsed escrowId directly.
  } catch (error) {
    console.error(error);
  }
}

createEscrow();

Testing

npm run test

Contributing

Read our CONTRIBUTING.md for guidelines on PRs, branch naming, and enterprise coding standards.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages