@streamflow/stream 6.3.9 → 7.0.0-alpha.2
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/README.md +17 -18
- package/dist/{__tests__ → cjs/__tests__}/aptos/streamClient.spec.js +26 -25
- package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +45 -0
- package/dist/{aptos → cjs/aptos}/StreamClient.js +20 -20
- package/dist/cjs/aptos/constants.js +28 -0
- package/dist/{aptos → cjs/aptos}/index.js +3 -3
- package/dist/{aptos → cjs/aptos}/types.js +23 -22
- package/dist/{aptos → cjs/aptos}/utils.js +2 -2
- package/dist/{common → cjs/common}/GenericStreamClient.js +19 -19
- package/dist/{common → cjs/common}/constants.js +2 -2
- package/dist/{common → cjs/common}/contractUtils.js +10 -10
- package/dist/{common → cjs/common}/utils.js +21 -28
- package/dist/{evm → cjs/evm}/StreamClient.js +33 -33
- package/dist/cjs/evm/constants.js +39 -0
- package/dist/{evm → cjs/evm}/index.js +8 -8
- package/dist/{evm → cjs/evm}/types.js +16 -16
- package/dist/{evm → cjs/evm}/utils.js +2 -2
- package/dist/{solana → cjs/solana}/StreamClient.js +80 -79
- package/dist/cjs/solana/constants.js +60 -0
- package/dist/cjs/solana/index.js +39 -0
- package/dist/{solana → cjs/solana}/instructions.js +33 -28
- package/dist/{solana → cjs/solana}/layout.js +2 -2
- package/dist/{solana → cjs/solana}/types.js +5 -5
- package/dist/{solana → cjs/solana}/utils.js +44 -33
- package/dist/{sui → cjs/sui}/StreamClient.js +26 -26
- package/dist/cjs/sui/constants.js +43 -0
- package/dist/{sui → cjs/sui}/index.js +5 -5
- package/dist/{sui → cjs/sui}/types.js +16 -16
- package/dist/{sui → cjs/sui}/utils.js +3 -3
- package/dist/esm/__tests__/aptos/streamClient.spec.js +106 -0
- package/dist/esm/__tests__/common/GenericStreamClient.spec.js +40 -0
- package/dist/{aptos → esm/aptos}/StreamClient.d.ts +3 -3
- package/dist/esm/aptos/StreamClient.js +226 -0
- package/dist/{aptos → esm/aptos}/constants.d.ts +1 -1
- package/dist/esm/aptos/constants.js +24 -0
- package/dist/{aptos → esm/aptos}/index.d.ts +1 -1
- package/dist/{sui/index.d.ts → esm/aptos/index.js} +1 -1
- package/dist/{aptos → esm/aptos}/types.d.ts +13 -13
- package/dist/esm/aptos/types.js +105 -0
- package/dist/esm/aptos/utils.js +30 -0
- package/dist/esm/aptos/wallet.js +33 -0
- package/dist/{common → esm/common}/BaseStreamClient.d.ts +1 -1
- package/dist/esm/common/BaseStreamClient.js +19 -0
- package/dist/{common → esm/common}/GenericStreamClient.d.ts +2 -2
- package/dist/esm/common/GenericStreamClient.js +101 -0
- package/dist/esm/common/constants.d.ts +3 -0
- package/dist/esm/common/constants.js +3 -0
- package/dist/{common → esm/common}/contractUtils.d.ts +15 -15
- package/dist/esm/common/contractUtils.js +42 -0
- package/dist/{common → esm/common}/types.d.ts +19 -19
- package/dist/esm/common/types.js +106 -0
- package/dist/{common → esm/common}/utils.d.ts +11 -12
- package/dist/esm/common/utils.js +56 -0
- package/dist/{evm → esm/evm}/StreamClient.d.ts +4 -4
- package/dist/esm/evm/StreamClient.js +237 -0
- package/dist/esm/evm/abi.js +1255 -0
- package/dist/{evm → esm/evm}/constants.d.ts +1 -1
- package/dist/esm/evm/constants.js +35 -0
- package/dist/esm/evm/ercAbi.js +222 -0
- package/dist/esm/evm/index.d.ts +5 -0
- package/dist/esm/evm/index.js +5 -0
- package/dist/{evm → esm/evm}/types.d.ts +38 -38
- package/dist/esm/evm/types.js +102 -0
- package/dist/esm/evm/utils.js +8 -0
- package/dist/esm/index.js +9 -0
- package/dist/{solana → esm/solana}/StreamClient.d.ts +4 -4
- package/dist/esm/solana/StreamClient.js +695 -0
- package/dist/{solana → esm/solana}/constants.d.ts +2 -0
- package/dist/esm/solana/constants.js +56 -0
- package/dist/esm/solana/index.d.ts +6 -0
- package/dist/esm/solana/index.js +6 -0
- package/dist/esm/solana/instructionTypes.js +1 -0
- package/dist/{solana → esm/solana}/instructions.d.ts +18 -18
- package/dist/esm/solana/instructions.js +257 -0
- package/dist/{solana → esm/solana}/layout.d.ts +2 -1
- package/dist/esm/solana/layout.js +155 -0
- package/dist/esm/solana/timelockIDL.js +420 -0
- package/dist/{solana → esm/solana}/types.d.ts +38 -37
- package/dist/esm/solana/types.js +101 -0
- package/dist/{solana → esm/solana}/utils.d.ts +4 -1
- package/dist/esm/solana/utils.js +123 -0
- package/dist/{sui → esm/sui}/StreamClient.d.ts +3 -3
- package/dist/esm/sui/StreamClient.js +403 -0
- package/dist/{sui → esm/sui}/constants.d.ts +1 -1
- package/dist/esm/sui/constants.js +39 -0
- package/dist/esm/sui/index.d.ts +4 -0
- package/dist/esm/sui/index.js +4 -0
- package/dist/{sui → esm/sui}/types.d.ts +13 -13
- package/dist/esm/sui/types.js +104 -0
- package/dist/{sui → esm/sui}/utils.d.ts +1 -1
- package/dist/esm/sui/utils.js +23 -0
- package/dist/{sui → esm/sui}/wallet.d.ts +1 -1
- package/dist/esm/sui/wallet.js +38 -0
- package/package.json +37 -35
- package/dist/__tests__/common/GenericStreamClient.spec.js +0 -44
- package/dist/aptos/constants.js +0 -28
- package/dist/common/constants.d.ts +0 -3
- package/dist/evm/constants.js +0 -39
- package/dist/evm/index.d.ts +0 -5
- package/dist/solana/constants.js +0 -59
- package/dist/solana/index.d.ts +0 -7
- package/dist/solana/index.js +0 -43
- package/dist/sui/constants.js +0 -43
- /package/dist/{aptos → cjs/aptos}/wallet.js +0 -0
- /package/dist/{common → cjs/common}/BaseStreamClient.js +0 -0
- /package/dist/{common → cjs/common}/types.js +0 -0
- /package/dist/{evm → cjs/evm}/abi.js +0 -0
- /package/dist/{evm → cjs/evm}/ercAbi.js +0 -0
- /package/dist/{index.js → cjs/index.js} +0 -0
- /package/dist/{solana → cjs/solana}/instructionTypes.js +0 -0
- /package/dist/{solana → cjs/solana}/timelockIDL.js +0 -0
- /package/dist/{sui → cjs/sui}/wallet.js +0 -0
- /package/dist/{__tests__ → esm/__tests__}/aptos/streamClient.spec.d.ts +0 -0
- /package/dist/{__tests__ → esm/__tests__}/common/GenericStreamClient.spec.d.ts +0 -0
- /package/dist/{aptos → esm/aptos}/utils.d.ts +0 -0
- /package/dist/{aptos → esm/aptos}/wallet.d.ts +0 -0
- /package/dist/{evm → esm/evm}/abi.d.ts +0 -0
- /package/dist/{evm → esm/evm}/ercAbi.d.ts +0 -0
- /package/dist/{evm → esm/evm}/utils.d.ts +0 -0
- /package/dist/{index.d.ts → esm/index.d.ts} +0 -0
- /package/dist/{solana → esm/solana}/instructionTypes.d.ts +0 -0
- /package/dist/{solana → esm/solana}/timelockIDL.d.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContractErrorCode, ICluster } from "../common/types";
|
|
1
|
+
import { ContractErrorCode, ICluster } from "../common/types.js";
|
|
2
2
|
export declare const ETHEREUM_PROGRAM_IDS: Record<ICluster, string>;
|
|
3
3
|
export declare const BNB_PROGRAM_IDS: Record<ICluster, string>;
|
|
4
4
|
export declare const POLYGON_PROGRAM_IDS: Record<ICluster, string>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ContractErrorCode, ICluster } from "../common/types.js";
|
|
2
|
+
export const ETHEREUM_PROGRAM_IDS = {
|
|
3
|
+
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
4
|
+
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
5
|
+
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
6
|
+
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
7
|
+
};
|
|
8
|
+
export const BNB_PROGRAM_IDS = {
|
|
9
|
+
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
10
|
+
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
11
|
+
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
12
|
+
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
13
|
+
};
|
|
14
|
+
export const POLYGON_PROGRAM_IDS = {
|
|
15
|
+
[ICluster.Mainnet]: "0x94d4646Bd307Bf91CB1893BC64d976BF9E60D9B2",
|
|
16
|
+
[ICluster.Devnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
17
|
+
[ICluster.Testnet]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
18
|
+
[ICluster.Local]: "0x5Db7a43D20De64E3a3BC765334a477026FD13E7d",
|
|
19
|
+
};
|
|
20
|
+
export const EVM_ERROR_MATCH_REGEX = /execution reverted: ([A-Z_]+)/;
|
|
21
|
+
export const EVM_ERROR_MAP = {
|
|
22
|
+
ECONTRACT_NOT_INIT: ContractErrorCode.ECONTRACT_NOT_INIT,
|
|
23
|
+
EBAD_AMOUNT: ContractErrorCode.EBAD_AMOUNT,
|
|
24
|
+
ENO_PERMISSIONS: ContractErrorCode.ENO_PERMISSIONS,
|
|
25
|
+
EBADINPUT: ContractErrorCode.EBADINPUT,
|
|
26
|
+
ECLOSED: ContractErrorCode.ECLOSED,
|
|
27
|
+
EBAD_INPUT_AMOUNT_PER_PERIOD: ContractErrorCode.EBAD_INPUT_AMOUNT_PER_PERIOD,
|
|
28
|
+
EBAD_INPUT_PAUSABLE: ContractErrorCode.EBAD_INPUT_PAUSABLE,
|
|
29
|
+
EBAD_INPUT_UPDATE_RATE: ContractErrorCode.EBAD_INPUT_UPDATE_RATE,
|
|
30
|
+
EBAD_INPUT_CLIFF_AMOUNT: ContractErrorCode.EBAD_INPUT_CLIFF_AMOUNT,
|
|
31
|
+
EBAD_INPUT_PERIOD: ContractErrorCode.EBAD_INPUT_PERIOD,
|
|
32
|
+
EBAD_INPUT_START: ContractErrorCode.EBAD_INPUT_START,
|
|
33
|
+
EBAD_INSUFFICIENT_TOKEN_ALLOWANCE: ContractErrorCode.EBAD_INSUFFICIENT_TOKEN_ALLOWANCE,
|
|
34
|
+
EBAD_INSUFFICIENT_WITHDRAWAL_FEES: ContractErrorCode.EBAD_INSUFFICIENT_WITHDRAWAL_FEES,
|
|
35
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
constant: true,
|
|
4
|
+
inputs: [],
|
|
5
|
+
name: "name",
|
|
6
|
+
outputs: [
|
|
7
|
+
{
|
|
8
|
+
name: "",
|
|
9
|
+
type: "string",
|
|
10
|
+
},
|
|
11
|
+
],
|
|
12
|
+
payable: false,
|
|
13
|
+
stateMutability: "view",
|
|
14
|
+
type: "function",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
constant: false,
|
|
18
|
+
inputs: [
|
|
19
|
+
{
|
|
20
|
+
name: "_spender",
|
|
21
|
+
type: "address",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "_value",
|
|
25
|
+
type: "uint256",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
name: "approve",
|
|
29
|
+
outputs: [
|
|
30
|
+
{
|
|
31
|
+
name: "",
|
|
32
|
+
type: "bool",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
payable: false,
|
|
36
|
+
stateMutability: "nonpayable",
|
|
37
|
+
type: "function",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
constant: true,
|
|
41
|
+
inputs: [],
|
|
42
|
+
name: "totalSupply",
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
name: "",
|
|
46
|
+
type: "uint256",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
payable: false,
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
type: "function",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
constant: false,
|
|
55
|
+
inputs: [
|
|
56
|
+
{
|
|
57
|
+
name: "_from",
|
|
58
|
+
type: "address",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "_to",
|
|
62
|
+
type: "address",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "_value",
|
|
66
|
+
type: "uint256",
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
name: "transferFrom",
|
|
70
|
+
outputs: [
|
|
71
|
+
{
|
|
72
|
+
name: "",
|
|
73
|
+
type: "bool",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
payable: false,
|
|
77
|
+
stateMutability: "nonpayable",
|
|
78
|
+
type: "function",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
constant: true,
|
|
82
|
+
inputs: [],
|
|
83
|
+
name: "decimals",
|
|
84
|
+
outputs: [
|
|
85
|
+
{
|
|
86
|
+
name: "",
|
|
87
|
+
type: "uint8",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
payable: false,
|
|
91
|
+
stateMutability: "view",
|
|
92
|
+
type: "function",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
constant: true,
|
|
96
|
+
inputs: [
|
|
97
|
+
{
|
|
98
|
+
name: "_owner",
|
|
99
|
+
type: "address",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
name: "balanceOf",
|
|
103
|
+
outputs: [
|
|
104
|
+
{
|
|
105
|
+
name: "balance",
|
|
106
|
+
type: "uint256",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
payable: false,
|
|
110
|
+
stateMutability: "view",
|
|
111
|
+
type: "function",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
constant: true,
|
|
115
|
+
inputs: [],
|
|
116
|
+
name: "symbol",
|
|
117
|
+
outputs: [
|
|
118
|
+
{
|
|
119
|
+
name: "",
|
|
120
|
+
type: "string",
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
payable: false,
|
|
124
|
+
stateMutability: "view",
|
|
125
|
+
type: "function",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
constant: false,
|
|
129
|
+
inputs: [
|
|
130
|
+
{
|
|
131
|
+
name: "_to",
|
|
132
|
+
type: "address",
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "_value",
|
|
136
|
+
type: "uint256",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
name: "transfer",
|
|
140
|
+
outputs: [
|
|
141
|
+
{
|
|
142
|
+
name: "",
|
|
143
|
+
type: "bool",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
payable: false,
|
|
147
|
+
stateMutability: "nonpayable",
|
|
148
|
+
type: "function",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
constant: true,
|
|
152
|
+
inputs: [
|
|
153
|
+
{
|
|
154
|
+
name: "_owner",
|
|
155
|
+
type: "address",
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "_spender",
|
|
159
|
+
type: "address",
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
name: "allowance",
|
|
163
|
+
outputs: [
|
|
164
|
+
{
|
|
165
|
+
name: "",
|
|
166
|
+
type: "uint256",
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
payable: false,
|
|
170
|
+
stateMutability: "view",
|
|
171
|
+
type: "function",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
payable: true,
|
|
175
|
+
stateMutability: "payable",
|
|
176
|
+
type: "fallback",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
anonymous: false,
|
|
180
|
+
inputs: [
|
|
181
|
+
{
|
|
182
|
+
indexed: true,
|
|
183
|
+
name: "owner",
|
|
184
|
+
type: "address",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
indexed: true,
|
|
188
|
+
name: "spender",
|
|
189
|
+
type: "address",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
indexed: false,
|
|
193
|
+
name: "value",
|
|
194
|
+
type: "uint256",
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
name: "Approval",
|
|
198
|
+
type: "event",
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
anonymous: false,
|
|
202
|
+
inputs: [
|
|
203
|
+
{
|
|
204
|
+
indexed: true,
|
|
205
|
+
name: "from",
|
|
206
|
+
type: "address",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
indexed: true,
|
|
210
|
+
name: "to",
|
|
211
|
+
type: "address",
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
indexed: false,
|
|
215
|
+
name: "value",
|
|
216
|
+
type: "uint256",
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
name: "Transfer",
|
|
220
|
+
type: "event",
|
|
221
|
+
},
|
|
222
|
+
];
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BigNumber } from "ethers";
|
|
3
|
-
import { Stream, StreamType } from "../common/types";
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { BigNumber as BigNumberEvm } from "ethers";
|
|
3
|
+
import { Stream, StreamType } from "../common/types.js";
|
|
4
4
|
export interface StreamAbiResult {
|
|
5
|
-
amount:
|
|
6
|
-
amount_per_period:
|
|
7
|
-
canceled_at:
|
|
8
|
-
cliff_amount:
|
|
5
|
+
amount: BigNumberEvm;
|
|
6
|
+
amount_per_period: BigNumberEvm;
|
|
7
|
+
canceled_at: BigNumberEvm;
|
|
8
|
+
cliff_amount: BigNumberEvm;
|
|
9
9
|
closed: boolean;
|
|
10
|
-
created:
|
|
11
|
-
current_pause_start:
|
|
12
|
-
end:
|
|
10
|
+
created: BigNumberEvm;
|
|
11
|
+
current_pause_start: BigNumberEvm;
|
|
12
|
+
end: BigNumberEvm;
|
|
13
13
|
fees: {
|
|
14
|
-
streamflow_fee_percentage:
|
|
15
|
-
streamflow_fee:
|
|
16
|
-
streamflow_fee_withdrawn:
|
|
17
|
-
partner_fee_percentage:
|
|
18
|
-
partner_fee:
|
|
19
|
-
partner_fee_withdrawn:
|
|
20
|
-
tx_fee:
|
|
14
|
+
streamflow_fee_percentage: BigNumberEvm;
|
|
15
|
+
streamflow_fee: BigNumberEvm;
|
|
16
|
+
streamflow_fee_withdrawn: BigNumberEvm;
|
|
17
|
+
partner_fee_percentage: BigNumberEvm;
|
|
18
|
+
partner_fee: BigNumberEvm;
|
|
19
|
+
partner_fee_withdrawn: BigNumberEvm;
|
|
20
|
+
tx_fee: BigNumberEvm;
|
|
21
21
|
};
|
|
22
|
-
funds_unlocked_at_last_rate_change:
|
|
23
|
-
last_rate_change_time:
|
|
24
|
-
last_withdrawn_at:
|
|
22
|
+
funds_unlocked_at_last_rate_change: BigNumberEvm;
|
|
23
|
+
last_rate_change_time: BigNumberEvm;
|
|
24
|
+
last_withdrawn_at: BigNumberEvm;
|
|
25
25
|
meta: {
|
|
26
26
|
automatic_withdrawal: boolean;
|
|
27
27
|
can_topup: boolean;
|
|
@@ -32,27 +32,27 @@ export interface StreamAbiResult {
|
|
|
32
32
|
pausable: boolean;
|
|
33
33
|
transferable_by_recipient: boolean;
|
|
34
34
|
transferable_by_sender: boolean;
|
|
35
|
-
withdrawal_frequency:
|
|
35
|
+
withdrawal_frequency: BigNumberEvm;
|
|
36
36
|
};
|
|
37
|
-
pause_cumulative:
|
|
38
|
-
period:
|
|
37
|
+
pause_cumulative: BigNumberEvm;
|
|
38
|
+
period: BigNumberEvm;
|
|
39
39
|
recipient: string;
|
|
40
40
|
sender: string;
|
|
41
41
|
partner: string;
|
|
42
|
-
start:
|
|
42
|
+
start: BigNumberEvm;
|
|
43
43
|
token: string;
|
|
44
|
-
withdrawn:
|
|
44
|
+
withdrawn: BigNumberEvm;
|
|
45
45
|
}
|
|
46
46
|
export interface FeesAbiResult {
|
|
47
47
|
exists: boolean;
|
|
48
|
-
streamflow_fee:
|
|
49
|
-
partner_fee:
|
|
48
|
+
streamflow_fee: BigNumberEvm;
|
|
49
|
+
partner_fee: BigNumberEvm;
|
|
50
50
|
}
|
|
51
51
|
export declare class EvmContract implements Stream {
|
|
52
52
|
magic: number;
|
|
53
53
|
version: number;
|
|
54
54
|
createdAt: number;
|
|
55
|
-
withdrawnAmount:
|
|
55
|
+
withdrawnAmount: BigNumber;
|
|
56
56
|
canceledAt: number;
|
|
57
57
|
end: number;
|
|
58
58
|
lastWithdrawnAt: number;
|
|
@@ -64,20 +64,20 @@ export declare class EvmContract implements Stream {
|
|
|
64
64
|
escrowTokens: string;
|
|
65
65
|
streamflowTreasury: string;
|
|
66
66
|
streamflowTreasuryTokens: string;
|
|
67
|
-
streamflowFeeTotal:
|
|
68
|
-
streamflowFeeWithdrawn:
|
|
67
|
+
streamflowFeeTotal: BigNumber;
|
|
68
|
+
streamflowFeeWithdrawn: BigNumber;
|
|
69
69
|
streamflowFeePercent: number;
|
|
70
|
-
partnerFeeTotal:
|
|
71
|
-
partnerFeeWithdrawn:
|
|
70
|
+
partnerFeeTotal: BigNumber;
|
|
71
|
+
partnerFeeWithdrawn: BigNumber;
|
|
72
72
|
partnerFeePercent: number;
|
|
73
73
|
partner: string;
|
|
74
74
|
partnerTokens: string;
|
|
75
75
|
start: number;
|
|
76
|
-
depositedAmount:
|
|
76
|
+
depositedAmount: BigNumber;
|
|
77
77
|
period: number;
|
|
78
|
-
amountPerPeriod:
|
|
78
|
+
amountPerPeriod: BigNumber;
|
|
79
79
|
cliff: number;
|
|
80
|
-
cliffAmount:
|
|
80
|
+
cliffAmount: BigNumber;
|
|
81
81
|
cancelableBySender: boolean;
|
|
82
82
|
cancelableByRecipient: boolean;
|
|
83
83
|
automaticWithdrawal: boolean;
|
|
@@ -88,11 +88,11 @@ export declare class EvmContract implements Stream {
|
|
|
88
88
|
withdrawalFrequency: number;
|
|
89
89
|
closed: boolean;
|
|
90
90
|
currentPauseStart: number;
|
|
91
|
-
pauseCumulative:
|
|
91
|
+
pauseCumulative: BigNumber;
|
|
92
92
|
lastRateChangeTime: number;
|
|
93
|
-
fundsUnlockedAtLastRateChange:
|
|
93
|
+
fundsUnlockedAtLastRateChange: BigNumber;
|
|
94
94
|
type: StreamType;
|
|
95
95
|
constructor(stream: StreamAbiResult);
|
|
96
|
-
unlocked(currentTimestamp: number):
|
|
96
|
+
unlocked(currentTimestamp: number): BigNumber;
|
|
97
97
|
remaining(decimals: number): number;
|
|
98
98
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { buildStreamType, calculateUnlockedAmount } from "../common/contractUtils.js";
|
|
3
|
+
import { getNumberFromBigNumber } from "../common/utils.js";
|
|
4
|
+
export class EvmContract {
|
|
5
|
+
magic;
|
|
6
|
+
version;
|
|
7
|
+
createdAt;
|
|
8
|
+
withdrawnAmount;
|
|
9
|
+
canceledAt;
|
|
10
|
+
end;
|
|
11
|
+
lastWithdrawnAt;
|
|
12
|
+
sender;
|
|
13
|
+
senderTokens;
|
|
14
|
+
recipient;
|
|
15
|
+
recipientTokens;
|
|
16
|
+
mint;
|
|
17
|
+
escrowTokens;
|
|
18
|
+
streamflowTreasury;
|
|
19
|
+
streamflowTreasuryTokens;
|
|
20
|
+
streamflowFeeTotal;
|
|
21
|
+
streamflowFeeWithdrawn;
|
|
22
|
+
streamflowFeePercent;
|
|
23
|
+
partnerFeeTotal;
|
|
24
|
+
partnerFeeWithdrawn;
|
|
25
|
+
partnerFeePercent;
|
|
26
|
+
partner;
|
|
27
|
+
partnerTokens;
|
|
28
|
+
start;
|
|
29
|
+
depositedAmount;
|
|
30
|
+
period;
|
|
31
|
+
amountPerPeriod;
|
|
32
|
+
cliff;
|
|
33
|
+
cliffAmount;
|
|
34
|
+
cancelableBySender;
|
|
35
|
+
cancelableByRecipient;
|
|
36
|
+
automaticWithdrawal;
|
|
37
|
+
transferableBySender;
|
|
38
|
+
transferableByRecipient;
|
|
39
|
+
canTopup;
|
|
40
|
+
name;
|
|
41
|
+
withdrawalFrequency;
|
|
42
|
+
closed;
|
|
43
|
+
currentPauseStart;
|
|
44
|
+
pauseCumulative;
|
|
45
|
+
lastRateChangeTime;
|
|
46
|
+
fundsUnlockedAtLastRateChange;
|
|
47
|
+
type;
|
|
48
|
+
constructor(stream) {
|
|
49
|
+
this.magic = 0;
|
|
50
|
+
this.version = 0;
|
|
51
|
+
this.createdAt = stream.created.toNumber();
|
|
52
|
+
this.withdrawnAmount = BigNumber(stream.withdrawn.toString());
|
|
53
|
+
this.canceledAt = stream.canceled_at.toNumber();
|
|
54
|
+
this.end = stream.end.toNumber();
|
|
55
|
+
this.lastWithdrawnAt = stream.last_withdrawn_at.toNumber();
|
|
56
|
+
this.sender = stream.sender;
|
|
57
|
+
this.senderTokens = stream.sender;
|
|
58
|
+
this.recipient = stream.recipient;
|
|
59
|
+
this.recipientTokens = stream.recipient;
|
|
60
|
+
this.mint = stream.token.toLowerCase();
|
|
61
|
+
this.escrowTokens = "";
|
|
62
|
+
this.streamflowTreasury = "";
|
|
63
|
+
this.streamflowTreasuryTokens = "";
|
|
64
|
+
this.streamflowFeeTotal = BigNumber(stream.fees.streamflow_fee.toString());
|
|
65
|
+
this.streamflowFeeWithdrawn = BigNumber(stream.fees.streamflow_fee_withdrawn.toString());
|
|
66
|
+
this.streamflowFeePercent = stream.fees.streamflow_fee_percentage.toNumber() / 10000;
|
|
67
|
+
this.partnerFeeTotal = BigNumber(0);
|
|
68
|
+
this.partnerFeeWithdrawn = BigNumber(0);
|
|
69
|
+
this.partnerFeePercent = 0;
|
|
70
|
+
this.partner = "";
|
|
71
|
+
this.partnerTokens = "";
|
|
72
|
+
this.start = stream.start.toNumber();
|
|
73
|
+
this.depositedAmount = BigNumber(stream.amount.toString());
|
|
74
|
+
this.period = stream.period.toNumber();
|
|
75
|
+
this.amountPerPeriod = BigNumber(stream.amount_per_period.toString());
|
|
76
|
+
this.cliff = stream.start.toNumber();
|
|
77
|
+
this.cliffAmount = BigNumber(stream.cliff_amount.toString());
|
|
78
|
+
this.cancelableBySender = stream.meta.cancelable_by_sender;
|
|
79
|
+
this.cancelableByRecipient = stream.meta.cancelable_by_recipient;
|
|
80
|
+
this.automaticWithdrawal = stream.meta.automatic_withdrawal;
|
|
81
|
+
this.transferableBySender = stream.meta.transferable_by_sender;
|
|
82
|
+
this.transferableByRecipient = stream.meta.transferable_by_recipient;
|
|
83
|
+
this.canTopup = stream.meta.can_topup;
|
|
84
|
+
this.name = stream.meta.contract_name;
|
|
85
|
+
this.withdrawalFrequency = stream.meta.withdrawal_frequency.toNumber();
|
|
86
|
+
this.closed = stream.closed;
|
|
87
|
+
this.currentPauseStart = stream.current_pause_start.toNumber();
|
|
88
|
+
this.pauseCumulative = BigNumber(stream.pause_cumulative.toString());
|
|
89
|
+
this.lastRateChangeTime = stream.last_rate_change_time.toNumber();
|
|
90
|
+
this.fundsUnlockedAtLastRateChange = BigNumber(stream.funds_unlocked_at_last_rate_change.toString());
|
|
91
|
+
this.type = buildStreamType(this);
|
|
92
|
+
}
|
|
93
|
+
unlocked(currentTimestamp) {
|
|
94
|
+
return calculateUnlockedAmount({
|
|
95
|
+
...this,
|
|
96
|
+
currentTimestamp,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
remaining(decimals) {
|
|
100
|
+
return getNumberFromBigNumber(this.depositedAmount.minus(this.withdrawnAmount), decimals);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as StreamflowAptos from "./aptos";
|
|
2
|
+
export * as StreamflowEVM from "./evm";
|
|
3
|
+
export * as StreamflowSolana from "./solana";
|
|
4
|
+
export * as StreamflowSui from "./sui";
|
|
5
|
+
export * from "./common/types";
|
|
6
|
+
export * from "./common/utils";
|
|
7
|
+
export * from "./common/constants";
|
|
8
|
+
export * from "./common/contractUtils";
|
|
9
|
+
export { default as GenericStreamClient } from "./common/GenericStreamClient";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import PQueue from "p-queue";
|
|
2
2
|
import { Connection, Keypair, PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from "@solana/web3.js";
|
|
3
|
-
import { ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types";
|
|
4
|
-
import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream } from "../common/types";
|
|
5
|
-
import { BaseStreamClient } from "../common/BaseStreamClient";
|
|
6
|
-
export
|
|
3
|
+
import { ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt } from "./types.js";
|
|
4
|
+
import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream } from "../common/types.js";
|
|
5
|
+
import { BaseStreamClient } from "../common/BaseStreamClient.js";
|
|
6
|
+
export declare class SolanaStreamClient extends BaseStreamClient {
|
|
7
7
|
private connection;
|
|
8
8
|
private programId;
|
|
9
9
|
private commitment;
|