@streamflow/stream 9.0.4 → 10.0.0-alpha.p313.18b7be3

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,136 +0,0 @@
1
- import { B as BaseStreamClient, N as ISuiIdParameters, I as ICreateStreamData, f as ICreateStreamSuiExt, g as ICreateResult, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, k as ITransactionSuiExt, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, p as IGetOneData, P as Contract, r as IUpdateData, s as IGetFeesData, t as IFees, Q as SuiErrorInfo, R as ClassResource, T as FeeTableResource, U as FeeValueResource, V as IContractCreated, W as IContractWithdrawn, X as StreamResource, Y as SuiParsedError, Z as SuiSignAndExecuteTransactionBlockInput } from './BaseStreamClient-DOyJqO7R.js';
2
- import { ICluster } from '@streamflow/common';
3
- import { SuiClient, GetTransactionBlockParams, SuiTransactionBlockResponse } from '@mysten/sui/client';
4
-
5
- declare class SuiStreamClient extends BaseStreamClient {
6
- private programId;
7
- private configId;
8
- private feeTableId;
9
- private client;
10
- constructor(clusterUrl: string, cluster?: ICluster, ids?: ISuiIdParameters);
11
- /**
12
- * Creates a new stream/vesting contract.
13
- */
14
- create(streamData: ICreateStreamData, { senderWallet }: ICreateStreamSuiExt): Promise<ICreateResult>;
15
- /**
16
- * Creates multiple stream/vesting contracts.
17
- * We don't chain transactions in one Block so that one failed transaction does not revert all others.
18
- */
19
- createMultiple(multipleStreamData: ICreateMultipleStreamData, { senderWallet }: ICreateStreamSuiExt): Promise<IMultiTransactionResult>;
20
- /**
21
- * Attempts withdrawing from the specified stream.
22
- */
23
- withdraw({ id, amount }: IWithdrawData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
24
- /**
25
- * Attempts canceling the specified stream.
26
- */
27
- cancel(cancelData: ICancelData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
28
- /**
29
- * Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
30
- */
31
- transfer(transferData: ITransferData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
32
- /**
33
- * Tops up stream account with specified amount.
34
- */
35
- topup(topupData: ITopUpData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
36
- /**
37
- * Fetch stream data by its id (address).
38
- */
39
- getOne({ id }: IGetOneData): Promise<Contract>;
40
- get(): Promise<[string, Contract][]>;
41
- /**
42
- * Attempts updating the stream auto withdrawal params and amount per period
43
- */
44
- update(updateData: IUpdateData, { senderWallet, tokenId }: ITransactionSuiExt): Promise<ITransactionResult>;
45
- extractErrorCode(err: Error): string | null;
46
- getFees({ address }: IGetFeesData): Promise<IFees | null>;
47
- getDefaultStreamflowFee(): Promise<number>;
48
- /**
49
- * Returns StreamClient protocol program ID.
50
- */
51
- getProgramId(): string;
52
- /**
53
- * Utility function to generate Transaction Block to create streams
54
- */
55
- private generateCreateBlock;
56
- /**
57
- * Returns all coins owned by a Wallet
58
- * @param walletAddress wallet address
59
- * @param coinType coin type
60
- * @returns Array of Coin Structs
61
- */
62
- private getAllCoins;
63
- /**
64
- * Utility function to split Coin object and use splitted object for stream operations.
65
- * We do it like thid to mitigate risk of Transaction reverting in case Stream is created for Sui Coin object.
66
- * This way we can safely pass splitted Sui Coin object in Stream payload and use another object for gas/withdrawal fees.
67
- * @param tx current transanction block
68
- * @param amount minimal amount of coins requried
69
- * @param coinType coin type
70
- * @param coins array of owned coins of the same type
71
- * @param totalFee partner and treasury fees
72
- * @returns Coin Object to use in a Move Call
73
- */
74
- private splitCoinObjectForAmount;
75
- /**
76
- * Return previously splitted Coin Object to owner and merge it to to rebate storage fees
77
- * @param tx current transaction
78
- * @param coinType coin type
79
- * @param coinObject splitted object
80
- * @param coins array of objects used in
81
- */
82
- private returnSplittedCoinObject;
83
- }
84
-
85
- declare function extractSuiErrorInfo(errorText: string): SuiErrorInfo;
86
- /**
87
- * Fetches transaction block with a retry:
88
- * retries `Could not find the referenced transaction` error as it could be that some validators still don't have the tx;
89
- *
90
- * @param client sui client to use
91
- * @param input transaction fetch payload,
92
- */
93
- declare function getTransactionBlock(client: SuiClient, input: GetTransactionBlockParams): Promise<SuiTransactionBlockResponse>;
94
-
95
- declare const SUI_PROGRAM_IDS: Record<ICluster, string>;
96
- declare const SUI_CONFIG_IDS: Record<ICluster, string>;
97
- declare const SUI_FEE_TABLE_IDS: Record<ICluster, string>;
98
- declare const SUI_ERROR_MATCH_REGEX: RegExp;
99
- declare const SUI_MODULE_ERROR_MAP: {
100
- [key: string]: {
101
- [key: number]: string;
102
- };
103
- };
104
-
105
- declare const constants_SUI_CONFIG_IDS: typeof SUI_CONFIG_IDS;
106
- declare const constants_SUI_ERROR_MATCH_REGEX: typeof SUI_ERROR_MATCH_REGEX;
107
- declare const constants_SUI_FEE_TABLE_IDS: typeof SUI_FEE_TABLE_IDS;
108
- declare const constants_SUI_MODULE_ERROR_MAP: typeof SUI_MODULE_ERROR_MAP;
109
- declare const constants_SUI_PROGRAM_IDS: typeof SUI_PROGRAM_IDS;
110
- declare namespace constants {
111
- export { constants_SUI_CONFIG_IDS as SUI_CONFIG_IDS, constants_SUI_ERROR_MATCH_REGEX as SUI_ERROR_MATCH_REGEX, constants_SUI_FEE_TABLE_IDS as SUI_FEE_TABLE_IDS, constants_SUI_MODULE_ERROR_MAP as SUI_MODULE_ERROR_MAP, constants_SUI_PROGRAM_IDS as SUI_PROGRAM_IDS };
112
- }
113
-
114
- declare const index_ClassResource: typeof ClassResource;
115
- declare const index_Contract: typeof Contract;
116
- declare const index_FeeTableResource: typeof FeeTableResource;
117
- declare const index_FeeValueResource: typeof FeeValueResource;
118
- declare const index_IContractCreated: typeof IContractCreated;
119
- declare const index_IContractWithdrawn: typeof IContractWithdrawn;
120
- declare const index_ICreateStreamSuiExt: typeof ICreateStreamSuiExt;
121
- declare const index_ISuiIdParameters: typeof ISuiIdParameters;
122
- declare const index_ITransactionSuiExt: typeof ITransactionSuiExt;
123
- declare const index_StreamResource: typeof StreamResource;
124
- declare const index_SuiErrorInfo: typeof SuiErrorInfo;
125
- declare const index_SuiParsedError: typeof SuiParsedError;
126
- declare const index_SuiSignAndExecuteTransactionBlockInput: typeof SuiSignAndExecuteTransactionBlockInput;
127
- type index_SuiStreamClient = SuiStreamClient;
128
- declare const index_SuiStreamClient: typeof SuiStreamClient;
129
- declare const index_constants: typeof constants;
130
- declare const index_extractSuiErrorInfo: typeof extractSuiErrorInfo;
131
- declare const index_getTransactionBlock: typeof getTransactionBlock;
132
- declare namespace index {
133
- export { index_ClassResource as ClassResource, index_Contract as Contract, index_FeeTableResource as FeeTableResource, index_FeeValueResource as FeeValueResource, index_IContractCreated as IContractCreated, index_IContractWithdrawn as IContractWithdrawn, index_ICreateStreamSuiExt as ICreateStreamSuiExt, index_ISuiIdParameters as ISuiIdParameters, index_ITransactionSuiExt as ITransactionSuiExt, index_StreamResource as StreamResource, index_SuiErrorInfo as SuiErrorInfo, index_SuiParsedError as SuiParsedError, index_SuiSignAndExecuteTransactionBlockInput as SuiSignAndExecuteTransactionBlockInput, index_SuiStreamClient as SuiStreamClient, index_constants as constants, index_extractSuiErrorInfo as extractSuiErrorInfo, index_getTransactionBlock as getTransactionBlock };
134
- }
135
-
136
- export { SuiStreamClient as S, constants as c, extractSuiErrorInfo as e, getTransactionBlock as g, index as i };
@@ -1,213 +0,0 @@
1
- import { ethers, BigNumber } from 'ethers';
2
- import BN from 'bn.js';
3
- import { B as BaseStreamClient, I as ICreateStreamData, g as ICreateResult, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, r as IUpdateData, p as IGetOneData, S as Stream, q as IGetAllData, s as IGetFeesData, t as IFees, L as LinearStream, b as StreamType, G as ContractErrorCode } from './BaseStreamClient-DOyJqO7R.js';
4
- import { IChain, ICluster } from '@streamflow/common';
5
-
6
- declare class EvmStreamClient extends BaseStreamClient {
7
- private programId;
8
- private provider;
9
- private signer;
10
- private readContract;
11
- private writeContract;
12
- constructor(clusterUrl: string, chain: IChain, signer: ethers.Signer, cluster?: ICluster, programId?: string);
13
- create(streamData: ICreateStreamData): Promise<ICreateResult>;
14
- createMultiple(multipleStreamData: ICreateMultipleStreamData): Promise<IMultiTransactionResult>;
15
- withdraw({ id, amount }: IWithdrawData): Promise<ITransactionResult>;
16
- cancel(cancelData: ICancelData): Promise<ITransactionResult>;
17
- transfer(transferData: ITransferData): Promise<ITransactionResult>;
18
- topup(topupData: ITopUpData): Promise<ITransactionResult>;
19
- update(updateData: IUpdateData): Promise<ITransactionResult>;
20
- getOne({ id }: IGetOneData): Promise<Stream>;
21
- get({ address, direction, }: IGetAllData): Promise<[string, Stream][]>;
22
- extractErrorCode(err: Error): string | null;
23
- getFees({ address }: IGetFeesData): Promise<IFees | null>;
24
- getDefaultStreamflowFee(): Promise<number>;
25
- /**
26
- * Returns StreamClient protocol program ID.
27
- */
28
- getProgramId(): string;
29
- approveTokens(tokenId: string, amount: BN): Promise<void>;
30
- private generateMultiPayloads;
31
- private getFeeParams;
32
- private formatMetadataId;
33
- }
34
-
35
- declare function extractEvmErrorCode(errorText: string): string | null;
36
-
37
- interface StreamAbiResult {
38
- amount: BigNumber;
39
- amount_per_period: BigNumber;
40
- canceled_at: BigNumber;
41
- cliff_amount: BigNumber;
42
- closed: boolean;
43
- created: BigNumber;
44
- current_pause_start: BigNumber;
45
- end: BigNumber;
46
- fees: {
47
- streamflow_fee_percentage: BigNumber;
48
- streamflow_fee: BigNumber;
49
- streamflow_fee_withdrawn: BigNumber;
50
- partner_fee_percentage: BigNumber;
51
- partner_fee: BigNumber;
52
- partner_fee_withdrawn: BigNumber;
53
- tx_fee: BigNumber;
54
- };
55
- funds_unlocked_at_last_rate_change: BigNumber;
56
- last_rate_change_time: BigNumber;
57
- last_withdrawn_at: BigNumber;
58
- meta: {
59
- automatic_withdrawal: boolean;
60
- can_topup: boolean;
61
- can_update_rate: boolean;
62
- cancelable_by_recipient: boolean;
63
- cancelable_by_sender: boolean;
64
- contract_name: string;
65
- pausable: boolean;
66
- transferable_by_recipient: boolean;
67
- transferable_by_sender: boolean;
68
- withdrawal_frequency: BigNumber;
69
- };
70
- pause_cumulative: BigNumber;
71
- period: BigNumber;
72
- recipient: string;
73
- sender: string;
74
- partner: string;
75
- start: BigNumber;
76
- token: string;
77
- withdrawn: BigNumber;
78
- }
79
- interface FeesAbiResult {
80
- exists: boolean;
81
- streamflow_fee: BigNumber;
82
- partner_fee: BigNumber;
83
- }
84
- declare class EvmContract implements LinearStream {
85
- magic: number;
86
- version: number;
87
- createdAt: number;
88
- withdrawnAmount: BN;
89
- canceledAt: number;
90
- end: number;
91
- lastWithdrawnAt: number;
92
- sender: string;
93
- senderTokens: string;
94
- recipient: string;
95
- recipientTokens: string;
96
- mint: string;
97
- escrowTokens: string;
98
- streamflowTreasury: string;
99
- streamflowTreasuryTokens: string;
100
- streamflowFeeTotal: BN;
101
- streamflowFeeWithdrawn: BN;
102
- streamflowFeePercent: number;
103
- partnerFeeTotal: BN;
104
- partnerFeeWithdrawn: BN;
105
- partnerFeePercent: number;
106
- partner: string;
107
- partnerTokens: string;
108
- start: number;
109
- depositedAmount: BN;
110
- period: number;
111
- amountPerPeriod: BN;
112
- cliff: number;
113
- cliffAmount: BN;
114
- cancelableBySender: boolean;
115
- cancelableByRecipient: boolean;
116
- automaticWithdrawal: boolean;
117
- transferableBySender: boolean;
118
- transferableByRecipient: boolean;
119
- canTopup: boolean;
120
- name: string;
121
- withdrawalFrequency: number;
122
- closed: boolean;
123
- currentPauseStart: number;
124
- pauseCumulative: BN;
125
- lastRateChangeTime: number;
126
- fundsUnlockedAtLastRateChange: BN;
127
- type: StreamType;
128
- constructor(stream: StreamAbiResult);
129
- unlocked(currentTimestamp: number): BN;
130
- remaining(decimals: number): number;
131
- }
132
-
133
- declare const ETHEREUM_PROGRAM_IDS: Record<ICluster, string>;
134
- declare const BNB_PROGRAM_IDS: Record<ICluster, string>;
135
- declare const POLYGON_PROGRAM_IDS: Record<ICluster, string>;
136
- declare const EVM_ERROR_MATCH_REGEX: RegExp;
137
- declare const EVM_ERROR_MAP: {
138
- ECONTRACT_NOT_INIT: ContractErrorCode;
139
- EBAD_AMOUNT: ContractErrorCode;
140
- ENO_PERMISSIONS: ContractErrorCode;
141
- EBADINPUT: ContractErrorCode;
142
- ECLOSED: ContractErrorCode;
143
- EBAD_INPUT_AMOUNT_PER_PERIOD: ContractErrorCode;
144
- EBAD_INPUT_PAUSABLE: ContractErrorCode;
145
- EBAD_INPUT_UPDATE_RATE: ContractErrorCode;
146
- EBAD_INPUT_CLIFF_AMOUNT: ContractErrorCode;
147
- EBAD_INPUT_PERIOD: ContractErrorCode;
148
- EBAD_INPUT_START: ContractErrorCode;
149
- EBAD_INSUFFICIENT_TOKEN_ALLOWANCE: ContractErrorCode;
150
- EBAD_INSUFFICIENT_WITHDRAWAL_FEES: ContractErrorCode;
151
- };
152
-
153
- declare const constants_BNB_PROGRAM_IDS: typeof BNB_PROGRAM_IDS;
154
- declare const constants_ETHEREUM_PROGRAM_IDS: typeof ETHEREUM_PROGRAM_IDS;
155
- declare const constants_EVM_ERROR_MAP: typeof EVM_ERROR_MAP;
156
- declare const constants_EVM_ERROR_MATCH_REGEX: typeof EVM_ERROR_MATCH_REGEX;
157
- declare const constants_POLYGON_PROGRAM_IDS: typeof POLYGON_PROGRAM_IDS;
158
- declare namespace constants {
159
- export { constants_BNB_PROGRAM_IDS as BNB_PROGRAM_IDS, constants_ETHEREUM_PROGRAM_IDS as ETHEREUM_PROGRAM_IDS, constants_EVM_ERROR_MAP as EVM_ERROR_MAP, constants_EVM_ERROR_MATCH_REGEX as EVM_ERROR_MATCH_REGEX, constants_POLYGON_PROGRAM_IDS as POLYGON_PROGRAM_IDS };
160
- }
161
-
162
- declare const _default: ({
163
- constant: boolean;
164
- inputs: {
165
- name: string;
166
- type: string;
167
- }[];
168
- name: string;
169
- outputs: {
170
- name: string;
171
- type: string;
172
- }[];
173
- payable: boolean;
174
- stateMutability: string;
175
- type: string;
176
- anonymous?: undefined;
177
- } | {
178
- payable: boolean;
179
- stateMutability: string;
180
- type: string;
181
- constant?: undefined;
182
- inputs?: undefined;
183
- name?: undefined;
184
- outputs?: undefined;
185
- anonymous?: undefined;
186
- } | {
187
- anonymous: boolean;
188
- inputs: {
189
- indexed: boolean;
190
- name: string;
191
- type: string;
192
- }[];
193
- name: string;
194
- type: string;
195
- constant?: undefined;
196
- outputs?: undefined;
197
- payable?: undefined;
198
- stateMutability?: undefined;
199
- })[];
200
-
201
- type index_EvmContract = EvmContract;
202
- declare const index_EvmContract: typeof EvmContract;
203
- type index_EvmStreamClient = EvmStreamClient;
204
- declare const index_EvmStreamClient: typeof EvmStreamClient;
205
- type index_FeesAbiResult = FeesAbiResult;
206
- type index_StreamAbiResult = StreamAbiResult;
207
- declare const index_constants: typeof constants;
208
- declare const index_extractEvmErrorCode: typeof extractEvmErrorCode;
209
- declare namespace index {
210
- export { index_EvmContract as EvmContract, index_EvmStreamClient as EvmStreamClient, type index_FeesAbiResult as FeesAbiResult, type index_StreamAbiResult as StreamAbiResult, index_constants as constants, EvmStreamClient as default, _default as ercAbi, index_extractEvmErrorCode as extractEvmErrorCode };
211
- }
212
-
213
- export { EvmStreamClient as E, type FeesAbiResult as F, type StreamAbiResult as S, _default as _, EvmContract as a, constants as c, extractEvmErrorCode as e, index as i };
@@ -1,13 +0,0 @@
1
- export { S as SuiStreamClient, c as constants, e as extractSuiErrorInfo, g as getTransactionBlock } from '../index-DrzqsoIB.js';
2
- export { R as ClassResource, P as Contract, T as FeeTableResource, U as FeeValueResource, V as IContractCreated, W as IContractWithdrawn, f as ICreateStreamSuiExt, N as ISuiIdParameters, k as ITransactionSuiExt, X as StreamResource, Q as SuiErrorInfo, Y as SuiParsedError, Z as SuiSignAndExecuteTransactionBlockInput } from '../BaseStreamClient-DOyJqO7R.js';
3
- import '@streamflow/common';
4
- import '@mysten/sui/client';
5
- import '@coral-xyz/anchor';
6
- import '@solana/web3.js';
7
- import 'bn.js';
8
- import 'ethers';
9
- import 'p-queue';
10
- import 'aptos';
11
- import '@mysten/sui/cryptography';
12
- import '@mysten/sui/transactions';
13
- import '@suiet/wallet-kit';