@streamflow/stream 12.5.0-alpha.p366.24de361 → 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.
- 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 +72 -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-CroMeFk7.js';
|
|
2
2
|
import '@solana/wallet-adapter-base';
|
|
3
3
|
import '@solana/web3.js';
|
|
4
4
|
import '@streamflow/common';
|
|
@@ -986,25 +986,29 @@ var transferStreamInstruction = async (programId, {
|
|
|
986
986
|
data
|
|
987
987
|
});
|
|
988
988
|
};
|
|
989
|
-
var
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
});
|
|
1000
|
-
};
|
|
1001
|
-
var withdrawCancelRequestInstruction = async (programId, { authority, metadata }) => {
|
|
989
|
+
var claimRoutedFeeStreamInstruction = async (destination, programId, {
|
|
990
|
+
authority,
|
|
991
|
+
metadata,
|
|
992
|
+
escrowTokens,
|
|
993
|
+
streamflowTreasury,
|
|
994
|
+
streamflowTreasuryTokens,
|
|
995
|
+
senderTokens,
|
|
996
|
+
mint,
|
|
997
|
+
tokenProgram
|
|
998
|
+
}) => {
|
|
1002
999
|
const keys = [
|
|
1003
1000
|
{ pubkey: authority, isSigner: true, isWritable: false },
|
|
1004
|
-
{ pubkey: metadata, isSigner: false, isWritable: true }
|
|
1001
|
+
{ pubkey: metadata, isSigner: false, isWritable: true },
|
|
1002
|
+
{ pubkey: escrowTokens, isSigner: false, isWritable: true },
|
|
1003
|
+
{ pubkey: streamflowTreasury, isSigner: false, isWritable: true },
|
|
1004
|
+
{ pubkey: streamflowTreasuryTokens, isSigner: false, isWritable: true },
|
|
1005
|
+
{ pubkey: senderTokens, isSigner: false, isWritable: true },
|
|
1006
|
+
{ pubkey: mint, isSigner: false, isWritable: true },
|
|
1007
|
+
{ pubkey: tokenProgram, isSigner: false, isWritable: false }
|
|
1005
1008
|
];
|
|
1006
1009
|
const data = Buffer.concat([
|
|
1007
|
-
Buffer.from(await sha256.digest("global:
|
|
1010
|
+
Buffer.from(await sha256.digest("global:claim_routed_fee")).slice(0, 8),
|
|
1011
|
+
Buffer.from([destination === "treasury" ? 0 : 1]),
|
|
1008
1012
|
Buffer.alloc(10)
|
|
1009
1013
|
]);
|
|
1010
1014
|
return new TransactionInstruction({
|
|
@@ -4243,13 +4247,13 @@ var SolanaStreamClient = class {
|
|
|
4243
4247
|
return ixs;
|
|
4244
4248
|
}
|
|
4245
4249
|
/**
|
|
4246
|
-
*
|
|
4247
|
-
* @param {
|
|
4250
|
+
* Claims routed fee from the stream and routes it to the requested destination.
|
|
4251
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
4248
4252
|
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
4249
4253
|
* @returns Transaction result
|
|
4250
4254
|
*/
|
|
4251
|
-
async
|
|
4252
|
-
const ixs = await this.
|
|
4255
|
+
async claimRoutedFee(data, extParams) {
|
|
4256
|
+
const ixs = await this.prepareClaimRoutedFeeInstructions(data, extParams);
|
|
4253
4257
|
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
4254
4258
|
const signature = await signAndExecuteTransaction(
|
|
4255
4259
|
this.connection,
|
|
@@ -4265,65 +4269,51 @@ var SolanaStreamClient = class {
|
|
|
4265
4269
|
return { ixs, txId: signature };
|
|
4266
4270
|
}
|
|
4267
4271
|
/**
|
|
4268
|
-
* Creates
|
|
4269
|
-
* @param {
|
|
4272
|
+
* Creates transaction instructions for claim_routed_fee.
|
|
4273
|
+
* @param {IClaimRoutedFeeData} data - Routed fee claim parameters including stream ID and destination
|
|
4270
4274
|
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
4271
4275
|
* @returns Transaction instructions
|
|
4272
4276
|
*/
|
|
4273
|
-
async
|
|
4277
|
+
async prepareClaimRoutedFeeInstructions({ id, destination }, { invoker, checkTokenAccounts, computePrice, computeLimit }) {
|
|
4274
4278
|
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
4275
4279
|
const ixs = prepareBaseInstructions(this.connection, {
|
|
4276
4280
|
computePrice,
|
|
4277
4281
|
computeLimit
|
|
4278
4282
|
});
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
);
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
*/
|
|
4293
|
-
async withdrawCancelRequest(data, extParams) {
|
|
4294
|
-
const ixs = await this.prepareWithdrawCancelRequestInstructions(data, extParams);
|
|
4295
|
-
const { tx, hash, context } = await prepareTransaction(this.connection, ixs, extParams.invoker.publicKey);
|
|
4296
|
-
const signature = await signAndExecuteTransaction(
|
|
4297
|
-
this.connection,
|
|
4298
|
-
extParams.invoker,
|
|
4299
|
-
tx,
|
|
4300
|
-
{
|
|
4301
|
-
hash,
|
|
4302
|
-
context,
|
|
4303
|
-
commitment: this.getCommitment()
|
|
4304
|
-
},
|
|
4305
|
-
this.schedulingParams
|
|
4283
|
+
const streamPublicKey = new PublicKey(id);
|
|
4284
|
+
const streamAccount = await this.connection.getAccountInfo(streamPublicKey);
|
|
4285
|
+
invariant(streamAccount?.data, "Couldn't get account info");
|
|
4286
|
+
const { sender, mint, escrowTokens } = decodeStream(streamAccount.data);
|
|
4287
|
+
const { mint: mintAccount, tokenProgramId } = await getMintAndProgram(this.connection, mint);
|
|
4288
|
+
const streamflowTreasuryTokens = await ata(mint, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
4289
|
+
const senderTokens = await ata(mint, sender, tokenProgramId);
|
|
4290
|
+
const ataIxs = await this.getCreateATAInstructions(
|
|
4291
|
+
[sender, STREAMFLOW_TREASURY_PUBLIC_KEY],
|
|
4292
|
+
mint,
|
|
4293
|
+
invoker,
|
|
4294
|
+
checkTokenAccounts,
|
|
4295
|
+
tokenProgramId
|
|
4306
4296
|
);
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
assertHasPublicKey(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
4317
|
-
const ixs = prepareBaseInstructions(this.connection, {
|
|
4318
|
-
computePrice,
|
|
4319
|
-
computeLimit
|
|
4297
|
+
const claimRoutedFeeIx = await claimRoutedFeeStreamInstruction(destination, this.programId, {
|
|
4298
|
+
authority: invoker.publicKey,
|
|
4299
|
+
metadata: streamPublicKey,
|
|
4300
|
+
escrowTokens,
|
|
4301
|
+
streamflowTreasury: STREAMFLOW_TREASURY_PUBLIC_KEY,
|
|
4302
|
+
streamflowTreasuryTokens,
|
|
4303
|
+
senderTokens,
|
|
4304
|
+
mint,
|
|
4305
|
+
tokenProgram: tokenProgramId
|
|
4320
4306
|
});
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4307
|
+
await this.addTransferHookAccounts(claimRoutedFeeIx, {
|
|
4308
|
+
mint,
|
|
4309
|
+
mintAccount,
|
|
4310
|
+
tokenProgramId,
|
|
4311
|
+
potentialTransfers: [
|
|
4312
|
+
{ source: escrowTokens, destination: streamflowTreasuryTokens, owner: escrowTokens },
|
|
4313
|
+
{ source: escrowTokens, destination: senderTokens, owner: escrowTokens }
|
|
4314
|
+
]
|
|
4315
|
+
});
|
|
4316
|
+
ixs.push(...ataIxs, claimRoutedFeeIx);
|
|
4327
4317
|
return ixs;
|
|
4328
4318
|
}
|
|
4329
4319
|
/**
|