@streamflow/stream 9.0.3 → 10.0.0-alpha.p313.3ce4d29

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.
Files changed (42) hide show
  1. package/README.md +6 -62
  2. package/dist/cjs/index.cjs +421 -3786
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/cjs/index.d.cts +3 -186
  5. package/dist/cjs/solana/index.cjs +376 -301
  6. package/dist/cjs/solana/index.cjs.map +1 -1
  7. package/dist/cjs/solana/index.d.cts +1134 -17
  8. package/dist/esm/index.d.ts +3 -186
  9. package/dist/esm/index.js +239 -3617
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/solana/index.d.ts +1134 -17
  12. package/dist/esm/solana/index.js +257 -232
  13. package/dist/esm/solana/index.js.map +1 -1
  14. package/package.json +4 -43
  15. package/dist/cjs/BaseStreamClient-DOyJqO7R.d.cts +0 -551
  16. package/dist/cjs/aptos/index.cjs +0 -456
  17. package/dist/cjs/aptos/index.cjs.map +0 -1
  18. package/dist/cjs/aptos/index.d.cts +0 -14
  19. package/dist/cjs/evm/index.cjs +0 -1915
  20. package/dist/cjs/evm/index.cjs.map +0 -1
  21. package/dist/cjs/evm/index.d.cts +0 -13
  22. package/dist/cjs/index-BMZATAYa.d.cts +0 -213
  23. package/dist/cjs/index-BgGtpOPg.d.cts +0 -850
  24. package/dist/cjs/index-DYIamO0j.d.cts +0 -203
  25. package/dist/cjs/index-Y0HH2ugY.d.cts +0 -136
  26. package/dist/cjs/sui/index.cjs +0 -1021
  27. package/dist/cjs/sui/index.cjs.map +0 -1
  28. package/dist/cjs/sui/index.d.cts +0 -13
  29. package/dist/esm/BaseStreamClient-DOyJqO7R.d.ts +0 -551
  30. package/dist/esm/aptos/index.d.ts +0 -14
  31. package/dist/esm/aptos/index.js +0 -443
  32. package/dist/esm/aptos/index.js.map +0 -1
  33. package/dist/esm/evm/index.d.ts +0 -13
  34. package/dist/esm/evm/index.js +0 -1902
  35. package/dist/esm/evm/index.js.map +0 -1
  36. package/dist/esm/index-D54wSYym.d.ts +0 -203
  37. package/dist/esm/index-Dp5DXxr-.d.ts +0 -850
  38. package/dist/esm/index-DrzqsoIB.d.ts +0 -136
  39. package/dist/esm/index-elpYUBph.d.ts +0 -213
  40. package/dist/esm/sui/index.d.ts +0 -13
  41. package/dist/esm/sui/index.js +0 -1011
  42. package/dist/esm/sui/index.js.map +0 -1
@@ -1,17 +1,1134 @@
1
- export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-Dp5DXxr-.js';
2
- export { ContractError, IChain, ICluster } from '@streamflow/common';
3
- import 'p-queue';
4
- import '@solana/web3.js';
5
- import '@streamflow/common/solana';
6
- import '@coral-xyz/anchor';
7
- import '@solana/wallet-adapter-base';
8
- import 'bn.js';
9
- import '../BaseStreamClient-DOyJqO7R.js';
10
- import 'ethers';
11
- import 'aptos';
12
- import '@mysten/sui/cryptography';
13
- import '@mysten/sui/transactions';
14
- import '@mysten/sui/client';
15
- import '@suiet/wallet-kit';
16
- import './descriptor/streamflow_aligned_unlocks.js';
17
- import 'buffer';
1
+ import { ICluster, ITransactionExt, IProgramAccount, ConfirmationParams, ThrottleParams } from '@streamflow/common';
2
+ export { ContractError, ICluster, getBN, getNumberFromBN } from '@streamflow/common';
3
+ import PQueue from 'p-queue';
4
+ import { Commitment, ConnectionConfig, PublicKey, Keypair, TransactionInstruction, VersionedTransaction, AccountInfo, Connection } from '@solana/web3.js';
5
+ import { Address, IdlAccounts, IdlTypes, Program } from '@coral-xyz/anchor';
6
+ import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
7
+ import BN from 'bn.js';
8
+ import { StreamflowAlignedUnlocks } from './descriptor/streamflow_aligned_unlocks.js';
9
+ import { Buffer as Buffer$1 } from 'buffer';
10
+
11
+ interface IRecipient {
12
+ recipient: string;
13
+ amount: BN;
14
+ name: string;
15
+ cliffAmount: BN;
16
+ amountPerPeriod: BN;
17
+ }
18
+ interface IBaseStreamConfig {
19
+ period: number;
20
+ start: number;
21
+ cliff: number;
22
+ cancelableBySender: boolean;
23
+ cancelableByRecipient: boolean;
24
+ transferableBySender: boolean;
25
+ transferableByRecipient: boolean;
26
+ canTopup: boolean;
27
+ automaticWithdrawal?: boolean;
28
+ withdrawalFrequency?: number;
29
+ tokenId: string;
30
+ canPause?: boolean;
31
+ canUpdateRate?: boolean;
32
+ partner?: string;
33
+ tokenProgramId?: string | PublicKey;
34
+ }
35
+ type IAlignedStreamConfig = {
36
+ minPrice: number | BN;
37
+ maxPrice: number | BN;
38
+ minPercentage: number | BN;
39
+ maxPercentage: number | BN;
40
+ oracleType?: OracleTypeName;
41
+ priceOracle?: Address;
42
+ skipInitial?: boolean;
43
+ tickSize?: number;
44
+ expiryTime?: number;
45
+ expiryPercentage?: number | BN;
46
+ floorPrice?: number | BN;
47
+ };
48
+ type ICreateLinearStreamData = IBaseStreamConfig & IRecipient;
49
+ type ICreateAlignedStreamData = ICreateLinearStreamData & IAlignedStreamConfig;
50
+ type ICreateStreamData = ICreateLinearStreamData | ICreateAlignedStreamData;
51
+ type ICreateMultipleLinearStreamData = IBaseStreamConfig & {
52
+ recipients: IRecipient[];
53
+ };
54
+ type ICreateMultipleAlignedStreamData = ICreateMultipleLinearStreamData & IAlignedStreamConfig;
55
+ type ICreateMultipleStreamData = ICreateMultipleLinearStreamData | ICreateMultipleAlignedStreamData;
56
+ interface IInteractData {
57
+ id: string;
58
+ }
59
+ interface IWithdrawData extends IInteractData {
60
+ amount?: BN;
61
+ }
62
+ interface IUpdateData extends IInteractData {
63
+ enableAutomaticWithdrawal?: boolean;
64
+ withdrawFrequency?: BN;
65
+ amountPerPeriod?: BN;
66
+ transferableBySender?: boolean;
67
+ transferableByRecipient?: boolean;
68
+ cancelableBySender?: boolean;
69
+ }
70
+ type ICancelData = IInteractData;
71
+ interface ITransferData extends IInteractData {
72
+ newRecipient: string;
73
+ }
74
+ interface ITopUpData extends IInteractData {
75
+ amount: BN;
76
+ }
77
+ type IGetOneData = IInteractData;
78
+ interface IGetFeesData {
79
+ address: string;
80
+ }
81
+ interface IGetAllData {
82
+ address: string;
83
+ type?: StreamType;
84
+ direction?: StreamDirection;
85
+ }
86
+ interface ICreateMultiError {
87
+ recipient: string;
88
+ error: string;
89
+ contractErrorCode?: string;
90
+ }
91
+ type MetadataId = string;
92
+ interface ITransactionResult {
93
+ ixs: TransactionInstruction[];
94
+ txId: string;
95
+ }
96
+ interface IFees {
97
+ streamflowFee: number;
98
+ partnerFee: number;
99
+ }
100
+ interface ICreateResult extends ITransactionResult {
101
+ metadataId: MetadataId;
102
+ }
103
+ interface IMultiTransactionResult {
104
+ txs: string[];
105
+ metadatas: MetadataId[];
106
+ metadataToRecipient: Record<MetadataId, IRecipient>;
107
+ errors: ICreateMultiError[];
108
+ }
109
+ type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
110
+ declare enum StreamDirection {
111
+ Outgoing = "outgoing",
112
+ Incoming = "incoming",
113
+ All = "all"
114
+ }
115
+ declare enum StreamType {
116
+ All = "all",
117
+ Payment = "payment",
118
+ Vesting = "vesting",
119
+ Lock = "lock"
120
+ }
121
+ interface LinearStream {
122
+ magic: number;
123
+ version: number;
124
+ createdAt: number;
125
+ withdrawnAmount: BN;
126
+ canceledAt: number;
127
+ end: number;
128
+ lastWithdrawnAt: number;
129
+ sender: string;
130
+ senderTokens: string;
131
+ recipient: string;
132
+ recipientTokens: string;
133
+ mint: string;
134
+ escrowTokens: string;
135
+ streamflowTreasury: string;
136
+ streamflowTreasuryTokens: string;
137
+ streamflowFeeTotal: BN;
138
+ streamflowFeeWithdrawn: BN;
139
+ streamflowFeePercent: number;
140
+ partnerFeeTotal: BN;
141
+ partnerFeeWithdrawn: BN;
142
+ partnerFeePercent: number;
143
+ partner: string;
144
+ partnerTokens: string;
145
+ start: number;
146
+ depositedAmount: BN;
147
+ period: number;
148
+ amountPerPeriod: BN;
149
+ cliff: number;
150
+ cliffAmount: BN;
151
+ cancelableBySender: boolean;
152
+ cancelableByRecipient: boolean;
153
+ automaticWithdrawal: boolean;
154
+ transferableBySender: boolean;
155
+ transferableByRecipient: boolean;
156
+ canTopup: boolean;
157
+ name: string;
158
+ withdrawalFrequency: number;
159
+ closed: boolean;
160
+ currentPauseStart: number;
161
+ pauseCumulative: BN;
162
+ lastRateChangeTime: number;
163
+ fundsUnlockedAtLastRateChange: BN;
164
+ type: StreamType;
165
+ unlocked(currentTimestamp: number): BN;
166
+ remaining(decimals: number): number;
167
+ }
168
+ type AlignedStreamData = {
169
+ minPrice: number;
170
+ maxPrice: number;
171
+ minPercentage: number;
172
+ maxPercentage: number;
173
+ oracleType: OracleTypeName;
174
+ priceOracle: string | undefined;
175
+ tickSize: number;
176
+ initialAmountPerPeriod: BN;
177
+ initialPrice: number;
178
+ lastPrice: number;
179
+ lastAmountUpdateTime: number;
180
+ initialNetAmount: BN;
181
+ expiryTime: number;
182
+ expiryPercentage: number;
183
+ floorPrice: number;
184
+ };
185
+ type AlignedStream = LinearStream & AlignedStreamData;
186
+ type Stream = LinearStream | AlignedStream;
187
+ /**
188
+ * Error codes raised by Solana protocol specifically
189
+ */
190
+ declare enum ContractErrorCode {
191
+ /** Accounts not writable */
192
+ AccountsNotWritable = "AccountsNotWritable",
193
+ /** Invalid Metadata */
194
+ InvalidMetadata = "InvalidMetadata",
195
+ /** Invalid metadata account */
196
+ InvalidMetadataAccount = "InvalidMetadataAccount",
197
+ /** Provided accounts don't match the ones in contract */
198
+ MetadataAccountMismatch = "MetadataAccountMismatch",
199
+ /** Invalid escrow account */
200
+ InvalidEscrowAccount = "InvalidEscrowAccount",
201
+ /** Provided account(s) is/are not valid associated token accounts */
202
+ NotAssociated = "NotAssociated",
203
+ /** Sender mint does not match accounts mint */
204
+ MintMismatch = "MintMismatch",
205
+ /** Recipient not transferable for account */
206
+ TransferNotAllowed = "TransferNotAllowed",
207
+ /** Contract closed */
208
+ ContractClosed = "ContractClosed",
209
+ /** Invalid Streamflow Treasury accounts supplied */
210
+ InvalidTreasury = "InvalidTreasury",
211
+ /** Given timestamps are invalid */
212
+ InvalidTimestamps = "InvalidTimestamps",
213
+ /** Invalid deposit configuration */
214
+ InvalidDepositConfiguration = "InvalidDepositConfiguration",
215
+ /** Amount cannot be zero */
216
+ AmountIsZero = "AmountIsZero",
217
+ /** Amount requested is larger than available */
218
+ AmountMoreThanAvailable = "AmountMoreThanAvailable",
219
+ /** Amount currently available is zero */
220
+ AmountAvailableIsZero = "AmountAvailableIsZero",
221
+ /** Arithmetic error */
222
+ ArithmeticError = "ArithmeticError",
223
+ /** Metadata account data must be 1104 bytes long */
224
+ InvalidMetadataSize = "InvalidMetadataSize",
225
+ /** Metadata state account must be initialized */
226
+ UninitializedMetadata = "UninitializedMetadata",
227
+ /** Authority does not have permission for this action */
228
+ Unauthorized = "Unauthorized",
229
+ /** Contract is not transferable to the original recipient */
230
+ SelfTransfer = "SelfTransfer",
231
+ /** Contract is already paused */
232
+ AlreadyPaused = "AlreadyPaused",
233
+ /** Contract is not paused */
234
+ NotPaused = "NotPaused",
235
+ /** Meta account is not rent exempt */
236
+ MetadataNotRentExempt = "MetadataNotRentExempt"
237
+ }
238
+ declare enum AlignedProxyErrorCode {
239
+ /** Authority does not have permission for this action */
240
+ Unauthorized = "Unauthorized",
241
+ /** Arithmetic error */
242
+ ArithmeticError = "ArithmeticError",
243
+ /** Mint has unsupported Token Extensions */
244
+ UnsupportedTokenExtensions = "UnsupportedTokenExtensions",
245
+ /** Provided period is too short, should be equal or more than 30 seconds */
246
+ PeriodTooShort = "PeriodTooShort",
247
+ /** Provided percentage tick size is invalid */
248
+ InvalidTickSize = "InvalidTickSize",
249
+ /** Provided percentage bounds are invalid */
250
+ InvalidPercentageBoundaries = "InvalidPercentageBoundaries",
251
+ /** Provided price bounds are invalid */
252
+ InvalidPriceBoundaries = "InvalidPriceBoundaries",
253
+ /** Unsupported price oracle */
254
+ UnsupportedOracle = "UnsupportedOracle",
255
+ /** Invalid oracle account */
256
+ InvalidOracleAccount = "InvalidOracleAccount",
257
+ /** Invalid oracle price */
258
+ InvalidOraclePrice = "InvalidOraclePrice",
259
+ /** Invalid Stream Metadata */
260
+ InvalidStreamMetadata = "InvalidStreamMetadata",
261
+ /** Release amount has already been updated in this period */
262
+ AmountAlreadyUpdated = "AmountAlreadyUpdated",
263
+ /** All funds are already unlocked */
264
+ AllFundsUnlocked = "AllFundsUnlocked"
265
+ }
266
+ /**
267
+ * @interface
268
+ */
269
+ interface TransactionSchedulingOptions {
270
+ /**
271
+ * concurrency rate for scheduling
272
+ */
273
+ sendRate: number;
274
+ /**
275
+ * time interval between consecutive sends
276
+ */
277
+ sendInterval?: number;
278
+ /**
279
+ * time interval before confirming the transaction
280
+ */
281
+ waitBeforeConfirming?: number;
282
+ }
283
+ /**
284
+ * @interface
285
+ */
286
+ interface StreamClientOptions {
287
+ clusterUrl: string;
288
+ cluster?: ICluster;
289
+ programId?: string;
290
+ commitment?: Commitment | ConnectionConfig;
291
+ sendRate?: number;
292
+ sendThrottler?: PQueue;
293
+ sendScheduler?: PQueue | TransactionSchedulingOptions;
294
+ }
295
+ type AlignedUnlocksTypes = IdlTypes<StreamflowAlignedUnlocks>;
296
+ type AlignedUnlocksAccounts = IdlAccounts<StreamflowAlignedUnlocks>;
297
+ type AlignedUnlocksContract = AlignedUnlocksAccounts["contract"];
298
+ type OracleType = IdlTypes<StreamflowAlignedUnlocks>["oracleType"];
299
+ type TestOracle = AlignedUnlocksAccounts["testOracle"];
300
+ type CreateParams = AlignedUnlocksTypes["createParams"];
301
+ type ChangeOracleParams = AlignedUnlocksTypes["changeOracleParams"];
302
+ type CreateTestOracleParams = AlignedUnlocksTypes["createTestOracleParams"];
303
+ type UpdateTestOracleParams = AlignedUnlocksTypes["updateTestOracleParams"];
304
+ interface ISearchStreams {
305
+ mint?: string;
306
+ sender?: string;
307
+ recipient?: string;
308
+ closed?: boolean;
309
+ }
310
+ interface Account {
311
+ pubkey: PublicKey;
312
+ account: AccountInfo<Buffer>;
313
+ }
314
+ interface ICreateExt {
315
+ sender: SignerWalletAdapter | Keypair;
316
+ isNative?: boolean;
317
+ }
318
+ interface ITransactionExtWithInstructions extends ITransactionExt {
319
+ customInstructions?: {
320
+ after?: InstructionGenerator;
321
+ };
322
+ }
323
+ interface ICreateStreamExt extends ICreateExt, ITransactionExtWithInstructions {
324
+ metadataPubKeys?: PublicKey[];
325
+ partner?: string | null;
326
+ }
327
+ interface IPrepareCreateStreamExt extends Omit<ICreateStreamExt, "sender"> {
328
+ sender: {
329
+ publicKey: PublicKey | null;
330
+ };
331
+ }
332
+ interface IInteractStreamExt extends ITransactionExtWithInstructions {
333
+ invoker: SignerWalletAdapter | Keypair;
334
+ checkTokenAccounts?: boolean;
335
+ }
336
+ interface IPrepareStreamExt extends Omit<IInteractStreamExt, "invoker"> {
337
+ invoker: {
338
+ publicKey: PublicKey | null;
339
+ };
340
+ }
341
+ interface ITopUpStreamExt extends ITransactionExt {
342
+ invoker: SignerWalletAdapter | Keypair;
343
+ isNative?: boolean;
344
+ }
345
+ interface ICreateStreamInstructions {
346
+ ixs: TransactionInstruction[];
347
+ metadata: Keypair | undefined;
348
+ metadataPubKey: PublicKey;
349
+ }
350
+ declare class Contract implements LinearStream {
351
+ magic: number;
352
+ version: number;
353
+ createdAt: number;
354
+ withdrawnAmount: BN;
355
+ canceledAt: number;
356
+ end: number;
357
+ lastWithdrawnAt: number;
358
+ sender: string;
359
+ senderTokens: string;
360
+ recipient: string;
361
+ recipientTokens: string;
362
+ mint: string;
363
+ escrowTokens: string;
364
+ streamflowTreasury: string;
365
+ streamflowTreasuryTokens: string;
366
+ streamflowFeeTotal: BN;
367
+ streamflowFeeWithdrawn: BN;
368
+ streamflowFeePercent: number;
369
+ partnerFeeTotal: BN;
370
+ partnerFeeWithdrawn: BN;
371
+ partnerFeePercent: number;
372
+ partner: string;
373
+ partnerTokens: string;
374
+ start: number;
375
+ depositedAmount: BN;
376
+ period: number;
377
+ amountPerPeriod: BN;
378
+ cliff: number;
379
+ cliffAmount: BN;
380
+ cancelableBySender: boolean;
381
+ cancelableByRecipient: boolean;
382
+ automaticWithdrawal: boolean;
383
+ transferableBySender: boolean;
384
+ transferableByRecipient: boolean;
385
+ canTopup: boolean;
386
+ name: string;
387
+ withdrawalFrequency: number;
388
+ closed: boolean;
389
+ currentPauseStart: number;
390
+ pauseCumulative: BN;
391
+ lastRateChangeTime: number;
392
+ fundsUnlockedAtLastRateChange: BN;
393
+ type: StreamType;
394
+ isAligned?: boolean;
395
+ constructor(stream: DecodedStream);
396
+ unlocked(currentTimestamp: number): BN;
397
+ remaining(decimals: number): number;
398
+ }
399
+ declare class AlignedContract extends Contract implements AlignedStream {
400
+ minPrice: number;
401
+ maxPrice: number;
402
+ minPercentage: number;
403
+ maxPercentage: number;
404
+ tickSize: number;
405
+ proxyAddress: string;
406
+ priceOracle: string | undefined;
407
+ oracleType: OracleTypeName;
408
+ initialAmountPerPeriod: BN;
409
+ initialPrice: number;
410
+ lastPrice: number;
411
+ lastAmountUpdateTime: number;
412
+ initialNetAmount: BN;
413
+ expiryTime: number;
414
+ expiryPercentage: number;
415
+ floorPrice: number;
416
+ constructor(stream: DecodedStream, alignedProxy: AlignedUnlocksContract);
417
+ }
418
+ interface DecodedStream {
419
+ magic: BN;
420
+ version: BN;
421
+ createdAt: BN;
422
+ withdrawnAmount: BN;
423
+ canceledAt: BN;
424
+ end: BN;
425
+ lastWithdrawnAt: BN;
426
+ sender: PublicKey;
427
+ senderTokens: PublicKey;
428
+ recipient: PublicKey;
429
+ recipientTokens: PublicKey;
430
+ mint: PublicKey;
431
+ escrowTokens: PublicKey;
432
+ streamflowTreasury: PublicKey;
433
+ streamflowTreasuryTokens: PublicKey;
434
+ streamflowFeeTotal: BN;
435
+ streamflowFeeWithdrawn: BN;
436
+ streamflowFeePercent: number;
437
+ partnerFeeTotal: BN;
438
+ partnerFeeWithdrawn: BN;
439
+ partnerFeePercent: number;
440
+ partner: PublicKey;
441
+ partnerTokens: PublicKey;
442
+ start: BN;
443
+ depositedAmount: BN;
444
+ period: BN;
445
+ amountPerPeriod: BN;
446
+ cliff: BN;
447
+ cliffAmount: BN;
448
+ cancelableBySender: boolean;
449
+ cancelableByRecipient: boolean;
450
+ automaticWithdrawal: boolean;
451
+ transferableBySender: boolean;
452
+ transferableByRecipient: boolean;
453
+ canTopup: boolean;
454
+ name: string;
455
+ withdrawFrequency: BN;
456
+ closed: boolean;
457
+ currentPauseStart: BN;
458
+ pauseCumulative: BN;
459
+ lastRateChangeTime: BN;
460
+ fundsUnlockedAtLastRateChange: BN;
461
+ }
462
+ interface MetadataRecipientHashMap {
463
+ [metadataPubKey: string]: IRecipient;
464
+ }
465
+ interface BatchItem {
466
+ recipient: string;
467
+ tx: VersionedTransaction;
468
+ }
469
+ interface BatchItemSuccess extends BatchItem {
470
+ signature: string;
471
+ }
472
+ interface BatchItemError extends BatchItem {
473
+ error: string;
474
+ }
475
+ type BatchItemResult = BatchItemSuccess | BatchItemError;
476
+ type InstructionGenerator = TransactionInstruction[] | ((params: {
477
+ instructions: TransactionInstruction[];
478
+ metadata?: PublicKey;
479
+ }) => TransactionInstruction[] | Promise<TransactionInstruction[]>);
480
+
481
+ /**
482
+ * Solana Client creation options
483
+ * @property cluster {@link ICluster} cluster type
484
+ * @property clusterUrl cluster url
485
+ * @interface ClientCreationOptions
486
+ */
487
+ type ClientCreationOptions = Omit<StreamClientOptions, "sendRate" | "sendThrottler">;
488
+ declare class SolanaStreamClient {
489
+ private readonly connection;
490
+ private readonly programId;
491
+ private readonly commitment;
492
+ readonly alignedProxyProgram: Program<StreamflowAlignedUnlocks>;
493
+ private readonly schedulingParams;
494
+ /**
495
+ * Create Stream instance with flat arguments
496
+ */
497
+ constructor(clusterUrl: string, cluster?: ICluster, commitment?: Commitment | ConnectionConfig, programId?: string, sendRate?: number, sendThrottler?: PQueue);
498
+ /**
499
+ * Create Stream instance with options
500
+ */
501
+ constructor(options: ClientCreationOptions);
502
+ getConnection(): Connection;
503
+ getCommitment(): Commitment | undefined;
504
+ getProgramId(): string;
505
+ getAlignedProxyProgramId(): string;
506
+ /**
507
+ * Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
508
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
509
+ *
510
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
511
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
512
+ *
513
+ * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
514
+ * @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
515
+ * @returns Transaction instructions and metadata ID
516
+ */
517
+ buildCreateTransactionInstructions(data: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<{
518
+ ixs: TransactionInstruction[];
519
+ metadataId: string;
520
+ metadata?: Keypair;
521
+ }>;
522
+ /**
523
+ * Builds a transaction for creating a new stream/vesting contract without signing or executing it.
524
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
525
+ *
526
+ * For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
527
+ * (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
528
+ *
529
+ * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
530
+ * @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
531
+ * @returns Transaction and metadata information
532
+ */
533
+ buildCreateTransaction(data: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<{
534
+ tx: VersionedTransaction;
535
+ metadataId: string;
536
+ metadata?: Keypair;
537
+ hash: string;
538
+ context: any;
539
+ }>;
540
+ /**
541
+ * Creates a new stream/vesting contract.
542
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
543
+ * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
544
+ * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
545
+ * @returns Create result
546
+ */
547
+ create(data: ICreateStreamData, extParams: ICreateStreamExt): Promise<ICreateResult>;
548
+ prepareCreateInstructions(streamParams: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
549
+ prepareCreateAlignedUnlockInstructions(streamParams: ICreateAlignedStreamData, extParams: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
550
+ /**
551
+ * Creates a new stream/vesting contract.
552
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
553
+ * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
554
+ * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
555
+ * @returns Create stream instructions
556
+ */
557
+ prepareCreateStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, tokenProgramId: streamTokenProgramId, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
558
+ /**
559
+ * Creates a new stream/vesting contract using unchecked instruction.
560
+ *
561
+ * Unchecked instruction differs from the regular in:
562
+ * - does not check for initialized associated token account (wallets with no control over their ATA should not be used
563
+ * as sender/recipient/partner or there are risks of funds being locked in the contract)
564
+ * - initialized contract PDA off chain
565
+ *
566
+ * If you are not sure if you should use create or create_unchecked, go for create to be safer.
567
+ * @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
568
+ * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
569
+ * @returns Create result
570
+ */
571
+ createUnchecked(data: ICreateStreamData, extParams: ICreateStreamExt): Promise<ICreateResult>;
572
+ /**
573
+ * Create Transaction instructions for `createUnchecked`
574
+ */
575
+ prepareCreateUncheckedInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, canUpdateRate, canPause, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<{
576
+ ixs: TransactionInstruction[];
577
+ metadata: Keypair | undefined;
578
+ metadataPubKey: PublicKey;
579
+ }>;
580
+ /**
581
+ * Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
582
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
583
+ * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
584
+ * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
585
+ * @returns Create multiple transaction instructions
586
+ */
587
+ buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
588
+ instructionsBatch: {
589
+ ixs: TransactionInstruction[];
590
+ metadata: Keypair | undefined;
591
+ recipient: string;
592
+ }[];
593
+ metadatas: string[];
594
+ metadataToRecipient: MetadataRecipientHashMap;
595
+ prepareInstructions: TransactionInstruction[];
596
+ }>;
597
+ /**
598
+ * Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
599
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
600
+ *
601
+ * IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation
602
+ * before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });
607
+ *
608
+ * // CRITICAL: Execute prepareTx first if it exists
609
+ * if (result.prepareTx) {
610
+ * await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
611
+ * }
612
+ *
613
+ * // Only then execute stream creation transactions
614
+ * for (const item of result.transactions) {
615
+ * await connection.sendAndConfirmTransaction(item.tx, [signer]);
616
+ * }
617
+ * ```
618
+ *
619
+ * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
620
+ * @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
621
+ * @returns Multiple transaction information
622
+ */
623
+ buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt): Promise<{
624
+ transactions: BatchItem[];
625
+ metadatas: string[];
626
+ metadataToRecipient: MetadataRecipientHashMap;
627
+ hash: Readonly<{
628
+ blockhash: string;
629
+ lastValidBlockHeight: number;
630
+ }>;
631
+ context: any;
632
+ prepareTx?: VersionedTransaction;
633
+ }>;
634
+ /**
635
+ * Creates multiple stream/vesting contracts.
636
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
637
+ * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
638
+ * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
639
+ * @returns Multiple transaction information
640
+ */
641
+ createMultiple(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
642
+ /**
643
+ * Creates multiple stream/vesting contracts, and send all transactions sequentially.
644
+ * All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
645
+ * In most cases, createMultiple should be used instead.
646
+ * @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
647
+ * @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
648
+ * @returns Multiple transaction information
649
+ */
650
+ createMultipleSequential(data: ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
651
+ /**
652
+ * Attempts withdrawing from the specified stream.
653
+ * @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
654
+ * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
655
+ * @returns Transaction result
656
+ */
657
+ withdraw({ id, amount }: IWithdrawData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
658
+ /**
659
+ * Creates Transaction Instructions for withdrawal
660
+ * @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
661
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
662
+ * @returns Transaction instructions
663
+ */
664
+ prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
665
+ /**
666
+ * Attempts canceling the specified stream.
667
+ * @param {ICancelData} cancelData - Cancellation parameters including stream ID
668
+ * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
669
+ * @returns Transaction result
670
+ */
671
+ cancel(cancelData: ICancelData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
672
+ /**
673
+ * Creates Transaction Instructions for cancel
674
+ * @param {ICancelData} cancelData - Cancellation parameters including stream ID
675
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
676
+ * @returns Transaction instructions
677
+ */
678
+ prepareCancelInstructions(cancelData: ICancelData, extParams: IPrepareStreamExt): Promise<TransactionInstruction[]>;
679
+ /**
680
+ * Creates Transaction Instructions for cancel
681
+ * @param {ICancelData} cancelData - Cancellation parameters including stream ID
682
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
683
+ * @returns Transaction instructions
684
+ */
685
+ prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
686
+ /**
687
+ * Creates Transaction Instructions for cancel
688
+ * @param {ICancelData} cancelData - Cancellation parameters including stream ID
689
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
690
+ * @returns Transaction instructions
691
+ */
692
+ prepareCancelStreamInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
693
+ /**
694
+ * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
695
+ * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
696
+ * @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
697
+ * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
698
+ * @returns Transaction result
699
+ */
700
+ transfer({ id, newRecipient }: ITransferData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
701
+ /**
702
+ * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
703
+ * Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
704
+ * @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
705
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
706
+ * @returns Transaction instructions
707
+ */
708
+ prepareTransferInstructions({ id, newRecipient }: ITransferData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
709
+ /**
710
+ * Tops up stream account with specified amount.
711
+ * @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
712
+ * @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
713
+ * @returns Transaction result
714
+ */
715
+ topup({ id, amount }: ITopUpData, extParams: ITopUpStreamExt): Promise<ITransactionResult>;
716
+ /**
717
+ * Create Transaction instructions for topup
718
+ * @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
719
+ * @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
720
+ * @returns Transaction instructions
721
+ */
722
+ prepareTopupInstructions({ id, amount }: ITopUpData, { invoker, isNative, computePrice, computeLimit }: ITopUpStreamExt): Promise<TransactionInstruction[]>;
723
+ /**
724
+ * Fetch stream data by its id (address).
725
+ * @param {IGetOneData} getData - Query parameters containing the stream ID to fetch
726
+ * @returns Stream data
727
+ */
728
+ getOne({ id }: IGetOneData): Promise<Stream>;
729
+ /**
730
+ * Fetch all aligned outgoing streams/contracts by the provided public key.
731
+ * @param {string} sender - Sender public key
732
+ * @returns Record of stream data
733
+ */
734
+ private getOutgoingAlignedStreams;
735
+ private getIncomingAlignedStreams;
736
+ /**
737
+ * Fetch streams/contracts by providing direction.
738
+ * Streams are sorted by start time in ascending order.
739
+ * @param {IGetAllData} getData - Query parameters including address, stream type filter, and direction filter
740
+ * @returns Record of stream data
741
+ */
742
+ get({ address, type, direction, }: IGetAllData): Promise<[string, Stream][]>;
743
+ /**
744
+ * Searches for streams/contracts by providing filters.
745
+ * @param {ISearchStreams} data - Search by mint, sender, recipient or closed status
746
+ * @returns Record of stream data
747
+ */
748
+ searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
749
+ /**
750
+ * Attempts updating the stream auto withdrawal params and amount per period
751
+ * @param {IUpdateData} data - Update parameters including stream ID and new settings
752
+ * @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
753
+ * @returns Transaction result
754
+ */
755
+ update(data: IUpdateData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
756
+ /**
757
+ * Create Transaction instructions for update
758
+ * @param {IUpdateData} data - Update parameters including stream ID and new settings
759
+ * @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
760
+ * @returns Transaction instructions
761
+ */
762
+ prepareUpdateInstructions(data: IUpdateData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
763
+ /**
764
+ * Gets fees for a given address
765
+ * @param {IGetFeesData} getData - Query parameters containing the partner address to check for custom fees
766
+ * @returns Fees
767
+ */
768
+ getFees({ address }: IGetFeesData): Promise<IFees | null>;
769
+ /**
770
+ * Gets default streamflow fee
771
+ * @returns Default streamflow fee
772
+ */
773
+ getDefaultStreamflowFee(): Promise<number>;
774
+ /**
775
+ * Returns total fee percent, streamflow fees + partner fees
776
+ * @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
777
+ * @param chainSpecificParams additional parameters required by chain client
778
+ * @returns fee as floating number, so if fee is 0.99%, it will return 0.99
779
+ */
780
+ getTotalFee(getFeesData: IGetFeesData): Promise<number>;
781
+ /**
782
+ * Extracts error code from an error
783
+ * @param {Error} err - Error
784
+ * @returns Error code
785
+ */
786
+ extractErrorCode(err: Error): string | null;
787
+ /**
788
+ * Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
789
+ */
790
+ isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
791
+ /**
792
+ * Utility function to generate metadata for a Contract or return existing Pubkey
793
+ */
794
+ private getOrCreateStreamMetadata;
795
+ /**
796
+ * Returns insrtuctions for creating associated token accounts for the provided owners
797
+ */
798
+ private getCreateATAInstructions;
799
+ private applyCustomAfterInstructions;
800
+ }
801
+
802
+ /**
803
+ * Calculate total amount of a Contract including all fees.
804
+ * - first we convert fee floating to a BN with up to 4 decimals precision
805
+ * - then we reverse the fee with `FEE_MULTIPLIER` to safely multiply it by depositedAmount
806
+ * to receive a total number and not percentage of depositedAmount
807
+ * @param depositedAmount deposited raw tokens
808
+ * @param totalFee sum of all fees in percentage as floating number, e.g. 0.99% should be supplied as 0.99
809
+ * @returns total tokens amount that Contract will retrieve from the Sender
810
+ */
811
+ declare const calculateTotalAmountToDeposit: (depositedAmount: BN, totalFee: number) => BN;
812
+ declare const decodeStream: (buf: Buffer) => DecodedStream;
813
+ /**
814
+ * Sign passed BatchItems with wallet request or KeyPair
815
+ * @param {Keypair | SignerWalletAdapter} sender - Wallet or Keypair of sendin account
816
+ * @param {BatchItem[]} items - Multiple recipient contracts split into separate items
817
+ * @return {BatchItem[]} - Returns items with signatures.
818
+ */
819
+ declare function signAllTransactionWithRecipients(sender: Keypair | SignerWalletAdapter, items: BatchItem[]): Promise<BatchItem[]>;
820
+ /**
821
+ * Sign passed BatchItems with wallet request or KeyPair
822
+ * @param {Connection} connection - Solana web3 connection object.
823
+ * @param {BatchItem} batchItem - Signed transaction ready to be send.
824
+ * @param confirmationParams - Confirmation Params that will be used for execution
825
+ * @param throttleParams - rate or throttler instance to throttle TX sending - to not spam the blockchain too much
826
+ * @return {Promise<BatchItemResult>} - Returns settled transaction item
827
+ */
828
+ declare function sendAndConfirmStreamRawTransaction(connection: Connection, batchItem: BatchItem, confirmationParams: ConfirmationParams, throttleParams: ThrottleParams): Promise<BatchItemResult>;
829
+ /**
830
+ * Used to make on chain calls to the contract and wrap raised errors if any
831
+ * @param func function that interacts with the contract
832
+ * @param callback callback that may be used to extract error code
833
+ * @returns {T}
834
+ */
835
+ declare function handleContractError<T>(func: () => Promise<T>, callback?: (err: Error) => string | null): Promise<T>;
836
+ declare function extractSolanaErrorCode(errorText: string, logs?: string[]): string | null;
837
+
838
+ declare const deriveContractPDA: (programId: PublicKey, streamMetadata: PublicKey) => PublicKey;
839
+ declare const deriveEscrowPDA: (programId: PublicKey, streamMetadata: PublicKey) => PublicKey;
840
+ declare const deriveTestOraclePDA: (programId: PublicKey, mint: PublicKey, creator: PublicKey) => PublicKey;
841
+
842
+ interface CreateStreamData {
843
+ start: BN;
844
+ depositedAmount: BN;
845
+ period: BN;
846
+ amountPerPeriod: BN;
847
+ cliff: BN;
848
+ cliffAmount: BN;
849
+ cancelableBySender: boolean;
850
+ cancelableByRecipient: boolean;
851
+ automaticWithdrawal: boolean;
852
+ transferableBySender: boolean;
853
+ transferableByRecipient: boolean;
854
+ canTopup: boolean;
855
+ canUpdateRate: boolean;
856
+ canPause: boolean;
857
+ name: string;
858
+ withdrawFrequency: BN;
859
+ }
860
+ interface CreateStreamAccounts {
861
+ sender: PublicKey;
862
+ senderTokens: PublicKey;
863
+ recipient: PublicKey;
864
+ recipientTokens: PublicKey;
865
+ metadata: PublicKey;
866
+ escrowTokens: PublicKey;
867
+ streamflowTreasury: PublicKey;
868
+ streamflowTreasuryTokens: PublicKey;
869
+ partner: PublicKey;
870
+ partnerTokens: PublicKey;
871
+ mint: PublicKey;
872
+ feeOracle: PublicKey;
873
+ rent: PublicKey;
874
+ timelockProgram: PublicKey;
875
+ tokenProgram: PublicKey;
876
+ associatedTokenProgram: PublicKey;
877
+ withdrawor: PublicKey;
878
+ systemProgram: PublicKey;
879
+ }
880
+ declare const createStreamInstruction: (data: CreateStreamData, programId: PublicKey, accounts: CreateStreamAccounts) => Promise<TransactionInstruction>;
881
+ interface CreateUncheckedStreamData {
882
+ start: BN;
883
+ depositedAmount: BN;
884
+ period: BN;
885
+ amountPerPeriod: BN;
886
+ cliff: BN;
887
+ cliffAmount: BN;
888
+ cancelableBySender: boolean;
889
+ cancelableByRecipient: boolean;
890
+ automaticWithdrawal: boolean;
891
+ transferableBySender: boolean;
892
+ transferableByRecipient: boolean;
893
+ canTopup: boolean;
894
+ canUpdateRate: boolean;
895
+ canPause: boolean;
896
+ name: string;
897
+ withdrawFrequency: BN;
898
+ recipient: PublicKey;
899
+ partner: PublicKey;
900
+ }
901
+ interface CreateUncheckedStreamAccounts {
902
+ payer?: PublicKey;
903
+ sender: PublicKey;
904
+ senderTokens: PublicKey;
905
+ metadata: PublicKey;
906
+ escrowTokens: PublicKey;
907
+ mint: PublicKey;
908
+ feeOracle: PublicKey;
909
+ rent: PublicKey;
910
+ timelockProgram: PublicKey;
911
+ tokenProgram: PublicKey;
912
+ withdrawor: PublicKey;
913
+ systemProgram: PublicKey;
914
+ }
915
+ declare const createUncheckedStreamInstruction: (data: CreateUncheckedStreamData, programId: PublicKey, accounts: CreateUncheckedStreamAccounts) => Promise<TransactionInstruction>;
916
+ interface WithdrawAccounts {
917
+ authority: PublicKey;
918
+ recipient: PublicKey;
919
+ recipientTokens: PublicKey;
920
+ metadata: PublicKey;
921
+ escrowTokens: PublicKey;
922
+ streamflowTreasury: PublicKey;
923
+ streamflowTreasuryTokens: PublicKey;
924
+ partner: PublicKey;
925
+ partnerTokens: PublicKey;
926
+ mint: PublicKey;
927
+ tokenProgram: PublicKey;
928
+ }
929
+ declare const withdrawStreamInstruction: (amount: BN, programId: PublicKey, { authority, recipient, recipientTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, }: WithdrawAccounts) => Promise<TransactionInstruction>;
930
+ interface UpdateAccounts {
931
+ authority: PublicKey;
932
+ metadata: PublicKey;
933
+ withdrawor: PublicKey;
934
+ systemProgram: PublicKey;
935
+ }
936
+ declare const updateStreamInstruction: (params: IUpdateData, programId: PublicKey, { authority, metadata, withdrawor, systemProgram }: UpdateAccounts) => Promise<TransactionInstruction>;
937
+ interface CancelAccounts {
938
+ authority: PublicKey;
939
+ sender: PublicKey;
940
+ senderTokens: PublicKey;
941
+ recipient: PublicKey;
942
+ recipientTokens: PublicKey;
943
+ metadata: PublicKey;
944
+ escrowTokens: PublicKey;
945
+ streamflowTreasury: PublicKey;
946
+ streamflowTreasuryTokens: PublicKey;
947
+ partner: PublicKey;
948
+ partnerTokens: PublicKey;
949
+ mint: PublicKey;
950
+ tokenProgram: PublicKey;
951
+ }
952
+ declare const cancelStreamInstruction: (programId: PublicKey, { authority, sender, senderTokens, recipient, recipientTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, }: CancelAccounts) => Promise<TransactionInstruction>;
953
+ interface TransferAccounts {
954
+ authority: PublicKey;
955
+ newRecipient: PublicKey;
956
+ newRecipientTokens: PublicKey;
957
+ metadata: PublicKey;
958
+ mint: PublicKey;
959
+ rent: PublicKey;
960
+ tokenProgram: PublicKey;
961
+ associatedTokenProgram: PublicKey;
962
+ systemProgram: PublicKey;
963
+ }
964
+ declare const transferStreamInstruction: (programId: PublicKey, { authority, newRecipient, newRecipientTokens, metadata, mint, rent, tokenProgram, associatedTokenProgram, systemProgram, }: TransferAccounts) => Promise<TransactionInstruction>;
965
+ interface TopupAccounts {
966
+ sender: PublicKey;
967
+ senderTokens: PublicKey;
968
+ metadata: PublicKey;
969
+ escrowTokens: PublicKey;
970
+ streamflowTreasury: PublicKey;
971
+ streamflowTreasuryTokens: PublicKey;
972
+ partner: PublicKey;
973
+ partnerTokens: PublicKey;
974
+ mint: PublicKey;
975
+ tokenProgram: PublicKey;
976
+ withdrawor: PublicKey;
977
+ systemProgram: PublicKey;
978
+ }
979
+ declare const topupStreamInstruction: (amount: BN, programId: PublicKey, { sender, senderTokens, metadata, escrowTokens, streamflowTreasury, streamflowTreasuryTokens, partner, partnerTokens, mint, tokenProgram, withdrawor, systemProgram, }: TopupAccounts) => Promise<TransactionInstruction>;
980
+
981
+ interface ICalculateUnlockedAmount {
982
+ depositedAmount: BN;
983
+ cliff: number;
984
+ cliffAmount: BN;
985
+ end: number;
986
+ currentTimestamp: number;
987
+ lastRateChangeTime: number;
988
+ period: number;
989
+ amountPerPeriod: BN;
990
+ fundsUnlockedAtLastRateChange: BN;
991
+ }
992
+ declare const calculateUnlockedAmount: ({ depositedAmount, cliff, cliffAmount, end, currentTimestamp, lastRateChangeTime, period, amountPerPeriod, fundsUnlockedAtLastRateChange, }: ICalculateUnlockedAmount) => BN;
993
+ declare const isCliffCloseToDepositedAmount: (streamData: {
994
+ depositedAmount: BN;
995
+ cliffAmount: BN;
996
+ }) => boolean;
997
+ declare const isPayment: (streamData: {
998
+ canTopup: boolean;
999
+ }) => boolean;
1000
+ declare const isVesting: (streamData: {
1001
+ canTopup: boolean;
1002
+ depositedAmount: BN;
1003
+ cliffAmount: BN;
1004
+ minPrice?: number;
1005
+ maxPrice?: number;
1006
+ minPercentage?: number;
1007
+ maxPercentage?: number;
1008
+ }) => boolean;
1009
+ declare const isAligned: (stream: Stream) => stream is AlignedStream;
1010
+ declare const isCreateAlignedStreamData: (obj: ICreateStreamData) => obj is ICreateAlignedStreamData;
1011
+ declare const isDynamicLock: (minPrice?: number, maxPrice?: number, minPercentage?: number, maxPercentage?: number) => boolean;
1012
+ declare const isTokenLock: (streamData: {
1013
+ canTopup: boolean;
1014
+ automaticWithdrawal: boolean;
1015
+ cancelableBySender: boolean;
1016
+ cancelableByRecipient: boolean;
1017
+ transferableBySender: boolean;
1018
+ transferableByRecipient: boolean;
1019
+ depositedAmount: BN;
1020
+ cliffAmount: BN;
1021
+ minPrice?: number;
1022
+ maxPrice?: number;
1023
+ minPercentage?: number;
1024
+ maxPercentage?: number;
1025
+ }) => boolean;
1026
+ declare const buildStreamType: (streamData: {
1027
+ canTopup: boolean;
1028
+ automaticWithdrawal: boolean;
1029
+ cancelableBySender: boolean;
1030
+ cancelableByRecipient: boolean;
1031
+ transferableBySender: boolean;
1032
+ transferableByRecipient: boolean;
1033
+ depositedAmount: BN;
1034
+ cliffAmount: BN;
1035
+ minPrice?: number;
1036
+ maxPrice?: number;
1037
+ minPercentage?: number;
1038
+ maxPercentage?: number;
1039
+ }) => StreamType;
1040
+ declare const decodeEndTime: (endTime: BN) => number;
1041
+
1042
+ declare const TX_FINALITY_CONFIRMED = "confirmed";
1043
+ declare const ORIGINAL_CONTRACT_SENDER_OFFSET = 9;
1044
+ declare const STREAM_STRUCT_OFFSET_SENDER = 49;
1045
+ declare const STREAM_STRUCT_OFFSET_RECIPIENT = 113;
1046
+ declare const STREAM_STRUCT_OFFSET_MINT = 177;
1047
+ declare const STREAM_STRUCT_OFFSET_CLOSED = 671;
1048
+ declare const MAX_SAFE_UNIX_TIME_VALUE = 8640000000000;
1049
+ declare const WITHDRAW_AVAILABLE_AMOUNT: BN;
1050
+ declare const ALIGNED_PRECISION_FACTOR_POW = 9;
1051
+ declare const STREAM_STRUCT_OFFSETS: Record<keyof ISearchStreams, number>;
1052
+ declare const CREATE_PARAMS_PADDING = 126;
1053
+ declare const PROGRAM_ID: {
1054
+ devnet: string;
1055
+ mainnet: string;
1056
+ testnet: string;
1057
+ local: string;
1058
+ };
1059
+ declare const ALIGNED_UNLOCKS_PROGRAM_ID: {
1060
+ devnet: string;
1061
+ mainnet: string;
1062
+ testnet: string;
1063
+ local: string;
1064
+ };
1065
+ declare const ALIGNED_COMPUTE_LIMIT = 300000;
1066
+ declare const CONTRACT_DISCRIMINATOR: number[];
1067
+ declare const TEST_ORACLE_DISCRIMINATOR: number[];
1068
+ declare const CONTRACT_SEED: Buffer$1;
1069
+ declare const ESCROW_SEED: Buffer$1;
1070
+ declare const TEST_ORACLE_SEED: Buffer$1;
1071
+ declare const PARTNER_ORACLE_PROGRAM_ID = "pardpVtPjC8nLj1Dwncew62mUzfChdCX1EaoZe8oCAa";
1072
+ declare const STREAMFLOW_TREASURY_PUBLIC_KEY: PublicKey;
1073
+ declare const WITHDRAWOR_PUBLIC_KEY: PublicKey;
1074
+ declare const FEE_ORACLE_PUBLIC_KEY: PublicKey;
1075
+ declare const AIRDROP_TEST_TOKEN = "Gssm3vfi8s65R31SBdmQRq6cKeYojGgup7whkw4VCiQj";
1076
+ declare const FEES_METADATA_SEED: Buffer$1;
1077
+ declare const DEFAULT_STREAMFLOW_FEE = 0.99;
1078
+ declare const AIRDROP_AMOUNT = 1;
1079
+ declare const PARTNER_SCHEMA: {
1080
+ struct: {
1081
+ pubkey: {
1082
+ array: {
1083
+ type: string;
1084
+ len: number;
1085
+ };
1086
+ };
1087
+ partner_fee: string;
1088
+ strm_fee: string;
1089
+ };
1090
+ };
1091
+ declare const PARTNERS_SCHEMA: {
1092
+ array: {
1093
+ type: {
1094
+ struct: {
1095
+ pubkey: {
1096
+ array: {
1097
+ type: string;
1098
+ len: number;
1099
+ };
1100
+ };
1101
+ partner_fee: string;
1102
+ strm_fee: string;
1103
+ };
1104
+ };
1105
+ };
1106
+ };
1107
+ declare const SOLANA_ERROR_MATCH_REGEX: RegExp;
1108
+ declare const SOLANA_ERROR_MAP: {
1109
+ [key: number]: string;
1110
+ };
1111
+
1112
+ declare const _default: {
1113
+ version: string;
1114
+ name: string;
1115
+ instructions: {
1116
+ name: string;
1117
+ accounts: {
1118
+ name: string;
1119
+ isMut: boolean;
1120
+ isSigner: boolean;
1121
+ }[];
1122
+ args: ({
1123
+ name: string;
1124
+ type: string;
1125
+ } | {
1126
+ name: string;
1127
+ type: {
1128
+ array: (string | number)[];
1129
+ };
1130
+ })[];
1131
+ }[];
1132
+ };
1133
+
1134
+ export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, type Account, AlignedContract, AlignedProxyErrorCode, type AlignedStream, type AlignedStreamData, type AlignedUnlocksContract, type BatchItem, type BatchItemError, type BatchItemResult, type BatchItemSuccess, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type ChangeOracleParams, type ClientCreationOptions, Contract, ContractErrorCode, type CreateParams, type CreateTestOracleParams, DEFAULT_STREAMFLOW_FEE, type DecodedStream, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type IAlignedStreamConfig, type IBaseStreamConfig, type ICancelData, type ICreateAlignedStreamData, type ICreateExt, type ICreateLinearStreamData, type ICreateMultiError, type ICreateMultipleAlignedStreamData, type ICreateMultipleLinearStreamData, type ICreateMultipleStreamData, type ICreateResult, type ICreateStreamData, type ICreateStreamExt, type ICreateStreamInstructions, type IFees, type IGetAllData, type IGetFeesData, type IGetOneData, type IInteractData, type IInteractStreamExt, type IMultiTransactionResult, type IPrepareCreateStreamExt, type IPrepareStreamExt, type IRecipient, type ISearchStreams, type ITopUpData, type ITopUpStreamExt, type ITransactionExtWithInstructions, type ITransactionResult, type ITransferData, type IUpdateData, type IWithdrawData, type InstructionGenerator, type LinearStream, MAX_SAFE_UNIX_TIME_VALUE, type MetadataRecipientHashMap, ORIGINAL_CONTRACT_SENDER_OFFSET, type OracleType, type OracleTypeName, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, 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_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, SolanaStreamClient, type Stream, type StreamClientOptions, StreamDirection, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TestOracle, type TransactionSchedulingOptions, type UpdateTestOracleParams, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createStreamInstruction, createUncheckedStreamInstruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveTestOraclePDA, extractSolanaErrorCode, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isPayment, isTokenLock, isVesting, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, updateStreamInstruction, withdrawStreamInstruction };