@streamflow/stream 6.5.0 → 7.0.0-alpha.10

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 (137) hide show
  1. package/README.md +17 -22
  2. package/dist/cjs/__tests__/aptos/streamClient.spec.js +111 -0
  3. package/dist/cjs/__tests__/common/GenericStreamClient.spec.js +45 -0
  4. package/dist/cjs/aptos/StreamClient.js +226 -0
  5. package/dist/cjs/aptos/constants.js +27 -0
  6. package/dist/{aptos → cjs/aptos}/index.js +6 -6
  7. package/dist/cjs/aptos/types.js +69 -0
  8. package/dist/{aptos → cjs/aptos}/utils.js +4 -4
  9. package/dist/cjs/aptos/wallet.js +34 -0
  10. package/dist/cjs/common/BaseStreamClient.js +23 -0
  11. package/dist/cjs/common/GenericStreamClient.js +102 -0
  12. package/dist/{common → cjs/common}/constants.js +2 -2
  13. package/dist/{common → cjs/common}/contractUtils.js +19 -20
  14. package/dist/cjs/common/utils.js +66 -0
  15. package/dist/cjs/evm/StreamClient.js +238 -0
  16. package/dist/cjs/evm/constants.js +38 -0
  17. package/dist/{evm → cjs/evm}/index.js +8 -8
  18. package/dist/{evm → cjs/evm}/types.js +26 -35
  19. package/dist/{evm → cjs/evm}/utils.js +2 -2
  20. package/dist/{index.js → cjs/index.js} +10 -10
  21. package/dist/cjs/solana/StreamClient.js +737 -0
  22. package/dist/{solana → cjs/solana}/constants.js +33 -33
  23. package/dist/cjs/solana/index.js +39 -0
  24. package/dist/{solana → cjs/solana}/instructions.js +83 -83
  25. package/dist/{solana → cjs/solana}/layout.js +8 -9
  26. package/dist/{solana → cjs/solana}/types.js +16 -26
  27. package/dist/cjs/solana/utils.js +134 -0
  28. package/dist/cjs/sui/StreamClient.js +402 -0
  29. package/dist/cjs/sui/constants.js +42 -0
  30. package/dist/{sui → cjs/sui}/index.js +5 -5
  31. package/dist/cjs/sui/types.js +68 -0
  32. package/dist/{sui → cjs/sui}/utils.js +7 -7
  33. package/dist/cjs/sui/wallet.js +40 -0
  34. package/dist/esm/__tests__/aptos/streamClient.spec.js +106 -0
  35. package/dist/esm/__tests__/common/GenericStreamClient.spec.js +40 -0
  36. package/dist/{aptos → esm/aptos}/StreamClient.d.ts +3 -3
  37. package/dist/esm/aptos/StreamClient.js +226 -0
  38. package/dist/{aptos → esm/aptos}/constants.d.ts +1 -1
  39. package/dist/esm/aptos/constants.js +24 -0
  40. package/dist/esm/aptos/index.d.ts +4 -0
  41. package/dist/esm/aptos/index.js +4 -0
  42. package/dist/{aptos → esm/aptos}/types.d.ts +13 -13
  43. package/dist/esm/aptos/types.js +105 -0
  44. package/dist/esm/aptos/utils.js +30 -0
  45. package/dist/esm/aptos/wallet.js +33 -0
  46. package/dist/{common → esm/common}/BaseStreamClient.d.ts +1 -1
  47. package/dist/esm/common/BaseStreamClient.js +19 -0
  48. package/dist/{common → esm/common}/GenericStreamClient.d.ts +6 -6
  49. package/dist/esm/common/GenericStreamClient.js +101 -0
  50. package/dist/esm/common/constants.d.ts +3 -0
  51. package/dist/esm/common/constants.js +3 -0
  52. package/dist/{common → esm/common}/contractUtils.d.ts +15 -15
  53. package/dist/esm/common/contractUtils.js +42 -0
  54. package/dist/{common → esm/common}/types.d.ts +19 -19
  55. package/dist/esm/common/types.js +106 -0
  56. package/dist/{common → esm/common}/utils.d.ts +11 -12
  57. package/dist/esm/common/utils.js +56 -0
  58. package/dist/{evm → esm/evm}/StreamClient.d.ts +4 -4
  59. package/dist/esm/evm/StreamClient.js +237 -0
  60. package/dist/esm/evm/abi.js +1255 -0
  61. package/dist/{evm → esm/evm}/constants.d.ts +1 -1
  62. package/dist/esm/evm/constants.js +35 -0
  63. package/dist/esm/evm/ercAbi.js +222 -0
  64. package/dist/esm/evm/index.d.ts +5 -0
  65. package/dist/esm/evm/index.js +5 -0
  66. package/dist/{evm → esm/evm}/types.d.ts +38 -38
  67. package/dist/esm/evm/types.js +102 -0
  68. package/dist/esm/evm/utils.js +8 -0
  69. package/dist/esm/index.d.ts +9 -0
  70. package/dist/esm/index.js +9 -0
  71. package/dist/{solana → esm/solana}/StreamClient.d.ts +4 -4
  72. package/dist/esm/solana/StreamClient.js +711 -0
  73. package/dist/{solana → esm/solana}/constants.d.ts +3 -1
  74. package/dist/esm/solana/constants.js +62 -0
  75. package/dist/esm/solana/index.d.ts +6 -0
  76. package/dist/esm/solana/index.js +6 -0
  77. package/dist/esm/solana/instructionTypes.js +1 -0
  78. package/dist/{solana → esm/solana}/instructions.d.ts +18 -18
  79. package/dist/esm/solana/instructions.js +257 -0
  80. package/dist/{solana → esm/solana}/layout.d.ts +2 -1
  81. package/dist/esm/solana/layout.js +155 -0
  82. package/dist/esm/solana/timelockIDL.js +420 -0
  83. package/dist/{solana → esm/solana}/types.d.ts +38 -37
  84. package/dist/esm/solana/types.js +101 -0
  85. package/dist/{solana → esm/solana}/utils.d.ts +4 -1
  86. package/dist/esm/solana/utils.js +123 -0
  87. package/dist/{sui → esm/sui}/StreamClient.d.ts +3 -3
  88. package/dist/esm/sui/StreamClient.js +403 -0
  89. package/dist/{sui → esm/sui}/constants.d.ts +1 -1
  90. package/dist/esm/sui/constants.js +39 -0
  91. package/dist/esm/sui/index.d.ts +4 -0
  92. package/dist/esm/sui/index.js +4 -0
  93. package/dist/{sui → esm/sui}/types.d.ts +13 -13
  94. package/dist/esm/sui/types.js +104 -0
  95. package/dist/{sui → esm/sui}/utils.d.ts +1 -1
  96. package/dist/esm/sui/utils.js +23 -0
  97. package/dist/{sui → esm/sui}/wallet.d.ts +1 -1
  98. package/dist/esm/sui/wallet.js +38 -0
  99. package/package.json +37 -35
  100. package/dist/__tests__/aptos/streamClient.spec.js +0 -161
  101. package/dist/__tests__/common/GenericStreamClient.spec.js +0 -44
  102. package/dist/aptos/StreamClient.js +0 -431
  103. package/dist/aptos/constants.js +0 -28
  104. package/dist/aptos/index.d.ts +0 -4
  105. package/dist/aptos/types.js +0 -77
  106. package/dist/aptos/wallet.js +0 -89
  107. package/dist/common/BaseStreamClient.js +0 -71
  108. package/dist/common/GenericStreamClient.js +0 -128
  109. package/dist/common/constants.d.ts +0 -3
  110. package/dist/common/utils.js +0 -118
  111. package/dist/evm/StreamClient.js +0 -496
  112. package/dist/evm/constants.js +0 -39
  113. package/dist/evm/index.d.ts +0 -5
  114. package/dist/index.d.ts +0 -9
  115. package/dist/solana/StreamClient.js +0 -1253
  116. package/dist/solana/index.d.ts +0 -7
  117. package/dist/solana/index.js +0 -43
  118. package/dist/solana/utils.js +0 -211
  119. package/dist/sui/StreamClient.js +0 -648
  120. package/dist/sui/constants.js +0 -43
  121. package/dist/sui/index.d.ts +0 -4
  122. package/dist/sui/types.js +0 -102
  123. package/dist/sui/wallet.js +0 -90
  124. /package/dist/{common → cjs/common}/types.js +0 -0
  125. /package/dist/{evm → cjs/evm}/abi.js +0 -0
  126. /package/dist/{evm → cjs/evm}/ercAbi.js +0 -0
  127. /package/dist/{solana → cjs/solana}/instructionTypes.js +0 -0
  128. /package/dist/{solana → cjs/solana}/timelockIDL.js +0 -0
  129. /package/dist/{__tests__ → esm/__tests__}/aptos/streamClient.spec.d.ts +0 -0
  130. /package/dist/{__tests__ → esm/__tests__}/common/GenericStreamClient.spec.d.ts +0 -0
  131. /package/dist/{aptos → esm/aptos}/utils.d.ts +0 -0
  132. /package/dist/{aptos → esm/aptos}/wallet.d.ts +0 -0
  133. /package/dist/{evm → esm/evm}/abi.d.ts +0 -0
  134. /package/dist/{evm → esm/evm}/ercAbi.d.ts +0 -0
  135. /package/dist/{evm → esm/evm}/utils.d.ts +0 -0
  136. /package/dist/{solana → esm/solana}/instructionTypes.d.ts +0 -0
  137. /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
+ ];
@@ -0,0 +1,5 @@
1
+ export { default, default as EvmStreamClient } from "./StreamClient.js";
2
+ export * from "./utils.js";
3
+ export * from "./types.js";
4
+ export * as constants from "./constants.js";
5
+ export { default as ercAbi } from "./ercAbi.js";
@@ -0,0 +1,5 @@
1
+ export { default, default as EvmStreamClient } from "./StreamClient.js";
2
+ export * from "./utils.js";
3
+ export * from "./types.js";
4
+ export * as constants from "./constants.js";
5
+ export { default as ercAbi } from "./ercAbi.js";
@@ -1,27 +1,27 @@
1
- import BN from "bn.js";
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: BigNumber;
6
- amount_per_period: BigNumber;
7
- canceled_at: BigNumber;
8
- cliff_amount: BigNumber;
5
+ amount: BigNumberEvm;
6
+ amount_per_period: BigNumberEvm;
7
+ canceled_at: BigNumberEvm;
8
+ cliff_amount: BigNumberEvm;
9
9
  closed: boolean;
10
- created: BigNumber;
11
- current_pause_start: BigNumber;
12
- end: BigNumber;
10
+ created: BigNumberEvm;
11
+ current_pause_start: BigNumberEvm;
12
+ end: BigNumberEvm;
13
13
  fees: {
14
- streamflow_fee_percentage: BigNumber;
15
- streamflow_fee: BigNumber;
16
- streamflow_fee_withdrawn: BigNumber;
17
- partner_fee_percentage: BigNumber;
18
- partner_fee: BigNumber;
19
- partner_fee_withdrawn: BigNumber;
20
- tx_fee: BigNumber;
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: BigNumber;
23
- last_rate_change_time: BigNumber;
24
- last_withdrawn_at: BigNumber;
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: BigNumber;
35
+ withdrawal_frequency: BigNumberEvm;
36
36
  };
37
- pause_cumulative: BigNumber;
38
- period: BigNumber;
37
+ pause_cumulative: BigNumberEvm;
38
+ period: BigNumberEvm;
39
39
  recipient: string;
40
40
  sender: string;
41
41
  partner: string;
42
- start: BigNumber;
42
+ start: BigNumberEvm;
43
43
  token: string;
44
- withdrawn: BigNumber;
44
+ withdrawn: BigNumberEvm;
45
45
  }
46
46
  export interface FeesAbiResult {
47
47
  exists: boolean;
48
- streamflow_fee: BigNumber;
49
- partner_fee: BigNumber;
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: BN;
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: BN;
68
- streamflowFeeWithdrawn: BN;
67
+ streamflowFeeTotal: BigNumber;
68
+ streamflowFeeWithdrawn: BigNumber;
69
69
  streamflowFeePercent: number;
70
- partnerFeeTotal: BN;
71
- partnerFeeWithdrawn: BN;
70
+ partnerFeeTotal: BigNumber;
71
+ partnerFeeWithdrawn: BigNumber;
72
72
  partnerFeePercent: number;
73
73
  partner: string;
74
74
  partnerTokens: string;
75
75
  start: number;
76
- depositedAmount: BN;
76
+ depositedAmount: BigNumber;
77
77
  period: number;
78
- amountPerPeriod: BN;
78
+ amountPerPeriod: BigNumber;
79
79
  cliff: number;
80
- cliffAmount: BN;
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: BN;
91
+ pauseCumulative: BigNumber;
92
92
  lastRateChangeTime: number;
93
- fundsUnlockedAtLastRateChange: BN;
93
+ fundsUnlockedAtLastRateChange: BigNumber;
94
94
  type: StreamType;
95
95
  constructor(stream: StreamAbiResult);
96
- unlocked(currentTimestamp: number): BN;
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,8 @@
1
+ import { EVM_ERROR_MATCH_REGEX } from "./constants.js";
2
+ export function extractEvmErrorCode(errorText) {
3
+ const match = EVM_ERROR_MATCH_REGEX.exec(errorText);
4
+ if (!match) {
5
+ return null;
6
+ }
7
+ return match[1];
8
+ }
@@ -0,0 +1,9 @@
1
+ export * as StreamflowAptos from "./aptos/index.js";
2
+ export * as StreamflowEVM from "./evm/index.js";
3
+ export * as StreamflowSolana from "./solana/index.js";
4
+ export * as StreamflowSui from "./sui/index.js";
5
+ export * from "./common/types.js";
6
+ export * from "./common/utils.js";
7
+ export * from "./common/constants.js";
8
+ export * from "./common/contractUtils.js";
9
+ export { default as GenericStreamClient } from "./common/GenericStreamClient.js";
@@ -0,0 +1,9 @@
1
+ export * as StreamflowAptos from "./aptos/index.js";
2
+ export * as StreamflowEVM from "./evm/index.js";
3
+ export * as StreamflowSolana from "./solana/index.js";
4
+ export * as StreamflowSui from "./sui/index.js";
5
+ export * from "./common/types.js";
6
+ export * from "./common/utils.js";
7
+ export * from "./common/constants.js";
8
+ export * from "./common/contractUtils.js";
9
+ export { default as GenericStreamClient } from "./common/GenericStreamClient.js";
@@ -1,10 +1,10 @@
1
1
  import PQueue from "p-queue";
2
2
  import { Connection, Keypair, PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from "@solana/web3.js";
3
3
  import { IProgramAccount } from "@streamflow/common/solana";
4
- import { ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt, ISearchStreams } from "./types";
5
- import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream } from "../common/types";
6
- import { BaseStreamClient } from "../common/BaseStreamClient";
7
- export default class SolanaStreamClient extends BaseStreamClient {
4
+ import { ICreateStreamSolanaExt, IInteractStreamSolanaExt, ITopUpStreamSolanaExt, ISearchStreams } from "./types.js";
5
+ import { ICancelData, ICluster, ICreateMultipleStreamData, ICreateResult, ICreateStreamData, IGetAllData, IGetFeesData, IGetOneData, IFees, IMultiTransactionResult, ITopUpData, ITransactionResult, ITransferData, IUpdateData, IWithdrawData, Stream } from "../common/types.js";
6
+ import { BaseStreamClient } from "../common/BaseStreamClient.js";
7
+ export declare class SolanaStreamClient extends BaseStreamClient {
8
8
  private connection;
9
9
  private programId;
10
10
  private commitment;