Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "11.3.0",
"version": "11.3.1",
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"command": {
"run": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/common",
"version": "11.3.0",
"version": "11.3.1",
"description": "Common utilities and types used by streamflow packages.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/distributor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/distributor",
"version": "11.3.0",
"version": "11.3.1",
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/cjs/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/eslint-config",
"version": "11.3.0",
"version": "11.3.1",
"description": "ESLint configuration for Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/launchpad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/launchpad",
"version": "11.3.0",
"version": "11.3.1",
"description": "JavaScript SDK to interact with Streamflow Launchpad protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/cjs/index.cjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/staking/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/staking",
"version": "11.3.0",
"version": "11.3.1",
"description": "JavaScript SDK to interact with Streamflow Staking protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/cjs/index.cjs",
Expand Down
8 changes: 5 additions & 3 deletions packages/stream/__tests__/solana/streamClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe("SolanaStreamClient Transaction Builders", async () => {
});
});

test("should build multiple transactions with native SOL and include prepare transaction", async () => {
test("should build multiple transactions with native SOL and include wrap instructions per recipient", async () => {
// Arrange
const senderPublicKey = new PublicKey("11111111111111111111111111111112");
const mockData = {
Expand Down Expand Up @@ -418,8 +418,10 @@ describe("SolanaStreamClient Transaction Builders", async () => {
expect(result.transactions).toHaveLength(2);
expect(result.metadatas).toHaveLength(2);

// Should have a prepare transaction for native SOL handling
expect(result.prepareTx).toBeDefined();
// Wrap instructions are now included in each recipient's transaction, not in a separate prepareTx
expect(result.prepareTx).toBeUndefined();
// prepareWrappedAccount should be called once per recipient
expect(mockPrepareWrappedAccount).toHaveBeenCalledTimes(2);
});

test("should throw error when recipients array is empty", async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@streamflow/stream",
"version": "11.3.0",
"version": "11.3.1",
"description": "JavaScript SDK to interact with Streamflow protocol.",
"homepage": "https://github.com/streamflow-finance/js-sdk/",
"main": "./dist/cjs/index.cjs",
Expand Down
15 changes: 8 additions & 7 deletions packages/stream/solana/StreamClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,13 @@ export class SolanaStreamClient {
metadataPubKeys: metadataPubKeysExt?.[i] ? [metadataPubKeysExt[i]] : undefined,
};

const wrapInstructions: TransactionInstruction[] = [];
if (isNative) {
const totalFee = await this.getTotalFee({ address: partnerPublicKey.toString() });
const recipientAmount = calculateTotalAmountToDeposit(recipientData.amount, totalFee);
wrapInstructions.push(...(await prepareWrappedAccount(this.connection, sender.publicKey, recipientAmount)));
}

const { ixs, metadata, metadataPubKey } = await this.prepareCreateInstructions(
createStreamData,
createStreamExtParams,
Expand All @@ -862,20 +869,14 @@ export class SolanaStreamClient {

metadatas.push(metadataPubKey.toBase58());
instructionsBatch.push({
ixs,
ixs: [...wrapInstructions, ...ixs],
metadata,
recipient: recipientData.recipient,
});
}

const prepareInstructions = await this.getCreateATAInstructions([partnerPublicKey], mintPublicKey, sender, true);

if (isNative) {
const totalDepositedAmount = recipients.reduce((acc, recipient) => recipient.amount.add(acc), new BN(0));
const nativeInstructions = await prepareWrappedAccount(this.connection, sender.publicKey, totalDepositedAmount);
prepareInstructions.push(...nativeInstructions);
}

return {
instructionsBatch,
metadatas,
Expand Down
Loading