@streamflow/stream 12.5.0 → 13.1.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.
- package/dist/cjs/{index-CjMTLhxa.d.cts → index-80Zw9SxQ.d.cts} +11 -23
- package/dist/cjs/index.cjs +59 -70
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/api/index.cjs +58 -68
- package/dist/cjs/solana/api/index.cjs.map +1 -1
- package/dist/cjs/solana/api/index.d.cts +1 -1
- package/dist/cjs/solana/index.cjs +59 -70
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +11 -10
- package/dist/esm/{index-Cu0If4Dd.d.ts → index-CroMeFk7.d.ts} +11 -23
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +59 -69
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/api/index.d.ts +1 -1
- package/dist/esm/solana/api/index.js +58 -68
- package/dist/esm/solana/api/index.js.map +1 -1
- package/dist/esm/solana/descriptor/idl/streamflow.json +75 -48
- package/dist/esm/solana/index.d.ts +11 -10
- package/dist/esm/solana/index.js +59 -69
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -71,8 +71,10 @@ interface IUpdateData extends IInteractData {
|
|
|
71
71
|
cancelableBySender?: boolean;
|
|
72
72
|
}
|
|
73
73
|
type ICancelData = IInteractData;
|
|
74
|
-
type
|
|
75
|
-
|
|
74
|
+
type RoutedFeeDestination = "treasury" | "sender";
|
|
75
|
+
interface IClaimRoutedFeeData extends IInteractData {
|
|
76
|
+
destination: RoutedFeeDestination;
|
|
77
|
+
}
|
|
76
78
|
interface ITransferData extends IInteractData {
|
|
77
79
|
newRecipient: string;
|
|
78
80
|
}
|
|
@@ -749,33 +751,19 @@ declare class SolanaStreamClient {
|
|
|
749
751
|
*/
|
|
750
752
|
prepareCancelLinearStream({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
751
753
|
/**
|
|
752
|
-
*
|
|
753
|
-
* @param {
|
|
754
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
755
|
-
* @returns Transaction result
|
|
756
|
-
*/
|
|
757
|
-
requestCancel(data: IRequestCancelData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
758
|
-
/**
|
|
759
|
-
* Creates Transaction Instructions for request_cancel
|
|
760
|
-
* @param {IRequestCancelData} data - Request cancel parameters including stream ID
|
|
761
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
762
|
-
* @returns Transaction instructions
|
|
763
|
-
*/
|
|
764
|
-
prepareRequestCancelInstructions({ id }: IRequestCancelData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
765
|
-
/**
|
|
766
|
-
* Withdraws a previously submitted cancel request.
|
|
767
|
-
* @param {IWithdrawCancelRequestData} data - Withdraw cancel request parameters including stream ID
|
|
754
|
+
* Claims routed fee from the stream and routes it to the requested destination.
|
|
755
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
768
756
|
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
769
757
|
* @returns Transaction result
|
|
770
758
|
*/
|
|
771
|
-
|
|
759
|
+
claimRoutedFee(data: IClaimRoutedFeeData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
772
760
|
/**
|
|
773
|
-
* Creates
|
|
774
|
-
* @param {
|
|
761
|
+
* Creates transaction instructions for claim_routed_fee.
|
|
762
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
775
763
|
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
776
764
|
* @returns Transaction instructions
|
|
777
765
|
*/
|
|
778
|
-
|
|
766
|
+
prepareClaimRoutedFeeInstructions({ id, destination }: IClaimRoutedFeeData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
779
767
|
/**
|
|
780
768
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
781
769
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
@@ -1111,4 +1099,4 @@ declare function execute(builtTx: BuiltTransaction, env: ExecutionEnv): Promise<
|
|
|
1111
1099
|
declare function executeBatch(builtTransactions: BuiltTransaction[], env: ExecutionEnv): Promise<BatchExecuteResult>;
|
|
1112
1100
|
declare function executeBatchSequential(builtTransactions: BuiltTransaction[], env: ExecutionEnv): Promise<BatchExecuteResult>;
|
|
1113
1101
|
|
|
1114
|
-
export { type
|
|
1102
|
+
export { type ICreateStreamInstructions as $, type AlignedStream as A, type BatchItem as B, type CancelFn as C, type DecodedStream as D, type CreateTestOracleParams as E, type Env as F, type ExecuteBatchFn as G, type ExecuteBatchSequentialFn as H, type IUpdateData as I, type ExecuteFn as J, type ExecutionEnv as K, type IAlignedStreamConfig as L, type IBaseStreamConfig as M, type ICancelData as N, type IClaimRoutedFeeData as O, type ICreateExt as P, type ICreateLinearStreamData as Q, type RoutedFeeDestination as R, StreamType as S, type ICreateLockBatchParams as T, type ICreateLockParams as U, type ICreateMultiError as V, type ICreateMultipleAlignedStreamData as W, type ICreateMultipleLinearStreamData as X, type ICreateMultipleStreamData as Y, type ICreateResult as Z, type ICreateStreamExt as _, type BatchItemResult as a, update as a$, type ICreateVestingBatchParams as a0, type ICreateVestingParams as a1, type IFees as a2, type IGetAllData as a3, type IGetFeesData as a4, type IGetOneData as a5, type IInteractData as a6, type IInteractStreamExt as a7, type ILockBatchRecipient as a8, type IMultiTransactionResult as a9, type TransactionSchedulingOptions as aA, type TransferFn as aB, type UpdateFn as aC, type UpdateTestOracleParams as aD, type WithdrawFn as aE, buildLockBatchParams as aF, buildLockParams as aG, buildTransaction as aH, buildVestingBatchParams as aI, buildVestingParams as aJ, cancel as aK, computeAmountPerPeriod as aL, create as aM, createBatch as aN, createClientFromEnv as aO, createLock as aP, createLockBatch as aQ, createVesting as aR, createVestingBatch as aS, execute as aT, executeBatch as aU, executeBatchSequential as aV, resolveConnection as aW, resolveDuration as aX, sign as aY, topup as aZ, transfer as a_, type IPrepareCreateStreamExt as aa, type IPrepareStreamExt as ab, type IPrepareTopUpstreamExt as ac, type IRecipient as ad, type ITopUpData as ae, type ITopUpStreamExt as af, type ITransactionExtWithInstructions as ag, type ITransactionResult as ah, type ITransferData as ai, type IVestingBatchRecipient as aj, type IWithdrawData as ak, type InstructionGenerator as al, type InstructionResult as am, type Invoker as an, type LinearStream as ao, type MetadataRecipientHashMap as ap, type NativeOptions as aq, type OracleType as ar, type OracleTypeName as as, type SignFn as at, SolanaStreamClient as au, type StreamClientOptions as av, type StreamClientOptionsWithConnection as aw, StreamDirection as ax, type TestOracle as ay, type TopupFn as az, type Stream as b, withdraw as b0, type ICreateStreamData as c, type ICreateAlignedStreamData as d, type ISearchStreams as e, type Account as f, AlignedContract as g, AlignedProxyErrorCode as h, type AlignedStreamData as i, type AlignedUnlocksContract as j, type BatchCreationItem as k, type BatchExecuteResult as l, type BatchInstructionResult as m, type BatchItemError as n, type BatchItemSuccess as o, type BuildTransactionFn as p, type BuildTransactionOptions as q, type BuiltTransaction as r, type ChangeOracleParams as s, type ClientCreationOptions as t, Contract as u, ContractErrorCode as v, type CreateBatchFn as w, type CreateFn as x, type CreateInstructionResult as y, type CreateParams as z };
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1097,25 +1097,29 @@ var transferStreamInstruction = async (programId, {
|
|
|
1097
1097
|
data
|
|
1098
1098
|
});
|
|
1099
1099
|
};
|
|
1100
|
-
var
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
});
|
|
1111
|
-
};
|
|
1112
|
-
var withdrawCancelRequestInstruction = async (programId, { authority, metadata }) => {
|
|
1100
|
+
var claimRoutedFeeStreamInstruction = async (destination, programId, {
|
|
1101
|
+
authority,
|
|
1102
|
+
metadata,
|
|
1103
|
+
escrowTokens,
|
|
1104
|
+
streamflowTreasury,
|
|
1105
|
+
streamflowTreasuryTokens,
|
|
1106
|
+
senderTokens,
|
|
1107
|
+
mint,
|
|
1108
|
+
tokenProgram
|
|
1109
|
+
}) => {
|
|
1113
1110
|
const keys = [
|
|
1114
1111
|
{ pubkey: authority, isSigner: true, isWritable: false },
|
|
1115
|
-
{ pubkey: metadata, isSigner: false, isWritable: true }
|
|
1112
|
+
{ pubkey: metadata, isSigner: false, isWritable: true },
|
|
1113
|
+
{ pubkey: escrowTokens, isSigner: false, isWritable: true },
|
|
1114
|
+
{ pubkey: streamflowTreasury, isSigner: false, isWritable: true },
|
|
1115
|
+
{ pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
|
|
1116
|
+
{ pubkey: senderTokens, isSigner: false, isWritable: true },
|
|
1117
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
1118
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false }
|
|
1116
1119
|
];
|
|
1117
1120
|
const data = buffer.Buffer.concat([
|
|
1118
|
-
buffer.Buffer.from(await sha256.digest("global:
|
|
1121
|
+
buffer.Buffer.from(await sha256.digest("global:claim_routed_fee")).slice(0, 8),
|
|
1122
|
+
buffer.Buffer.from([destination === "treasury" ? 0 : 1]),
|
|
1119
1123
|
buffer.Buffer.alloc(10)
|
|
1120
1124
|
]);
|
|
1121
1125
|
return new web3_js.TransactionInstruction({
|
|
@@ -4357,13 +4361,13 @@ var SolanaStreamClient = class {
|
|
|
4357
4361
|
return ixs;
|
|
4358
4362
|
}
|
|
4359
4363
|
/**
|
|
4360
|
-
*
|
|
4361
|
-
* @param {
|
|
4364
|
+
* Claims routed fee from the stream and routes it to the requested destination.
|
|
4365
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
4362
4366
|
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
4363
4367
|
* @returns Transaction result
|
|
4364
4368
|
*/
|
|
4365
|
-
async
|
|
4366
|
-
const ixs = await this.
|
|
4369
|
+
async claimRoutedFee(data, extParams) {
|
|
4370
|
+
const ixs = await this.prepareClaimRoutedFeeInstructions(data, extParams);
|
|
4367
4371
|
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
4368
4372
|
const signature = await common.signAndExecuteTransaction(
|
|
4369
4373
|
this.connection,
|
|
@@ -4379,65 +4383,51 @@ var SolanaStreamClient = class {
|
|
|
4379
4383
|
return { ixs, txId: signature };
|
|
4380
4384
|
}
|
|
4381
4385
|
/**
|
|
4382
|
-
* Creates
|
|
4383
|
-
* @param {
|
|
4386
|
+
* Creates transaction instructions for claim_routed_fee.
|
|
4387
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
4384
4388
|
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
4385
4389
|
* @returns Transaction instructions
|
|
4386
4390
|
*/
|
|
4387
|
-
async
|
|
4391
|
+
async prepareClaimRoutedFeeInstructions({ id, destination }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
4388
4392
|
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
4389
4393
|
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
4390
4394
|
computePrice,
|
|
4391
4395
|
computeLimit
|
|
4392
4396
|
});
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
);
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
*/
|
|
4407
|
-
async withdrawCancelRequest(data, extParams) {
|
|
4408
|
-
const ixs = await this.prepareWithdrawCancelRequestInstructions(data, extParams);
|
|
4409
|
-
const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
4410
|
-
const signature = await common.signAndExecuteTransaction(
|
|
4411
|
-
this.connection,
|
|
4412
|
-
extParams.invoker,
|
|
4413
|
-
tx,
|
|
4414
|
-
{
|
|
4415
|
-
hash,
|
|
4416
|
-
context,
|
|
4417
|
-
commitment: this.getCommitment()
|
|
4418
|
-
},
|
|
4419
|
-
this.schedulingParams
|
|
4397
|
+
const streamPublicKey = new web3_js.PublicKey(id);
|
|
4398
|
+
const streamAccount = await this.connection.getAccountInfo(streamPublicKey);
|
|
4399
|
+
common.invariant(streamAccount?.data, "Couldn't get account info");
|
|
4400
|
+
const { sender, mint, escrowTokens } = decodeStream(streamAccount.data);
|
|
4401
|
+
const { mint: mintAccount, tokenProgramId } = await common.getMintAndProgram(this.connection, mint);
|
|
4402
|
+
const streamflowTreasuryTokens = await common.ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
4403
|
+
const senderTokens = await common.ata(mint, sender, tokenProgramId);
|
|
4404
|
+
const ataIxs = await this.getCreateATAInstructions(
|
|
4405
|
+
[sender, STREAMFLOW_TREASURY_PUBLIC_KEY],
|
|
4406
|
+
mint,
|
|
4407
|
+
invoker,
|
|
4408
|
+
checkTokenAccounts,
|
|
4409
|
+
tokenProgramId
|
|
4420
4410
|
);
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
common.assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
4431
|
-
const ixs = common.prepareBaseInstructions(this.connection, {
|
|
4432
|
-
computePrice,
|
|
4433
|
-
computeLimit
|
|
4411
|
+
const claimRoutedFeeIx = await claimRoutedFeeStreamInstruction(destination, this.programId, {
|
|
4412
|
+
authority: invoker.publicKey,
|
|
4413
|
+
metadata: streamPublicKey,
|
|
4414
|
+
escrowTokens,
|
|
4415
|
+
streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
4416
|
+
streamflowTreasuryTokens,
|
|
4417
|
+
senderTokens,
|
|
4418
|
+
mint,
|
|
4419
|
+
tokenProgram: tokenProgramId
|
|
4434
4420
|
});
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4421
|
+
await this.addTransferHookAccounts(claimRoutedFeeIx, {
|
|
4422
|
+
mint,
|
|
4423
|
+
mintAccount,
|
|
4424
|
+
tokenProgramId,
|
|
4425
|
+
potentialTransfers: [
|
|
4426
|
+
{ source: escrowTokens, destination: streamflowTreasuryTokens, owner: escrowTokens },
|
|
4427
|
+
{ source: escrowTokens, destination: senderTokens, owner: escrowTokens }
|
|
4428
|
+
]
|
|
4429
|
+
});
|
|
4430
|
+
ixs.push(...ataIxs, claimRoutedFeeIx);
|
|
4441
4431
|
return ixs;
|
|
4442
4432
|
}
|
|
4443
4433
|
/**
|
|
@@ -5951,6 +5941,7 @@ exports.calculateTotalAmountToDeposit = calculateTotalAmountToDeposit;
|
|
|
5951
5941
|
exports.calculateUnlockedAmount = calculateUnlockedAmount;
|
|
5952
5942
|
exports.cancel = cancel;
|
|
5953
5943
|
exports.cancelStreamInstruction = cancelStreamInstruction;
|
|
5944
|
+
exports.claimRoutedFeeStreamInstruction = claimRoutedFeeStreamInstruction;
|
|
5954
5945
|
exports.computeAmountPerPeriod = computeAmountPerPeriod;
|
|
5955
5946
|
exports.create = create;
|
|
5956
5947
|
exports.createBatch = createBatch;
|
|
@@ -5983,7 +5974,6 @@ exports.isCreateAlignedStreamData = isCreateAlignedStreamData;
|
|
|
5983
5974
|
exports.isDynamicLock = isDynamicLock;
|
|
5984
5975
|
exports.isTokenLock = isTokenLock;
|
|
5985
5976
|
exports.isVesting = isVesting;
|
|
5986
|
-
exports.requestCancelStreamInstruction = requestCancelStreamInstruction;
|
|
5987
5977
|
exports.resolveConnection = resolveConnection;
|
|
5988
5978
|
exports.resolveDuration = resolveDuration;
|
|
5989
5979
|
exports.sendAndConfirmStreamRawTransaction = sendAndConfirmStreamRawTransaction;
|
|
@@ -5998,7 +5988,6 @@ exports.transformContract = transformContract;
|
|
|
5998
5988
|
exports.update = update;
|
|
5999
5989
|
exports.updateStreamInstruction = updateStreamInstruction;
|
|
6000
5990
|
exports.withdraw = withdraw;
|
|
6001
|
-
exports.withdrawCancelRequestInstruction = withdrawCancelRequestInstruction;
|
|
6002
5991
|
exports.withdrawStreamInstruction = withdrawStreamInstruction;
|
|
6003
5992
|
//# sourceMappingURL=index.cjs.map
|
|
6004
5993
|
//# sourceMappingURL=index.cjs.map
|