@streamflow/stream 7.5.2 → 7.5.3-alpha.cffa362.20250508190445
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 +460 -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 +1917 -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 +7205 -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 +3763 -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 +1023 -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 +447 -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 +1904 -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 +7112 -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 +3707 -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 +1013 -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,136 @@
|
|
|
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-CQOC8m8V.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 };
|
|
@@ -0,0 +1,213 @@
|
|
|
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-CQOC8m8V.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 };
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { L as LinearStream, b as StreamType, 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, p as IGetOneData, r as IUpdateData, s as IGetFeesData, t as IFees } from './BaseStreamClient-CQOC8m8V.js';
|
|
2
|
+
import { WalletContextState } from '@manahippo/aptos-wallet-adapter';
|
|
3
|
+
import BN from 'bn.js';
|
|
4
|
+
import { AptosAccount } from 'aptos';
|
|
5
|
+
import { ICluster } from '@streamflow/common';
|
|
6
|
+
|
|
7
|
+
interface ICreateStreamAptosExt {
|
|
8
|
+
senderWallet: WalletContextState | AptosAccount;
|
|
9
|
+
}
|
|
10
|
+
type ITransactionAptosExt = ICreateStreamAptosExt & {
|
|
11
|
+
tokenId: string;
|
|
12
|
+
};
|
|
13
|
+
interface StreamResource {
|
|
14
|
+
amount: string;
|
|
15
|
+
amount_per_period: string;
|
|
16
|
+
canceled_at: string;
|
|
17
|
+
cliff_amount: string;
|
|
18
|
+
closed: boolean;
|
|
19
|
+
contract_signer_cap: {
|
|
20
|
+
account: string;
|
|
21
|
+
};
|
|
22
|
+
created: string;
|
|
23
|
+
current_pause_start: string;
|
|
24
|
+
end: string;
|
|
25
|
+
fees: {
|
|
26
|
+
streamflow_fee: string;
|
|
27
|
+
streamflow_fee_percentage: string;
|
|
28
|
+
streamflow_fee_withdrawn: string;
|
|
29
|
+
};
|
|
30
|
+
funds_unlocked_at_last_rate_change: string;
|
|
31
|
+
last_rate_change_time: string;
|
|
32
|
+
last_withdrawn_at: string;
|
|
33
|
+
meta: {
|
|
34
|
+
automatic_withdrawal: boolean;
|
|
35
|
+
can_topup: boolean;
|
|
36
|
+
can_update_rate: boolean;
|
|
37
|
+
cancelable_by_recipient: boolean;
|
|
38
|
+
cancelable_by_sender: boolean;
|
|
39
|
+
contract_name: string;
|
|
40
|
+
pausable: boolean;
|
|
41
|
+
transferable_by_recipient: boolean;
|
|
42
|
+
transferable_by_sender: boolean;
|
|
43
|
+
withdrawal_frequency: string;
|
|
44
|
+
};
|
|
45
|
+
pause_cumulative: string;
|
|
46
|
+
period: string;
|
|
47
|
+
recipient: string;
|
|
48
|
+
sender: string;
|
|
49
|
+
start: string;
|
|
50
|
+
withdrawn: string;
|
|
51
|
+
}
|
|
52
|
+
interface FeeTableResource {
|
|
53
|
+
values: {
|
|
54
|
+
handle: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface ConfigResource {
|
|
58
|
+
admin: string;
|
|
59
|
+
streamflow_fees: string;
|
|
60
|
+
treasury: string;
|
|
61
|
+
tx_fee: string;
|
|
62
|
+
withdrawor: string;
|
|
63
|
+
}
|
|
64
|
+
declare class Contract implements LinearStream {
|
|
65
|
+
magic: number;
|
|
66
|
+
version: number;
|
|
67
|
+
createdAt: number;
|
|
68
|
+
withdrawnAmount: BN;
|
|
69
|
+
canceledAt: number;
|
|
70
|
+
end: number;
|
|
71
|
+
lastWithdrawnAt: number;
|
|
72
|
+
sender: string;
|
|
73
|
+
senderTokens: string;
|
|
74
|
+
recipient: string;
|
|
75
|
+
recipientTokens: string;
|
|
76
|
+
mint: string;
|
|
77
|
+
escrowTokens: string;
|
|
78
|
+
streamflowTreasury: string;
|
|
79
|
+
streamflowTreasuryTokens: string;
|
|
80
|
+
streamflowFeeTotal: BN;
|
|
81
|
+
streamflowFeeWithdrawn: BN;
|
|
82
|
+
streamflowFeePercent: number;
|
|
83
|
+
partnerFeeTotal: BN;
|
|
84
|
+
partnerFeeWithdrawn: BN;
|
|
85
|
+
partnerFeePercent: number;
|
|
86
|
+
partner: string;
|
|
87
|
+
partnerTokens: string;
|
|
88
|
+
start: number;
|
|
89
|
+
depositedAmount: BN;
|
|
90
|
+
period: number;
|
|
91
|
+
amountPerPeriod: BN;
|
|
92
|
+
cliff: number;
|
|
93
|
+
cliffAmount: BN;
|
|
94
|
+
cancelableBySender: boolean;
|
|
95
|
+
cancelableByRecipient: boolean;
|
|
96
|
+
automaticWithdrawal: boolean;
|
|
97
|
+
transferableBySender: boolean;
|
|
98
|
+
transferableByRecipient: boolean;
|
|
99
|
+
canTopup: boolean;
|
|
100
|
+
name: string;
|
|
101
|
+
withdrawalFrequency: number;
|
|
102
|
+
closed: boolean;
|
|
103
|
+
currentPauseStart: number;
|
|
104
|
+
pauseCumulative: BN;
|
|
105
|
+
lastRateChangeTime: number;
|
|
106
|
+
fundsUnlockedAtLastRateChange: BN;
|
|
107
|
+
type: StreamType;
|
|
108
|
+
constructor(stream: StreamResource, tokenId: string);
|
|
109
|
+
unlocked(currentTimestamp: number): BN;
|
|
110
|
+
remaining(decimals: number): number;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
declare class AptosStreamClient extends BaseStreamClient {
|
|
114
|
+
private programId;
|
|
115
|
+
private maxGas;
|
|
116
|
+
private client;
|
|
117
|
+
constructor(clusterUrl: string, cluster?: ICluster, maxGas?: string, programId?: string);
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new stream/vesting contract.
|
|
120
|
+
*/
|
|
121
|
+
create(streamData: ICreateStreamData, { senderWallet }: ICreateStreamAptosExt): Promise<ICreateResult>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates multiple stream/vesting contracts.
|
|
124
|
+
*/
|
|
125
|
+
createMultiple(multipleStreamData: ICreateMultipleStreamData, { senderWallet }: ICreateStreamAptosExt): Promise<IMultiTransactionResult>;
|
|
126
|
+
/**
|
|
127
|
+
* Attempts withdrawing from the specified stream.
|
|
128
|
+
*/
|
|
129
|
+
withdraw({ id, amount }: IWithdrawData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
130
|
+
/**
|
|
131
|
+
* Attempts canceling the specified stream.
|
|
132
|
+
*/
|
|
133
|
+
cancel(cancelData: ICancelData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
134
|
+
/**
|
|
135
|
+
* Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract).
|
|
136
|
+
*/
|
|
137
|
+
transfer(transferData: ITransferData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
138
|
+
/**
|
|
139
|
+
* Tops up stream account with specified amount.
|
|
140
|
+
*/
|
|
141
|
+
topup(topupData: ITopUpData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Fetch stream data by its id (address).
|
|
144
|
+
*/
|
|
145
|
+
getOne({ id }: IGetOneData): Promise<Contract>;
|
|
146
|
+
get(): Promise<[string, Contract][]>;
|
|
147
|
+
/**
|
|
148
|
+
* Attempts updating the stream auto withdrawal params and amount per period
|
|
149
|
+
*/
|
|
150
|
+
update(updateData: IUpdateData, { senderWallet, tokenId }: ITransactionAptosExt): Promise<ITransactionResult>;
|
|
151
|
+
getFees({ address }: IGetFeesData): Promise<IFees | null>;
|
|
152
|
+
getDefaultStreamflowFee(): Promise<number>;
|
|
153
|
+
extractErrorCode(err: Error): string | null;
|
|
154
|
+
/**
|
|
155
|
+
* Returns StreamClient protocol program ID.
|
|
156
|
+
*/
|
|
157
|
+
getProgramId(): string;
|
|
158
|
+
getMaxGas(): {
|
|
159
|
+
max_gas_amount: string;
|
|
160
|
+
};
|
|
161
|
+
private generateMultiPayloads;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare function extractAptosErrorCode(errorText: string): string | null;
|
|
165
|
+
/**
|
|
166
|
+
* Aptos has inconsistencies in how it returns addresses.
|
|
167
|
+
* This method normalizes them to be 64+2(0x...) characters long, or leaves it as SPECIAL ADDRESS (0x0 - 0xf inclusive)
|
|
168
|
+
* Per this: https://github.com/aptos-labs/aptos-ts-sdk/blob/main/src/core/accountAddress.ts#L115
|
|
169
|
+
* */
|
|
170
|
+
declare function normalizeAptosAddress(address: string): string;
|
|
171
|
+
|
|
172
|
+
declare const APTOS_PROGRAM_IDS: Record<ICluster, string>;
|
|
173
|
+
declare const APTOS_ERROR_MATCH_REGEX: RegExp;
|
|
174
|
+
declare const APTOS_MODULE_ERROR_MAP: {
|
|
175
|
+
[key: string]: {
|
|
176
|
+
[key: number]: string;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
declare const constants_APTOS_ERROR_MATCH_REGEX: typeof APTOS_ERROR_MATCH_REGEX;
|
|
181
|
+
declare const constants_APTOS_MODULE_ERROR_MAP: typeof APTOS_MODULE_ERROR_MAP;
|
|
182
|
+
declare const constants_APTOS_PROGRAM_IDS: typeof APTOS_PROGRAM_IDS;
|
|
183
|
+
declare namespace constants {
|
|
184
|
+
export { constants_APTOS_ERROR_MATCH_REGEX as APTOS_ERROR_MATCH_REGEX, constants_APTOS_MODULE_ERROR_MAP as APTOS_MODULE_ERROR_MAP, constants_APTOS_PROGRAM_IDS as APTOS_PROGRAM_IDS };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
type index_AptosStreamClient = AptosStreamClient;
|
|
188
|
+
declare const index_AptosStreamClient: typeof AptosStreamClient;
|
|
189
|
+
type index_ConfigResource = ConfigResource;
|
|
190
|
+
type index_Contract = Contract;
|
|
191
|
+
declare const index_Contract: typeof Contract;
|
|
192
|
+
type index_FeeTableResource = FeeTableResource;
|
|
193
|
+
type index_ICreateStreamAptosExt = ICreateStreamAptosExt;
|
|
194
|
+
type index_ITransactionAptosExt = ITransactionAptosExt;
|
|
195
|
+
type index_StreamResource = StreamResource;
|
|
196
|
+
declare const index_constants: typeof constants;
|
|
197
|
+
declare const index_extractAptosErrorCode: typeof extractAptosErrorCode;
|
|
198
|
+
declare const index_normalizeAptosAddress: typeof normalizeAptosAddress;
|
|
199
|
+
declare namespace index {
|
|
200
|
+
export { index_AptosStreamClient as AptosStreamClient, type index_ConfigResource as ConfigResource, index_Contract as Contract, type index_FeeTableResource as FeeTableResource, type index_ICreateStreamAptosExt as ICreateStreamAptosExt, type index_ITransactionAptosExt as ITransactionAptosExt, type index_StreamResource as StreamResource, index_constants as constants, AptosStreamClient as default, index_extractAptosErrorCode as extractAptosErrorCode, index_normalizeAptosAddress as normalizeAptosAddress };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { AptosStreamClient as A, type ConfigResource as C, type FeeTableResource as F, type ICreateStreamAptosExt as I, type StreamResource as S, type ITransactionAptosExt as a, Contract as b, constants as c, extractAptosErrorCode as e, index as i, normalizeAptosAddress as n };
|