Skip to content

Commit 6a4c6a6

Browse files
tatomir-streamflowdperdic-streamflowRolginRomanYolley
authored
v10 (#313)
* [skip alpha] Remove generic client and some aptos and sui code * [skip alpha] remove dependencies and build targets/exports/imports * [skip alpha] remove sui and aptos mention from readme * [skip alpha] Remove Solana named types, move constants, types and utils from unnecessary common sub-folders * [skip alpha] refactor to make it work * [skip alpha] some more * bump version to v10 * fix extra type in import statement * Fix examples build * some missed deps * remove payments * bump package versions * remove payments from moved type folder * Revert "remove payments" * Reapply "remove payments" This reverts commit e531e2c. * better naming for prepare instructions * support for array of stream data * applyCustomInstructions only once * lint * revert public API, needs fixing * Refactor metadata handling in SolanaStreamClient to use metadataPubKeysExt for stream creation. Do not override properties with the spread * proper non-null check for fee response * stricter check for null/undefined * feat: use sender as default partner (#320) * feat: new partner fee structure * lint * fix program ids set and partner schema * lint * rebase * Update docs * Update oracle API endpoint in docs and update release-notes --------- Co-authored-by: Dujo Perdić <[email protected]> Co-authored-by: roman.rolgin <[email protected]> Co-authored-by: Yolley <[email protected]>
1 parent 6ef4827 commit 6a4c6a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4958
-13160
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Streamflow
22

3-
Streamflow is a token vesting and streaming payments platform.
3+
Streamflow is a token vesting platform.
44

55
There are several ways to use **Streamflow**:
66

@@ -23,7 +23,7 @@ API Documentation available here:
2323
## JS SDK to interact with Streamflow protocols
2424

2525
This repo consists of js-sdk to interact with several protocol exposed by streamflow:
26-
- `packages/stream` - [Core Streamflow Protocol](packages/stream/README.md) that allows to create a vesting/payment/lock Stream to a Recipient;
26+
- `packages/stream` - [Core Streamflow Protocol](packages/stream/README.md) that allows to create a vesting/lock Stream to a Recipient;
2727
- `packages/distributor` - [Distributor Streamflow Protocol](packages/distributor/README.md) that allows to Airdrop tokens to large amount of Recipients (thousands or even millions);
2828
- `packages/common` - Common utilities and types used by Streamflow SDK;
2929

RELEASE_NOTES.md

Lines changed: 53 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,63 @@
1-
# Streamflow JS SDK v8.0.0 Release Notes
1+
# Streamflow JS SDK Release Notes
22

3-
## Overview
3+
## v10.0.0
44

5-
Version 8.0.0 improves how the Streamflow SDK works with modern JavaScript environments (like ES Modules and CommonJS) and different bundlers. This update makes using the SDK more reliable and predictable across various project setups.
5+
### Breaking Changes
66

7-
This guide focuses on the steps you need to take in your application to upgrade to v8.
7+
* **Removed Payments Stream Type:** The `StreamType.Payment` enum value has been removed. The `StreamType` enum now only includes `All`, `Vesting`, and `Lock`. If your code references `StreamType.Payment`, you'll need to update it to use one of the remaining types or remove the reference.
8+
* **Removed Multi-Chain Support:** All non-Solana blockchain implementations have been removed from the SDK:
9+
* **Aptos** support removed (`packages/stream/aptos/`)
10+
* **EVM** (Ethereum/Polygon/Avalanche) support removed (`packages/stream/evm/`)
11+
* **Sui** support removed (`packages/stream/sui/`)
12+
* The SDK is now **Solana-only**. If you were using any of these implementations, please see the v9 branch of the SDK which we will continue to support, but not activelty improve or add new features.
13+
* **Removed GenericStreamClient:** The `GenericStreamClient` and `BaseStreamClient` classes have been removed. The SDK now only provides `SolanaStreamClient` (exported as `SolanaStreamClient`). Update your imports:
14+
* **Before:** `import { GenericStreamClient } from "@streamflow/stream/common"`
15+
* **After:** `import { SolanaStreamClient } from "@streamflow/stream"`
16+
* **Partner Fee Structure Changes:** The partner fee structure has been updated. The `partner` parameter now defaults to the sender's address if not provided. Review your stream creation code to ensure partner fees are configured correctly.
817

9-
## Migration Steps for Your Application
18+
### New Features
1019

11-
Here's what you need to do to update your application to use Streamflow SDK v8:
20+
* **Price-based Streams (Aligned Streams) Documentation:** Added comprehensive documentation for creating and managing price-based streams that dynamically adjust unlock rates based on token price oracles. The documentation includes:
21+
* Creating price-based vesting streams
22+
* Creating price-based token locks
23+
* Fetching and accessing aligned stream data
24+
* Integration with Streamflow's Oracle API
1225

13-
* **Update Dependencies:** In your `package.json`, change the version for all `@streamflow/*` packages to `^8.0.0` (or the specific v8 release number) and run your package manager's install command (e.g., `npm install`, `yarn install`, `pnpm install`).
14-
* **Verify Import Paths for Sub-modules:**
15-
* If you only import from the main package entry point (e.g., `import { ... } from "@streamflow/stream";` or `require("@streamflow/stream")`), these imports should work without changes.
16-
* **If you import directly from sub-paths** (e.g., `@streamflow/distributor/solana` or internal build files like `dist/...`), review these. You should now use the officially supported entry points like `import { MerkleDistributor } from "@streamflow/distributor/solana";`. Check the relevant package's documentation or `package.json` `exports` field if you need specific sub-modules.
17-
* **Verify IDL JSON Imports:** If you import Streamflow's IDL JSON files directly, ensure you use the correct syntax for your environment:
18-
* **ESM/TypeScript:** `import myIdl from "@streamflow/[package_name]/solana/idl/[idl_name].json" with { type: "json" };`
19-
* **CommonJS:** `const myIdl = require("@streamflow/[package_name]/solana/idl/[idl_name].json");`
20-
* **Check Peer Dependencies:** The Streamflow SDK relies on certain external libraries (peer dependencies) that are *not* included directly in the SDK bundles. Ensure the following packages, with at least the specified versions, are listed as dependencies in your project's `package.json` and installed:
26+
### Enhancements
2127

22-
* **NPM Scoped Packages:**
23-
* `@coral-xyz/`
24-
* `@coral-xyz/borsh`: `^0.30.1`
25-
* `@solana/`
26-
* `@solana/buffer-layout`: `4.0.1`
27-
* `@solana/spl-token`: `0.4.9`
28-
* `@solana/wallet-adapter-base`: `0.9.19`
29-
* `@solana/web3.js`: `1.95.4`
30-
* **Other Packages:**
31-
* `bn.js`: `5.2.1`
32-
* `borsh`: `^2.0.0`
28+
* **Improved Metadata Handling:** Enhanced support for custom metadata public keys via the `metadataPubKeys` parameter in stream creation methods. You can now pass an array of metadata public keys for batch operations.
29+
* **Fixed Double ATA Creation:** Resolved an issue where WSOL (wrapped SOL) streams would attempt to create duplicate Associated Token Accounts when the recipient and sender were the same address.
30+
* **Removed Treasury ATA Creation:** The SDK no longer automatically creates Streamflow treasury ATA accounts, reducing transaction size and costs.
31+
* **Squads Ephemeral Signatures Support:** Fixed support for Squads multisig wallets using ephemeral signatures.
32+
* **Better Error Handling:** Improved error handling and null/undefined checks throughout the SDK.
3333

34-
*(Note: Node.js built-in modules like `buffer`, `crypto`, `fs`, etc., are also externalized but do not need to be explicitly installed as they are part of the Node.js environment).*
35-
The easiest way to include these is using a bundler's plugin.
36-
For polyfills take a look:
37-
1. Vite - https://www.npmjs.com/package/vite-plugin-node-polyfills
38-
2. Rsbuild - https://github.com/rspack-contrib/rsbuild-plugin-node-polyfill
39-
3. Webpack - https://www.npmjs.com/package/node-polyfill-webpack-plugin
34+
### Documentation Updates
4035

41-
## Technical Details (Why these changes?)
36+
* Enhanced `@streamflow/stream` README with detailed examples for price-based stream creation
37+
* Added examples for fetching aligned stream properties using `getOne()`, `get()`, and `searchStreams()`
38+
* Documented Oracle API integration for fetching price oracle addresses
39+
* Removed references to non-Solana chains from documentation
4240

43-
*For users interested in the underlying changes:* Version 8 introduces a standardized build process using `tsup` across all packages. This creates distinct `dist/esm` (ECMAScript Modules) and `dist/cjs` (CommonJS) output directories. The `package.json` `exports` map in each package has been carefully configured to ensure that Node.js and bundlers automatically select the correct format (ESM or CJS) based on how you import the package. This resolves previous inconsistencies, particularly with loading specific files like IDLs in CommonJS projects. IDL `.json` files are now explicitly copied during the build and correctly referenced in the exports map. The list of externalized peer dependencies (defined in `tsup.config.base.ts`) remains largely the same, requiring users to manage these dependencies in their own projects.
41+
### Migration Guide
42+
43+
If you're upgrading from v8.x or v9.x to v10.0.0:
44+
45+
1. **Update Imports:**
46+
* Remove any imports from `@streamflow/stream/common`, `@streamflow/stream/aptos`, `@streamflow/stream/evm`, or `@streamflow/stream/sui`
47+
* Use only `@streamflow/stream` for Solana-specific imports
48+
* Replace `GenericStreamClient` with `SolanaStreamClient`
49+
50+
2. **Update Stream Type References:**
51+
* Remove any code that references `StreamType.Payment`
52+
* Update your code to use `StreamType.Vesting`, `StreamType.Lock`, or `StreamType.All`
53+
54+
3. **Review Partner Fee Configuration:**
55+
* If you were explicitly setting `partner` to `undefined` or relying on default behavior, verify that the new default (sender address) works for your use case
56+
* Update partner fee logic if needed
57+
58+
4. **Update Dependencies:**
59+
* Remove any non-Solana blockchain dependencies from your `package.json`
60+
* Ensure you're only using Solana-related packages
61+
62+
5. **Test Metadata Handling:**
63+
* If you're using custom metadata public keys, test that the new `metadataPubKeys` array parameter works correctly with your implementation

examples/js-cjs-bundled/src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
* 4. Bundling with Vite
99
*/
1010

11-
const { StreamflowSolana } = require("@streamflow/stream");
11+
const { SolanaStreamClient } = require("@streamflow/stream");
1212
const { StreamflowDistributorSolana } = require("@streamflow/distributor");
1313
const { SolanaStakingClient } = require("@streamflow/staking");
1414
const { SolanaLaunchpadClient } = require("@streamflow/launchpad");
1515
const { ICluster } = require("@streamflow/common");
1616
// Other entrypoints to test that the package.json is correct
1717
const { MerkleDistributor } = require("@streamflow/distributor/solana");
18-
const { prepareTransaction } = require("@streamflow/common/solana");
18+
const { prepareTransaction } = require("@streamflow/common");
1919

2020
// Import IDL files to test import resolving
2121
const streamflowAlignedUnlocksIDL = require("@streamflow/stream/solana/idl/streamflow_aligned_unlocks.json");
@@ -45,10 +45,10 @@ function verifyEnvironment() {
4545
// but we can check if the modules were loaded correctly
4646
try {
4747
// Verify StreamClient is loaded correctly
48-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
49-
throw new Error("StreamflowSolana.SolanaStreamClient is not a constructor function");
48+
if (typeof SolanaStreamClient !== "function") {
49+
throw new Error("SolanaStreamClient is not a constructor function");
5050
}
51-
console.log("Verified: StreamflowSolana.SolanaStreamClient loaded correctly");
51+
console.log("Verified: SolanaStreamClient loaded correctly");
5252

5353
// Verify DistributorClient is loaded correctly
5454
if (typeof StreamflowDistributorSolana.SolanaDistributorClient !== "function") {
@@ -145,7 +145,7 @@ async function main() {
145145
const cluster = ICluster.Devnet;
146146

147147
// Correct initialization:
148-
const streamClient = new StreamflowSolana.SolanaStreamClient({ clusterUrl, cluster });
148+
const streamClient = new SolanaStreamClient({ clusterUrl, cluster });
149149

150150
const distributorClient = new StreamflowDistributorSolana.SolanaDistributorClient({
151151
clusterUrl,

examples/js-cjs-unbundled/src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
*/
99

1010
// Import specific exports from each package using CommonJS require
11-
const { StreamflowSolana } = require("@streamflow/stream");
11+
const { SolanaStreamClient } = require("@streamflow/stream");
1212
const { ICluster, ContractError } = require("@streamflow/common");
1313
const { StreamflowDistributorSolana } = require("@streamflow/distributor");
1414
const { SolanaStakingClient } = require("@streamflow/staking");
1515
const { SolanaLaunchpadClient } = require("@streamflow/launchpad");
1616

1717
// Other entrypoints to test that the package.json is correct
1818
const { MerkleDistributor } = require("@streamflow/distributor/solana");
19-
const { prepareTransaction } = require("@streamflow/common/solana");
19+
const { prepareTransaction } = require("@streamflow/common");
2020

2121
// Import IDL files to test import resolving
2222
const streamflowAlignedUnlocksIDL = require("@streamflow/stream/solana/idl/streamflow_aligned_unlocks.json");
@@ -52,7 +52,7 @@ function verifyEnvironment() {
5252
}
5353

5454
// Verify StreamClient is loaded correctly
55-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
55+
if (typeof SolanaStreamClient !== "function") {
5656
throw new Error("SolanaStreamClient is not a constructor function");
5757
}
5858
console.log("Verified: SolanaStreamClient loaded correctly");
@@ -152,7 +152,7 @@ async function main() {
152152

153153
// Initialize the Streamflow Solana client
154154
console.log("Initializing Streamflow Solana client...");
155-
const streamClient = new StreamflowSolana.SolanaStreamClient({ clusterUrl, cluster });
155+
const streamClient = new SolanaStreamClient({ clusterUrl, cluster });
156156

157157
// Initialize the Distributor Solana client
158158
console.log("Initializing Distributor Solana client...");

examples/js-esm-bundled/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* 4. Bundling with Vite
99
*/
1010

11-
import { StreamflowSolana } from "@streamflow/stream";
11+
import { SolanaStreamClient } from "@streamflow/stream";
1212
import { StreamflowDistributorSolana } from "@streamflow/distributor";
1313
import { SolanaStakingClient } from "@streamflow/staking";
1414
import { SolanaLaunchpadClient } from "@streamflow/launchpad";
@@ -42,7 +42,7 @@ function verifyEnvironment() {
4242
// but we can check if the modules were loaded correctly
4343
try {
4444
// Verify StreamClient is loaded correctly
45-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
45+
if (typeof SolanaStreamClient !== "function") {
4646
throw new Error("SolanaStreamClient is not a constructor function");
4747
}
4848
console.log("Verified: SolanaStreamClient loaded correctly");
@@ -135,7 +135,7 @@ async function main() {
135135
console.log("Initializing Streamflow clients...");
136136

137137
// Stream client
138-
const streamClient = new StreamflowSolana.SolanaStreamClient({
138+
const streamClient = new SolanaStreamClient({
139139
clusterUrl,
140140
cluster,
141141
});

examples/js-esm-unbundled/src/start-node18.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
*/
99

1010
// Import specific exports from each package
11-
import { StreamflowSolana } from "@streamflow/stream";
11+
import { SolanaStreamClient } from "@streamflow/stream";
1212
import { ICluster, ContractError } from "@streamflow/common";
1313
import { StreamflowDistributorSolana } from "@streamflow/distributor";
1414
import { SolanaStakingClient } from "@streamflow/staking";
1515
import { SolanaLaunchpadClient } from "@streamflow/launchpad";
1616
// Other entrypoints to test that the package.json is correct
1717
import { MerkleDistributor } from "@streamflow/distributor/solana";
18-
import {prepareTransaction} from "@streamflow/common/solana";
18+
import {prepareTransaction} from "@streamflow/common";
1919

2020
// Import IDL files to test import resolving
2121
import streamflowAlignedUnlocksIDL from "@streamflow/stream/solana/idl/streamflow_aligned_unlocks.json" assert { type: "json" };
@@ -53,7 +53,7 @@ function verifyEnvironment() {
5353
}
5454

5555
// Verify StreamClient is loaded correctly
56-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
56+
if (typeof SolanaStreamClient !== "function") {
5757
throw new Error("SolanaStreamClient is not a constructor function");
5858
}
5959
console.log("Verified: SolanaStreamClient loaded correctly");
@@ -136,7 +136,7 @@ async function main() {
136136

137137
// Initialize the Streamflow Solana client
138138
console.log("Initializing Streamflow Solana client...");
139-
const streamClient = new StreamflowSolana.SolanaStreamClient(clusterUrl, cluster);
139+
const streamClient = new SolanaStreamClient(clusterUrl, cluster);
140140

141141
// Initialize the Distributor Solana client
142142
console.log("Initializing Distributor Solana client...");

examples/js-esm-unbundled/src/start-node20.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
*/
99

1010
// Import specific exports from each package
11-
import { StreamflowSolana } from "@streamflow/stream";
11+
import { SolanaStreamClient } from "@streamflow/stream";
1212
import { ICluster, ContractError } from "@streamflow/common";
1313
import { StreamflowDistributorSolana } from "@streamflow/distributor";
1414
import { SolanaStakingClient } from "@streamflow/staking";
1515
import { SolanaLaunchpadClient } from "@streamflow/launchpad";
1616
// Other entrypoints to test that the package.json is correct
1717
import { MerkleDistributor } from "@streamflow/distributor/solana";
18-
import {prepareTransaction} from "@streamflow/common/solana";
18+
import {prepareTransaction} from "@streamflow/common";
1919

2020
// Import IDL files to test import resolving
2121
import streamflowAlignedUnlocksIDL from "@streamflow/stream/solana/idl/streamflow_aligned_unlocks.json" with { type: "json" };
@@ -53,7 +53,7 @@ function verifyEnvironment() {
5353
}
5454

5555
// Verify StreamClient is loaded correctly
56-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
56+
if (typeof SolanaStreamClient !== "function") {
5757
throw new Error("SolanaStreamClient is not a constructor function");
5858
}
5959
console.log("Verified: SolanaStreamClient loaded correctly");
@@ -136,7 +136,7 @@ async function main() {
136136

137137
// Initialize the Streamflow Solana client
138138
console.log("Initializing Streamflow Solana client...");
139-
const streamClient = new StreamflowSolana.SolanaStreamClient(clusterUrl, cluster);
139+
const streamClient = new SolanaStreamClient(clusterUrl, cluster);
140140

141141
// Initialize the Distributor Solana client
142142
console.log("Initializing Distributor Solana client...");

examples/ts-cjs-bundled/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Stream, StreamflowSolana } from "@streamflow/stream";
1+
import { Stream, SolanaStreamClient } from "@streamflow/stream";
22
import { ICluster } from "@streamflow/common";
33
import { SolanaStakingClient } from "@streamflow/staking";
44
import { StreamflowDistributorSolana } from "@streamflow/distributor";
55
import { SolanaLaunchpadClient } from "@streamflow/launchpad";
66
// Other entrypoints to test that the package.json is correct
77
import { MerkleDistributor } from "@streamflow/distributor/solana";
8-
import {prepareTransaction} from "@streamflow/common/solana";
8+
import {prepareTransaction} from "@streamflow/common";
99

1010
// Import IDL files to test import resolving
1111
// Note: Using require for JSON imports in CJS context
@@ -36,7 +36,7 @@ function verifyEnvironment() {
3636
// but we can check if the modules were loaded correctly
3737
try {
3838
// Verify StreamClient is loaded correctly
39-
if (typeof StreamflowSolana.SolanaStreamClient !== "function") {
39+
if (typeof SolanaStreamClient !== "function") {
4040
throw new Error("SolanaStreamClient is not a constructor function");
4141
}
4242
console.log("Verified: SolanaStreamClient loaded correctly");
@@ -132,7 +132,7 @@ async function main() {
132132
const cluster = ICluster.Devnet;
133133

134134
// Initialize the Streamflow client
135-
const streamClient = new StreamflowSolana.SolanaStreamClient({ clusterUrl, cluster });
135+
const streamClient = new SolanaStreamClient({ clusterUrl, cluster });
136136
console.log("SolanaStreamClient initialized successfully");
137137

138138
console.log("Available clusters:", Object.values(ICluster));

0 commit comments

Comments
 (0)