@oceanprotocol/lib 1.0.0-next.15 → 1.0.0-next.19
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/CHANGELOG.md +31 -0
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/dist/src/@types/Erc20.d.ts +5 -0
- package/dist/src/@types/Pool.d.ts +7 -0
- package/dist/src/factories/NFTFactory.d.ts +3 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/pools/balancer/Pool.d.ts +115 -60
- package/dist/src/tokens/Datatoken.d.ts +7 -4
- package/package.json +2 -2
|
@@ -34,3 +34,10 @@ export interface AmountsOutMaxFee {
|
|
|
34
34
|
swapMarketFee: string;
|
|
35
35
|
maxPrice?: string;
|
|
36
36
|
}
|
|
37
|
+
export interface PoolPriceAndFees {
|
|
38
|
+
tokenAmount: string;
|
|
39
|
+
liquidityProviderSwapFeeAmount: string;
|
|
40
|
+
oceanFeeAmount: string;
|
|
41
|
+
publishMarketSwapFeeAmount: string;
|
|
42
|
+
consumeMarketSwapFeeAmount: string;
|
|
43
|
+
}
|
|
@@ -3,7 +3,7 @@ import Web3 from 'web3';
|
|
|
3
3
|
import { TransactionReceipt } from 'web3-core';
|
|
4
4
|
import { AbiItem } from 'web3-utils';
|
|
5
5
|
import { Config } from '../models/index.js';
|
|
6
|
-
import { ProviderFees, FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams } from '../@types/index.js';
|
|
6
|
+
import { ProviderFees, FreCreationParams, Erc20CreateParams, PoolCreationParams, DispenserCreationParams, ConsumeMarketFee } from '../@types/index.js';
|
|
7
7
|
interface Template {
|
|
8
8
|
templateAddress: string;
|
|
9
9
|
isActive: boolean;
|
|
@@ -12,7 +12,8 @@ export interface TokenOrder {
|
|
|
12
12
|
tokenAddress: string;
|
|
13
13
|
consumer: string;
|
|
14
14
|
serviceIndex: number;
|
|
15
|
-
|
|
15
|
+
_providerFee: ProviderFees;
|
|
16
|
+
_consumeMarketFee: ConsumeMarketFee;
|
|
16
17
|
}
|
|
17
18
|
export interface NftCreateData {
|
|
18
19
|
name: string;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ 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 { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../@types';
|
|
5
|
+
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee, PoolPriceAndFees } from '../../@types';
|
|
6
6
|
import { Config } from '../../models';
|
|
7
7
|
/**
|
|
8
8
|
* Provides an interface to Ocean friendly fork from Balancer BPool
|
|
@@ -32,14 +32,14 @@ export declare class Pool {
|
|
|
32
32
|
*/
|
|
33
33
|
estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Allows controller to change the swapFee
|
|
36
36
|
* @param {String} account
|
|
37
37
|
* @param {String} poolAddress
|
|
38
|
-
* @param {String} fee 0.1=
|
|
38
|
+
* @param {String} fee swap fee (1e17 = 10 % , 1e16 = 1% , 1e15 = 0.1%, 1e14 = 0.01%)
|
|
39
39
|
*/
|
|
40
40
|
setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* Returns number of tokens bounded to pool
|
|
43
43
|
* @param {String} poolAddress
|
|
44
44
|
* @return {String}
|
|
45
45
|
*/
|
|
@@ -51,31 +51,33 @@ export declare class Pool {
|
|
|
51
51
|
*/
|
|
52
52
|
getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
|
|
53
53
|
/**
|
|
54
|
-
* Get tokens composing this
|
|
54
|
+
* Get tokens composing this poo
|
|
55
|
+
* Returns tokens bounded to pool, before the pool is finalizedl
|
|
55
56
|
* @param {String} poolAddress
|
|
56
57
|
* @return {String[]}
|
|
57
58
|
*/
|
|
58
59
|
getCurrentTokens(poolAddress: string): Promise<string[]>;
|
|
59
60
|
/**
|
|
60
61
|
* Get the final tokens composing this pool
|
|
62
|
+
* Returns tokens bounded to pool, after the pool was finalized
|
|
61
63
|
* @param {String} poolAddress
|
|
62
64
|
* @return {String[]}
|
|
63
65
|
*/
|
|
64
66
|
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
65
67
|
/**
|
|
66
|
-
*
|
|
68
|
+
* Returns the current controller address (ssBot)
|
|
67
69
|
* @param {String} poolAddress
|
|
68
70
|
* @return {String}
|
|
69
71
|
*/
|
|
70
72
|
getController(poolAddress: string): Promise<string>;
|
|
71
73
|
/**
|
|
72
|
-
*
|
|
74
|
+
* Returns the current baseToken address of the pool
|
|
73
75
|
* @param {String} poolAddress
|
|
74
76
|
* @return {String}
|
|
75
77
|
*/
|
|
76
78
|
getBaseToken(poolAddress: string): Promise<string>;
|
|
77
79
|
/**
|
|
78
|
-
*
|
|
80
|
+
* Returns the current datatoken address
|
|
79
81
|
* @param {String} poolAddress
|
|
80
82
|
* @return {String}
|
|
81
83
|
*/
|
|
@@ -94,51 +96,57 @@ export declare class Pool {
|
|
|
94
96
|
getOPCCollector(poolAddress: string): Promise<string>;
|
|
95
97
|
/**
|
|
96
98
|
* Get if a token is bounded to a pool
|
|
99
|
+
* Returns true if token is bound
|
|
97
100
|
* @param {String} poolAddress
|
|
98
|
-
* @param {String} token Address of the token
|
|
101
|
+
* @param {String} token Address of the token to be checked
|
|
99
102
|
* @return {Boolean}
|
|
100
103
|
*/
|
|
101
104
|
isBound(poolAddress: string, token: string): Promise<boolean>;
|
|
102
105
|
/**
|
|
103
|
-
*
|
|
106
|
+
* Returns the current token reserve amount
|
|
104
107
|
* @param {String} poolAddress
|
|
105
|
-
* @param {String} token Address of the token
|
|
108
|
+
* @param {String} token Address of the token to be checked
|
|
106
109
|
* @return {String}
|
|
107
110
|
*/
|
|
108
111
|
getReserve(poolAddress: string, token: string): Promise<string>;
|
|
109
112
|
/**
|
|
110
113
|
* Get if a pool is finalized
|
|
114
|
+
* Returns true if pool is finalized
|
|
111
115
|
* @param {String} poolAddress
|
|
112
116
|
* @return {Boolean}
|
|
113
117
|
*/
|
|
114
118
|
isFinalized(poolAddress: string): Promise<boolean>;
|
|
115
119
|
/**
|
|
116
|
-
*
|
|
120
|
+
* Returns the current Liquidity Providers swap fee
|
|
117
121
|
* @param {String} poolAddress
|
|
118
122
|
* @return {String} Swap fee. To get the percentage value, substract by 100. E.g. `0.1` represents a 10% swap fee.
|
|
119
123
|
*/
|
|
120
124
|
getSwapFee(poolAddress: string): Promise<string>;
|
|
121
125
|
/**
|
|
122
|
-
*
|
|
126
|
+
* Returns normalized weight of a token.
|
|
127
|
+
* The combined normalized weights of all tokens will sum up to 1.
|
|
128
|
+
* (Note: the actual sum may be 1 plus or minus a few wei due to division precision loss)
|
|
123
129
|
* @param {String} poolAddress
|
|
124
|
-
* @param {String} token
|
|
130
|
+
* @param {String} token token to be checked
|
|
125
131
|
* @return {String}
|
|
126
132
|
*/
|
|
127
133
|
getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
128
134
|
/**
|
|
129
|
-
*
|
|
135
|
+
* Returns denormalized weight of a token
|
|
130
136
|
* @param {String} poolAddress
|
|
131
|
-
* @param {String} token
|
|
137
|
+
* @param {String} token token to be checked
|
|
132
138
|
* @return {String}
|
|
133
139
|
*/
|
|
134
140
|
getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
135
141
|
/**
|
|
136
|
-
* getTotalDenormalizedWeight
|
|
142
|
+
* getTotalDenormalizedWeight
|
|
143
|
+
* Returns total denormalized weught of the pool
|
|
137
144
|
* @param {String} poolAddress
|
|
138
145
|
* @return {String}
|
|
139
146
|
*/
|
|
140
147
|
getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
|
|
141
148
|
/**
|
|
149
|
+
* Returns the current fee of publishingMarket
|
|
142
150
|
* Get Market Fees available to be collected for a specific token
|
|
143
151
|
* @param {String} poolAddress
|
|
144
152
|
* @param {String} token token we want to check fees
|
|
@@ -215,22 +223,23 @@ export declare class Pool {
|
|
|
215
223
|
* Estimate gas cost for swapExactAmountIn
|
|
216
224
|
* @param {String} address
|
|
217
225
|
* @param {String} poolAddress
|
|
218
|
-
* @param {TokenInOutMarket} tokenInOutMarket
|
|
219
|
-
* @param {AmountsInMaxFee} amountsInOutMaxFee
|
|
226
|
+
* @param {TokenInOutMarket} tokenInOutMarket object contianing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
227
|
+
* @param {AmountsInMaxFee} amountsInOutMaxFee object contianing tokenAmountIn, minAmountOut, maxPrice, consumeMarketSwapFee
|
|
220
228
|
* @param {Contract} contractInstance optional contract instance
|
|
221
229
|
* @return {Promise<number>}
|
|
222
230
|
*/
|
|
223
231
|
estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
|
|
224
232
|
/**
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
233
|
+
* Swaps an exact amount of tokensIn to get a mimum amount of tokenOut
|
|
234
|
+
* Trades an exact tokenAmountIn of tokenIn taken from the caller by the pool,
|
|
235
|
+
* in exchange for at least minAmountOut of tokenOut given to the caller from the pool, with a maximum marginal price of maxPrice.
|
|
236
|
+
* Returns (tokenAmountOut, spotPriceAfter), where tokenAmountOut is the amount of token that came out of the pool,
|
|
237
|
+
* and spotPriceAfter is the new marginal spot price, ie, the result of getSpotPrice after the call.
|
|
229
238
|
* (These values are what are limited by the arguments; you are guaranteed tokenAmountOut >= minAmountOut and spotPriceAfter <= maxPrice).
|
|
230
239
|
* @param {String} address
|
|
231
240
|
* @param {String} poolAddress
|
|
232
|
-
* @param {TokenInOutMarket} tokenInOutMarket
|
|
233
|
-
* @param {AmountsInMaxFee} amountsInOutMaxFee
|
|
241
|
+
* @param {TokenInOutMarket} tokenInOutMarket object contianing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
242
|
+
* @param {AmountsInMaxFee} amountsInOutMaxFee object contianing tokenAmountIn, minAmountOut, maxPrice, consumeMarketSwapFee
|
|
234
243
|
* @return {TransactionReceipt}
|
|
235
244
|
*/
|
|
236
245
|
swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
|
|
@@ -245,49 +254,54 @@ export declare class Pool {
|
|
|
245
254
|
*/
|
|
246
255
|
estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
|
|
247
256
|
/**
|
|
248
|
-
*
|
|
257
|
+
* Swaps a maximum maxAmountIn of tokensIn to get an exact amount of tokenOut
|
|
249
258
|
* @param {String} account
|
|
250
259
|
* @param {String} poolAddress
|
|
251
|
-
* @param {TokenInOutMarket} tokenInOutMarket
|
|
252
|
-
* @param {AmountsOutMaxFee} amountsInOutMaxFee
|
|
260
|
+
* @param {TokenInOutMarket} tokenInOutMarket Object containing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
261
|
+
* @param {AmountsOutMaxFee} amountsInOutMaxFee Object containging maxAmountIn,tokenAmountOut,maxPrice, consumeMarketSwapFee]
|
|
253
262
|
* @return {TransactionReceipt}
|
|
254
263
|
*/
|
|
255
264
|
swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
|
|
256
265
|
/**
|
|
257
|
-
* Estimate gas cost for
|
|
266
|
+
* Estimate gas cost for joinPool method
|
|
258
267
|
* @param {String} address
|
|
259
268
|
* @param {String} poolAddress
|
|
260
|
-
* @param {String} poolAmountOut
|
|
261
|
-
* @param {String[]} maxAmountsIn
|
|
269
|
+
* @param {String} poolAmountOut expected number of pool shares that you will get
|
|
270
|
+
* @param {String[]} maxAmountsIn array with maxium amounts spent
|
|
262
271
|
* @param {Contract} contractInstance optional contract instance
|
|
263
272
|
* @return {Promise<number>}
|
|
264
273
|
*/
|
|
265
274
|
estJoinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[], contractInstance?: Contract): Promise<number>;
|
|
266
275
|
/**
|
|
267
|
-
*
|
|
276
|
+
* Adds dual side liquidity to the pool (both datatoken and basetoken)
|
|
277
|
+
* This will pull some of each of the currently trading tokens in the pool,
|
|
278
|
+
* meaning you must have called approve for each token for this pool.
|
|
279
|
+
* These values are limited by the array of maxAmountsIn in the order of the pool tokens.
|
|
268
280
|
* @param {String} address
|
|
269
281
|
* @param {String} poolAddress
|
|
270
|
-
* @param {String} poolAmountOut
|
|
271
|
-
* @param {String[]} maxAmountsIn
|
|
282
|
+
* @param {String} poolAmountOut expected number of pool shares that you will get
|
|
283
|
+
* @param {String[]} maxAmountsIn array with maxium amounts spent
|
|
272
284
|
* @return {TransactionReceipt}
|
|
273
285
|
*/
|
|
274
286
|
joinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
|
|
275
287
|
/**
|
|
276
288
|
* Estimate gas cost for exitPool
|
|
277
|
-
|
|
289
|
+
* @param {String} address
|
|
278
290
|
* @param {String} poolAddress
|
|
279
|
-
``* @param {String} poolAmountIn
|
|
280
|
-
* @param {String[]} minAmountsOut
|
|
291
|
+
``* @param {String} poolAmountIn amount of pool shares spent
|
|
292
|
+
* @param {String[]} minAmountsOut aarray with minimum amount of tokens expected
|
|
281
293
|
* @param {Contract} contractInstance optional contract instance
|
|
282
294
|
* @return {Promise<number>}
|
|
283
295
|
*/
|
|
284
296
|
estExitPool(address: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[], contractInstance?: Contract): Promise<number>;
|
|
285
297
|
/**
|
|
286
|
-
*
|
|
298
|
+
* Removes dual side liquidity from the pool (both datatoken and basetoken)
|
|
299
|
+
* Exit the pool, paying poolAmountIn pool tokens and getting some of each of the currently trading tokens in return.
|
|
300
|
+
* These values are limited by the array of minAmountsOut in the order of the pool tokens.
|
|
287
301
|
* @param {String} account
|
|
288
302
|
* @param {String} poolAddress
|
|
289
|
-
* @param {String} poolAmountIn
|
|
290
|
-
* @param {String[]} minAmountsOut
|
|
303
|
+
* @param {String} poolAmountIn amount of pool shares spent
|
|
304
|
+
* @param {String[]} minAmountsOut array with minimum amount of tokens expected
|
|
291
305
|
* @return {TransactionReceipt}
|
|
292
306
|
*/
|
|
293
307
|
exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
|
|
@@ -296,56 +310,97 @@ export declare class Pool {
|
|
|
296
310
|
* @param {String} address
|
|
297
311
|
* @param {String} poolAddress
|
|
298
312
|
* @param {String} tokenIn
|
|
299
|
-
* @param {String} tokenAmountIn
|
|
300
|
-
* @param {String} minPoolAmountOut
|
|
313
|
+
* @param {String} tokenAmountIn exact number of base tokens to spend
|
|
314
|
+
* @param {String} minPoolAmountOut minimum of pool shares expectex
|
|
301
315
|
* @param {Contract} contractInstance optional contract instance
|
|
302
316
|
* @return {Promise<number>}
|
|
303
317
|
*/
|
|
304
318
|
estJoinswapExternAmountIn(address: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
305
319
|
/**
|
|
320
|
+
* Single side add liquidity to the pool,
|
|
321
|
+
* expecting a minPoolAmountOut of shares for spending tokenAmountIn basetokens.
|
|
306
322
|
* Pay tokenAmountIn of baseToken to join the pool, getting poolAmountOut of the pool shares.
|
|
307
323
|
* @param {String} account
|
|
308
324
|
* @param {String} poolAddress
|
|
309
325
|
* @param {String} tokenIn
|
|
310
|
-
* @param {String} tokenAmountIn
|
|
311
|
-
* @param {String} minPoolAmountOut
|
|
326
|
+
* @param {String} tokenAmountIn exact number of base tokens to spend
|
|
327
|
+
* @param {String} minPoolAmountOut minimum of pool shares expectex
|
|
312
328
|
* @return {TransactionReceipt}
|
|
313
329
|
*/
|
|
314
330
|
joinswapExternAmountIn(account: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
|
|
315
331
|
/**
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
* @param {String} poolAmountIn
|
|
320
|
-
* @param {String} minTokenAmountOut
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
332
|
+
* Estimate gas cost for exitswapPoolAmountIn
|
|
333
|
+
* @param {String} address
|
|
334
|
+
* @param {String} poolAddress
|
|
335
|
+
* @param {String} poolAmountIn exact number of pool shares to spend
|
|
336
|
+
* @param {String} minTokenAmountOut minimum amount of basetokens expected
|
|
337
|
+
* @param {Contract} contractInstance optional contract instance
|
|
338
|
+
* @return {Promise<number>}
|
|
339
|
+
*/
|
|
324
340
|
estExitswapPoolAmountIn(address: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
325
341
|
/**
|
|
342
|
+
* Single side remove liquidity from the pool,
|
|
343
|
+
* expecting a minAmountOut of basetokens for spending poolAmountIn pool shares
|
|
326
344
|
* Pay poolAmountIn pool shares into the pool, getting minTokenAmountOut of the baseToken
|
|
327
345
|
* @param {String} account
|
|
328
346
|
* @param {String} poolAddress
|
|
329
347
|
* @param {String} tokenOut
|
|
330
|
-
* @param {String} poolAmountIn
|
|
331
|
-
* @param {String} minTokenAmountOut
|
|
348
|
+
* @param {String} poolAmountIn exact number of pool shares to spend
|
|
349
|
+
* @param {String} minTokenAmountOut minimum amount of basetokens expected
|
|
332
350
|
* @return {TransactionReceipt}
|
|
333
351
|
*/
|
|
334
352
|
exitswapPoolAmountIn(account: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
|
|
335
353
|
/**
|
|
336
|
-
*
|
|
354
|
+
* Return the spot price of swapping tokenIn to tokenOut
|
|
337
355
|
* @param {String} poolAddress
|
|
338
|
-
* @param {String} tokenIn
|
|
339
|
-
* @param {String} tokenOut
|
|
340
|
-
* @param {String} swapMarketFe
|
|
356
|
+
* @param {String} tokenIn in token
|
|
357
|
+
* @param {String} tokenOut out token
|
|
358
|
+
* @param {String} swapMarketFe consume market swap fee
|
|
341
359
|
* @return {String}
|
|
342
360
|
*/
|
|
343
361
|
getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
|
|
344
|
-
|
|
345
|
-
|
|
362
|
+
/**
|
|
363
|
+
* How many tokensIn do you need in order to get exact tokenAmountOut.
|
|
364
|
+
* Returns: tokenAmountIn, swapFee, opcFee , consumeMarketSwapFee, publishMarketSwapFee
|
|
365
|
+
* Returns: tokenAmountIn, LPFee, opcFee , publishMarketSwapFee, consumeMarketSwapFee
|
|
366
|
+
* @param tokenIn token to be swaped
|
|
367
|
+
* @param tokenOut token to get
|
|
368
|
+
* @param tokenAmountOut exact amount of tokenOut
|
|
369
|
+
* @param swapMarketFee consume market swap fee
|
|
370
|
+
*/
|
|
371
|
+
getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string): Promise<PoolPriceAndFees>;
|
|
372
|
+
/**
|
|
373
|
+
* How many tokensOut you will get for a exact tokenAmountIn
|
|
374
|
+
* Returns: tokenAmountOut, LPFee, opcFee , publishMarketSwapFee, consumeMarketSwapFee
|
|
375
|
+
* @param tokenIn token to be swaped
|
|
376
|
+
* @param tokenOut token to get
|
|
377
|
+
* @param tokenAmountOut exact amount of tokenOut
|
|
378
|
+
* @param _consumeMarketSwapFee consume market swap fee
|
|
379
|
+
*/
|
|
380
|
+
getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string): Promise<PoolPriceAndFees>;
|
|
381
|
+
/**
|
|
382
|
+
* Returns number of poolshares obtain by staking exact tokenAmountIn tokens
|
|
383
|
+
* @param tokenIn tokenIn
|
|
384
|
+
* @param tokenAmountIn exact number of tokens staked
|
|
385
|
+
*/
|
|
346
386
|
calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string): Promise<string>;
|
|
387
|
+
/**
|
|
388
|
+
* Returns number of tokens to be staked to the pool in order to get an exact number of poolshares
|
|
389
|
+
* @param tokenIn tokenIn
|
|
390
|
+
* @param poolAmountOut expected amount of pool shares
|
|
391
|
+
*/
|
|
347
392
|
calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string): Promise<string>;
|
|
393
|
+
/**
|
|
394
|
+
* Returns expected amount of tokenOut for removing exact poolAmountIn pool shares from the pool
|
|
395
|
+
* @param tokenOut tokenOut
|
|
396
|
+
* @param poolAmountIn amount of shares spent
|
|
397
|
+
*/
|
|
348
398
|
calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string): Promise<string>;
|
|
399
|
+
/**
|
|
400
|
+
* Returns number of poolshares needed to withdraw exact tokenAmountOut tokens
|
|
401
|
+
* @param tokenOut tokenOut
|
|
402
|
+
* @param tokenAmountOut expected amount of tokensOut
|
|
403
|
+
*/
|
|
349
404
|
calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string): Promise<string>;
|
|
350
405
|
/**
|
|
351
406
|
* Get LOG_SWAP encoded topic
|
|
@@ -2,7 +2,7 @@ import Web3 from 'web3';
|
|
|
2
2
|
import { AbiItem } from 'web3-utils';
|
|
3
3
|
import { TransactionReceipt } from 'web3-eth';
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
|
-
import { FreOrderParams, FreCreationParams, ProviderFees } from '../@types';
|
|
5
|
+
import { ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees } from '../@types';
|
|
6
6
|
import { Nft } from './NFT';
|
|
7
7
|
import { Config } from '../models/index.js';
|
|
8
8
|
/**
|
|
@@ -15,7 +15,8 @@ interface Roles {
|
|
|
15
15
|
export interface OrderParams {
|
|
16
16
|
consumer: string;
|
|
17
17
|
serviceIndex: number;
|
|
18
|
-
|
|
18
|
+
_providerFee: ProviderFees;
|
|
19
|
+
_consumeMarketFee: ConsumeMarketFee;
|
|
19
20
|
}
|
|
20
21
|
export interface DispenserParams {
|
|
21
22
|
maxTokens: string;
|
|
@@ -245,19 +246,21 @@ export declare class Datatoken {
|
|
|
245
246
|
* @param {String} consumer Consumer Address
|
|
246
247
|
* @param {Number} serviceIndex Service index in the metadata
|
|
247
248
|
* @param {providerFees} providerFees provider fees
|
|
249
|
+
* @param {consumeMarketFee} ConsumeMarketFee consume market fees
|
|
248
250
|
* @param {Contract} contractInstance optional contract instance
|
|
249
251
|
* @return {Promise<any>}
|
|
250
252
|
*/
|
|
251
|
-
estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
|
|
253
|
+
estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee, contractInstance?: Contract): Promise<any>;
|
|
252
254
|
/** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
|
|
253
255
|
* @param {String} dtAddress Datatoken address
|
|
254
256
|
* @param {String} address User address which calls
|
|
255
257
|
* @param {String} consumer Consumer Address
|
|
256
258
|
* @param {Number} serviceIndex Service index in the metadata
|
|
257
259
|
* @param {providerFees} providerFees provider fees
|
|
260
|
+
* @param {consumeMarketFee} ConsumeMarketFee consume market fees
|
|
258
261
|
* @return {Promise<TransactionReceipt>} string
|
|
259
262
|
*/
|
|
260
|
-
startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees): Promise<TransactionReceipt>;
|
|
263
|
+
startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee): Promise<TransactionReceipt>;
|
|
261
264
|
/** Estimate gas cost for buyFromFreAndOrder method
|
|
262
265
|
* @param {String} dtAddress Datatoken address
|
|
263
266
|
* @param {String} address User address which calls
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "1.0.0-next.
|
|
4
|
+
"version": "1.0.0-next.19",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"web3": "^1.7.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@oceanprotocol/contracts": "1.0.0-alpha.
|
|
60
|
+
"@oceanprotocol/contracts": "1.0.0-alpha.19",
|
|
61
61
|
"bignumber.js": "^9.0.2",
|
|
62
62
|
"cross-fetch": "^3.1.5",
|
|
63
63
|
"crypto-js": "^4.1.1",
|