@streamflow/stream 12.1.0 → 12.2.1-alpha.p361.abedd84
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 +1114 -0
- package/dist/cjs/index.cjs +487 -22
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +5 -4
- package/dist/cjs/solana/api/index.cjs +5402 -0
- package/dist/cjs/solana/api/index.cjs.map +1 -0
- package/dist/cjs/solana/api/index.d.cts +8 -0
- package/dist/cjs/solana/index.cjs +487 -22
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +8 -902
- package/dist/esm/index-Cu0If4Dd.d.ts +1114 -0
- package/dist/esm/index.d.ts +5 -4
- package/dist/esm/index.js +464 -23
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/api/index.d.ts +8 -0
- package/dist/esm/solana/api/index.js +5352 -0
- package/dist/esm/solana/api/index.js.map +1 -0
- package/dist/esm/solana/index.d.ts +8 -902
- package/dist/esm/solana/index.js +464 -23
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +19 -6
|
@@ -1,908 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as DecodedStream, B as BatchItem, a as BatchItemResult, I as IUpdateData, S as StreamType, b as Stream, A as AlignedStream, c as ICreateStreamData, d as ICreateAlignedStreamData, e as ISearchStreams } from '../index-Cu0If4Dd.js';
|
|
2
|
+
export { f as Account, g as AlignedContract, h as AlignedProxyErrorCode, i as AlignedStreamData, j as AlignedUnlocksContract, k as BatchCreationItem, l as BatchExecuteResult, m as BatchInstructionResult, n as BatchItemError, o as BatchItemSuccess, p as BuildTransactionFn, q as BuildTransactionOptions, r as BuiltTransaction, C as CancelFn, s as ChangeOracleParams, t as ClientCreationOptions, u as Contract, v as ContractErrorCode, w as CreateBatchFn, x as CreateFn, y as CreateInstructionResult, z as CreateParams, E as CreateTestOracleParams, F as Env, G as ExecuteBatchFn, H as ExecuteBatchSequentialFn, J as ExecuteFn, K as ExecutionEnv, L as IAlignedStreamConfig, M as IBaseStreamConfig, N as ICancelData, O as ICreateExt, P as ICreateLinearStreamData, Q as ICreateLockBatchParams, R as ICreateLockParams, T as ICreateMultiError, U as ICreateMultipleAlignedStreamData, V as ICreateMultipleLinearStreamData, W as ICreateMultipleStreamData, X as ICreateResult, Y as ICreateStreamExt, Z as ICreateStreamInstructions, _ as ICreateVestingBatchParams, $ as ICreateVestingParams, a0 as IFees, a1 as IGetAllData, a2 as IGetFeesData, a3 as IGetOneData, a4 as IInteractData, a5 as IInteractStreamExt, a6 as ILockBatchRecipient, a7 as IMultiTransactionResult, a8 as IPrepareCreateStreamExt, a9 as IPrepareStreamExt, aa as IPrepareTopUpstreamExt, ab as IRecipient, ac as IRequestCancelData, ad as ITopUpData, ae as ITopUpStreamExt, af as ITransactionExtWithInstructions, ag as ITransactionResult, ah as ITransferData, ai as IVestingBatchRecipient, aj as IWithdrawCancelRequestData, ak as IWithdrawData, al as InstructionGenerator, am as InstructionResult, an as Invoker, ao as LinearStream, ap as MetadataRecipientHashMap, aq as NativeOptions, ar as OracleType, as as OracleTypeName, at as SignFn, au as SolanaStreamClient, av as StreamClientOptions, aw as StreamClientOptionsWithConnection, ax as StreamDirection, ay as TestOracle, az as TopupFn, aA as TransactionSchedulingOptions, aB as TransferFn, aC as UpdateFn, aD as UpdateTestOracleParams, 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-Cu0If4Dd.js';
|
|
3
|
+
import { ConfirmationParams, ThrottleParams } from '@streamflow/common';
|
|
2
4
|
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
5
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
6
|
+
import { PublicKey, Connection, Keypair, TransactionInstruction } from '@solana/web3.js';
|
|
7
7
|
import BN from 'bn.js';
|
|
8
|
-
import { StreamflowAlignedUnlocks } from './descriptor/streamflow_aligned_unlocks.js';
|
|
9
8
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
amount: BN;
|
|
14
|
-
name: string;
|
|
15
|
-
cliffAmount: BN;
|
|
16
|
-
amountPerPeriod: BN;
|
|
17
|
-
nonce?: number;
|
|
18
|
-
}
|
|
19
|
-
interface IBaseStreamConfig {
|
|
20
|
-
period: number;
|
|
21
|
-
start: number;
|
|
22
|
-
cliff: number;
|
|
23
|
-
cancelableBySender: boolean;
|
|
24
|
-
cancelableByRecipient: boolean;
|
|
25
|
-
transferableBySender: boolean;
|
|
26
|
-
transferableByRecipient: boolean;
|
|
27
|
-
canTopup: boolean;
|
|
28
|
-
automaticWithdrawal?: boolean;
|
|
29
|
-
withdrawalFrequency?: number;
|
|
30
|
-
tokenId: string;
|
|
31
|
-
canPause?: boolean;
|
|
32
|
-
canUpdateRate?: boolean;
|
|
33
|
-
partner?: string;
|
|
34
|
-
partnerLink?: {
|
|
35
|
-
address: string;
|
|
36
|
-
isSigner: boolean;
|
|
37
|
-
};
|
|
38
|
-
tokenProgramId?: string | PublicKey;
|
|
39
|
-
}
|
|
40
|
-
type IAlignedStreamConfig = {
|
|
41
|
-
minPrice: number | BN;
|
|
42
|
-
maxPrice: number | BN;
|
|
43
|
-
minPercentage: number | BN;
|
|
44
|
-
maxPercentage: number | BN;
|
|
45
|
-
oracleType?: OracleTypeName;
|
|
46
|
-
priceOracle?: Address;
|
|
47
|
-
skipInitial?: boolean;
|
|
48
|
-
tickSize?: number;
|
|
49
|
-
expiryTime?: number;
|
|
50
|
-
expiryPercentage?: number | BN;
|
|
51
|
-
floorPrice?: number | BN;
|
|
52
|
-
};
|
|
53
|
-
type ICreateLinearStreamData = IBaseStreamConfig & IRecipient;
|
|
54
|
-
type ICreateAlignedStreamData = ICreateLinearStreamData & IAlignedStreamConfig;
|
|
55
|
-
type ICreateStreamData = ICreateLinearStreamData | ICreateAlignedStreamData;
|
|
56
|
-
type ICreateMultipleLinearStreamData = IBaseStreamConfig & {
|
|
57
|
-
recipients: IRecipient[];
|
|
58
|
-
};
|
|
59
|
-
type ICreateMultipleAlignedStreamData = ICreateMultipleLinearStreamData & IAlignedStreamConfig;
|
|
60
|
-
type ICreateMultipleStreamData = ICreateMultipleLinearStreamData | ICreateMultipleAlignedStreamData;
|
|
61
|
-
interface IInteractData {
|
|
62
|
-
id: string;
|
|
63
|
-
}
|
|
64
|
-
interface IWithdrawData extends IInteractData {
|
|
65
|
-
amount?: BN;
|
|
66
|
-
}
|
|
67
|
-
interface IUpdateData extends IInteractData {
|
|
68
|
-
enableAutomaticWithdrawal?: boolean;
|
|
69
|
-
withdrawFrequency?: BN;
|
|
70
|
-
amountPerPeriod?: BN;
|
|
71
|
-
transferableBySender?: boolean;
|
|
72
|
-
transferableByRecipient?: boolean;
|
|
73
|
-
cancelableBySender?: boolean;
|
|
74
|
-
}
|
|
75
|
-
type ICancelData = IInteractData;
|
|
76
|
-
type IRequestCancelData = IInteractData;
|
|
77
|
-
type IWithdrawCancelRequestData = IInteractData;
|
|
78
|
-
interface ITransferData extends IInteractData {
|
|
79
|
-
newRecipient: string;
|
|
80
|
-
}
|
|
81
|
-
interface ITopUpData extends IInteractData {
|
|
82
|
-
amount: BN;
|
|
83
|
-
}
|
|
84
|
-
type IGetOneData = IInteractData;
|
|
85
|
-
interface IGetFeesData {
|
|
86
|
-
address: string;
|
|
87
|
-
}
|
|
88
|
-
interface IGetAllData {
|
|
89
|
-
address: string;
|
|
90
|
-
type?: StreamType;
|
|
91
|
-
direction?: StreamDirection;
|
|
92
|
-
filters?: {
|
|
93
|
-
closed?: boolean;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
interface ICreateMultiError {
|
|
97
|
-
recipient: string;
|
|
98
|
-
error: string;
|
|
99
|
-
contractErrorCode?: string;
|
|
100
|
-
}
|
|
101
|
-
type MetadataId = string;
|
|
102
|
-
interface ITransactionResult {
|
|
103
|
-
ixs: TransactionInstruction[];
|
|
104
|
-
txId: string;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Schema outlining vesting protocol fees.
|
|
108
|
-
*/
|
|
109
|
-
interface IFees {
|
|
110
|
-
creationFeeSol?: number;
|
|
111
|
-
autoClaimFeeSol?: number;
|
|
112
|
-
streamflowFee: number;
|
|
113
|
-
partnerFee: number;
|
|
114
|
-
}
|
|
115
|
-
interface ICreateResult extends ITransactionResult {
|
|
116
|
-
metadataId: MetadataId;
|
|
117
|
-
}
|
|
118
|
-
interface IMultiTransactionResult {
|
|
119
|
-
txs: string[];
|
|
120
|
-
metadatas: MetadataId[];
|
|
121
|
-
metadataToRecipient: Record<MetadataId, IRecipient>;
|
|
122
|
-
errors: ICreateMultiError[];
|
|
123
|
-
}
|
|
124
|
-
type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
|
|
125
|
-
declare enum StreamDirection {
|
|
126
|
-
Outgoing = "outgoing",
|
|
127
|
-
Incoming = "incoming",
|
|
128
|
-
All = "all"
|
|
129
|
-
}
|
|
130
|
-
declare enum StreamType {
|
|
131
|
-
All = "all",
|
|
132
|
-
Vesting = "vesting",
|
|
133
|
-
Lock = "lock"
|
|
134
|
-
}
|
|
135
|
-
interface LinearStream {
|
|
136
|
-
isAligned: boolean;
|
|
137
|
-
magic: number;
|
|
138
|
-
version: number;
|
|
139
|
-
createdAt: number;
|
|
140
|
-
withdrawnAmount: BN;
|
|
141
|
-
canceledAt: number;
|
|
142
|
-
end: number;
|
|
143
|
-
lastWithdrawnAt: number;
|
|
144
|
-
sender: string;
|
|
145
|
-
senderTokens: string;
|
|
146
|
-
recipient: string;
|
|
147
|
-
recipientTokens: string;
|
|
148
|
-
mint: string;
|
|
149
|
-
escrowTokens: string;
|
|
150
|
-
streamflowTreasury: string;
|
|
151
|
-
streamflowTreasuryTokens: string;
|
|
152
|
-
streamflowFeeTotal: BN;
|
|
153
|
-
streamflowFeeWithdrawn: BN;
|
|
154
|
-
streamflowFeePercent: number;
|
|
155
|
-
partnerFeeTotal: BN;
|
|
156
|
-
partnerFeeWithdrawn: BN;
|
|
157
|
-
partnerFeePercent: number;
|
|
158
|
-
partner: string;
|
|
159
|
-
partnerTokens: string;
|
|
160
|
-
start: number;
|
|
161
|
-
depositedAmount: BN;
|
|
162
|
-
period: number;
|
|
163
|
-
amountPerPeriod: BN;
|
|
164
|
-
cliff: number;
|
|
165
|
-
cliffAmount: BN;
|
|
166
|
-
cancelableBySender: boolean;
|
|
167
|
-
cancelableByRecipient: boolean;
|
|
168
|
-
automaticWithdrawal: boolean;
|
|
169
|
-
transferableBySender: boolean;
|
|
170
|
-
transferableByRecipient: boolean;
|
|
171
|
-
canTopup: boolean;
|
|
172
|
-
name: string;
|
|
173
|
-
withdrawalFrequency: number;
|
|
174
|
-
isPda: boolean;
|
|
175
|
-
nonce: number;
|
|
176
|
-
closed: boolean;
|
|
177
|
-
currentPauseStart: number;
|
|
178
|
-
pauseCumulative: BN;
|
|
179
|
-
lastRateChangeTime: number;
|
|
180
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
181
|
-
oldMetadata: PublicKey;
|
|
182
|
-
payer: string;
|
|
183
|
-
bump: number;
|
|
184
|
-
feePartner: string;
|
|
185
|
-
cancelRequestTime: number;
|
|
186
|
-
type: StreamType;
|
|
187
|
-
unlocked(currentTimestamp: number): BN;
|
|
188
|
-
remaining(decimals: number): number;
|
|
189
|
-
}
|
|
190
|
-
type AlignedStreamData = {
|
|
191
|
-
minPrice: number;
|
|
192
|
-
maxPrice: number;
|
|
193
|
-
minPercentage: number;
|
|
194
|
-
maxPercentage: number;
|
|
195
|
-
oracleType: OracleTypeName;
|
|
196
|
-
priceOracle: string | undefined;
|
|
197
|
-
tickSize: number;
|
|
198
|
-
initialAmountPerPeriod: BN;
|
|
199
|
-
initialPrice: number;
|
|
200
|
-
lastPrice: number;
|
|
201
|
-
lastAmountUpdateTime: number;
|
|
202
|
-
initialNetAmount: BN;
|
|
203
|
-
expiryTime: number;
|
|
204
|
-
expiryPercentage: number;
|
|
205
|
-
floorPrice: number;
|
|
206
|
-
};
|
|
207
|
-
type AlignedStream = LinearStream & AlignedStreamData;
|
|
208
|
-
type Stream = LinearStream | AlignedStream;
|
|
209
|
-
/**
|
|
210
|
-
* Error codes raised by Solana protocol specifically
|
|
211
|
-
*/
|
|
212
|
-
declare enum ContractErrorCode {
|
|
213
|
-
/** Accounts not writable */
|
|
214
|
-
AccountsNotWritable = "AccountsNotWritable",
|
|
215
|
-
/** Invalid Metadata */
|
|
216
|
-
InvalidMetadata = "InvalidMetadata",
|
|
217
|
-
/** Invalid metadata account */
|
|
218
|
-
InvalidMetadataAccount = "InvalidMetadataAccount",
|
|
219
|
-
/** Provided accounts don't match the ones in contract */
|
|
220
|
-
MetadataAccountMismatch = "MetadataAccountMismatch",
|
|
221
|
-
/** Invalid escrow account */
|
|
222
|
-
InvalidEscrowAccount = "InvalidEscrowAccount",
|
|
223
|
-
/** Provided account(s) is/are not valid associated token accounts */
|
|
224
|
-
NotAssociated = "NotAssociated",
|
|
225
|
-
/** Sender mint does not match accounts mint */
|
|
226
|
-
MintMismatch = "MintMismatch",
|
|
227
|
-
/** Recipient not transferable for account */
|
|
228
|
-
TransferNotAllowed = "TransferNotAllowed",
|
|
229
|
-
/** Contract closed */
|
|
230
|
-
ContractClosed = "ContractClosed",
|
|
231
|
-
/** Invalid Streamflow Treasury accounts supplied */
|
|
232
|
-
InvalidTreasury = "InvalidTreasury",
|
|
233
|
-
/** Given timestamps are invalid */
|
|
234
|
-
InvalidTimestamps = "InvalidTimestamps",
|
|
235
|
-
/** Invalid deposit configuration */
|
|
236
|
-
InvalidDepositConfiguration = "InvalidDepositConfiguration",
|
|
237
|
-
/** Amount cannot be zero */
|
|
238
|
-
AmountIsZero = "AmountIsZero",
|
|
239
|
-
/** Amount requested is larger than available */
|
|
240
|
-
AmountMoreThanAvailable = "AmountMoreThanAvailable",
|
|
241
|
-
/** Amount currently available is zero */
|
|
242
|
-
AmountAvailableIsZero = "AmountAvailableIsZero",
|
|
243
|
-
/** Arithmetic error */
|
|
244
|
-
ArithmeticError = "ArithmeticError",
|
|
245
|
-
/** Metadata account data must be 1104 bytes long */
|
|
246
|
-
InvalidMetadataSize = "InvalidMetadataSize",
|
|
247
|
-
/** Metadata state account must be initialized */
|
|
248
|
-
UninitializedMetadata = "UninitializedMetadata",
|
|
249
|
-
/** Authority does not have permission for this action */
|
|
250
|
-
Unauthorized = "Unauthorized",
|
|
251
|
-
/** Contract is not transferable to the original recipient */
|
|
252
|
-
SelfTransfer = "SelfTransfer",
|
|
253
|
-
/** Contract is already paused */
|
|
254
|
-
AlreadyPaused = "AlreadyPaused",
|
|
255
|
-
/** Contract is not paused */
|
|
256
|
-
NotPaused = "NotPaused",
|
|
257
|
-
/** Meta account is not rent exempt */
|
|
258
|
-
MetadataNotRentExempt = "MetadataNotRentExempt"
|
|
259
|
-
}
|
|
260
|
-
declare enum AlignedProxyErrorCode {
|
|
261
|
-
/** Authority does not have permission for this action */
|
|
262
|
-
Unauthorized = "Unauthorized",
|
|
263
|
-
/** Arithmetic error */
|
|
264
|
-
ArithmeticError = "ArithmeticError",
|
|
265
|
-
/** Mint has unsupported Token Extensions */
|
|
266
|
-
UnsupportedTokenExtensions = "UnsupportedTokenExtensions",
|
|
267
|
-
/** Provided period is too short, should be equal or more than 30 seconds */
|
|
268
|
-
PeriodTooShort = "PeriodTooShort",
|
|
269
|
-
/** Provided percentage tick size is invalid */
|
|
270
|
-
InvalidTickSize = "InvalidTickSize",
|
|
271
|
-
/** Provided percentage bounds are invalid */
|
|
272
|
-
InvalidPercentageBoundaries = "InvalidPercentageBoundaries",
|
|
273
|
-
/** Provided price bounds are invalid */
|
|
274
|
-
InvalidPriceBoundaries = "InvalidPriceBoundaries",
|
|
275
|
-
/** Unsupported price oracle */
|
|
276
|
-
UnsupportedOracle = "UnsupportedOracle",
|
|
277
|
-
/** Invalid oracle account */
|
|
278
|
-
InvalidOracleAccount = "InvalidOracleAccount",
|
|
279
|
-
/** Invalid oracle price */
|
|
280
|
-
InvalidOraclePrice = "InvalidOraclePrice",
|
|
281
|
-
/** Invalid Stream Metadata */
|
|
282
|
-
InvalidStreamMetadata = "InvalidStreamMetadata",
|
|
283
|
-
/** Release amount has already been updated in this period */
|
|
284
|
-
AmountAlreadyUpdated = "AmountAlreadyUpdated",
|
|
285
|
-
/** All funds are already unlocked */
|
|
286
|
-
AllFundsUnlocked = "AllFundsUnlocked"
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* @interface
|
|
290
|
-
*/
|
|
291
|
-
interface TransactionSchedulingOptions {
|
|
292
|
-
/**
|
|
293
|
-
* concurrency rate for scheduling
|
|
294
|
-
*/
|
|
295
|
-
sendRate: number;
|
|
296
|
-
/**
|
|
297
|
-
* time interval between consecutive sends
|
|
298
|
-
*/
|
|
299
|
-
sendInterval?: number;
|
|
300
|
-
/**
|
|
301
|
-
* time interval before confirming the transaction
|
|
302
|
-
*/
|
|
303
|
-
waitBeforeConfirming?: number;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* @interface
|
|
307
|
-
*/
|
|
308
|
-
interface StreamClientOptions {
|
|
309
|
-
clusterUrl: string;
|
|
310
|
-
cluster?: ICluster;
|
|
311
|
-
programId?: string;
|
|
312
|
-
commitment?: Commitment | ConnectionConfig;
|
|
313
|
-
sendRate?: number;
|
|
314
|
-
sendThrottler?: PQueue;
|
|
315
|
-
sendScheduler?: PQueue | TransactionSchedulingOptions;
|
|
316
|
-
}
|
|
317
|
-
type AlignedUnlocksTypes = IdlTypes<StreamflowAlignedUnlocks>;
|
|
318
|
-
type AlignedUnlocksAccounts = IdlAccounts<StreamflowAlignedUnlocks>;
|
|
319
|
-
type AlignedUnlocksContract = AlignedUnlocksAccounts["contract"];
|
|
320
|
-
type OracleType = IdlTypes<StreamflowAlignedUnlocks>["oracleType"];
|
|
321
|
-
type TestOracle = AlignedUnlocksAccounts["testOracle"];
|
|
322
|
-
type CreateParams = AlignedUnlocksTypes["createParams"];
|
|
323
|
-
type ChangeOracleParams = AlignedUnlocksTypes["changeOracleParams"];
|
|
324
|
-
type CreateTestOracleParams = AlignedUnlocksTypes["createTestOracleParams"];
|
|
325
|
-
type UpdateTestOracleParams = AlignedUnlocksTypes["updateTestOracleParams"];
|
|
326
|
-
interface ISearchStreams {
|
|
327
|
-
mint?: string;
|
|
328
|
-
sender?: string;
|
|
329
|
-
recipient?: string;
|
|
330
|
-
closed?: boolean;
|
|
331
|
-
}
|
|
332
|
-
interface Account {
|
|
333
|
-
pubkey: PublicKey;
|
|
334
|
-
account: AccountInfo<Buffer>;
|
|
335
|
-
}
|
|
336
|
-
interface ICreateExt {
|
|
337
|
-
sender: SignerWalletAdapter | Keypair;
|
|
338
|
-
isNative?: boolean;
|
|
339
|
-
}
|
|
340
|
-
interface ITransactionExtWithInstructions extends ITransactionExt {
|
|
341
|
-
customInstructions?: {
|
|
342
|
-
after?: InstructionGenerator;
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
interface ICreateStreamExt extends ICreateExt, ITransactionExtWithInstructions {
|
|
346
|
-
metadataPubKeys?: PublicKey[];
|
|
347
|
-
partner?: string | null;
|
|
348
|
-
}
|
|
349
|
-
interface IPrepareCreateStreamExt extends Omit<ICreateStreamExt, "sender"> {
|
|
350
|
-
sender: {
|
|
351
|
-
publicKey: PublicKey | null;
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
interface IInteractStreamExt extends ITransactionExtWithInstructions {
|
|
355
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
356
|
-
checkTokenAccounts?: boolean;
|
|
357
|
-
}
|
|
358
|
-
interface IPrepareStreamExt extends Omit<IInteractStreamExt, "invoker"> {
|
|
359
|
-
invoker: {
|
|
360
|
-
publicKey: PublicKey | null;
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
interface IPrepareTopUpstreamExt extends ITransactionExt {
|
|
364
|
-
invoker: {
|
|
365
|
-
publicKey: PublicKey | null;
|
|
366
|
-
};
|
|
367
|
-
isNative?: boolean;
|
|
368
|
-
}
|
|
369
|
-
interface ITopUpStreamExt extends IPrepareTopUpstreamExt {
|
|
370
|
-
invoker: SignerWalletAdapter | Keypair;
|
|
371
|
-
}
|
|
372
|
-
interface ICreateStreamInstructions {
|
|
373
|
-
ixs: TransactionInstruction[];
|
|
374
|
-
metadata: Keypair | undefined;
|
|
375
|
-
metadataPubKey: PublicKey;
|
|
376
|
-
}
|
|
377
|
-
declare class Contract implements LinearStream {
|
|
378
|
-
magic: number;
|
|
379
|
-
version: number;
|
|
380
|
-
createdAt: number;
|
|
381
|
-
withdrawnAmount: BN;
|
|
382
|
-
canceledAt: number;
|
|
383
|
-
end: number;
|
|
384
|
-
lastWithdrawnAt: number;
|
|
385
|
-
sender: string;
|
|
386
|
-
senderTokens: string;
|
|
387
|
-
recipient: string;
|
|
388
|
-
recipientTokens: string;
|
|
389
|
-
mint: string;
|
|
390
|
-
escrowTokens: string;
|
|
391
|
-
streamflowTreasury: string;
|
|
392
|
-
streamflowTreasuryTokens: string;
|
|
393
|
-
streamflowFeeTotal: BN;
|
|
394
|
-
streamflowFeeWithdrawn: BN;
|
|
395
|
-
streamflowFeePercent: number;
|
|
396
|
-
partnerFeeTotal: BN;
|
|
397
|
-
partnerFeeWithdrawn: BN;
|
|
398
|
-
partnerFeePercent: number;
|
|
399
|
-
partner: string;
|
|
400
|
-
partnerTokens: string;
|
|
401
|
-
start: number;
|
|
402
|
-
depositedAmount: BN;
|
|
403
|
-
period: number;
|
|
404
|
-
amountPerPeriod: BN;
|
|
405
|
-
cliff: number;
|
|
406
|
-
cliffAmount: BN;
|
|
407
|
-
cancelableBySender: boolean;
|
|
408
|
-
cancelableByRecipient: boolean;
|
|
409
|
-
automaticWithdrawal: boolean;
|
|
410
|
-
transferableBySender: boolean;
|
|
411
|
-
transferableByRecipient: boolean;
|
|
412
|
-
canTopup: boolean;
|
|
413
|
-
name: string;
|
|
414
|
-
withdrawalFrequency: number;
|
|
415
|
-
isPda: boolean;
|
|
416
|
-
nonce: number;
|
|
417
|
-
closed: boolean;
|
|
418
|
-
currentPauseStart: number;
|
|
419
|
-
pauseCumulative: BN;
|
|
420
|
-
lastRateChangeTime: number;
|
|
421
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
422
|
-
oldMetadata: PublicKey;
|
|
423
|
-
payer: string;
|
|
424
|
-
bump: number;
|
|
425
|
-
feePartner: string;
|
|
426
|
-
cancelRequestTime: number;
|
|
427
|
-
type: StreamType;
|
|
428
|
-
isAligned: boolean;
|
|
429
|
-
constructor(stream: DecodedStream);
|
|
430
|
-
unlocked(currentTimestamp: number): BN;
|
|
431
|
-
remaining(decimals: number): number;
|
|
432
|
-
}
|
|
433
|
-
declare class AlignedContract extends Contract implements AlignedStream {
|
|
434
|
-
minPrice: number;
|
|
435
|
-
maxPrice: number;
|
|
436
|
-
minPercentage: number;
|
|
437
|
-
maxPercentage: number;
|
|
438
|
-
tickSize: number;
|
|
439
|
-
proxyAddress: string;
|
|
440
|
-
priceOracle: string | undefined;
|
|
441
|
-
oracleType: OracleTypeName;
|
|
442
|
-
initialAmountPerPeriod: BN;
|
|
443
|
-
initialPrice: number;
|
|
444
|
-
lastPrice: number;
|
|
445
|
-
lastAmountUpdateTime: number;
|
|
446
|
-
initialNetAmount: BN;
|
|
447
|
-
expiryTime: number;
|
|
448
|
-
expiryPercentage: number;
|
|
449
|
-
floorPrice: number;
|
|
450
|
-
constructor(stream: DecodedStream, alignedProxy: AlignedUnlocksContract);
|
|
451
|
-
}
|
|
452
|
-
interface DecodedStream {
|
|
453
|
-
magic: BN;
|
|
454
|
-
version: BN;
|
|
455
|
-
createdAt: BN;
|
|
456
|
-
withdrawnAmount: BN;
|
|
457
|
-
canceledAt: BN;
|
|
458
|
-
end: BN;
|
|
459
|
-
lastWithdrawnAt: BN;
|
|
460
|
-
sender: PublicKey;
|
|
461
|
-
senderTokens: PublicKey;
|
|
462
|
-
recipient: PublicKey;
|
|
463
|
-
recipientTokens: PublicKey;
|
|
464
|
-
mint: PublicKey;
|
|
465
|
-
escrowTokens: PublicKey;
|
|
466
|
-
streamflowTreasury: PublicKey;
|
|
467
|
-
streamflowTreasuryTokens: PublicKey;
|
|
468
|
-
streamflowFeeTotal: BN;
|
|
469
|
-
streamflowFeeWithdrawn: BN;
|
|
470
|
-
streamflowFeePercent: number;
|
|
471
|
-
partnerFeeTotal: BN;
|
|
472
|
-
partnerFeeWithdrawn: BN;
|
|
473
|
-
partnerFeePercent: number;
|
|
474
|
-
partner: PublicKey;
|
|
475
|
-
partnerTokens: PublicKey;
|
|
476
|
-
start: BN;
|
|
477
|
-
depositedAmount: BN;
|
|
478
|
-
period: BN;
|
|
479
|
-
amountPerPeriod: BN;
|
|
480
|
-
cliff: BN;
|
|
481
|
-
cliffAmount: BN;
|
|
482
|
-
cancelableBySender: boolean;
|
|
483
|
-
cancelableByRecipient: boolean;
|
|
484
|
-
automaticWithdrawal: boolean;
|
|
485
|
-
transferableBySender: boolean;
|
|
486
|
-
transferableByRecipient: boolean;
|
|
487
|
-
canTopup: boolean;
|
|
488
|
-
name: string;
|
|
489
|
-
withdrawFrequency: BN;
|
|
490
|
-
isPda: boolean;
|
|
491
|
-
nonce: number;
|
|
492
|
-
closed: boolean;
|
|
493
|
-
currentPauseStart: BN;
|
|
494
|
-
pauseCumulative: BN;
|
|
495
|
-
lastRateChangeTime: BN;
|
|
496
|
-
fundsUnlockedAtLastRateChange: BN;
|
|
497
|
-
oldMetadata: PublicKey;
|
|
498
|
-
payer: PublicKey;
|
|
499
|
-
bump: number;
|
|
500
|
-
feePartner: PublicKey;
|
|
501
|
-
cancelRequestTime: BN;
|
|
502
|
-
}
|
|
503
|
-
interface MetadataRecipientHashMap {
|
|
504
|
-
[metadataPubKey: string]: IRecipient;
|
|
505
|
-
}
|
|
506
|
-
interface BatchItem {
|
|
507
|
-
recipient: string;
|
|
508
|
-
tx: VersionedTransaction;
|
|
509
|
-
}
|
|
510
|
-
interface BatchItemSuccess extends BatchItem {
|
|
511
|
-
signature: string;
|
|
512
|
-
}
|
|
513
|
-
interface BatchItemError extends BatchItem {
|
|
514
|
-
error: string;
|
|
515
|
-
}
|
|
516
|
-
type BatchItemResult = BatchItemSuccess | BatchItemError;
|
|
517
|
-
type InstructionGenerator = TransactionInstruction[] | ((params: {
|
|
518
|
-
instructions: TransactionInstruction[];
|
|
519
|
-
metadata?: PublicKey;
|
|
520
|
-
}) => TransactionInstruction[] | Promise<TransactionInstruction[]>);
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Solana Client creation options
|
|
524
|
-
* @property cluster {@link ICluster} cluster type
|
|
525
|
-
* @property clusterUrl cluster url
|
|
526
|
-
* @interface ClientCreationOptions
|
|
527
|
-
*/
|
|
528
|
-
type ClientCreationOptions = Omit<StreamClientOptions, "sendRate" | "sendThrottler">;
|
|
529
|
-
declare class SolanaStreamClient {
|
|
530
|
-
private readonly connection;
|
|
531
|
-
private readonly programId;
|
|
532
|
-
private readonly partnerOracleProgramId;
|
|
533
|
-
private readonly feeOraclePublicKey;
|
|
534
|
-
private readonly commitment;
|
|
535
|
-
readonly alignedProxyProgram: Program<StreamflowAlignedUnlocks>;
|
|
536
|
-
private readonly schedulingParams;
|
|
537
|
-
private readonly apiClient;
|
|
538
|
-
/**
|
|
539
|
-
* Create Stream instance with flat arguments
|
|
540
|
-
*/
|
|
541
|
-
constructor(clusterUrl: string, cluster?: ICluster, commitment?: Commitment | ConnectionConfig, programId?: string, sendRate?: number, sendThrottler?: PQueue);
|
|
542
|
-
/**
|
|
543
|
-
* Create Stream instance with options
|
|
544
|
-
*/
|
|
545
|
-
constructor(options: ClientCreationOptions);
|
|
546
|
-
getConnection(): Connection;
|
|
547
|
-
getCommitment(): Commitment | undefined;
|
|
548
|
-
getProgramId(): string;
|
|
549
|
-
getAlignedProxyProgramId(): string;
|
|
550
|
-
/**
|
|
551
|
-
* Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
|
|
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
|
-
*
|
|
554
|
-
* For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
|
|
555
|
-
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
556
|
-
*
|
|
557
|
-
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
558
|
-
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
559
|
-
* @returns Transaction instructions and metadata ID
|
|
560
|
-
*/
|
|
561
|
-
buildCreateTransactionInstructions(data: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
562
|
-
ixs: TransactionInstruction[];
|
|
563
|
-
metadataId: string;
|
|
564
|
-
metadata?: Keypair;
|
|
565
|
-
}>;
|
|
566
|
-
/**
|
|
567
|
-
* Builds a transaction for creating a new stream/vesting contract without signing or executing it.
|
|
568
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
569
|
-
*
|
|
570
|
-
* For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order
|
|
571
|
-
* (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.
|
|
572
|
-
*
|
|
573
|
-
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
574
|
-
* @param {Omit<ICreateStreamExt, "sender"> & { senderPublicKey: PublicKey }} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
575
|
-
* @returns Transaction and metadata information
|
|
576
|
-
*/
|
|
577
|
-
buildCreateTransaction(data: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<{
|
|
578
|
-
tx: VersionedTransaction;
|
|
579
|
-
metadataId: string;
|
|
580
|
-
metadata?: Keypair;
|
|
581
|
-
hash: string;
|
|
582
|
-
context: any;
|
|
583
|
-
}>;
|
|
584
|
-
/**
|
|
585
|
-
* Creates a new stream/vesting contract.
|
|
586
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
587
|
-
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
588
|
-
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, native token handling, and compute settings
|
|
589
|
-
* @returns Create result
|
|
590
|
-
*/
|
|
591
|
-
create(data: ICreateStreamData, extParams: ICreateStreamExt): Promise<ICreateResult>;
|
|
592
|
-
prepareCreateInstructions(streamParams: ICreateStreamData, extParams: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
|
|
593
|
-
/**
|
|
594
|
-
* Builds instructions for creating an aligned unlock stream.
|
|
595
|
-
* For Token-2022 mints with a transfer hook, partner link and hook accounts are appended as remaining accounts.
|
|
596
|
-
*/
|
|
597
|
-
prepareCreateAlignedUnlockInstructions(streamParams: ICreateAlignedStreamData, extParams: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
|
|
598
|
-
/**
|
|
599
|
-
* Creates a new stream/vesting contract.
|
|
600
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
601
|
-
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
602
|
-
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
603
|
-
* @returns Create stream instructions
|
|
604
|
-
*/
|
|
605
|
-
prepareCreateLinearStreamInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canPause, canUpdateRate, canTopup, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, partnerLink, tokenProgramId: streamTokenProgramId, nonce, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<ICreateStreamInstructions>;
|
|
606
|
-
/**
|
|
607
|
-
* Creates a new stream/vesting contract using unchecked instruction.
|
|
608
|
-
*
|
|
609
|
-
* Unchecked instruction differs from the regular in:
|
|
610
|
-
* - does not check for initialized associated token account (wallets with no control over their ATA should not be used
|
|
611
|
-
* as sender/recipient/partner or there are risks of funds being locked in the contract)
|
|
612
|
-
* - initialized contract PDA off chain
|
|
613
|
-
*
|
|
614
|
-
* If you are not sure if you should use create or create_unchecked, go for create to be safer.
|
|
615
|
-
* @param {ICreateStreamData} data - Stream parameters including recipient, token, amount, schedule, and permissions
|
|
616
|
-
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
617
|
-
* @returns Create result
|
|
618
|
-
*/
|
|
619
|
-
createUnchecked(data: ICreateStreamData, extParams: ICreateStreamExt): Promise<ICreateResult>;
|
|
620
|
-
/**
|
|
621
|
-
* Create Transaction instructions for `createUnchecked`
|
|
622
|
-
*/
|
|
623
|
-
prepareCreateUncheckedInstructions({ recipient, tokenId: mint, start, amount: depositedAmount, period, cliff, cliffAmount, amountPerPeriod, name, canTopup, canUpdateRate, canPause, cancelableBySender, cancelableByRecipient, transferableBySender, transferableByRecipient, automaticWithdrawal, withdrawalFrequency, partner, partnerLink, nonce, }: ICreateStreamData, { sender, metadataPubKeys, isNative, computePrice, computeLimit }: IPrepareCreateStreamExt): Promise<{
|
|
624
|
-
ixs: TransactionInstruction[];
|
|
625
|
-
metadata: Keypair | undefined;
|
|
626
|
-
metadataPubKey: PublicKey;
|
|
627
|
-
}>;
|
|
628
|
-
/**
|
|
629
|
-
* Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions.
|
|
630
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
631
|
-
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
632
|
-
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
633
|
-
* @returns Create multiple transaction instructions
|
|
634
|
-
*/
|
|
635
|
-
buildCreateMultipleTransactionInstructions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
636
|
-
instructionsBatch: {
|
|
637
|
-
ixs: TransactionInstruction[];
|
|
638
|
-
metadata: Keypair | undefined;
|
|
639
|
-
recipient: string;
|
|
640
|
-
}[];
|
|
641
|
-
metadatas: string[];
|
|
642
|
-
metadataToRecipient: MetadataRecipientHashMap;
|
|
643
|
-
prepareInstructions: TransactionInstruction[];
|
|
644
|
-
}>;
|
|
645
|
-
/**
|
|
646
|
-
* Builds multiple transactions for creating stream/vesting contracts without signing or executing them.
|
|
647
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
648
|
-
*
|
|
649
|
-
* IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation
|
|
650
|
-
* before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".
|
|
651
|
-
*
|
|
652
|
-
* @example
|
|
653
|
-
* ```typescript
|
|
654
|
-
* const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });
|
|
655
|
-
*
|
|
656
|
-
* // CRITICAL: Execute prepareTx first if it exists
|
|
657
|
-
* if (result.prepareTx) {
|
|
658
|
-
* await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
|
|
659
|
-
* }
|
|
660
|
-
*
|
|
661
|
-
* // Only then execute stream creation transactions
|
|
662
|
-
* for (const item of result.transactions) {
|
|
663
|
-
* await connection.sendAndConfirmTransaction(item.tx, [signer]);
|
|
664
|
-
* }
|
|
665
|
-
* ```
|
|
666
|
-
*
|
|
667
|
-
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
668
|
-
* @param {IPrepareCreateStreamExt} extParams - Transaction configuration including sender public key, native token handling, and custom instructions
|
|
669
|
-
* @returns Multiple transaction information
|
|
670
|
-
*/
|
|
671
|
-
buildCreateMultipleTransactions(data: ICreateMultipleStreamData, extParams: IPrepareCreateStreamExt, applyCustomAfterInstructions?: boolean): Promise<{
|
|
672
|
-
transactions: BatchItem[];
|
|
673
|
-
metadatas: string[];
|
|
674
|
-
metadataToRecipient: MetadataRecipientHashMap;
|
|
675
|
-
hash: Readonly<{
|
|
676
|
-
blockhash: string;
|
|
677
|
-
lastValidBlockHeight: number;
|
|
678
|
-
}>;
|
|
679
|
-
context: any;
|
|
680
|
-
prepareTx?: VersionedTransaction;
|
|
681
|
-
}>;
|
|
682
|
-
/**
|
|
683
|
-
* Creates multiple stream/vesting contracts.
|
|
684
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
685
|
-
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
686
|
-
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
687
|
-
* @returns Multiple transaction information
|
|
688
|
-
*/
|
|
689
|
-
createMultiple(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
690
|
-
/**
|
|
691
|
-
* Creates multiple stream/vesting contracts, and send all transactions sequentially.
|
|
692
|
-
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
693
|
-
* In most cases, createMultiple should be used instead.
|
|
694
|
-
* @param {ICreateMultipleStreamData} data - Stream base parameters and array of recipients with individual amounts and settings
|
|
695
|
-
* @param {ICreateStreamExt} extParams - Transaction configuration including sender wallet, metadata keys, and compute settings
|
|
696
|
-
* @returns Multiple transaction information
|
|
697
|
-
*/
|
|
698
|
-
createMultipleSequential(data: ICreateMultipleStreamData[] | ICreateMultipleStreamData, extParams: ICreateStreamExt): Promise<IMultiTransactionResult>;
|
|
699
|
-
/**
|
|
700
|
-
* Attempts withdrawing from the specified stream.
|
|
701
|
-
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
702
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
703
|
-
* @returns Transaction result
|
|
704
|
-
*/
|
|
705
|
-
withdraw({ id, amount }: IWithdrawData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
706
|
-
/**
|
|
707
|
-
* Creates Transaction Instructions for withdrawal
|
|
708
|
-
* @param {IWithdrawData} withdrawData - Withdrawal parameters including stream ID and amount to withdraw
|
|
709
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
710
|
-
* @returns Transaction instructions
|
|
711
|
-
*/
|
|
712
|
-
prepareWithdrawInstructions({ id, amount }: IWithdrawData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
713
|
-
/**
|
|
714
|
-
* Attempts canceling the specified stream.
|
|
715
|
-
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
716
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
717
|
-
* @returns Transaction result
|
|
718
|
-
*/
|
|
719
|
-
cancel(cancelData: ICancelData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
720
|
-
/**
|
|
721
|
-
* Creates Transaction Instructions for cancel
|
|
722
|
-
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
723
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet address, token account validation, and compute settings
|
|
724
|
-
* @returns Transaction instructions
|
|
725
|
-
*/
|
|
726
|
-
prepareCancelInstructions(cancelData: ICancelData, extParams: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
727
|
-
/**
|
|
728
|
-
* Creates Transaction Instructions for cancel
|
|
729
|
-
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
730
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
731
|
-
* @returns Transaction instructions
|
|
732
|
-
*/
|
|
733
|
-
prepareCancelAlignedUnlockInstructions({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
734
|
-
/**
|
|
735
|
-
* Creates Transaction Instructions for cancel
|
|
736
|
-
* @param {ICancelData} cancelData - Cancellation parameters including stream ID
|
|
737
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet, token account validation, and compute settings
|
|
738
|
-
* @returns Transaction instructions
|
|
739
|
-
*/
|
|
740
|
-
prepareCancelLinearStream({ id }: ICancelData, { invoker, checkTokenAccounts, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
741
|
-
/**
|
|
742
|
-
* Requests cancellation of a stream by the fee partner authority.
|
|
743
|
-
* @param {IRequestCancelData} data - Request cancel parameters including stream ID
|
|
744
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
745
|
-
* @returns Transaction result
|
|
746
|
-
*/
|
|
747
|
-
requestCancel(data: IRequestCancelData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
748
|
-
/**
|
|
749
|
-
* Creates Transaction Instructions for request_cancel
|
|
750
|
-
* @param {IRequestCancelData} data - Request cancel parameters including stream ID
|
|
751
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
752
|
-
* @returns Transaction instructions
|
|
753
|
-
*/
|
|
754
|
-
prepareRequestCancelInstructions({ id }: IRequestCancelData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
755
|
-
/**
|
|
756
|
-
* Withdraws a previously submitted cancel request.
|
|
757
|
-
* @param {IWithdrawCancelRequestData} data - Withdraw cancel request parameters including stream ID
|
|
758
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
759
|
-
* @returns Transaction result
|
|
760
|
-
*/
|
|
761
|
-
withdrawCancelRequest(data: IWithdrawCancelRequestData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
762
|
-
/**
|
|
763
|
-
* Creates Transaction Instructions for withdraw_cancel_request
|
|
764
|
-
* @param {IWithdrawCancelRequestData} data - Withdraw cancel request parameters including stream ID
|
|
765
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
766
|
-
* @returns Transaction instructions
|
|
767
|
-
*/
|
|
768
|
-
prepareWithdrawCancelRequestInstructions({ id }: IWithdrawCancelRequestData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
769
|
-
/**
|
|
770
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
771
|
-
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
772
|
-
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
773
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
774
|
-
* @returns Transaction result
|
|
775
|
-
*/
|
|
776
|
-
transfer({ id, newRecipient }: ITransferData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
777
|
-
/**
|
|
778
|
-
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
779
|
-
* Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.
|
|
780
|
-
* @param {ITransferData} transferData - Transfer parameters including stream ID and new recipient address
|
|
781
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
782
|
-
* @returns Transaction instructions
|
|
783
|
-
*/
|
|
784
|
-
prepareTransferInstructions({ id, newRecipient }: ITransferData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
785
|
-
/**
|
|
786
|
-
* Tops up stream account with specified amount.
|
|
787
|
-
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
788
|
-
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
789
|
-
* @returns Transaction result
|
|
790
|
-
*/
|
|
791
|
-
topup({ id, amount }: ITopUpData, extParams: ITopUpStreamExt): Promise<ITransactionResult>;
|
|
792
|
-
/**
|
|
793
|
-
* Create Transaction instructions for topup
|
|
794
|
-
* @param {ITopUpData} topupData - Top-up parameters including stream ID and amount to add
|
|
795
|
-
* @param {ITopUpStreamExt} extParams - Transaction configuration including invoker wallet, native token handling, and compute settings
|
|
796
|
-
* @returns Transaction instructions
|
|
797
|
-
*/
|
|
798
|
-
prepareTopupInstructions({ id, amount }: ITopUpData, { invoker, isNative, computePrice, computeLimit }: IPrepareTopUpstreamExt): Promise<TransactionInstruction[]>;
|
|
799
|
-
/**
|
|
800
|
-
* Fetch stream data by its id (address).
|
|
801
|
-
* @param {IGetOneData} getData - Query parameters containing the stream ID to fetch
|
|
802
|
-
* @returns Stream data
|
|
803
|
-
*/
|
|
804
|
-
getOne({ id }: IGetOneData): Promise<Stream>;
|
|
805
|
-
private decodeStreamAccount;
|
|
806
|
-
/**
|
|
807
|
-
* Fetch all aligned outgoing streams/contracts by the provided public key.
|
|
808
|
-
* @param {string} sender - Sender public key
|
|
809
|
-
* @returns Record of stream data
|
|
810
|
-
*/
|
|
811
|
-
private getOutgoingAlignedStreams;
|
|
812
|
-
private getIncomingAlignedStreams;
|
|
813
|
-
/**
|
|
814
|
-
* Fetch streams/contracts by providing direction.
|
|
815
|
-
* Streams are sorted by start time in ascending order.
|
|
816
|
-
* @param {IGetAllData} getData - Query parameters including address, stream type filter, and direction filter
|
|
817
|
-
* @returns Record of stream data
|
|
818
|
-
*/
|
|
819
|
-
get({ address, type, direction, filters, }: IGetAllData): Promise<[string, Stream][]>;
|
|
820
|
-
/**
|
|
821
|
-
* Searches for streams/contracts by providing filters.
|
|
822
|
-
* @param {ISearchStreams} data - Search by mint, sender, recipient or closed status
|
|
823
|
-
* @returns Record of stream data
|
|
824
|
-
*/
|
|
825
|
-
searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
|
|
826
|
-
private decodeStreamsFromAccounts;
|
|
827
|
-
private collectAlignedEntries;
|
|
828
|
-
private fetchAlignedProxiesByEntries;
|
|
829
|
-
private mapDecodedToProgramAccounts;
|
|
830
|
-
/**
|
|
831
|
-
* Attempts updating the stream auto withdrawal params and amount per period
|
|
832
|
-
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
833
|
-
* @param {IInteractStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
834
|
-
* @returns Transaction result
|
|
835
|
-
*/
|
|
836
|
-
update(data: IUpdateData, extParams: IInteractStreamExt): Promise<ITransactionResult>;
|
|
837
|
-
/**
|
|
838
|
-
* Create Transaction instructions for update
|
|
839
|
-
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
|
840
|
-
* @param {IPrepareStreamExt} extParams - Transaction configuration including invoker wallet and compute settings
|
|
841
|
-
* @returns Transaction instructions
|
|
842
|
-
*/
|
|
843
|
-
prepareUpdateInstructions(data: IUpdateData, { invoker, computePrice, computeLimit }: IPrepareStreamExt): Promise<TransactionInstruction[]>;
|
|
844
|
-
/**
|
|
845
|
-
* Gets fees for a given address
|
|
846
|
-
* @param {IGetFeesData} getData - Query parameters containing the partner address to check for custom fees
|
|
847
|
-
* @returns Fees
|
|
848
|
-
*/
|
|
849
|
-
getFees({ address }: IGetFeesData): Promise<IFees | null>;
|
|
850
|
-
/**
|
|
851
|
-
* Gets default streamflow fee
|
|
852
|
-
* @returns Default streamflow fee
|
|
853
|
-
*/
|
|
854
|
-
getDefaultStreamflowFee(): Promise<number>;
|
|
855
|
-
/**
|
|
856
|
-
* Get all defaults fees applied by the protocol.
|
|
857
|
-
*
|
|
858
|
-
* Protocol will use fees set for WITHDRAWOR as default if they are set.
|
|
859
|
-
*/
|
|
860
|
-
getDefaultFees(): Promise<IFees>;
|
|
861
|
-
/**
|
|
862
|
-
* Returns total fee percent, streamflow fees + partner fees
|
|
863
|
-
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
864
|
-
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
865
|
-
*/
|
|
866
|
-
getTotalFee(getFeesData: IGetFeesData): Promise<number>;
|
|
867
|
-
/**
|
|
868
|
-
* Extracts error code from an error
|
|
869
|
-
* @param {Error} err - Error
|
|
870
|
-
* @returns Error code
|
|
871
|
-
*/
|
|
872
|
-
extractErrorCode(err: Error): string | null;
|
|
873
|
-
/**
|
|
874
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA.
|
|
875
|
-
* For migrated streams, the PDA was derived from the old metadata key.
|
|
876
|
-
*/
|
|
877
|
-
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
878
|
-
private flatBuildCreateMultipleTransactionInstructions;
|
|
879
|
-
/**
|
|
880
|
-
* Gets closed streams for a given owner and direction
|
|
881
|
-
* @param owner - Owner address
|
|
882
|
-
* @param direction - Stream direction
|
|
883
|
-
* @returns Record of closed streams
|
|
884
|
-
*/
|
|
885
|
-
getClosedStreams(owner: string, direction?: StreamDirection): Promise<Record<string, Stream>>;
|
|
886
|
-
/**
|
|
887
|
-
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
888
|
-
*/
|
|
889
|
-
private getOrCreateStreamMetadata;
|
|
890
|
-
/**
|
|
891
|
-
* Returns the configured transfer hook program for a Token-2022 mint, if present.
|
|
892
|
-
*/
|
|
893
|
-
private getTransferHookProgramId;
|
|
894
|
-
/**
|
|
895
|
-
* Appends transfer-hook extra metas for each potential token transfer performed by the instruction.
|
|
896
|
-
*
|
|
897
|
-
* Transfer hook may rely on additional accounts/PDAs - derivation path is configured on the transfer hook metadata account, so for each potential transfer we need to check whether these accounts are needed and add them.
|
|
898
|
-
*/
|
|
899
|
-
private addTransferHookAccounts;
|
|
900
|
-
/**
|
|
901
|
-
* Returns insrtuctions for creating associated token accounts for the provided owners
|
|
902
|
-
*/
|
|
903
|
-
private getCreateATAInstructions;
|
|
904
|
-
private applyCustomAfterInstructions;
|
|
905
|
-
}
|
|
9
|
+
import '@coral-xyz/anchor';
|
|
10
|
+
import 'p-queue';
|
|
11
|
+
import './descriptor/streamflow_aligned_unlocks.js';
|
|
906
12
|
|
|
907
13
|
/**
|
|
908
14
|
* Returns the key that should be used for PDA derivation.
|
|
@@ -1505,4 +611,4 @@ declare const createClient: (options?: ApiClientOptions) => ApiClient;
|
|
|
1505
611
|
|
|
1506
612
|
declare const transformContract: (schema: ContractSchema) => Promise<Stream>;
|
|
1507
613
|
|
|
1508
|
-
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID,
|
|
614
|
+
export { AIRDROP_AMOUNT, AIRDROP_TEST_TOKEN, ALIGNED_COMPUTE_LIMIT, ALIGNED_PRECISION_FACTOR_POW, ALIGNED_UNLOCKS_PROGRAM_ID, AlignedStream, type ApiClient, type ApiClientOptions, BatchItem, BatchItemResult, CONTRACT_DISCRIMINATOR, CONTRACT_SEED, CREATE_PARAMS_PADDING, type Chain, type ContractSchema, type ContractType, DEFAULT_AUTO_CLAIM_FEE_SOL, DEFAULT_CREATION_FEE_SOL, DEFAULT_STREAMFLOW_FEE, DecodedStream, type DynamicContractSchema, ESCROW_SEED, FEES_METADATA_SEED, FEE_ORACLE_PUBLIC_KEY, type GetContractsOptions, ICreateAlignedStreamData, ICreateStreamData, ISearchStreams, IUpdateData, MAX_SAFE_UNIX_TIME_VALUE, METADATA_SEED, ORIGINAL_CONTRACT_SENDER_OFFSET, PARTNERS_SCHEMA, PARTNER_ORACLE_PROGRAM_ID, PARTNER_SCHEMA, PROGRAM_ID, type PriceOracleType, REPOPULATED_METADATA_SEED, 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_OLD_METADATA_KEY, STREAM_STRUCT_OFFSET_RECIPIENT, STREAM_STRUCT_OFFSET_SENDER, Stream, StreamType, TEST_ORACLE_DISCRIMINATOR, TEST_ORACLE_SEED, TX_FINALITY_CONFIRMED, type TabulariumContract, WITHDRAWOR, WITHDRAWOR_PUBLIC_KEY, WITHDRAW_AVAILABLE_AMOUNT, buildStreamType, calculateTotalAmountToDeposit, calculateUnlockedAmount, cancelStreamInstruction, createClient, createStreamInstruction, createStreamV2Instruction, createUncheckedStreamInstruction, createUncheckedStreamV2Instruction, decodeEndTime, decodeStream, deriveContractPDA, deriveEscrowPDA, deriveRepopulatedMetadataPDA, deriveStreamMetadataPDA, deriveTestOraclePDA, extractSolanaErrorCode, getMetadataKey, handleContractError, isAligned, isCliffCloseToDepositedAmount, isCreateAlignedStreamData, isDynamicLock, isTokenLock, isVesting, requestCancelStreamInstruction, sendAndConfirmStreamRawTransaction, signAllTransactionWithRecipients, _default as timelockIDL, topupStreamInstruction, transferStreamInstruction, transformContract, updateStreamInstruction, withdrawCancelRequestInstruction, withdrawStreamInstruction };
|