@streamflow/stream 7.5.3 → 8.0.0-alpha.p284.726ba98
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/BaseStreamClient-CQOC8m8V.d.cts +542 -0
- package/dist/cjs/aptos/index.cjs +456 -0
- package/dist/cjs/aptos/index.cjs.map +1 -0
- package/dist/cjs/aptos/index.d.cts +14 -0
- package/dist/cjs/evm/index.cjs +1915 -0
- package/dist/cjs/evm/index.cjs.map +1 -0
- package/dist/cjs/evm/index.d.cts +13 -0
- package/dist/cjs/index-CYu6i--S.d.cts +136 -0
- package/dist/cjs/index-DUVcpIhD.d.cts +203 -0
- package/dist/cjs/index-b7Qo5mCj.d.cts +664 -0
- package/dist/cjs/index-fNLnPKzv.d.cts +213 -0
- package/dist/cjs/index.cjs +7202 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +192 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs +4 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.cjs.map +1 -0
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.d.cts +1234 -0
- package/dist/cjs/solana/index.cjs +3762 -0
- package/dist/cjs/solana/index.cjs.map +1 -0
- package/dist/cjs/solana/index.d.cts +17 -0
- package/dist/cjs/sui/index.cjs +1021 -0
- package/dist/cjs/sui/index.cjs.map +1 -0
- package/dist/cjs/sui/index.d.cts +13 -0
- package/dist/esm/BaseStreamClient-CQOC8m8V.d.ts +542 -0
- package/dist/esm/aptos/index.d.ts +14 -4
- package/dist/esm/aptos/index.js +443 -4
- package/dist/esm/aptos/index.js.map +1 -0
- package/dist/esm/evm/index.d.ts +13 -5
- package/dist/esm/evm/index.js +1902 -5
- package/dist/esm/evm/index.js.map +1 -0
- package/dist/esm/index-BEo0O2IG.d.ts +664 -0
- package/dist/esm/index-CWmb3-x9.d.ts +136 -0
- package/dist/esm/index-Cgv37xlG.d.ts +213 -0
- package/dist/esm/index-D6QYg8hn.d.ts +203 -0
- package/dist/esm/index.d.ts +192 -10
- package/dist/esm/index.js +7109 -10
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/solana/descriptor/idl/streamflow_aligned_unlocks.json +917 -1368
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.d.ts +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js +3 -1
- package/dist/esm/solana/descriptor/streamflow_aligned_unlocks.js.map +1 -0
- package/dist/esm/solana/index.d.ts +17 -7
- package/dist/esm/solana/index.js +3706 -7
- package/dist/esm/solana/index.js.map +1 -0
- package/dist/esm/sui/index.d.ts +13 -4
- package/dist/esm/sui/index.js +1011 -4
- package/dist/esm/sui/index.js.map +1 -0
- package/package.json +57 -27
- package/dist/cjs/__tests__/aptos/streamClient.spec.js +0 -111
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +0 -45
- package/dist/cjs/aptos/StreamClient.js +0 -226
- package/dist/cjs/aptos/constants.js +0 -27
- package/dist/cjs/aptos/index.js +0 -38
- package/dist/cjs/aptos/types.js +0 -69
- package/dist/cjs/aptos/utils.js +0 -34
- package/dist/cjs/aptos/wallet.js +0 -34
- package/dist/cjs/common/BaseStreamClient.js +0 -23
- package/dist/cjs/common/GenericStreamClient.js +0 -102
- package/dist/cjs/common/constants.js +0 -10
- package/dist/cjs/common/contractUtils.js +0 -77
- package/dist/cjs/common/types.js +0 -141
- package/dist/cjs/common/utils.js +0 -69
- package/dist/cjs/evm/StreamClient.js +0 -238
- package/dist/cjs/evm/abi.js +0 -1257
- package/dist/cjs/evm/constants.js +0 -38
- package/dist/cjs/evm/ercAbi.js +0 -224
- package/dist/cjs/evm/index.js +0 -40
- package/dist/cjs/evm/types.js +0 -66
- package/dist/cjs/evm/utils.js +0 -11
- package/dist/cjs/index.js +0 -43
- package/dist/cjs/solana/StreamClient.js +0 -1042
- package/dist/cjs/solana/constants.js +0 -95
- package/dist/cjs/solana/descriptor/idl/streamflow_aligned_unlocks.json +0 -1437
- package/dist/cjs/solana/descriptor/streamflow_aligned_unlocks.js +0 -2
- package/dist/cjs/solana/index.js +0 -40
- package/dist/cjs/solana/instructionTypes.js +0 -2
- package/dist/cjs/solana/instructions.js +0 -298
- package/dist/cjs/solana/layout.js +0 -182
- package/dist/cjs/solana/lib/derive-accounts.js +0 -17
- package/dist/cjs/solana/lib/utils.js +0 -127
- package/dist/cjs/solana/timelockIDL.js +0 -422
- package/dist/cjs/solana/types.js +0 -93
- package/dist/cjs/sui/StreamClient.js +0 -416
- package/dist/cjs/sui/constants.js +0 -42
- package/dist/cjs/sui/index.js +0 -37
- package/dist/cjs/sui/types.js +0 -68
- package/dist/cjs/sui/utils.js +0 -46
- package/dist/cjs/sui/wallet.js +0 -40
- package/dist/esm/__tests__/aptos/streamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/aptos/streamClient.spec.js +0 -106
- package/dist/esm/__tests__/common/GenericStreamClient.spec.d.ts +0 -1
- package/dist/esm/__tests__/common/GenericStreamClient.spec.js +0 -40
- package/dist/esm/aptos/StreamClient.d.ts +0 -53
- package/dist/esm/aptos/StreamClient.js +0 -226
- package/dist/esm/aptos/constants.d.ts +0 -8
- package/dist/esm/aptos/constants.js +0 -24
- package/dist/esm/aptos/types.d.ts +0 -109
- package/dist/esm/aptos/types.js +0 -105
- package/dist/esm/aptos/utils.d.ts +0 -7
- package/dist/esm/aptos/utils.js +0 -30
- package/dist/esm/aptos/wallet.d.ts +0 -9
- package/dist/esm/aptos/wallet.js +0 -33
- package/dist/esm/common/BaseStreamClient.d.ts +0 -22
- package/dist/esm/common/BaseStreamClient.js +0 -19
- package/dist/esm/common/GenericStreamClient.d.ts +0 -72
- package/dist/esm/common/GenericStreamClient.js +0 -101
- package/dist/esm/common/constants.d.ts +0 -4
- package/dist/esm/common/constants.js +0 -4
- package/dist/esm/common/contractUtils.d.ts +0 -63
- package/dist/esm/common/contractUtils.js +0 -61
- package/dist/esm/common/types.d.ts +0 -353
- package/dist/esm/common/types.js +0 -135
- package/dist/esm/common/utils.d.ts +0 -32
- package/dist/esm/common/utils.js +0 -59
- package/dist/esm/evm/StreamClient.d.ts +0 -32
- package/dist/esm/evm/StreamClient.js +0 -237
- package/dist/esm/evm/abi.d.ts +0 -111
- package/dist/esm/evm/abi.js +0 -1255
- package/dist/esm/evm/constants.d.ts +0 -20
- package/dist/esm/evm/constants.js +0 -35
- package/dist/esm/evm/ercAbi.d.ts +0 -39
- package/dist/esm/evm/ercAbi.js +0 -222
- package/dist/esm/evm/types.d.ts +0 -98
- package/dist/esm/evm/types.js +0 -102
- package/dist/esm/evm/utils.d.ts +0 -1
- package/dist/esm/evm/utils.js +0 -8
- package/dist/esm/solana/StreamClient.d.ts +0 -150
- package/dist/esm/solana/StreamClient.js +0 -1017
- package/dist/esm/solana/constants.d.ts +0 -70
- package/dist/esm/solana/constants.js +0 -92
- package/dist/esm/solana/instructionTypes.d.ts +0 -101
- package/dist/esm/solana/instructionTypes.js +0 -1
- package/dist/esm/solana/instructions.d.ts +0 -142
- package/dist/esm/solana/instructions.js +0 -265
- package/dist/esm/solana/layout.d.ts +0 -27
- package/dist/esm/solana/layout.js +0 -155
- package/dist/esm/solana/lib/derive-accounts.d.ts +0 -4
- package/dist/esm/solana/lib/derive-accounts.js +0 -11
- package/dist/esm/solana/lib/utils.d.ts +0 -22
- package/dist/esm/solana/lib/utils.js +0 -117
- package/dist/esm/solana/timelockIDL.d.ts +0 -22
- package/dist/esm/solana/timelockIDL.js +0 -420
- package/dist/esm/solana/types.d.ts +0 -180
- package/dist/esm/solana/types.js +0 -142
- package/dist/esm/sui/StreamClient.d.ts +0 -82
- package/dist/esm/sui/StreamClient.js +0 -417
- package/dist/esm/sui/constants.d.ts +0 -10
- package/dist/esm/sui/constants.js +0 -39
- package/dist/esm/sui/types.d.ts +0 -167
- package/dist/esm/sui/types.js +0 -104
- package/dist/esm/sui/utils.d.ts +0 -11
- package/dist/esm/sui/utils.js +0 -39
- package/dist/esm/sui/wallet.d.ts +0 -17
- package/dist/esm/sui/wallet.js +0 -38
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import { Address } from '@coral-xyz/anchor';
|
|
2
|
+
import { PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from '@solana/web3.js';
|
|
3
|
+
import { IChain, ICluster } from '@streamflow/common';
|
|
4
|
+
import BN from 'bn.js';
|
|
5
|
+
import { Signer } from 'ethers';
|
|
6
|
+
import PQueue from 'p-queue';
|
|
7
|
+
import { Types } from 'aptos';
|
|
8
|
+
import { Keypair } from '@mysten/sui/cryptography';
|
|
9
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
10
|
+
import { ExecuteTransactionRequestType, SuiTransactionBlockResponseOptions } from '@mysten/sui/client';
|
|
11
|
+
import { WalletContextState } from '@suiet/wallet-kit';
|
|
12
|
+
|
|
13
|
+
interface ICreateStreamSuiExt {
|
|
14
|
+
senderWallet: WalletContextState | Keypair;
|
|
15
|
+
}
|
|
16
|
+
interface ITransactionSuiExt {
|
|
17
|
+
senderWallet: WalletContextState | Keypair;
|
|
18
|
+
tokenId: string;
|
|
19
|
+
}
|
|
20
|
+
interface ISuiIdParameters {
|
|
21
|
+
program: string;
|
|
22
|
+
config: string;
|
|
23
|
+
feeTable: string;
|
|
24
|
+
}
|
|
25
|
+
interface IContractCreated {
|
|
26
|
+
address: string;
|
|
27
|
+
}
|
|
28
|
+
interface IContractWithdrawn {
|
|
29
|
+
address: string;
|
|
30
|
+
amount: number;
|
|
31
|
+
streamflow_amount: number;
|
|
32
|
+
partner_amount: number;
|
|
33
|
+
}
|
|
34
|
+
interface StreamResource {
|
|
35
|
+
id: {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
amount: string;
|
|
39
|
+
amount_per_period: string;
|
|
40
|
+
balance: string;
|
|
41
|
+
canceled_at: string;
|
|
42
|
+
cliff_amount: string;
|
|
43
|
+
closed: boolean;
|
|
44
|
+
created: string;
|
|
45
|
+
current_pause_start: string;
|
|
46
|
+
end: string;
|
|
47
|
+
fees: {
|
|
48
|
+
fields: {
|
|
49
|
+
partner_fee: string;
|
|
50
|
+
partner_fee_percentage: string;
|
|
51
|
+
partner_fee_withdrawn: string;
|
|
52
|
+
streamflow_fee: string;
|
|
53
|
+
streamflow_fee_percentage: string;
|
|
54
|
+
streamflow_fee_withdrawn: string;
|
|
55
|
+
};
|
|
56
|
+
type: string;
|
|
57
|
+
};
|
|
58
|
+
funds_unlocked_at_last_rate_change: string;
|
|
59
|
+
last_rate_change_time: string;
|
|
60
|
+
last_withdrawn_at: string;
|
|
61
|
+
meta: {
|
|
62
|
+
fields: {
|
|
63
|
+
automatic_withdrawal: boolean;
|
|
64
|
+
can_topup: boolean;
|
|
65
|
+
can_update_rate: boolean;
|
|
66
|
+
cancelable_by_recipient: boolean;
|
|
67
|
+
cancelable_by_sender: boolean;
|
|
68
|
+
contract_name: number[];
|
|
69
|
+
pausable: boolean;
|
|
70
|
+
transferable_by_recipient: boolean;
|
|
71
|
+
transferable_by_sender: boolean;
|
|
72
|
+
withdrawal_frequency: string;
|
|
73
|
+
};
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
partner: string;
|
|
77
|
+
pause_cumulative: string;
|
|
78
|
+
period: string;
|
|
79
|
+
recipient: string;
|
|
80
|
+
sender: string;
|
|
81
|
+
start: string;
|
|
82
|
+
version: string;
|
|
83
|
+
withdrawn: string;
|
|
84
|
+
}
|
|
85
|
+
interface ClassResource {
|
|
86
|
+
streamflow_fee: string;
|
|
87
|
+
treasury: string;
|
|
88
|
+
tx_fee: string;
|
|
89
|
+
withdrawor: string;
|
|
90
|
+
}
|
|
91
|
+
interface FeeTableResource {
|
|
92
|
+
values: {
|
|
93
|
+
type: string;
|
|
94
|
+
fields: {
|
|
95
|
+
id: {
|
|
96
|
+
id: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
interface FeeValueResource {
|
|
102
|
+
name: string;
|
|
103
|
+
value: {
|
|
104
|
+
type: string;
|
|
105
|
+
fields: {
|
|
106
|
+
partner_fee: string;
|
|
107
|
+
streamflow_fee: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
declare class Contract implements LinearStream {
|
|
112
|
+
magic: number;
|
|
113
|
+
version: number;
|
|
114
|
+
createdAt: number;
|
|
115
|
+
withdrawnAmount: BN;
|
|
116
|
+
canceledAt: number;
|
|
117
|
+
end: number;
|
|
118
|
+
lastWithdrawnAt: number;
|
|
119
|
+
sender: string;
|
|
120
|
+
senderTokens: string;
|
|
121
|
+
recipient: string;
|
|
122
|
+
recipientTokens: string;
|
|
123
|
+
mint: string;
|
|
124
|
+
escrowTokens: string;
|
|
125
|
+
streamflowTreasury: string;
|
|
126
|
+
streamflowTreasuryTokens: string;
|
|
127
|
+
streamflowFeeTotal: BN;
|
|
128
|
+
streamflowFeeWithdrawn: BN;
|
|
129
|
+
streamflowFeePercent: number;
|
|
130
|
+
partnerFeeTotal: BN;
|
|
131
|
+
partnerFeeWithdrawn: BN;
|
|
132
|
+
partnerFeePercent: number;
|
|
133
|
+
partner: string;
|
|
134
|
+
partnerTokens: string;
|
|
135
|
+
start: number;
|
|
136
|
+
depositedAmount: BN;
|
|
137
|
+
period: number;
|
|
138
|
+
amountPerPeriod: BN;
|
|
139
|
+
cliff: number;
|
|
140
|
+
cliffAmount: BN;
|
|
141
|
+
cancelableBySender: boolean;
|
|
142
|
+
cancelableByRecipient: boolean;
|
|
143
|
+
automaticWithdrawal: boolean;
|
|
144
|
+
transferableBySender: boolean;
|
|
145
|
+
transferableByRecipient: boolean;
|
|
146
|
+
canTopup: boolean;
|
|
147
|
+
name: string;
|
|
148
|
+
withdrawalFrequency: number;
|
|
149
|
+
closed: boolean;
|
|
150
|
+
currentPauseStart: number;
|
|
151
|
+
pauseCumulative: BN;
|
|
152
|
+
lastRateChangeTime: number;
|
|
153
|
+
fundsUnlockedAtLastRateChange: BN;
|
|
154
|
+
type: StreamType;
|
|
155
|
+
constructor(stream: StreamResource, tokenId: string);
|
|
156
|
+
unlocked(currentTimestamp: number): BN;
|
|
157
|
+
remaining(decimals: number): number;
|
|
158
|
+
}
|
|
159
|
+
interface SuiParsedError {
|
|
160
|
+
module: "protocol" | "admin" | "fee_manager";
|
|
161
|
+
code: number;
|
|
162
|
+
name: string;
|
|
163
|
+
}
|
|
164
|
+
interface SuiErrorInfo {
|
|
165
|
+
index?: number;
|
|
166
|
+
text: string;
|
|
167
|
+
parsed?: SuiParsedError;
|
|
168
|
+
}
|
|
169
|
+
interface SuiSignAndExecuteTransactionBlockInput {
|
|
170
|
+
transaction: Transaction;
|
|
171
|
+
requestType?: ExecuteTransactionRequestType;
|
|
172
|
+
options?: SuiTransactionBlockResponseOptions;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
interface IRecipient {
|
|
176
|
+
recipient: string;
|
|
177
|
+
amount: BN;
|
|
178
|
+
name: string;
|
|
179
|
+
cliffAmount: BN;
|
|
180
|
+
amountPerPeriod: BN;
|
|
181
|
+
}
|
|
182
|
+
interface IBaseStreamConfig {
|
|
183
|
+
period: number;
|
|
184
|
+
start: number;
|
|
185
|
+
cliff: number;
|
|
186
|
+
cancelableBySender: boolean;
|
|
187
|
+
cancelableByRecipient: boolean;
|
|
188
|
+
transferableBySender: boolean;
|
|
189
|
+
transferableByRecipient: boolean;
|
|
190
|
+
canTopup: boolean;
|
|
191
|
+
automaticWithdrawal?: boolean;
|
|
192
|
+
withdrawalFrequency?: number;
|
|
193
|
+
tokenId: string;
|
|
194
|
+
canPause?: boolean;
|
|
195
|
+
canUpdateRate?: boolean;
|
|
196
|
+
partner?: string;
|
|
197
|
+
tokenProgramId?: string | PublicKey;
|
|
198
|
+
}
|
|
199
|
+
type IAlignedStreamConfig = {
|
|
200
|
+
minPrice: number | BN;
|
|
201
|
+
maxPrice: number | BN;
|
|
202
|
+
minPercentage: number | BN;
|
|
203
|
+
maxPercentage: number | BN;
|
|
204
|
+
oracleType?: OracleTypeName;
|
|
205
|
+
priceOracle?: Address;
|
|
206
|
+
skipInitial?: boolean;
|
|
207
|
+
tickSize?: number;
|
|
208
|
+
};
|
|
209
|
+
type ICreateLinearStreamData = IBaseStreamConfig & IRecipient;
|
|
210
|
+
type ICreateAlignedStreamData = ICreateLinearStreamData & IAlignedStreamConfig;
|
|
211
|
+
type ICreateStreamData = ICreateLinearStreamData | ICreateAlignedStreamData;
|
|
212
|
+
type ICreateMultipleLinearStreamData = IBaseStreamConfig & {
|
|
213
|
+
recipients: IRecipient[];
|
|
214
|
+
};
|
|
215
|
+
type ICreateMultipleAlignedStreamData = ICreateMultipleLinearStreamData & IAlignedStreamConfig;
|
|
216
|
+
type ICreateMultipleStreamData = ICreateMultipleLinearStreamData | ICreateMultipleAlignedStreamData;
|
|
217
|
+
interface IInteractData {
|
|
218
|
+
id: string;
|
|
219
|
+
}
|
|
220
|
+
interface IWithdrawData extends IInteractData {
|
|
221
|
+
amount?: BN;
|
|
222
|
+
}
|
|
223
|
+
interface IUpdateData extends IInteractData {
|
|
224
|
+
enableAutomaticWithdrawal?: boolean;
|
|
225
|
+
withdrawFrequency?: BN;
|
|
226
|
+
amountPerPeriod?: BN;
|
|
227
|
+
}
|
|
228
|
+
type ICancelData = IInteractData;
|
|
229
|
+
interface ITransferData extends IInteractData {
|
|
230
|
+
newRecipient: string;
|
|
231
|
+
}
|
|
232
|
+
interface ITopUpData extends IInteractData {
|
|
233
|
+
amount: BN;
|
|
234
|
+
}
|
|
235
|
+
type IGetOneData = IInteractData;
|
|
236
|
+
interface IGetFeesData {
|
|
237
|
+
address: string;
|
|
238
|
+
}
|
|
239
|
+
interface IGetAllData {
|
|
240
|
+
address: string;
|
|
241
|
+
type?: StreamType;
|
|
242
|
+
direction?: StreamDirection;
|
|
243
|
+
}
|
|
244
|
+
interface ICreateMultiError {
|
|
245
|
+
recipient: string;
|
|
246
|
+
error: string;
|
|
247
|
+
contractErrorCode?: string;
|
|
248
|
+
}
|
|
249
|
+
type MetadataId = string;
|
|
250
|
+
interface ITransactionResult {
|
|
251
|
+
ixs: (TransactionInstruction | Types.TransactionPayload)[];
|
|
252
|
+
txId: string;
|
|
253
|
+
}
|
|
254
|
+
interface IFees {
|
|
255
|
+
streamflowFee: number;
|
|
256
|
+
partnerFee: number;
|
|
257
|
+
}
|
|
258
|
+
interface ICreateResult extends ITransactionResult {
|
|
259
|
+
metadataId: MetadataId;
|
|
260
|
+
}
|
|
261
|
+
interface IMultiTransactionResult {
|
|
262
|
+
txs: string[];
|
|
263
|
+
metadatas: MetadataId[];
|
|
264
|
+
metadataToRecipient: Record<MetadataId, IRecipient>;
|
|
265
|
+
errors: ICreateMultiError[];
|
|
266
|
+
}
|
|
267
|
+
type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
|
|
268
|
+
declare enum StreamDirection {
|
|
269
|
+
Outgoing = "outgoing",
|
|
270
|
+
Incoming = "incoming",
|
|
271
|
+
All = "all"
|
|
272
|
+
}
|
|
273
|
+
declare enum StreamType {
|
|
274
|
+
All = "all",
|
|
275
|
+
Payment = "payment",
|
|
276
|
+
Vesting = "vesting",
|
|
277
|
+
Lock = "lock"
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Error codes raised by all protocols except for Solana
|
|
281
|
+
*/
|
|
282
|
+
declare enum ContractErrorCode {
|
|
283
|
+
/** Contract does not exist */
|
|
284
|
+
ECONTRACT_NOT_INIT = "ECONTRACT_NOT_INIT",
|
|
285
|
+
/** Invalid total amount */
|
|
286
|
+
EBAD_AMOUNT = "EBAD_AMOUNT",
|
|
287
|
+
/** No permissions to perform an operation */
|
|
288
|
+
ENO_PERMISSIONS = "ENO_PERMISSIONS",
|
|
289
|
+
/** Invalid input parameters on create/update */
|
|
290
|
+
EBADINPUT = "EBADINPUT",
|
|
291
|
+
/** Contract is already ended */
|
|
292
|
+
ECLOSED = "ECLOSED",
|
|
293
|
+
/** Invalid amount per period input */
|
|
294
|
+
EBAD_INPUT_AMOUNT_PER_PERIOD = "EBAD_INPUT_AMOUNT_PER_PERIOD",
|
|
295
|
+
/** Pause feature is not supported */
|
|
296
|
+
EBAD_INPUT_PAUSABLE = "EBAD_INPUT_PAUSABLE",
|
|
297
|
+
/** Not used currently */
|
|
298
|
+
EBAD_INPUT_UPDATE_RATE = "EBAD_INPUT_UPDATE_RATE",
|
|
299
|
+
/** Invalid cliff amount input */
|
|
300
|
+
EBAD_INPUT_CLIFF_AMOUNT = "EBAD_INPUT_CLIFF_AMOUNT",
|
|
301
|
+
/** Invalid period input */
|
|
302
|
+
EBAD_INPUT_PERIOD = "EBAD_INPUT_PERIOD",
|
|
303
|
+
/** Invalid start time of the contract */
|
|
304
|
+
EBAD_INPUT_START = "EBAD_INPUT_START",
|
|
305
|
+
/** EVM: token allowance is not enough to create a Contract */
|
|
306
|
+
EBAD_INSUFFICIENT_TOKEN_ALLOWANCE = "EBAD_INSUFFICIENT_TOKEN_ALLOWANCE",
|
|
307
|
+
/** EVM: not enough coins were passed for withdrawal fees */
|
|
308
|
+
EBAD_INSUFFICIENT_WITHDRAWAL_FEES = "EBAD_INSUFFICIENT_WITHDRAWAL_FEES",
|
|
309
|
+
/** Sui: Insufficient amount of tokens passed */
|
|
310
|
+
EBAD_INSUFFICIENT_AMOUNT = "EBAD_INSUFFICIENT_AMOUNT",
|
|
311
|
+
/** Contract is already paused */
|
|
312
|
+
EPAUSED = "EPAUSED",
|
|
313
|
+
/** Contract is not paused */
|
|
314
|
+
ENOTPAUSED = "ENOTPAUSED",
|
|
315
|
+
/** Aptos: user opt out from direct coin transfers feature and has not coin wallet registered */
|
|
316
|
+
ENO_RECIPIENT_COIN_ADDRESS = "ENO_RECIPIENT_COIN_ADDRESS"
|
|
317
|
+
}
|
|
318
|
+
interface LinearStream {
|
|
319
|
+
magic: number;
|
|
320
|
+
version: number;
|
|
321
|
+
createdAt: number;
|
|
322
|
+
withdrawnAmount: BN;
|
|
323
|
+
canceledAt: number;
|
|
324
|
+
end: number;
|
|
325
|
+
lastWithdrawnAt: number;
|
|
326
|
+
sender: string;
|
|
327
|
+
senderTokens: string;
|
|
328
|
+
recipient: string;
|
|
329
|
+
recipientTokens: string;
|
|
330
|
+
mint: string;
|
|
331
|
+
escrowTokens: string;
|
|
332
|
+
streamflowTreasury: string;
|
|
333
|
+
streamflowTreasuryTokens: string;
|
|
334
|
+
streamflowFeeTotal: BN;
|
|
335
|
+
streamflowFeeWithdrawn: BN;
|
|
336
|
+
streamflowFeePercent: number;
|
|
337
|
+
partnerFeeTotal: BN;
|
|
338
|
+
partnerFeeWithdrawn: BN;
|
|
339
|
+
partnerFeePercent: number;
|
|
340
|
+
partner: string;
|
|
341
|
+
partnerTokens: string;
|
|
342
|
+
start: number;
|
|
343
|
+
depositedAmount: BN;
|
|
344
|
+
period: number;
|
|
345
|
+
amountPerPeriod: BN;
|
|
346
|
+
cliff: number;
|
|
347
|
+
cliffAmount: BN;
|
|
348
|
+
cancelableBySender: boolean;
|
|
349
|
+
cancelableByRecipient: boolean;
|
|
350
|
+
automaticWithdrawal: boolean;
|
|
351
|
+
transferableBySender: boolean;
|
|
352
|
+
transferableByRecipient: boolean;
|
|
353
|
+
canTopup: boolean;
|
|
354
|
+
name: string;
|
|
355
|
+
withdrawalFrequency: number;
|
|
356
|
+
closed: boolean;
|
|
357
|
+
currentPauseStart: number;
|
|
358
|
+
pauseCumulative: BN;
|
|
359
|
+
lastRateChangeTime: number;
|
|
360
|
+
fundsUnlockedAtLastRateChange: BN;
|
|
361
|
+
type: StreamType;
|
|
362
|
+
unlocked(currentTimestamp: number): BN;
|
|
363
|
+
remaining(decimals: number): number;
|
|
364
|
+
}
|
|
365
|
+
type AlignedStreamData = {
|
|
366
|
+
minPrice: number;
|
|
367
|
+
maxPrice: number;
|
|
368
|
+
minPercentage: number;
|
|
369
|
+
maxPercentage: number;
|
|
370
|
+
oracleType: OracleTypeName;
|
|
371
|
+
priceOracle: string | undefined;
|
|
372
|
+
tickSize: number;
|
|
373
|
+
initialAmountPerPeriod: BN;
|
|
374
|
+
initialPrice: number;
|
|
375
|
+
lastPrice: number;
|
|
376
|
+
lastAmountUpdateTime: number;
|
|
377
|
+
initialNetAmount: BN;
|
|
378
|
+
};
|
|
379
|
+
type AlignedStream = LinearStream & AlignedStreamData;
|
|
380
|
+
type Stream = LinearStream | AlignedStream;
|
|
381
|
+
/**
|
|
382
|
+
* Error codes raised by Solana protocol specifically
|
|
383
|
+
*/
|
|
384
|
+
declare enum SolanaContractErrorCode {
|
|
385
|
+
/** Accounts not writable */
|
|
386
|
+
AccountsNotWritable = "AccountsNotWritable",
|
|
387
|
+
/** Invalid Metadata */
|
|
388
|
+
InvalidMetadata = "InvalidMetadata",
|
|
389
|
+
/** Invalid metadata account */
|
|
390
|
+
InvalidMetadataAccount = "InvalidMetadataAccount",
|
|
391
|
+
/** Provided accounts don't match the ones in contract */
|
|
392
|
+
MetadataAccountMismatch = "MetadataAccountMismatch",
|
|
393
|
+
/** Invalid escrow account */
|
|
394
|
+
InvalidEscrowAccount = "InvalidEscrowAccount",
|
|
395
|
+
/** Provided account(s) is/are not valid associated token accounts */
|
|
396
|
+
NotAssociated = "NotAssociated",
|
|
397
|
+
/** Sender mint does not match accounts mint */
|
|
398
|
+
MintMismatch = "MintMismatch",
|
|
399
|
+
/** Recipient not transferable for account */
|
|
400
|
+
TransferNotAllowed = "TransferNotAllowed",
|
|
401
|
+
/** Contract closed */
|
|
402
|
+
ContractClosed = "ContractClosed",
|
|
403
|
+
/** Invalid Streamflow Treasury accounts supplied */
|
|
404
|
+
InvalidTreasury = "InvalidTreasury",
|
|
405
|
+
/** Given timestamps are invalid */
|
|
406
|
+
InvalidTimestamps = "InvalidTimestamps",
|
|
407
|
+
/** Invalid deposit configuration */
|
|
408
|
+
InvalidDepositConfiguration = "InvalidDepositConfiguration",
|
|
409
|
+
/** Amount cannot be zero */
|
|
410
|
+
AmountIsZero = "AmountIsZero",
|
|
411
|
+
/** Amount requested is larger than available */
|
|
412
|
+
AmountMoreThanAvailable = "AmountMoreThanAvailable",
|
|
413
|
+
/** Amount currently available is zero */
|
|
414
|
+
AmountAvailableIsZero = "AmountAvailableIsZero",
|
|
415
|
+
/** Arithmetic error */
|
|
416
|
+
ArithmeticError = "ArithmeticError",
|
|
417
|
+
/** Metadata account data must be 1104 bytes long */
|
|
418
|
+
InvalidMetadataSize = "InvalidMetadataSize",
|
|
419
|
+
/** Metadata state account must be initialized */
|
|
420
|
+
UninitializedMetadata = "UninitializedMetadata",
|
|
421
|
+
/** Authority does not have permission for this action */
|
|
422
|
+
Unauthorized = "Unauthorized",
|
|
423
|
+
/** Contract is not transferable to the original recipient */
|
|
424
|
+
SelfTransfer = "SelfTransfer",
|
|
425
|
+
/** Contract is already paused */
|
|
426
|
+
AlreadyPaused = "AlreadyPaused",
|
|
427
|
+
/** Contract is not paused */
|
|
428
|
+
NotPaused = "NotPaused",
|
|
429
|
+
/** Meta account is not rent exempt */
|
|
430
|
+
MetadataNotRentExempt = "MetadataNotRentExempt"
|
|
431
|
+
}
|
|
432
|
+
declare enum SolanaAlignedProxyErrorCode {
|
|
433
|
+
/** Authority does not have permission for this action */
|
|
434
|
+
Unauthorized = "Unauthorized",
|
|
435
|
+
/** Arithmetic error */
|
|
436
|
+
ArithmeticError = "ArithmeticError",
|
|
437
|
+
/** Mint has unsupported Token Extensions */
|
|
438
|
+
UnsupportedTokenExtensions = "UnsupportedTokenExtensions",
|
|
439
|
+
/** Provided period is too short, should be equal or more than 30 seconds */
|
|
440
|
+
PeriodTooShort = "PeriodTooShort",
|
|
441
|
+
/** Provided percentage tick size is invalid */
|
|
442
|
+
InvalidTickSize = "InvalidTickSize",
|
|
443
|
+
/** Provided percentage bounds are invalid */
|
|
444
|
+
InvalidPercentageBoundaries = "InvalidPercentageBoundaries",
|
|
445
|
+
/** Provided price bounds are invalid */
|
|
446
|
+
InvalidPriceBoundaries = "InvalidPriceBoundaries",
|
|
447
|
+
/** Unsupported price oracle */
|
|
448
|
+
UnsupportedOracle = "UnsupportedOracle",
|
|
449
|
+
/** Invalid oracle account */
|
|
450
|
+
InvalidOracleAccount = "InvalidOracleAccount",
|
|
451
|
+
/** Invalid oracle price */
|
|
452
|
+
InvalidOraclePrice = "InvalidOraclePrice",
|
|
453
|
+
/** Invalid Stream Metadata */
|
|
454
|
+
InvalidStreamMetadata = "InvalidStreamMetadata",
|
|
455
|
+
/** Release amount has already been updated in this period */
|
|
456
|
+
AmountAlreadyUpdated = "AmountAlreadyUpdated",
|
|
457
|
+
/** All funds are already unlocked */
|
|
458
|
+
AllFundsUnlocked = "AllFundsUnlocked"
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* @interface
|
|
462
|
+
*/
|
|
463
|
+
interface SolanaTransactionSchedulingOptions {
|
|
464
|
+
/**
|
|
465
|
+
* concurrency rate for scheduling
|
|
466
|
+
*/
|
|
467
|
+
sendRate: number;
|
|
468
|
+
/**
|
|
469
|
+
* time interval between consecutive sends
|
|
470
|
+
*/
|
|
471
|
+
sendInterval?: number;
|
|
472
|
+
/**
|
|
473
|
+
* time interval before confirming the transaction
|
|
474
|
+
*/
|
|
475
|
+
waitBeforeConfirming?: number;
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
478
|
+
* @interface
|
|
479
|
+
*/
|
|
480
|
+
interface SolanaStreamClientOptions {
|
|
481
|
+
chain: IChain.Solana;
|
|
482
|
+
clusterUrl: string;
|
|
483
|
+
cluster?: ICluster;
|
|
484
|
+
programId?: string;
|
|
485
|
+
commitment?: Commitment | ConnectionConfig;
|
|
486
|
+
sendRate?: number;
|
|
487
|
+
sendThrottler?: PQueue;
|
|
488
|
+
sendScheduler?: PQueue | SolanaTransactionSchedulingOptions;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @interface
|
|
492
|
+
*/
|
|
493
|
+
interface AptosStreamClientOptions {
|
|
494
|
+
chain: IChain.Aptos;
|
|
495
|
+
clusterUrl: string;
|
|
496
|
+
cluster?: ICluster;
|
|
497
|
+
programId?: string;
|
|
498
|
+
maxGas?: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* @interface
|
|
502
|
+
*/
|
|
503
|
+
interface EvmStreamClientOptions {
|
|
504
|
+
chain: IChain.Ethereum | IChain.BNB | IChain.Polygon;
|
|
505
|
+
clusterUrl: string;
|
|
506
|
+
signer: Signer;
|
|
507
|
+
cluster?: ICluster;
|
|
508
|
+
programId?: string;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* @interface
|
|
512
|
+
*/
|
|
513
|
+
interface SuiStreamClientOptions {
|
|
514
|
+
chain: IChain.Sui;
|
|
515
|
+
clusterUrl: string;
|
|
516
|
+
cluster?: ICluster;
|
|
517
|
+
ids?: ISuiIdParameters;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
declare abstract class BaseStreamClient {
|
|
521
|
+
abstract create(streamData: ICreateStreamData, chainSpecificParams: any): Promise<ICreateResult>;
|
|
522
|
+
abstract createMultiple(multipleStreamData: ICreateMultipleStreamData, chainSpecificParams: any): Promise<IMultiTransactionResult>;
|
|
523
|
+
abstract withdraw(withdrawData: IWithdrawData, chainSpecificParams: any): Promise<ITransactionResult>;
|
|
524
|
+
abstract cancel(cancelData: ICancelData, chainSpecificParams: any): Promise<ITransactionResult>;
|
|
525
|
+
abstract transfer(transferData: ITransferData, chainSpecificParams: any): Promise<ITransactionResult>;
|
|
526
|
+
abstract topup(topupData: ITopUpData, chainSpecificParams: any): Promise<ITransactionResult>;
|
|
527
|
+
abstract getOne(getOneData: IGetOneData, chainSpecificParams: any): Promise<Stream>;
|
|
528
|
+
abstract get(getAllData: IGetAllData, chainSpecificParams: any): Promise<[string, Stream][]>;
|
|
529
|
+
abstract update(updateData: IUpdateData, chainSpecificParams: any): Promise<ITransactionResult>;
|
|
530
|
+
abstract getFees(getFeesData: IGetFeesData, chainSpecificParams?: any): Promise<IFees | null>;
|
|
531
|
+
abstract getDefaultStreamflowFee(chainSpecificParams?: any): Promise<number>;
|
|
532
|
+
/**
|
|
533
|
+
* Returns total fee percent, streamflow fees + partner fees
|
|
534
|
+
* @param getFeesData structure with address for which we need to derive fee, either sender or partner usually
|
|
535
|
+
* @param chainSpecificParams additional parameters required by chain client
|
|
536
|
+
* @returns fee as floating number, so if fee is 0.99%, it will return 0.99
|
|
537
|
+
*/
|
|
538
|
+
getTotalFee(getFeesData: IGetFeesData, chainSpecificParams?: any): Promise<number>;
|
|
539
|
+
extractErrorCode(err: Error): string | null;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export { type AlignedStream as A, BaseStreamClient as B, type IInteractData as C, type ICreateMultiError as D, type EvmStreamClientOptions as E, StreamDirection as F, ContractErrorCode as G, type AlignedStreamData as H, type ICreateStreamData as I, SolanaContractErrorCode as J, SolanaAlignedProxyErrorCode as K, type LinearStream as L, type SolanaTransactionSchedulingOptions as M, type ISuiIdParameters as N, type OracleTypeName as O, Contract as P, type SuiErrorInfo as Q, type ClassResource as R, type Stream as S, type FeeTableResource as T, type FeeValueResource as U, type IContractCreated as V, type IContractWithdrawn as W, type StreamResource as X, type SuiParsedError as Y, type SuiSignAndExecuteTransactionBlockInput as Z, type ICreateAlignedStreamData as a, StreamType as b, type SolanaStreamClientOptions as c, type AptosStreamClientOptions as d, type SuiStreamClientOptions as e, type ICreateStreamSuiExt as f, type ICreateResult as g, type ICreateMultipleStreamData as h, type IMultiTransactionResult as i, type IWithdrawData as j, type ITransactionSuiExt as k, type ITransactionResult as l, type ICancelData as m, type ITransferData as n, type ITopUpData as o, type IGetOneData as p, type IGetAllData as q, type IUpdateData as r, type IGetFeesData as s, type IFees as t, type IRecipient as u, type IBaseStreamConfig as v, type IAlignedStreamConfig as w, type ICreateLinearStreamData as x, type ICreateMultipleLinearStreamData as y, type ICreateMultipleAlignedStreamData as z };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export { A as AptosStreamClient, C as ConfigResource, b as Contract, F as FeeTableResource, I as ICreateStreamAptosExt, a as ITransactionAptosExt, S as StreamResource, c as constants, A as default, e as extractAptosErrorCode, n as normalizeAptosAddress } from '../index-D6QYg8hn.js';
|
|
2
|
+
import '../BaseStreamClient-CQOC8m8V.js';
|
|
3
|
+
import '@coral-xyz/anchor';
|
|
4
|
+
import '@solana/web3.js';
|
|
5
|
+
import '@streamflow/common';
|
|
6
|
+
import 'bn.js';
|
|
7
|
+
import 'ethers';
|
|
8
|
+
import 'p-queue';
|
|
9
|
+
import 'aptos';
|
|
10
|
+
import '@mysten/sui/cryptography';
|
|
11
|
+
import '@mysten/sui/transactions';
|
|
12
|
+
import '@mysten/sui/client';
|
|
13
|
+
import '@suiet/wallet-kit';
|
|
14
|
+
import '@manahippo/aptos-wallet-adapter';
|