@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv,
|
|
1
|
+
export { k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, T as ICreateLockBatchParams, U as ICreateLockParams, a0 as ICreateVestingBatchParams, a1 as ICreateVestingParams, a8 as ILockBatchRecipient, aj as IVestingBatchRecipient, am as InstructionResult, an as Invoker, aq as NativeOptions, at as SignFn, az as TopupFn, aB as TransferFn, aC as UpdateFn, 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-80Zw9SxQ.cjs';
|
|
2
2
|
import '@solana/wallet-adapter-base';
|
|
3
3
|
import '@solana/web3.js';
|
|
4
4
|
import '@streamflow/common';
|
|
@@ -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
|