@streamflow/stream 12.5.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,6 +102,62 @@
102
102
  ],
103
103
  "args": []
104
104
  },
105
+ {
106
+ "name": "claim_routed_fee",
107
+ "discriminator": [
108
+ 21,
109
+ 196,
110
+ 95,
111
+ 101,
112
+ 117,
113
+ 238,
114
+ 89,
115
+ 30
116
+ ],
117
+ "accounts": [
118
+ {
119
+ "name": "authority",
120
+ "signer": true
121
+ },
122
+ {
123
+ "name": "metadata",
124
+ "writable": true
125
+ },
126
+ {
127
+ "name": "escrow_tokens",
128
+ "writable": true
129
+ },
130
+ {
131
+ "name": "streamflow_treasury",
132
+ "writable": true
133
+ },
134
+ {
135
+ "name": "streamflow_treasury_tokens",
136
+ "writable": true
137
+ },
138
+ {
139
+ "name": "sender_tokens",
140
+ "writable": true
141
+ },
142
+ {
143
+ "name": "mint",
144
+ "writable": true
145
+ },
146
+ {
147
+ "name": "token_program"
148
+ }
149
+ ],
150
+ "args": [
151
+ {
152
+ "name": "destination",
153
+ "type": {
154
+ "defined": {
155
+ "name": "RoutedFeeDestination"
156
+ }
157
+ }
158
+ }
159
+ ]
160
+ },
105
161
  {
106
162
  "name": "create",
107
163
  "discriminator": [
@@ -1126,30 +1182,6 @@
1126
1182
  ],
1127
1183
  "args": []
1128
1184
  },
1129
- {
1130
- "name": "request_cancel",
1131
- "discriminator": [
1132
- 244,
1133
- 78,
1134
- 42,
1135
- 227,
1136
- 165,
1137
- 174,
1138
- 94,
1139
- 167
1140
- ],
1141
- "accounts": [
1142
- {
1143
- "name": "authority",
1144
- "signer": true
1145
- },
1146
- {
1147
- "name": "metadata",
1148
- "writable": true
1149
- }
1150
- ],
1151
- "args": []
1152
- },
1153
1185
  {
1154
1186
  "name": "topup",
1155
1187
  "discriminator": [
@@ -1463,30 +1495,22 @@
1463
1495
  "type": "u64"
1464
1496
  }
1465
1497
  ]
1466
- },
1498
+ }
1499
+ ],
1500
+ "types": [
1467
1501
  {
1468
- "name": "withdraw_cancel_request",
1469
- "discriminator": [
1470
- 91,
1471
- 137,
1472
- 171,
1473
- 103,
1474
- 142,
1475
- 205,
1476
- 96,
1477
- 75
1478
- ],
1479
- "accounts": [
1480
- {
1481
- "name": "authority",
1482
- "signer": true
1483
- },
1484
- {
1485
- "name": "metadata",
1486
- "writable": true
1487
- }
1488
- ],
1489
- "args": []
1502
+ "name": "RoutedFeeDestination",
1503
+ "type": {
1504
+ "kind": "enum",
1505
+ "variants": [
1506
+ {
1507
+ "name": "Treasury"
1508
+ },
1509
+ {
1510
+ "name": "Sender"
1511
+ }
1512
+ ]
1513
+ }
1490
1514
  }
1491
1515
  ]
1492
- }
1516
+ }
@@ -1,5 +1,5 @@
1
- import { D as DecodedStream, B as BatchItem, a as BatchItemResult, I as IUpdateData, S as StreamType, b as Stream, A as AlignedStream, c as ICreateStreamData, d as ICreateAlignedStreamData, e as ISearchStreams } from '../index-Cu0If4Dd.js';
2
- export { f as Account, g as AlignedContract, h as AlignedProxyErrorCode, i as AlignedStreamData, j as AlignedUnlocksContract, k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, n as BatchItemError, o as BatchItemSuccess, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, s as ChangeOracleParams, t as ClientCreationOptions, u as Contract, v as ContractErrorCode, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, z as CreateParams, E as CreateTestOracleParams, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, L as IAlignedStreamConfig, M as IBaseStreamConfig, N as ICancelData, O as ICreateExt, P as ICreateLinearStreamData, Q as ICreateLockBatchParams, R as ICreateLockParams, T as ICreateMultiError, U as ICreateMultipleAlignedStreamData, V as ICreateMultipleLinearStreamData, W as ICreateMultipleStreamData, X as ICreateResult, Y as ICreateStreamExt, Z as ICreateStreamInstructions, _ as ICreateVestingBatchParams, $ as ICreateVestingParams, a0 as IFees, a1 as IGetAllData, a2 as IGetFeesData, a3 as IGetOneData, a4 as IInteractData, a5 as IInteractStreamExt, a6 as ILockBatchRecipient, a7 as IMultiTransactionResult, a8 as IPrepareCreateStreamExt, a9 as IPrepareStreamExt, aa as IPrepareTopUpstreamExt, ab as IRecipient, ac as IRequestCancelData, ad as ITopUpData, ae as ITopUpStreamExt, af as ITransactionExtWithInstructions, ag as ITransactionResult, ah as ITransferData, ai as IVestingBatchRecipient, aj as IWithdrawCancelRequestData, ak as IWithdrawData, al as InstructionGenerator, am as InstructionResult, an as Invoker, ao as LinearStream, ap as MetadataRecipientHashMap, aq as NativeOptions, ar as OracleType, as as OracleTypeName, at as SignFn, au as SolanaStreamClient, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, ay as TestOracle, az as TopupFn, aA as TransactionSchedulingOptions, aB as TransferFn, aC as UpdateFn, aD as UpdateTestOracleParams, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from '../index-Cu0If4Dd.js';
1
+ import { D as DecodedStream, B as BatchItem, a as BatchItemResult, R as RoutedFeeDestination, I as IUpdateData, S as StreamType, b as Stream, A as AlignedStream, c as ICreateStreamData, d as ICreateAlignedStreamData, e as ISearchStreams } from '../index-CroMeFk7.js';
2
+ export { f as Account, g as AlignedContract, h as AlignedProxyErrorCode, i as AlignedStreamData, j as AlignedUnlocksContract, k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, n as BatchItemError, o as BatchItemSuccess, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, s as ChangeOracleParams, t as ClientCreationOptions, u as Contract, v as ContractErrorCode, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, z as CreateParams, E as CreateTestOracleParams, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, L as IAlignedStreamConfig, M as IBaseStreamConfig, N as ICancelData, O as IClaimRoutedFeeData, P as ICreateExt, Q as ICreateLinearStreamData, T as ICreateLockBatchParams, U as ICreateLockParams, V as ICreateMultiError, W as ICreateMultipleAlignedStreamData, X as ICreateMultipleLinearStreamData, Y as ICreateMultipleStreamData, Z as ICreateResult, _ as ICreateStreamExt, $ as ICreateStreamInstructions, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a2 as IFees, a3 as IGetAllData, a4 as IGetFeesData, a5 as IGetOneData, a6 as IInteractData, a7 as IInteractStreamExt, a8 as ILockBatchRecipient, a9 as IMultiTransactionResult, aa as IPrepareCreateStreamExt, ab as IPrepareStreamExt, ac as IPrepareTopUpstreamExt, ad as IRecipient, ae as ITopUpData, af as ITopUpStreamExt, ag as ITransactionExtWithInstructions, ah as ITransactionResult, ai as ITransferData, aj as IVestingBatchRecipient, ak as IWithdrawData, al as InstructionGenerator, am as InstructionResult, an as Invoker, ao as LinearStream, ap as MetadataRecipientHashMap, aq as NativeOptions, ar as OracleType, as as OracleTypeName, at as SignFn, au as SolanaStreamClient, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, ay as TestOracle, az as TopupFn, aA as TransactionSchedulingOptions, aB as TransferFn, aC as UpdateFn, aD as UpdateTestOracleParams, aE as WithdrawFn, aF as buildLockBatchParams, aG as buildLockParams, aH as buildTransaction, aI as buildVestingBatchParams, aJ as buildVestingParams, aK as cancel, aL as computeAmountPerPeriod, aM as create, aN as createBatch, aO as createClientFromEnv, aP as createLock, aQ as createLockBatch, aR as createVesting, aS as createVestingBatch, aT as execute, aU as executeBatch, aV as executeBatchSequential, aW as resolveConnection, aX as resolveDuration, aY as sign, aZ as topup, a_ as transfer, a$ as update, b0 as withdraw } from '../index-CroMeFk7.js';
3
3
  import { ConfirmationParams, ThrottleParams } from '@streamflow/common';
4
4
  export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
5
5
  import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
@@ -231,16 +231,17 @@ interface TransferAccounts {
231
231
  systemProgram: PublicKey;
232
232
  }
233
233
  declare const transferStreamInstruction: (programId: PublicKey, { authority, newRecipient, newRecipientTokens, metadata, mint, rent, tokenProgram, associatedTokenProgram, systemProgram, }: TransferAccounts) => Promise<TransactionInstruction>;
234
- interface RequestCancelAccounts {
235
- authority: PublicKey;
236
- metadata: PublicKey;
237
- }
238
- declare const requestCancelStreamInstruction: (programId: PublicKey, { authority, metadata }: RequestCancelAccounts) => Promise<TransactionInstruction>;
239
- interface WithdrawCancelRequestAccounts {
234
+ interface ClaimRoutedFeeAccounts {
240
235
  authority: PublicKey;
241
236
  metadata: PublicKey;
237
+ escrowTokens: PublicKey;
238
+ streamflowTreasury: PublicKey;
239
+ streamflowTreasuryTokens: PublicKey;
240
+ senderTokens: PublicKey;
241
+ mint: PublicKey;
242
+ tokenProgram: PublicKey;
242
243
  }
243
- declare const withdrawCancelRequestInstruction: (programId: PublicKey, { authority, metadata }: WithdrawCancelRequestAccounts) => Promise<TransactionInstruction>;
244
+ declare const claimRoutedFeeStreamInstruction: (destination: RoutedFeeDestination, programId: PublicKey, { authority, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, senderTokens, mint, tokenProgram, }: ClaimRoutedFeeAccounts) => Promise<TransactionInstruction>;
244
245
  interface TopupAccounts {
245
246
  sender: PublicKey;
246
247
  senderTokens: PublicKey;
@@ -611,4 +612,4 @@ declare const createClient: (options?: ApiClientOptions) => ApiClient;
611
612
 
612
613
  declare const transformContract: (schema: ContractSchema) => Promise<Stream>;
613
614
 
614
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedStream, type ApiClient, type ApiClientOptions, BatchItem, BatchItemResult, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type Chain, type ContractSchema, type ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, type DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type GetContractsOptions, ICreateAlignedStreamData, ICreateStreamData, ISearchStreams, IUpdateData, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, type PriceOracleType, REPOPULATED_METADATA_SEED, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, Stream, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TabulariumContract, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createClient, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, requestCancelStreamInstruction, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawCancelRequestInstruction, withdrawStreamInstruction };
615
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedStream, type ApiClient, type ApiClientOptions, BatchItem, BatchItemResult, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type Chain, type ContractSchema, type ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, type DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type GetContractsOptions, ICreateAlignedStreamData, ICreateStreamData, ISearchStreams, IUpdateData, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, type PriceOracleType, REPOPULATED_METADATA_SEED, RoutedFeeDestination, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, Stream, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TabulariumContract, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, claimRoutedFeeStreamInstruction, createClient, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawStreamInstruction };
@@ -1071,25 +1071,29 @@ var transferStreamInstruction = async (programId, {
1071
1071
  data
1072
1072
  });
1073
1073
  };
1074
- var requestCancelStreamInstruction = async (programId, { authority, metadata }) => {
1075
- const keys = [
1076
- { pubkey: authority, isSigner: true, isWritable: false },
1077
- { pubkey: metadata, isSigner: false, isWritable: true }
1078
- ];
1079
- const data = Buffer.concat([Buffer.from(await sha256.digest("global:request_cancel")).slice(0, 8), Buffer.alloc(10)]);
1080
- return new TransactionInstruction({
1081
- keys,
1082
- programId,
1083
- data
1084
- });
1085
- };
1086
- var withdrawCancelRequestInstruction = async (programId, { authority, metadata }) => {
1074
+ var claimRoutedFeeStreamInstruction = async (destination, programId, {
1075
+ authority,
1076
+ metadata,
1077
+ escrowTokens,
1078
+ streamflowTreasury,
1079
+ streamflowTreasuryTokens,
1080
+ senderTokens,
1081
+ mint,
1082
+ tokenProgram
1083
+ }) => {
1087
1084
  const keys = [
1088
1085
  { pubkey: authority, isSigner: true, isWritable: false },
1089
- { pubkey: metadata, isSigner: false, isWritable: true }
1086
+ { pubkey: metadata, isSigner: false, isWritable: true },
1087
+ { pubkey: escrowTokens, isSigner: false, isWritable: true },
1088
+ { pubkey: streamflowTreasury, isSigner: false, isWritable: true },
1089
+ { pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
1090
+ { pubkey: senderTokens, isSigner: false, isWritable: true },
1091
+ { pubkey: mint, isSigner: false, isWritable: true },
1092
+ { pubkey: tokenProgram, isSigner: false, isWritable: false }
1090
1093
  ];
1091
1094
  const data = Buffer.concat([
1092
- Buffer.from(await sha256.digest("global:withdraw_cancel_request")).slice(0, 8),
1095
+ Buffer.from(await sha256.digest("global:claim_routed_fee")).slice(0, 8),
1096
+ Buffer.from([destination === "treasury" ? 0 : 1]),
1093
1097
  Buffer.alloc(10)
1094
1098
  ]);
1095
1099
  return new TransactionInstruction({
@@ -4331,13 +4335,13 @@ var SolanaStreamClient = class {
4331
4335
  return ixs;
4332
4336
  }
4333
4337
  /**
4334
- * Requests cancellation of a stream by the fee partner authority.
4335
- * @param {IRequestCancelData} data - Request cancel parameters including stream ID
4338
+ * Claims routed fee from the stream and routes it to the requested destination.
4339
+ * @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
4336
4340
  * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
4337
4341
  * @returns Transaction result
4338
4342
  */
4339
- async requestCancel(data, extParams) {
4340
- const ixs = await this.prepareRequestCancelInstructions(data, extParams);
4343
+ async claimRoutedFee(data, extParams) {
4344
+ const ixs = await this.prepareClaimRoutedFeeInstructions(data, extParams);
4341
4345
  const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
4342
4346
  const signature = await signAndExecuteTransaction(
4343
4347
  this.connection,
@@ -4353,65 +4357,51 @@ var SolanaStreamClient = class {
4353
4357
  return { ixs, txId: signature };
4354
4358
  }
4355
4359
  /**
4356
- * Creates Transaction Instructions for request_cancel
4357
- * @param {IRequestCancelData} data - Request cancel parameters including stream ID
4360
+ * Creates transaction instructions for claim_routed_fee.
4361
+ * @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
4358
4362
  * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
4359
4363
  * @returns Transaction instructions
4360
4364
  */
4361
- async prepareRequestCancelInstructions({ id }, { invoker, computePrice, computeLimit }) {
4365
+ async prepareClaimRoutedFeeInstructions({ id, destination }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
4362
4366
  assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
4363
4367
  const ixs = prepareBaseInstructions(this.connection, {
4364
4368
  computePrice,
4365
4369
  computeLimit
4366
4370
  });
4367
- ixs.push(
4368
- await requestCancelStreamInstruction(this.programId, {
4369
- authority: invoker.publicKey,
4370
- metadata: new PublicKey(id)
4371
- })
4372
- );
4373
- return ixs;
4374
- }
4375
- /**
4376
- * Withdraws a previously submitted cancel request.
4377
- * @param {IWithdrawCancelRequestData} data - Withdraw cancel request parameters including stream ID
4378
- * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
4379
- * @returns Transaction result
4380
- */
4381
- async withdrawCancelRequest(data, extParams) {
4382
- const ixs = await this.prepareWithdrawCancelRequestInstructions(data, extParams);
4383
- const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
4384
- const signature = await signAndExecuteTransaction(
4385
- this.connection,
4386
- extParams.invoker,
4387
- tx,
4388
- {
4389
- hash,
4390
- context,
4391
- commitment: this.getCommitment()
4392
- },
4393
- this.schedulingParams
4371
+ const streamPublicKey = new PublicKey(id);
4372
+ const streamAccount = await this.connection.getAccountInfo(streamPublicKey);
4373
+ invariant(streamAccount?.data, "Couldn't get account info");
4374
+ const { sender, mint, escrowTokens } = decodeStream(streamAccount.data);
4375
+ const { mint: mintAccount, tokenProgramId } = await getMintAndProgram(this.connection, mint);
4376
+ const streamflowTreasuryTokens = await ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
4377
+ const senderTokens = await ata(mint, sender, tokenProgramId);
4378
+ const ataIxs = await this.getCreateATAInstructions(
4379
+ [sender, STREAMFLOW_TREASURY_PUBLIC_KEY],
4380
+ mint,
4381
+ invoker,
4382
+ checkTokenAccounts,
4383
+ tokenProgramId
4394
4384
  );
4395
- return { ixs, txId: signature };
4396
- }
4397
- /**
4398
- * Creates Transaction Instructions for withdraw_cancel_request
4399
- * @param {IWithdrawCancelRequestData} data - Withdraw cancel request parameters including stream ID
4400
- * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
4401
- * @returns Transaction instructions
4402
- */
4403
- async prepareWithdrawCancelRequestInstructions({ id }, { invoker, computePrice, computeLimit }) {
4404
- assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
4405
- const ixs = prepareBaseInstructions(this.connection, {
4406
- computePrice,
4407
- computeLimit
4385
+ const claimRoutedFeeIx = await claimRoutedFeeStreamInstruction(destination, this.programId, {
4386
+ authority: invoker.publicKey,
4387
+ metadata: streamPublicKey,
4388
+ escrowTokens,
4389
+ streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
4390
+ streamflowTreasuryTokens,
4391
+ senderTokens,
4392
+ mint,
4393
+ tokenProgram: tokenProgramId
4408
4394
  });
4409
- ixs.push(
4410
- await withdrawCancelRequestInstruction(this.programId, {
4411
- authority: invoker.publicKey,
4412
- metadata: new PublicKey(id)
4413
- })
4414
- );
4395
+ await this.addTransferHookAccounts(claimRoutedFeeIx, {
4396
+ mint,
4397
+ mintAccount,
4398
+ tokenProgramId,
4399
+ potentialTransfers: [
4400
+ { source: escrowTokens, destination: streamflowTreasuryTokens, owner: escrowTokens },
4401
+ { source: escrowTokens, destination: senderTokens, owner: escrowTokens }
4402
+ ]
4403
+ });
4404
+ ixs.push(...ataIxs, claimRoutedFeeIx);
4415
4405
  return ixs;
4416
4406
  }
4417
4407
  /**
@@ -5855,6 +5845,6 @@ async function executeBatchSequential(builtTransactions, env) {
5855
5845
  return { signatures, errors };
5856
5846
  }
5857
5847
 
5858
- export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, REPOPULATED_METADATA_SEED, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildLockBatchParams, buildLockParams, buildStreamType, buildTransaction, buildVestingBatchParams, buildVestingParams, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancel, cancelStreamInstruction, computeAmountPerPeriod, create, createBatch, createClient, createClientFromEnv, createLock, createLockBatch, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, createVesting, createVestingBatch, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, execute, executeBatch, executeBatchSequential, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, requestCancelStreamInstruction, resolveConnection, resolveDuration, sendAndConfirmStreamRawTransaction, sign, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topup, topupStreamInstruction, transfer, transferStreamInstruction, transformContract, update, updateStreamInstruction, withdraw, withdrawCancelRequestInstruction, withdrawStreamInstruction };
5848
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW2 as ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedContract, AlignedProxyErrorCode, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, Contract, ContractErrorCode, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, MAX_SAFE_UNIX_TIME_VALUE2 as MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, REPOPULATED_METADATA_SEED, SOLANA_ERROR_MAP, SOLANA_ERROR_MATCH_REGEX, STREAMFLOW_TREASURY_PUBLIC_KEY, STREAM_STRUCT_OFFSETS, STREAM_STRUCT_OFFSET_CLOSED, STREAM_STRUCT_OFFSET_MINT, STREAM_STRUCT_OFFSET_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildLockBatchParams, buildLockParams, buildStreamType, buildTransaction, buildVestingBatchParams, buildVestingParams, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancel, cancelStreamInstruction, claimRoutedFeeStreamInstruction, computeAmountPerPeriod, create, createBatch, createClient, createClientFromEnv, createLock, createLockBatch, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, createVesting, createVestingBatch, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, execute, executeBatch, executeBatchSequential, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, resolveConnection, resolveDuration, sendAndConfirmStreamRawTransaction, sign, signAllTransactionWithRecipients, timelockIDL_default as timelockIDL, topup, topupStreamInstruction, transfer, transferStreamInstruction, transformContract, update, updateStreamInstruction, withdraw, withdrawStreamInstruction };
5859
5849
  //# sourceMappingURL=index.js.map
5860
5850
  //# sourceMappingURL=index.js.map