@streamflow/stream 7.0.0-alpha.2 → 7.0.0-alpha.20
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/README.md +70 -67
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +83 -134
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +9 -9
- package/dist/cjs/aptos/StreamClient.js +162 -367
- package/dist/cjs/aptos/constants.js +7 -8
- package/dist/cjs/aptos/index.js +3 -3
- package/dist/cjs/aptos/types.js +28 -37
- package/dist/cjs/aptos/utils.js +4 -4
- package/dist/cjs/aptos/wallet.js +20 -75
- package/dist/cjs/common/BaseStreamClient.js +11 -59
- package/dist/cjs/common/GenericStreamClient.js +46 -72
- package/dist/cjs/common/constants.js +4 -3
- package/dist/cjs/common/contractUtils.js +33 -18
- package/dist/cjs/common/types.js +30 -1
- package/dist/cjs/common/utils.js +38 -80
- package/dist/cjs/evm/StreamClient.js +198 -456
- package/dist/cjs/evm/constants.js +19 -20
- package/dist/cjs/evm/types.js +25 -34
- package/dist/cjs/evm/utils.js +2 -2
- package/dist/cjs/index.js +10 -10
- package/dist/cjs/solana/StreamClient.js +759 -1090
- package/dist/cjs/solana/constants.js +44 -11
- package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +2 -0
- package/dist/cjs/solana/index.js +2 -1
- package/dist/cjs/solana/instructions.js +75 -81
- package/dist/cjs/solana/layout.js +7 -8
- package/dist/cjs/solana/lib/derive-accounts.js +17 -0
- package/dist/cjs/solana/lib/utils.js +127 -0
- package/dist/cjs/solana/types.js +40 -27
- package/dist/cjs/sui/StreamClient.js +325 -571
- package/dist/cjs/sui/constants.js +19 -20
- package/dist/cjs/sui/types.js +28 -62
- package/dist/cjs/sui/utils.js +7 -7
- package/dist/cjs/sui/wallet.js +13 -63
- package/dist/esm/__tests__/aptos/streamClient.spec.js +4 -4
- package/dist/esm/aptos/index.d.ts +3 -3
- package/dist/esm/aptos/index.js +3 -3
- package/dist/esm/aptos/types.d.ts +14 -14
- package/dist/esm/aptos/types.js +13 -13
- package/dist/esm/common/GenericStreamClient.d.ts +4 -4
- package/dist/esm/common/GenericStreamClient.js +4 -4
- package/dist/esm/common/constants.d.ts +3 -2
- package/dist/esm/common/constants.js +3 -2
- package/dist/esm/common/contractUtils.d.ts +18 -15
- package/dist/esm/common/contractUtils.js +19 -6
- package/dist/esm/common/types.d.ts +112 -57
- package/dist/esm/common/types.js +29 -0
- package/dist/esm/common/utils.d.ts +11 -11
- package/dist/esm/common/utils.js +19 -16
- package/dist/esm/evm/StreamClient.d.ts +2 -2
- package/dist/esm/evm/StreamClient.js +7 -7
- package/dist/esm/evm/types.d.ts +14 -14
- package/dist/esm/evm/types.js +13 -13
- package/dist/esm/index.d.ts +9 -9
- package/dist/esm/index.js +9 -9
- package/dist/esm/solana/StreamClient.d.ts +24 -16
- package/dist/esm/solana/StreamClient.js +324 -156
- package/dist/esm/solana/constants.d.ts +17 -0
- package/dist/esm/solana/constants.js +35 -1
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +1471 -0
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +1272 -0
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +1 -0
- package/dist/esm/solana/index.d.ts +2 -1
- package/dist/esm/solana/index.js +2 -1
- package/dist/esm/solana/instructions.d.ts +17 -17
- package/dist/esm/solana/instructions.js +18 -19
- package/dist/esm/solana/lib/derive-accounts.d.ts +4 -0
- package/dist/esm/solana/lib/derive-accounts.js +11 -0
- package/dist/esm/solana/{utils.d.ts → lib/utils.d.ts} +1 -3
- package/dist/esm/solana/{utils.js → lib/utils.js} +28 -34
- package/dist/esm/solana/types.d.ts +72 -39
- package/dist/esm/solana/types.js +32 -4
- package/dist/esm/sui/StreamClient.js +1 -1
- package/dist/esm/sui/types.d.ts +14 -14
- package/dist/esm/sui/types.js +13 -13
- package/package.json +12 -10
- package/dist/cjs/solana/utils.js +0 -222
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import PQueue from "p-queue";
|
|
2
2
|
import { Connection, Keypair, PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from "@solana/web3.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { IProgramAccount } from "@streamflow/common/solana";
|
|
4
|
+
import { ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt, ISearchStreams, ICreateStreamInstructions } from "./types.js";
|
|
5
|
+
import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream, ICreateAlignedStreamData } from "../common/types.js";
|
|
5
6
|
import { BaseStreamClient } from "../common/BaseStreamClient.js";
|
|
6
7
|
export declare class SolanaStreamClient extends BaseStreamClient {
|
|
7
8
|
private connection;
|
|
8
9
|
private programId;
|
|
9
10
|
private commitment;
|
|
10
11
|
private sendThrottler;
|
|
12
|
+
private alignedProxyProgram;
|
|
11
13
|
/**
|
|
12
14
|
* Create Stream instance
|
|
13
15
|
*/
|
|
@@ -20,15 +22,13 @@ export declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
20
22
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
21
23
|
*/
|
|
22
24
|
create(data: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateResult>;
|
|
25
|
+
prepareCreateInstructions(streamParams: ICreateStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
26
|
+
prepareCreateAlignedUnlockInstructions(streamParams: ICreateAlignedStreamData, extParams: ICreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
23
27
|
/**
|
|
24
28
|
* Creates a new stream/vesting contract.
|
|
25
29
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
26
30
|
*/
|
|
27
|
-
|
|
28
|
-
ixs: TransactionInstruction[];
|
|
29
|
-
metadata: Keypair | undefined;
|
|
30
|
-
metadataPubKey: PublicKey;
|
|
31
|
-
}>;
|
|
31
|
+
prepareCreateStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: ICreateStreamSolanaExt): Promise<ICreateStreamInstructions>;
|
|
32
32
|
/**
|
|
33
33
|
* Creates a new stream/vesting contract using unchecked instruction.
|
|
34
34
|
*
|
|
@@ -52,7 +52,7 @@ export declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
52
52
|
* Creates multiple stream/vesting contracts.
|
|
53
53
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
54
54
|
*/
|
|
55
|
-
createMultiple(data: ICreateMultipleStreamData,
|
|
55
|
+
createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamSolanaExt): Promise<IMultiTransactionResult>;
|
|
56
56
|
/**
|
|
57
57
|
* Attempts withdrawing from the specified stream.
|
|
58
58
|
*/
|
|
@@ -64,11 +64,13 @@ export declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
64
64
|
/**
|
|
65
65
|
* Attempts canceling the specified stream.
|
|
66
66
|
*/
|
|
67
|
-
cancel(
|
|
67
|
+
cancel(cancelData: ICancelData, extParams: IInteractStreamSolanaExt): Promise<ITransactionResult>;
|
|
68
|
+
prepareCancelInstructions(cancelData: ICancelData, extParams: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
69
|
+
prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
68
70
|
/**
|
|
69
71
|
* Creates Transaction Instructions for cancel
|
|
70
72
|
*/
|
|
71
|
-
|
|
73
|
+
prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IInteractStreamSolanaExt): Promise<TransactionInstruction[]>;
|
|
72
74
|
/**
|
|
73
75
|
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
74
76
|
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
@@ -91,11 +93,17 @@ export declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
91
93
|
* Fetch stream data by its id (address).
|
|
92
94
|
*/
|
|
93
95
|
getOne({ id }: IGetOneData): Promise<Stream>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
98
|
+
*/
|
|
99
|
+
private getOutgoingAlignedStreams;
|
|
100
|
+
private getIncomingAlignedStreams;
|
|
94
101
|
/**
|
|
95
102
|
* Fetch streams/contracts by providing direction.
|
|
96
103
|
* Streams are sorted by start time in ascending order.
|
|
97
104
|
*/
|
|
98
105
|
get({ address, type, direction, }: IGetAllData): Promise<[string, Stream][]>;
|
|
106
|
+
searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
|
|
99
107
|
/**
|
|
100
108
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
101
109
|
*/
|
|
@@ -107,16 +115,16 @@ export declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
107
115
|
getFees({ address }: IGetFeesData): Promise<IFees | null>;
|
|
108
116
|
getDefaultStreamflowFee(): Promise<number>;
|
|
109
117
|
extractErrorCode(err: Error): string | null;
|
|
110
|
-
/**
|
|
111
|
-
* Forms instructions from params, creates a raw transaction and fetch recent blockhash.
|
|
112
|
-
*/
|
|
113
|
-
private prepareStreamInstructions;
|
|
114
118
|
/**
|
|
115
119
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
116
120
|
*/
|
|
117
121
|
private getOrCreateStreamMetadata;
|
|
118
122
|
/**
|
|
119
|
-
* Utility function that checks whether associated
|
|
123
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
124
|
+
*/
|
|
125
|
+
private isAlignedUnlock;
|
|
126
|
+
/**
|
|
127
|
+
* Returns insrtuctions for creating associated token accounts for the provided owners
|
|
120
128
|
*/
|
|
121
|
-
private
|
|
129
|
+
private getCreateATAInstructions;
|
|
122
130
|
}
|