@oceanprotocol/lib 1.0.0-next.4 → 1.0.0-next.42

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 (63) hide show
  1. package/CHANGELOG.md +381 -1
  2. package/README.md +11 -31
  3. package/dist/lib.js +1 -1
  4. package/dist/lib.js.map +1 -1
  5. package/dist/lib.modern.js +1 -1
  6. package/dist/lib.modern.js.map +1 -1
  7. package/dist/lib.module.js +1 -1
  8. package/dist/lib.module.js.map +1 -1
  9. package/dist/lib.umd.js +1 -1
  10. package/dist/lib.umd.js.map +1 -1
  11. package/dist/src/@types/Asset.d.ts +83 -0
  12. package/dist/src/@types/Compute.d.ts +18 -1
  13. package/dist/src/@types/DDO/DDO.d.ts +43 -0
  14. package/dist/src/@types/DDO/Event.d.ts +20 -0
  15. package/dist/src/@types/DDO/Metadata.d.ts +92 -0
  16. package/dist/src/@types/DDO/Service.d.ts +72 -6
  17. package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
  18. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  19. package/dist/src/{interfaces/Erc20Interface.d.ts → @types/Erc20.d.ts} +6 -1
  20. package/dist/src/@types/Erc721.d.ts +12 -0
  21. package/dist/src/@types/FileMetadata.d.ts +30 -0
  22. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +8 -2
  23. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +15 -6
  24. package/dist/src/@types/Provider.d.ts +12 -2
  25. package/dist/src/@types/Router.d.ts +59 -0
  26. package/dist/src/@types/index.d.ts +6 -0
  27. package/dist/src/aquarius/Aquarius.d.ts +26 -4
  28. package/dist/src/factories/NFTFactory.d.ts +224 -18
  29. package/dist/src/index.d.ts +1 -1
  30. package/dist/src/models/Config.d.ts +132 -0
  31. package/dist/src/pools/Router.d.ts +195 -12
  32. package/dist/src/pools/balancer/Pool.d.ts +366 -37
  33. package/dist/src/pools/dispenser/Dispenser.d.ts +112 -3
  34. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +314 -19
  35. package/dist/src/pools/index.d.ts +2 -0
  36. package/dist/src/pools/ssContracts/SideStaking.d.ts +116 -10
  37. package/dist/src/provider/Provider.d.ts +137 -14
  38. package/dist/src/tokens/Datatoken.d.ts +320 -13
  39. package/dist/src/tokens/NFT.d.ts +303 -5
  40. package/dist/src/utils/ConfigHelper.d.ts +1 -1
  41. package/dist/src/utils/Constants.d.ts +1 -0
  42. package/dist/src/utils/ContractUtils.d.ts +12 -0
  43. package/dist/src/utils/DatatokenName.d.ts +4 -0
  44. package/dist/src/utils/FetchHelper.d.ts +3 -2
  45. package/dist/src/utils/General.d.ts +4 -0
  46. package/dist/src/utils/PoolHelpers.d.ts +8 -0
  47. package/dist/src/utils/SignatureUtils.d.ts +0 -2
  48. package/dist/src/utils/TokenUtils.d.ts +42 -0
  49. package/dist/src/utils/index.d.ts +4 -2
  50. package/dist/src/utils/minAbi.d.ts +2 -0
  51. package/dist/test/TestContractHandler.d.ts +8 -36
  52. package/dist/test/config.d.ts +5 -0
  53. package/docs/beginners_guide.md +4 -4
  54. package/docs/overview.md +100 -9
  55. package/docs/quickstart_marketplace.md +34 -33
  56. package/docs/quickstart_simple.md +18 -16
  57. package/package.json +29 -27
  58. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  59. package/dist/src/interfaces/index.d.ts +0 -5
  60. package/dist/src/utils/ContractParams.d.ts +0 -4
  61. package/dist/src/utils/GasUtils.d.ts +0 -2
  62. package/dist/test/integration/config.d.ts +0 -3
  63. package/dist/test/unit/config.d.ts +0 -3
@@ -2,10 +2,12 @@ import { TransactionReceipt } from 'web3-core';
2
2
  import { Contract } from 'web3-eth-contract';
3
3
  import { AbiItem } from 'web3-utils/types';
4
4
  import Web3 from 'web3';
5
+ import { Config } from '../../models/index.js';
6
+ import { PriceAndFees } from '../..';
5
7
  export interface FixedPriceExchange {
6
8
  active: boolean;
7
9
  exchangeOwner: string;
8
- dataToken: string;
10
+ datatoken: string;
9
11
  baseToken: string;
10
12
  fixedRate: string;
11
13
  dtDecimals: string;
@@ -19,7 +21,7 @@ export interface FixedPriceExchange {
19
21
  exchangeId?: string;
20
22
  }
21
23
  export interface FeesInfo {
22
- opfFee: string;
24
+ opcFee: string;
23
25
  marketFee: string;
24
26
  marketFeeCollector: string;
25
27
  marketFeeAvailable: string;
@@ -30,7 +32,7 @@ export interface FixedPriceSwap {
30
32
  exchangeId: string;
31
33
  caller: string;
32
34
  baseTokenAmount: string;
33
- dataTokenAmount: string;
35
+ datatokenAmount: string;
34
36
  }
35
37
  export declare enum FixedRateCreateProgressStep {
36
38
  CreatingExchange = 0,
@@ -38,58 +40,351 @@ export declare enum FixedRateCreateProgressStep {
38
40
  }
39
41
  export declare class FixedRateExchange {
40
42
  GASLIMIT_DEFAULT: number;
43
+ /** Ocean related functions */
41
44
  oceanAddress: string;
42
45
  fixedRateAddress: string;
43
46
  fixedRateExchangeAbi: AbiItem | AbiItem[];
44
47
  fixedRateContract: Contract;
45
48
  web3: Web3;
46
49
  contract: Contract;
47
- startBlock: number;
50
+ config: Config;
48
51
  ssAbi: AbiItem | AbiItem[];
49
- constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, startBlock?: number);
50
- amountToUnits(token: string, amount: string): Promise<string>;
51
- unitsToAmount(token: string, amount: string): Promise<string>;
52
- generateExchangeId(basetoken: string, dataToken: string, owner: string): Promise<string>;
53
- estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBasetokenAmount: string, contractInstance?: Contract): Promise<number>;
54
- buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBasetokenAmount: string): Promise<TransactionReceipt>;
55
- estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBasetokenAmount: string, contractInstance?: Contract): Promise<number>;
56
- sellDT(address: string, exchangeId: string, datatokenAmount: string, minBasetokenAmount: string): Promise<TransactionReceipt>;
52
+ /**
53
+ * Instantiate FixedRateExchange
54
+ * @param {any} web3
55
+ * @param {any} fixedRateExchangeAbi
56
+ */
57
+ constructor(web3: Web3, fixedRateAddress: string, network?: string | number, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
58
+ amountToUnits(token: string, amount: string, tokenDecimals: number): Promise<string>;
59
+ unitsToAmount(token: string, amount: string, tokenDecimals: number): Promise<string>;
60
+ /**
61
+ * Creates unique exchange identifier.
62
+ * @param {String} baseToken baseToken contract address
63
+ * @param {String} datatoken Datatoken contract address
64
+ * @return {Promise<string>} exchangeId
65
+ */
66
+ generateExchangeId(baseToken: string, datatoken: string): Promise<string>;
67
+ /**
68
+ * Estimate gas cost for buyDT
69
+ * @param {String} account
70
+ * @param {String} dtAmount datatoken amount we want to buy
71
+ * @param {String} datatokenAddress datatokenAddress
72
+ * @param {String} consumeMarketAddress consumeMarketAddress
73
+ * @param {String} consumeMarketFee fee recieved by the consume market when a dt is bought from a fixed rate exchange, percent
74
+ * @param {Contract} contractInstance optional contract instance
75
+ * @return {Promise<number>}
76
+ */
77
+ estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, consumeMarketAddress: string, consumeMarketFee: string, contractInstance?: Contract): Promise<number>;
78
+ /**
79
+ * Atomic swap
80
+ * @param {String} exchangeId ExchangeId
81
+ * @param {String} datatokenAmount Amount of datatokens
82
+ * @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
83
+ * @param {String} address User address
84
+ * @param {String} consumeMarketAddress consumeMarketAddress
85
+ * @param {String} consumeMarketFee consumeMarketFee in fraction
86
+ * @return {Promise<TransactionReceipt>} transaction receipt
87
+ */
88
+ buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string): Promise<TransactionReceipt>;
89
+ /**
90
+ * Estimate gas cost for sellDT
91
+ * @param {String} account
92
+ * @param {String} dtAmount datatoken amount we want to sell
93
+ * @param {String} datatokenAddress datatokenAddress
94
+ * @param {String} consumeMarketAddress consumeMarketAddress
95
+ * @param {String} consumeMarketFee consumeMarketFee
96
+ * @param {Contract} contractInstance optional contract instance
97
+ * @return {Promise<number>}
98
+ */
99
+ estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, consumeMarketAddress: string, consumeMarketFee: string, contractInstance?: Contract): Promise<number>;
100
+ /**
101
+ * Atomic swap
102
+ * @param {String} exchangeId ExchangeId
103
+ * @param {String} datatokenAmount Amount of datatokens
104
+ * @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
105
+ * @param {String} address User address
106
+ * @param {String} consumeMarketAddress consumeMarketAddress
107
+ * @param {String} consumeMarketFee consumeMarketFee in fraction
108
+ * @return {Promise<TransactionReceipt>} transaction receipt
109
+ */
110
+ sellDT(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string): Promise<TransactionReceipt>;
111
+ /**
112
+ * Gets total number of exchanges
113
+ * @param {String} exchangeId ExchangeId
114
+ * @param {Number} datatokenAmount Amount of datatokens
115
+ * @return {Promise<Number>} no of available exchanges
116
+ */
57
117
  getNumberOfExchanges(): Promise<number>;
118
+ /**
119
+ * Estimate gas cost for setRate
120
+ * @param {String} account
121
+ * @param {String} exchangeId ExchangeId
122
+ * @param {String} newRate New rate
123
+ * @param {Contract} contractInstance optional contract instance
124
+ * @return {Promise<number>}
125
+ */
58
126
  estSetRate(account: string, exchangeId: string, newRate: string, contractInstance?: Contract): Promise<number>;
127
+ /**
128
+ * Set new rate
129
+ * @param {String} exchangeId ExchangeId
130
+ * @param {String} newRate New rate
131
+ * @param {String} address User account
132
+ * @return {Promise<TransactionReceipt>} transaction receipt
133
+ */
59
134
  setRate(address: string, exchangeId: string, newRate: string): Promise<TransactionReceipt>;
135
+ /**
136
+ * Estimate gas cost for setRate
137
+ * @param {String} account
138
+ * @param {String} exchangeId ExchangeId
139
+ * @param {String} newAllowedSwapper new allowed swapper address
140
+ * @param {Contract} contractInstance optional contract instance
141
+ * @return {Promise<number>}
142
+ */
60
143
  estSetAllowedSwapper(account: string, exchangeId: string, newAllowedSwapper: string, contractInstance?: Contract): Promise<number>;
144
+ /**
145
+ * Set new rate
146
+ * @param {String} exchangeId ExchangeId
147
+ * @param {String} newAllowedSwapper newAllowedSwapper (set address zero if we want to remove allowed swapper)
148
+ * @param {String} address User account
149
+ * @return {Promise<TransactionReceipt>} transaction receipt
150
+ */
61
151
  setAllowedSwapper(address: string, exchangeId: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
152
+ /**
153
+ * Estimate gas cost for activate
154
+ * @param {String} account
155
+ * @param {String} exchangeId ExchangeId
156
+ * @param {Contract} contractInstance optional contract instance
157
+ * @return {Promise<number>}
158
+ */
62
159
  estActivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
160
+ /**
161
+ * Activate an exchange
162
+ * @param {String} exchangeId ExchangeId
163
+ * @param {String} address User address
164
+ * @return {Promise<TransactionReceipt>} transaction receipt
165
+ */
63
166
  activate(address: string, exchangeId: string): Promise<TransactionReceipt>;
167
+ /**
168
+ * Estimate gas cost for deactivate
169
+ * @param {String} account
170
+ * @param {String} exchangeId ExchangeId
171
+ * @param {Contract} contractInstance optional contract instance
172
+ * @return {Promise<number>}
173
+ */
64
174
  estDeactivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
175
+ /**
176
+ * Deactivate an exchange
177
+ * @param {String} exchangeId ExchangeId
178
+ * @param {String} address User address
179
+ * @return {Promise<TransactionReceipt>} transaction receipt
180
+ */
65
181
  deactivate(address: string, exchangeId: string): Promise<TransactionReceipt>;
182
+ /**
183
+ * Get Rate
184
+ * @param {String} exchangeId ExchangeId
185
+ * @return {Promise<string>} Rate (converted from wei)
186
+ */
66
187
  getRate(exchangeId: string): Promise<string>;
188
+ /**
189
+ * Get Datatoken Supply in the exchange
190
+ * @param {String} exchangeId ExchangeId
191
+ * @return {Promise<string>} dt supply formatted
192
+ */
67
193
  getDTSupply(exchangeId: string): Promise<string>;
194
+ /**
195
+ * Get BaseToken Supply in the exchange
196
+ * @param {String} exchangeId ExchangeId
197
+ * @return {Promise<string>} dt supply formatted
198
+ */
68
199
  getBTSupply(exchangeId: string): Promise<string>;
200
+ /**
201
+ * Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
202
+ * @param {String} exchangeId ExchangeId
203
+ * @return {Promise<string>} address of allowedSwapper
204
+ */
69
205
  getAllowedSwapper(exchangeId: string): Promise<string>;
70
- getAmountBTIn(exchangeId: string, dataTokenAmount: string): Promise<string>;
71
- getAmountBTOut(exchangeId: string, dataTokenAmount: string): Promise<string>;
206
+ /**
207
+ * calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
208
+ * @param {String} exchangeId ExchangeId
209
+ * @param {string} datatokenAmount Amount of datatokens user wants to buy
210
+ * @param {String} consumeMarketFee consumeMarketFee in fraction
211
+ * @return {Promise<PriceAndFees>} how many base tokens are needed and fees
212
+ */
213
+ calcBaseInGivenOutDT(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<PriceAndFees>;
214
+ /**
215
+ * getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
216
+ * @param {String} exchangeId ExchangeId
217
+ * @param {Number} datatokenAmount Amount of datatokens
218
+ * @param {String} consumeMarketFee consumeMarketFee in fraction
219
+ * @return {Promise<string>} Amount of baseTokens user will receive
220
+ */
221
+ getAmountBTOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<string>;
222
+ /**
223
+ * Get exchange details
224
+ * @param {String} exchangeId ExchangeId
225
+ * @return {Promise<FixedPricedExchange>} Exchange details
226
+ */
72
227
  getExchange(exchangeId: string): Promise<FixedPriceExchange>;
228
+ /**
229
+ * Get fee details for an exchange
230
+ * @param {String} exchangeId ExchangeId
231
+ * @return {Promise<FixedPricedExchange>} Exchange details
232
+ */
73
233
  getFeesInfo(exchangeId: string): Promise<FeesInfo>;
234
+ /**
235
+ * Get all exchanges
236
+ * @param {String} exchangeId ExchangeId
237
+ * @return {Promise<String[]>} Exchanges list
238
+ */
74
239
  getExchanges(): Promise<string[]>;
240
+ /**
241
+ * Check if an exchange is active
242
+ * @param {String} exchangeId ExchangeId
243
+ * @return {Promise<Boolean>} Result
244
+ */
75
245
  isActive(exchangeId: string): Promise<boolean>;
246
+ /**
247
+ * Estimate gas cost for activate
248
+ * @param {String} account
249
+ * @param {String} exchangeId ExchangeId
250
+ * @param {Contract} contractInstance optional contract instance
251
+ * @return {Promise<number>}
252
+ */
76
253
  estActivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
254
+ /**
255
+ * Activate minting option for fixed rate contract
256
+ * @param {String} exchangeId ExchangeId
257
+ * @param {String} address User address
258
+ * @return {Promise<TransactionReceipt>} transaction receipt
259
+ */
77
260
  activateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
261
+ /**
262
+ * Estimate gas cost for deactivate
263
+ * @param {String} account
264
+ * @param {String} exchangeId ExchangeId
265
+ * @param {Contract} contractInstance optional contract instance
266
+ * @return {Promise<number>}
267
+ */
78
268
  estDeactivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
269
+ /**
270
+ * Deactivate minting for fixed rate
271
+ * @param {String} exchangeId ExchangeId
272
+ * @param {String} address User address
273
+ * @return {Promise<TransactionReceipt>} transaction receipt
274
+ */
79
275
  deactivateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
80
- estCollectBT(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
81
- collectBT(address: string, exchangeId: string): Promise<TransactionReceipt>;
82
- estCollectDT(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
83
- collectDT(address: string, exchangeId: string): Promise<TransactionReceipt>;
276
+ /**
277
+ * Estimate gas cost for collectBT
278
+ * @param {String} account
279
+ * @param {String} exchangeId ExchangeId
280
+ * @param {String} amount amount to be collected
281
+ * @param {Contract} contractInstance optional contract instance
282
+ * @return {Promise<number>}
283
+ */
284
+ estCollectBT(account: string, exchangeId: string, amount: string, contractInstance?: Contract): Promise<number>;
285
+ /**
286
+ * Collect BaseTokens in the contract (anyone can call this, funds are sent to erc20.paymentCollector)
287
+ * @param {String} address User address
288
+ * @param {String} exchangeId ExchangeId
289
+ * @param {String} amount amount to be collected
290
+ * @return {Promise<TransactionReceipt>} transaction receipt
291
+ */
292
+ collectBT(address: string, exchangeId: string, amount: string): Promise<TransactionReceipt>;
293
+ /**
294
+ * Estimate gas cost for collecDT
295
+ * @param {String} account
296
+ * @param {String} exchangeId ExchangeId
297
+ * @param {String} amount amount to be collected
298
+ * @param {Contract} contractInstance optional contract instance
299
+ * @return {Promise<number>}
300
+ */
301
+ estCollectDT(account: string, exchangeId: string, amount: string, contractInstance?: Contract): Promise<number>;
302
+ /**
303
+ * Collect datatokens in the contract (anyone can call this, funds are sent to erc20.paymentCollector)
304
+ * @param {String} address User address
305
+ * @param {String} exchangeId ExchangeId
306
+ * @param {String} amount amount to be collected
307
+ * @return {Promise<TransactionReceipt>} transaction receipt
308
+ */
309
+ collectDT(address: string, exchangeId: string, amount: string): Promise<TransactionReceipt>;
310
+ /**
311
+ * Estimate gas cost for collecMarketFee
312
+ * @param {String} account
313
+ * @param {String} exchangeId ExchangeId
314
+ * @param {Contract} contractInstance optional contract instance
315
+ * @return {Promise<number>}
316
+ */
84
317
  estCollectMarketFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
318
+ /**
319
+ * Collect market fee and send it to marketFeeCollector (anyone can call it)
320
+ * @param {String} exchangeId ExchangeId
321
+ * @param {String} address User address
322
+ * @return {Promise<TransactionReceipt>} transaction receipt
323
+ */
85
324
  collectMarketFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
325
+ /**
326
+ * Estimate gas cost for collectOceanFee
327
+ * @param {String} account
328
+ * @param {String} exchangeId ExchangeId
329
+ * @param {Contract} contractInstance optional contract instance
330
+ * @return {Promise<number>}
331
+ */
86
332
  estCollectOceanFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
333
+ /**
334
+ * Collect ocean fee and send it to OPF collector (anyone can call it)
335
+ * @param {String} exchangeId ExchangeId
336
+ * @param {String} address User address
337
+ * @return {Promise<TransactionReceipt>} transaction receipt
338
+ */
87
339
  collectOceanFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
88
- getOPFCollector(): Promise<string>;
340
+ /**
341
+ * Get OPF Collector of fixed rate contract
342
+ * @return {String}
343
+ */
344
+ getOPCCollector(): Promise<string>;
345
+ /**
346
+ * Get Router address set in fixed rate contract
347
+ * @return {String}
348
+ */
89
349
  getRouter(): Promise<string>;
350
+ /**
351
+ * Get Exchange Owner given an exchangeId
352
+ * @param {String} exchangeId ExchangeId
353
+ * @return {String} return exchange owner
354
+ */
90
355
  getExchangeOwner(exchangeId: string): Promise<string>;
356
+ /**
357
+ * Estimate gas cost for updateMarketFee
358
+ * @param {String} account
359
+ * @param {String} exchangeId ExchangeId
360
+ * @param {String} newMarketFee New market fee
361
+ * @param {Contract} contractInstance optional contract instance
362
+ * @return {Promise<number>}
363
+ */
91
364
  estUpdateMarketFee(account: string, exchangeId: string, newMarketFee: string, contractInstance?: Contract): Promise<number>;
365
+ /**
366
+ * Set new market fee, only market fee collector can update it
367
+ * @param {String} address user address
368
+ * @param {String} exchangeId ExchangeId
369
+ * @param {String} newMarketFee New market fee
370
+ * @return {Promise<TransactionReceipt>} transaction receipt
371
+ */
92
372
  updateMarketFee(address: string, exchangeId: string, newMarketFee: string): Promise<TransactionReceipt>;
373
+ /**
374
+ * Estimate gas cost for updateMarketFeeCollector
375
+ * @param {String} account
376
+ * @param {String} exchangeId ExchangeId
377
+ * @param {String} newMarketFee New market fee collector
378
+ * @param {Contract} contractInstance optional contract instance
379
+ * @return {Promise<number>}
380
+ */
93
381
  estUpdateMarketFeeCollector(account: string, exchangeId: string, newMarketFeeCollector: string, contractInstance?: Contract): Promise<number>;
382
+ /**
383
+ * Set new market fee collector, only market fee collector can update it
384
+ * @param {String} address user address
385
+ * @param {String} exchangeId ExchangeId
386
+ * @param {String} newMarketFeeCollector New market fee collector
387
+ * @return {Promise<TransactionReceipt>} transaction receipt
388
+ */
94
389
  updateMarketFeeCollector(address: string, exchangeId: string, newMarketFeeCollector: string): Promise<TransactionReceipt>;
95
390
  }
@@ -1,3 +1,5 @@
1
1
  export * from './balancer';
2
2
  export * from './dispenser';
3
3
  export * from './fixedRate';
4
+ export * from './ssContracts';
5
+ export * from './Router';
@@ -2,27 +2,133 @@ import Web3 from 'web3';
2
2
  import { AbiItem } from 'web3-utils/types';
3
3
  import { TransactionReceipt } from 'web3-core';
4
4
  import { Contract } from 'web3-eth-contract';
5
+ import { Config } from '../../models';
5
6
  export declare class SideStaking {
6
7
  ssAbi: AbiItem | AbiItem[];
7
8
  web3: Web3;
8
9
  GASLIMIT_DEFAULT: number;
9
- constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[]);
10
- amountToUnits(token: string, amount: string): Promise<string>;
11
- unitsToAmount(token: string, amount: string): Promise<string>;
12
- getDataTokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
13
- getDataTokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
10
+ config: Config;
11
+ constructor(web3: Web3, network?: string | number, ssAbi?: AbiItem | AbiItem[], config?: Config);
12
+ unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
13
+ /**
14
+ * Get (total vesting amount + token released from the contract when adding liquidity)
15
+ * @param {String} ssAddress side staking contract address
16
+ * @param {String} datatokenAddress datatoken address
17
+ * @return {String}
18
+ */
19
+ getDatatokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
20
+ /**
21
+ * Get actual dts in circulation (vested token withdrawn from the contract +
22
+ token released from the contract when adding liquidity)
23
+ * @param {String} ssAddress side staking contract address
24
+ * @param {String} datatokenAddress datatoken address
25
+ * @return {String}
26
+ */
27
+ getDatatokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
28
+ /**
29
+ * Get Publisher address
30
+ * @param {String} ssAddress side staking contract address
31
+ * @param {String} datatokenAddress datatoken address
32
+ * @return {String}
33
+ */
14
34
  getPublisherAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
15
- getBasetoken(ssAddress: string, datatokenAddress: string): Promise<string>;
35
+ /**
36
+ * Get
37
+ * @param {String} ssAddress side staking contract address
38
+ * @param {String} datatokenAddress datatokenAddress
39
+ * @return {String}
40
+ */
41
+ getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string>;
42
+ /**
43
+ * Get Pool Address
44
+ * @param {String} ssAddress side staking contract address
45
+ * @param {String} datatokenAddress datatokenAddress
46
+ * @return {String}
47
+ */
16
48
  getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
17
- getBasetokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
18
- getDatatokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
49
+ /**
50
+ * Get baseToken balance in the contract
51
+ * @param {String} ssAddress side staking contract address
52
+ * @param {String} datatokenAddress datatokenAddress
53
+ * @return {String}
54
+ */
55
+ getBaseTokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
56
+ /**
57
+ * Get dt balance in the staking contract available for being added as liquidity
58
+ * @param {String} ssAddress side staking contract address
59
+ * @param {String} datatokenAddress datatokenAddress
60
+ * @param {number} tokenDecimals optional number of decimals of the token
61
+ * @return {String}
62
+ */
63
+ getDatatokenBalance(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
64
+ /**
65
+ * Get block when vesting ends
66
+ * @param {String} ssAddress side staking contract address
67
+ * @param {String} datatokenAddress datatokenAddress
68
+ * @return {String} end block for vesting amount
69
+ */
19
70
  getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
20
- getvestingAmount(ssAddress: string, datatokenAddress: string): Promise<string>;
71
+ /**
72
+ * Get total amount vesting
73
+ * @param {String} ssAddress side staking contract address
74
+ * @param {String} datatokenAddress datatokenAddress
75
+ * @param {number} tokenDecimals optional number of decimals of the token
76
+ * @return {String}
77
+ */
78
+ getvestingAmount(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
79
+ /**
80
+ * Get last block publisher got some vested tokens
81
+ * @param {String} ssAddress side staking contract address
82
+ * @param {String} datatokenAddress datatokenAddress
83
+ * @return {String}
84
+ */
21
85
  getvestingLastBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
22
- getvestingAmountSoFar(ssAddress: string, datatokenAddress: string): Promise<string>;
86
+ /**
87
+ * Get how much has been taken from the vesting amount
88
+ * @param {String} ssAddress side staking contract address
89
+ * @param {String} datatokenAddress datatokenAddress
90
+ * @param {number} tokenDecimals optional number of decimals of the token
91
+ * @return {String}
92
+ */
93
+ getvestingAmountSoFar(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
94
+ /**
95
+ * Estimate gas cost for getVesting
96
+ * @param {String} account
97
+ * @param {String} ssAddress side staking contract address
98
+ * @param {String} datatokenAddress datatokenAddress
99
+ * @param {Contract} contractInstance optional contract instance
100
+ * @return {Promise<number>}
101
+ */
23
102
  estGetVesting(account: string, ssAddress: string, datatokenAddress: string, contractInstance?: Contract): Promise<number>;
103
+ /** Send vested tokens available to the publisher address, can be called by anyone
104
+ *
105
+ * @param {String} account
106
+ * @param {String} ssAddress side staking contract address
107
+ * @param {String} datatokenAddress datatokenAddress
108
+ * @return {TransactionReceipt}
109
+ */
24
110
  getVesting(account: string, ssAddress: string, datatokenAddress: string): Promise<TransactionReceipt>;
111
+ /**
112
+ * Estimate gas cost for getVesting
113
+ * @param {String} account
114
+ * @param {String} ssAddress side staking contract address
115
+ * @param {String} datatokenAddress datatokenAddress
116
+ * @param {Contract} contractInstance optional contract instance
117
+ * @return {Promise<number>}
118
+ */
25
119
  estSetPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number, contractInstance?: Contract): Promise<number>;
120
+ /** Send vested tokens available to the publisher address, can be called by anyone
121
+ *
122
+ * @param {String} account
123
+ * @param {String} ssAddress side staking contract address
124
+ * @param {String} datatokenAddress datatokenAddress
125
+ * @return {TransactionReceipt}
126
+ */
26
127
  setPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number): Promise<TransactionReceipt>;
128
+ /**
129
+ * Get Router address set in side staking contract
130
+ * @param {String} ssAddress side staking contract address
131
+ * @return {String}
132
+ */
27
133
  getRouter(ssAddress: string): Promise<string>;
28
134
  }