npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@unifiedflow/unified-flow-sdk

v1.0.11

Published

SDK for the Unified Flow program

Downloads

643

Readme

@unifiedflow/unified-flow-sdk

TypeScript SDK for interacting with the Unified Flow on-chain token vesting and streaming protocol on Solana.


Installation

npm install @unifiedflow/unified-flow-sdk

or

yarn add @unifiedflow/unified-flow-sdk

Peer Dependencies

npm install \
  @coral-xyz/anchor \
  @solana/web3.js \
  @solana/spl-token

Quick Start

Initialize Client

import { useMemo } from "react";
import { Program, AnchorProvider } from "@coral-xyz/anchor";
import { useConnection } from "@solana/wallet-adapter-react";

import {
  IDL,
  UnifiedFlowClient,
  type UnifiedFlow,
} from "@unifiedflow/unified-flow-sdk";

import { useWalletSession } from "@wallet-standard/react";

export function useUnifiedFlowClient() {
  const { connection } = useConnection();
  const wallet = useWalletSession();

  return useMemo(() => {
    if (!wallet) return null;

    const provider = new AnchorProvider(
      connection,
      {} as any,
      { commitment: "confirmed" }
    );

    const program = new Program(
      IDL,
      provider
    ) as Program<UnifiedFlow>;

    return new UnifiedFlowClient(
      program,
      wallet,
      connection,
      "confirmed"
    );
  }, [wallet, connection]);
}

Transaction Status Tracking

All transaction methods support an optional status callback.

await client.withdraw(streamPDA, (status) => {
  switch (status) {
    case "wallet_approval":
      console.log("Waiting for wallet approval");
      break;

    case "sending":
      console.log("Sending transaction");
      break;

    case "confirming":
      console.log("Confirming transaction");
      break;
  }
});

Available phases:

type TxProgressPhase =
  | "wallet_approval"
  | "sending"
  | "confirming";

Vesting Types

| Value | Type | Description | | ----- | --------- | ---------------------------------- | | 0 | LINEAR | Continuous linear vesting | | 1 | CLIFF | Entire allocation unlocks at cliff | | 2 | MILESTONE | Unlocks milestone-by-milestone |


API Reference

createStream

Creates a new stream.

const result = await client.createStream(
  recipient,
  mint,
  new BN(1_000_000),
  new BN(startTs),
  new BN(cliffTs),
  new BN(endTs),
  0,
  [],
  new BN(nonce)
);

console.log(result.signature);

Milestone Example

const milestones = [
  { amount: new BN(250_000) },
  { amount: new BN(250_000) },
  { amount: new BN(500_000) },
];

await client.createStream(
  recipient,
  mint,
  new BN(1_000_000),
  new BN(startTs),
  new BN(startTs),
  new BN(endTs),
  2,
  milestones,
  new BN(nonce)
);

Returns:

{
  signature: string;
}

withdraw

Withdraw vested tokens.

const result = await client.withdraw(
  streamPDA
);

console.log(result.signature);

The recipient must be the connected wallet.


cancel

Cancel a stream.

const result = await client.cancel(
  streamPDA
);

console.log(result.signature);

The creator must be the connected wallet.


unlockMilestone

Unlock a milestone.

const result = await client.unlockMilestone(
  streamPDA,
  0
);

console.log(result.signature);

editMilestone

Update a milestone allocation.

const result = await client.editMilestone(
  streamPDA,
  mint,
  milestoneIndex,
  new BN(newAmount)
);

console.log(result.signature);

editCliff

Update the cliff timestamp.

const result = await client.editCliff(
  streamPDA,
  new BN(newCliffTs)
);

console.log(result.signature);

editLinear

Extend a linear stream and/or deposit additional tokens.

const result = await client.editLinear(
  streamPDA,
  mint,
  new BN(newEndTs),
  new BN(topupAmount)
);

console.log(result.signature);

PDA Helpers

import {
  getConfigPDA,
  getStreamPDA,
  getMilestonePDA,
  getFeeVaultPDA,
  getVaultATA,
} from "@unifiedflow/unified-flow-sdk";

Stream PDA

const [streamPDA] = getStreamPDA(
  creator,
  recipient,
  nonce,
  programId
);

Milestone PDA

const [milestonePDA] = getMilestonePDA(
  streamPDA,
  milestoneIndex,
  programId
);

Chainlink Integration

Withdrawal fees are priced in USD and converted on-chain using Chainlink SOL/USD.

CHAINLINK_PROGRAM_ID
= HEvSKofvBgfaexv23kMabbYqxasxU3mQ4ibBMEmJWHny

SOL_USD_FEED
= 99B2bTijsU6f1GCT73HmdR7HCFFjGMBcPZY6jZ96ynrR

The SDK automatically includes these accounts during withdrawals.


Error Reference

| Error | Description | | ---------------------------- | ------------------------------------- | | AccountDiscriminatorMismatch | Wrong cluster or incorrect account | | AccountNotInitialized | PDA account does not exist | | InvalidMilestoneIndex | Milestone index out of range | | StreamNotActive | Stream already completed or cancelled |


Network Support

| Network | Status | | -------- | ------ | | Devnet | ✅ | | Mainnet | ✅ | | Localnet | ✅ |


License

MIT