Overview & Background
packages/flowfi-sdk provides basic interfaces and generated bindings, but lacks high-level transaction construction, client-side wallet signing abstractions, and simulation pipelines. For third-party dApps, payroll providers, and automated bots to integrate with FlowFi without routing through the FlowFi backend API, the SDK needs full standalone transaction building capabilities.
Detailed Problem Statement
- High Barrier for Third-Party Integrations:
- External developers must manually build raw Soroban XDR operations and handle footprint resource estimation.
- Tight Backend Coupling:
- Currently, dApps are forced to depend on FlowFi's central backend API for stream operations rather than communicating directly with the Stellar ledger.
Technical Specification & Architecture
1. High-Level FlowFiClient API
Implement in packages/flowfi-sdk/src/client.ts:
export class FlowFiClient {
constructor(config: { rpcUrl: string; networkPassphrase: string; contractId: string });
async createStream(params: CreateStreamParams, signer: Signer): Promise<StreamResult>;
async batchWithdraw(streamIds: bigint[], signer: Signer): Promise<WithdrawResult>;
async topUpStream(streamId: bigint, amount: bigint, signer: Signer): Promise<void>;
async cancelStream(streamId: bigint, signer: Signer): Promise<void>;
async getStream(streamId: bigint): Promise<StreamDetails>;
async getClaimableAmount(streamId: bigint): Promise<bigint>;
}
2. Modular Signer Adapters
Implement in packages/flowfi-sdk/src/signers/:
FreighterSigner: In-browser extension signing.
KeypairSigner: Node.js secret key signing for automated payroll daemons.
CustomSigner: Generic interface for WalletConnect / hardware wallets.
3. Automatic Resource Simulation & Fee Padding
- Automatically invokes
simulateTransaction on Soroban RPC.
- Attaches computed authorization entries and foot-print keys.
- Adds configurable safety resource fee buffer.
Target Files
packages/flowfi-sdk/src/client.ts
packages/flowfi-sdk/src/builder.ts
packages/flowfi-sdk/src/signers/index.ts
packages/flowfi-sdk/README.md
packages/flowfi-sdk/tests/client.test.ts
Acceptance Criteria
Overview & Background
packages/flowfi-sdkprovides basic interfaces and generated bindings, but lacks high-level transaction construction, client-side wallet signing abstractions, and simulation pipelines. For third-party dApps, payroll providers, and automated bots to integrate with FlowFi without routing through the FlowFi backend API, the SDK needs full standalone transaction building capabilities.Detailed Problem Statement
Technical Specification & Architecture
1. High-Level FlowFiClient API
Implement in
packages/flowfi-sdk/src/client.ts:2. Modular Signer Adapters
Implement in
packages/flowfi-sdk/src/signers/:FreighterSigner: In-browser extension signing.KeypairSigner: Node.js secret key signing for automated payroll daemons.CustomSigner: Generic interface for WalletConnect / hardware wallets.3. Automatic Resource Simulation & Fee Padding
simulateTransactionon Soroban RPC.Target Files
packages/flowfi-sdk/src/client.tspackages/flowfi-sdk/src/builder.tspackages/flowfi-sdk/src/signers/index.tspackages/flowfi-sdk/README.mdpackages/flowfi-sdk/tests/client.test.tsAcceptance Criteria