@oceanprotocol/lib 1.1.6 → 2.0.0-next.0
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 +48 -16
- package/CodeExamples.md +28 -315
- package/README.md +4 -7
- 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/Asset.d.ts +4 -4
- package/dist/src/@types/Compute.d.ts +1 -1
- package/dist/src/@types/DDO/DDO.d.ts +2 -5
- package/dist/src/@types/{Erc20.d.ts → Datatoken.d.ts} +18 -1
- package/dist/src/@types/Dispenser.d.ts +9 -0
- package/dist/src/@types/FixedPrice.d.ts +24 -0
- package/dist/src/@types/{Erc721.d.ts → NFT.d.ts} +6 -0
- package/dist/src/@types/NFTFactory.d.ts +20 -0
- package/dist/src/@types/Provider.d.ts +8 -0
- package/dist/src/@types/ReturnTypes.d.ts +2 -0
- package/dist/src/@types/Router.d.ts +1 -1
- package/dist/src/@types/index.d.ts +11 -8
- package/dist/src/{models → config}/Config.d.ts +2 -23
- package/dist/src/{utils → config}/ConfigHelper.d.ts +1 -1
- package/dist/src/config/index.d.ts +2 -0
- package/dist/src/contracts/Datatoken.d.ts +232 -0
- package/dist/src/contracts/Dispenser.d.ts +73 -0
- package/dist/src/contracts/FixedRateExchange.d.ts +212 -0
- package/dist/src/contracts/NFT.d.ts +197 -0
- package/dist/src/contracts/NFTFactory.d.ts +144 -0
- package/dist/src/contracts/Router.d.ts +92 -0
- package/dist/src/contracts/SmartContract.d.ts +22 -0
- package/dist/src/contracts/SmartContractWithAddress.d.ts +18 -0
- package/dist/src/contracts/index.d.ts +8 -0
- package/dist/src/index.d.ts +4 -7
- package/dist/src/{aquarius → services}/Aquarius.d.ts +25 -3
- package/dist/src/{provider → services}/Provider.d.ts +5 -13
- package/dist/src/services/index.d.ts +2 -0
- package/dist/src/utils/Constants.d.ts +2 -0
- package/dist/src/utils/ContractUtils.d.ts +14 -8
- package/dist/src/utils/DdoHelpers.d.ts +1 -1
- package/dist/src/utils/FetchHelper.d.ts +1 -4
- package/dist/src/utils/Logger.d.ts +0 -1
- package/dist/src/utils/TokenUtils.d.ts +17 -39
- package/dist/src/utils/index.d.ts +6 -7
- package/dist/test/TestContractHandler.d.ts +4 -4
- package/dist/test/config.d.ts +1 -1
- package/dist/test/unit/{tokens/Datatoken.test.d.ts → Datatoken.test.d.ts} +0 -0
- package/dist/test/unit/{pools/dispenser/Dispenser.test.d.ts → Dispenser.test.d.ts} +0 -0
- package/dist/test/unit/{pools/fixedRate/FixedRateExchange.test.d.ts → FixedRateExchange.test.d.ts} +0 -0
- package/dist/test/unit/{tokens/Nft.test.d.ts → Nft.test.d.ts} +0 -0
- package/dist/test/unit/{factories/NftFactory.test.d.ts → NftFactory.test.d.ts} +0 -0
- package/dist/test/unit/{pools/Router.test.d.ts → Router.test.d.ts} +0 -0
- package/package.json +5 -18
- package/dist/src/@types/Pool.d.ts +0 -45
- package/dist/src/aquarius/index.d.ts +0 -1
- package/dist/src/factories/NFTFactory.d.ts +0 -275
- package/dist/src/factories/index.d.ts +0 -1
- package/dist/src/models/index.d.ts +0 -1
- package/dist/src/pools/Router.d.ts +0 -228
- package/dist/src/pools/balancer/Pool.d.ts +0 -395
- package/dist/src/pools/balancer/index.d.ts +0 -1
- package/dist/src/pools/dispenser/Dispenser.d.ts +0 -145
- package/dist/src/pools/dispenser/index.d.ts +0 -1
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +0 -388
- package/dist/src/pools/fixedRate/index.d.ts +0 -1
- package/dist/src/pools/index.d.ts +0 -5
- package/dist/src/pools/ssContracts/SideStaking.d.ts +0 -133
- package/dist/src/pools/ssContracts/index.d.ts +0 -1
- package/dist/src/provider/index.d.ts +0 -1
- package/dist/src/tokens/Datatoken.d.ts +0 -413
- package/dist/src/tokens/NFT.d.ts +0 -354
- package/dist/src/tokens/index.d.ts +0 -2
- package/dist/src/utils/ConversionTypeHelper.d.ts +0 -3
- package/dist/src/utils/PoolHelpers.d.ts +0 -8
- package/dist/test/unit/pools/balancer/Pool.test.d.ts +0 -1
- package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +0 -1
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils/types';
|
|
3
|
-
import { TransactionReceipt } from 'web3-core';
|
|
4
|
-
import { Contract } from 'web3-eth-contract';
|
|
5
|
-
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee, PoolPriceAndFees } from '../../@types';
|
|
6
|
-
import { Config } from '../../models';
|
|
7
|
-
/**
|
|
8
|
-
* Provides an interface to Ocean friendly fork from Balancer BPool
|
|
9
|
-
*/
|
|
10
|
-
export declare class Pool {
|
|
11
|
-
poolAbi: AbiItem | AbiItem[];
|
|
12
|
-
web3: Web3;
|
|
13
|
-
private config;
|
|
14
|
-
constructor(web3: Web3, network?: string | number, poolAbi?: AbiItem | AbiItem[], config?: Config);
|
|
15
|
-
amountToUnits(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
16
|
-
unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Get user shares of pool tokens
|
|
19
|
-
* @param {String} account
|
|
20
|
-
* @param {String} poolAddress
|
|
21
|
-
* @return {String}
|
|
22
|
-
*/
|
|
23
|
-
sharesBalance(account: string, poolAddress: string): Promise<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Estimate gas cost for setSwapFee
|
|
26
|
-
* @param {String} account
|
|
27
|
-
* @param {String} tokenAddress
|
|
28
|
-
* @param {String} spender
|
|
29
|
-
* @param {String} amount
|
|
30
|
-
* @param {String} force
|
|
31
|
-
* @param {Contract} contractInstance optional contract instance
|
|
32
|
-
* @return {Promise<number>}
|
|
33
|
-
*/
|
|
34
|
-
estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
|
|
35
|
-
/**
|
|
36
|
-
* Allows controller to change the swapFee
|
|
37
|
-
* @param {String} account
|
|
38
|
-
* @param {String} poolAddress
|
|
39
|
-
* @param {String} fee swap fee (1e17 = 10 % , 1e16 = 1% , 1e15 = 0.1%, 1e14 = 0.01%)
|
|
40
|
-
*/
|
|
41
|
-
setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
|
|
42
|
-
/**
|
|
43
|
-
* Returns number of tokens bounded to pool
|
|
44
|
-
* @param {String} poolAddress
|
|
45
|
-
* @return {String}
|
|
46
|
-
*/
|
|
47
|
-
getNumTokens(poolAddress: string): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Get total supply of pool shares
|
|
50
|
-
* @param {String} poolAddress
|
|
51
|
-
* @return {String}
|
|
52
|
-
*/
|
|
53
|
-
getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
|
|
54
|
-
/**
|
|
55
|
-
* Get tokens composing this poo
|
|
56
|
-
* Returns tokens bounded to pool, before the pool is finalizedl
|
|
57
|
-
* @param {String} poolAddress
|
|
58
|
-
* @return {String[]}
|
|
59
|
-
*/
|
|
60
|
-
getCurrentTokens(poolAddress: string): Promise<string[]>;
|
|
61
|
-
/**
|
|
62
|
-
* Get the final tokens composing this pool
|
|
63
|
-
* Returns tokens bounded to pool, after the pool was finalized
|
|
64
|
-
* @param {String} poolAddress
|
|
65
|
-
* @return {String[]}
|
|
66
|
-
*/
|
|
67
|
-
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
68
|
-
/**
|
|
69
|
-
* Returns the current controller address (ssBot)
|
|
70
|
-
* @param {String} poolAddress
|
|
71
|
-
* @return {String}
|
|
72
|
-
*/
|
|
73
|
-
getController(poolAddress: string): Promise<string>;
|
|
74
|
-
/**
|
|
75
|
-
* Returns the current baseToken address of the pool
|
|
76
|
-
* @param {String} poolAddress
|
|
77
|
-
* @return {String}
|
|
78
|
-
*/
|
|
79
|
-
getBaseToken(poolAddress: string): Promise<string>;
|
|
80
|
-
/**
|
|
81
|
-
* Returns the current datatoken address
|
|
82
|
-
* @param {String} poolAddress
|
|
83
|
-
* @return {String}
|
|
84
|
-
*/
|
|
85
|
-
getDatatoken(poolAddress: string): Promise<string>;
|
|
86
|
-
/**
|
|
87
|
-
* Get getMarketFee
|
|
88
|
-
* @param {String} poolAddress
|
|
89
|
-
* @return {String}
|
|
90
|
-
*/
|
|
91
|
-
getMarketFee(poolAddress: string): Promise<string>;
|
|
92
|
-
/**
|
|
93
|
-
* Get marketFeeCollector of this pool
|
|
94
|
-
* @param {String} poolAddress
|
|
95
|
-
* @return {String}
|
|
96
|
-
*/
|
|
97
|
-
getMarketFeeCollector(poolAddress: string): Promise<string>;
|
|
98
|
-
/**
|
|
99
|
-
* Get if a token is bounded to a pool
|
|
100
|
-
* Returns true if token is bound
|
|
101
|
-
* @param {String} poolAddress
|
|
102
|
-
* @param {String} token Address of the token to be checked
|
|
103
|
-
* @return {Boolean}
|
|
104
|
-
*/
|
|
105
|
-
isBound(poolAddress: string, token: string): Promise<boolean>;
|
|
106
|
-
/**
|
|
107
|
-
* Returns the current token reserve amount
|
|
108
|
-
* @param {String} poolAddress
|
|
109
|
-
* @param {String} token Address of the token to be checked
|
|
110
|
-
* @param {number} tokenDecimals optional number of decimals of the token
|
|
111
|
-
* @return {String}
|
|
112
|
-
*/
|
|
113
|
-
getReserve(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
114
|
-
/**
|
|
115
|
-
* Get if a pool is finalized
|
|
116
|
-
* Returns true if pool is finalized
|
|
117
|
-
* @param {String} poolAddress
|
|
118
|
-
* @return {Boolean}
|
|
119
|
-
*/
|
|
120
|
-
isFinalized(poolAddress: string): Promise<boolean>;
|
|
121
|
-
/**
|
|
122
|
-
* Returns the current Liquidity Providers swap fee
|
|
123
|
-
* @param {String} poolAddress
|
|
124
|
-
* @return {String} Swap fee. To get the percentage value, substract by 100. E.g. `0.1` represents a 10% swap fee.
|
|
125
|
-
*/
|
|
126
|
-
getSwapFee(poolAddress: string): Promise<string>;
|
|
127
|
-
/**
|
|
128
|
-
* Returns normalized weight of a token.
|
|
129
|
-
* The combined normalized weights of all tokens will sum up to 1.
|
|
130
|
-
* (Note: the actual sum may be 1 plus or minus a few wei due to division precision loss)
|
|
131
|
-
* @param {String} poolAddress
|
|
132
|
-
* @param {String} token token to be checked
|
|
133
|
-
* @return {String}
|
|
134
|
-
*/
|
|
135
|
-
getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
136
|
-
/**
|
|
137
|
-
* Returns denormalized weight of a token
|
|
138
|
-
* @param {String} poolAddress
|
|
139
|
-
* @param {String} token token to be checked
|
|
140
|
-
* @return {String}
|
|
141
|
-
*/
|
|
142
|
-
getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
|
|
143
|
-
/**
|
|
144
|
-
* getTotalDenormalizedWeight
|
|
145
|
-
* Returns total denormalized weught of the pool
|
|
146
|
-
* @param {String} poolAddress
|
|
147
|
-
* @return {String}
|
|
148
|
-
*/
|
|
149
|
-
getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
|
|
150
|
-
/**
|
|
151
|
-
* Returns the current fee of publishingMarket
|
|
152
|
-
* Get Market Fees available to be collected for a specific token
|
|
153
|
-
* @param {String} poolAddress
|
|
154
|
-
* @param {String} token token we want to check fees
|
|
155
|
-
* @param {number} tokenDecimals optional number of decimals of the token
|
|
156
|
-
* @return {String}
|
|
157
|
-
*/
|
|
158
|
-
getMarketFees(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
159
|
-
/**
|
|
160
|
-
* Get Community Get the current amount of fees which can be withdrawned by the Market
|
|
161
|
-
* @return {CurrentFees}
|
|
162
|
-
*/
|
|
163
|
-
getCurrentMarketFees(poolAddress: string): Promise<CurrentFees>;
|
|
164
|
-
/**
|
|
165
|
-
* Get getCurrentOPFFees Get the current amount of fees which can be withdrawned by OPF
|
|
166
|
-
* @return {CurrentFees}
|
|
167
|
-
*/
|
|
168
|
-
getCurrentOPCFees(poolAddress: string): Promise<CurrentFees>;
|
|
169
|
-
/**
|
|
170
|
-
* Get Community Fees available to be collected for a specific token
|
|
171
|
-
* @param {String} poolAddress
|
|
172
|
-
* @param {String} token token we want to check fees
|
|
173
|
-
* @param {number} tokenDecimals optional number of decimals of the token
|
|
174
|
-
* @return {String}
|
|
175
|
-
*/
|
|
176
|
-
getCommunityFees(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
177
|
-
/**
|
|
178
|
-
* Estimate gas cost for collectOPF
|
|
179
|
-
* @param {String} address
|
|
180
|
-
* @param {String} poolAddress
|
|
181
|
-
* @param {Contract} contractInstance optional contract instance
|
|
182
|
-
* @return {Promise<number>}
|
|
183
|
-
*/
|
|
184
|
-
estCollectOPC(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
|
|
185
|
-
/**
|
|
186
|
-
* collectOPF - collect opf fee - can be called by anyone
|
|
187
|
-
* @param {String} address
|
|
188
|
-
* @param {String} poolAddress
|
|
189
|
-
* @return {TransactionReceipt}
|
|
190
|
-
*/
|
|
191
|
-
collectOPC(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
192
|
-
/**
|
|
193
|
-
* Estimate gas cost for collectMarketFee
|
|
194
|
-
* @param {String} address
|
|
195
|
-
* @param {String} poolAddress
|
|
196
|
-
* @param {String} to address that will receive fees
|
|
197
|
-
* @param {Contract} contractInstance optional contract instance
|
|
198
|
-
* @return {Promise<number>}
|
|
199
|
-
*/
|
|
200
|
-
estCollectMarketFee(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
|
|
201
|
-
/**
|
|
202
|
-
* collectOPF - collect market fees - can be called by the publishMarketCollector
|
|
203
|
-
* @param {String} address
|
|
204
|
-
* @param {String} poolAddress
|
|
205
|
-
* @param {String} to address that will receive fees
|
|
206
|
-
* @return {TransactionReceipt}
|
|
207
|
-
*/
|
|
208
|
-
collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
209
|
-
/**
|
|
210
|
-
* Estimate gas cost for updatePublishMarketFee
|
|
211
|
-
* @param {String} address
|
|
212
|
-
* @param {String} poolAddress
|
|
213
|
-
* @param {String} newPublishMarketAddress new market address
|
|
214
|
-
* @param {String} newPublishMarketSwapFee new market swap fee
|
|
215
|
-
* @param {Contract} contractInstance optional contract instance
|
|
216
|
-
* @return {Promise<number>}
|
|
217
|
-
*/
|
|
218
|
-
estUpdatePublishMarketFee(address: string, poolAddress: string, newPublishMarketAddress: string, newPublishMarketSwapFee: string, contractInstance?: Contract): Promise<number>;
|
|
219
|
-
/**
|
|
220
|
-
* updatePublishMarketFee - sets a new newPublishMarketAddress and new newPublishMarketSwapFee- can be called only by the marketFeeCollector
|
|
221
|
-
* @param {String} address
|
|
222
|
-
* @param {String} poolAddress
|
|
223
|
-
* @param {String} newPublishMarketAddress new market fee collector address
|
|
224
|
-
* @param {String} newPublishMarketSwapFee fee recieved by the publisher market when a dt is swaped from a pool, percent
|
|
225
|
-
* @return {TransactionReceipt}
|
|
226
|
-
*/
|
|
227
|
-
updatePublishMarketFee(address: string, poolAddress: string, newPublishMarketAddress: string, newPublishMarketSwapFee: string): Promise<TransactionReceipt>;
|
|
228
|
-
/**
|
|
229
|
-
* Estimate gas cost for swapExactAmountIn
|
|
230
|
-
* @param {String} address
|
|
231
|
-
* @param {String} poolAddress
|
|
232
|
-
* @param {TokenInOutMarket} tokenInOutMarket object contianing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
233
|
-
* @param {AmountsInMaxFee} amountsInOutMaxFee object contianing tokenAmountIn, minAmountOut, maxPrice, consumeMarketSwapFee
|
|
234
|
-
* @param {Contract} contractInstance optional contract instance
|
|
235
|
-
* @return {Promise<number>}
|
|
236
|
-
*/
|
|
237
|
-
estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
|
|
238
|
-
/**
|
|
239
|
-
* Swaps an exact amount of tokensIn to get a mimum amount of tokenOut
|
|
240
|
-
* Trades an exact tokenAmountIn of tokenIn taken from the caller by the pool,
|
|
241
|
-
* in exchange for at least minAmountOut of tokenOut given to the caller from the pool, with a maximum marginal price of maxPrice.
|
|
242
|
-
* Returns (tokenAmountOut, spotPriceAfter), where tokenAmountOut is the amount of token that came out of the pool,
|
|
243
|
-
* and spotPriceAfter is the new marginal spot price, ie, the result of getSpotPrice after the call.
|
|
244
|
-
* (These values are what are limited by the arguments; you are guaranteed tokenAmountOut >= minAmountOut and spotPriceAfter <= maxPrice).
|
|
245
|
-
* @param {String} address
|
|
246
|
-
* @param {String} poolAddress
|
|
247
|
-
* @param {TokenInOutMarket} tokenInOutMarket object contianing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
248
|
-
* @param {AmountsInMaxFee} amountsInOutMaxFee object contianing tokenAmountIn, minAmountOut, maxPrice, consumeMarketSwapFee
|
|
249
|
-
* @return {TransactionReceipt}
|
|
250
|
-
*/
|
|
251
|
-
swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
|
|
252
|
-
/**
|
|
253
|
-
* Estimate gas cost for swapExactAmountOut
|
|
254
|
-
* @param {String} address
|
|
255
|
-
* @param {String} poolAddress
|
|
256
|
-
* @param {TokenInOutMarket} tokenInOutMarket
|
|
257
|
-
* @param {AmountsOutMaxFee} amountsInOutMaxFee
|
|
258
|
-
* @param {Contract} contractInstance optional contract instance
|
|
259
|
-
* @return {Promise<number>}
|
|
260
|
-
*/
|
|
261
|
-
estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
|
|
262
|
-
/**
|
|
263
|
-
* Swaps a maximum maxAmountIn of tokensIn to get an exact amount of tokenOut
|
|
264
|
-
* @param {String} account
|
|
265
|
-
* @param {String} poolAddress
|
|
266
|
-
* @param {TokenInOutMarket} tokenInOutMarket Object containing addresses like tokenIn, tokenOut, consumeMarketFeeAddress
|
|
267
|
-
* @param {AmountsOutMaxFee} amountsInOutMaxFee Object containging maxAmountIn,tokenAmountOut,maxPrice, consumeMarketSwapFee]
|
|
268
|
-
* @return {TransactionReceipt}
|
|
269
|
-
*/
|
|
270
|
-
swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
|
|
271
|
-
/**
|
|
272
|
-
* Estimate gas cost for joinswapExternAmountIn
|
|
273
|
-
* @param {String} address
|
|
274
|
-
* @param {String} poolAddress
|
|
275
|
-
* @param {String} tokenIn
|
|
276
|
-
* @param {String} tokenAmountIn exact number of base tokens to spend
|
|
277
|
-
* @param {String} minPoolAmountOut minimum of pool shares expectex
|
|
278
|
-
* @param {Contract} contractInstance optional contract instance
|
|
279
|
-
* @return {Promise<number>}
|
|
280
|
-
*/
|
|
281
|
-
estJoinswapExternAmountIn(address: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
282
|
-
/**
|
|
283
|
-
* Single side add liquidity to the pool,
|
|
284
|
-
* expecting a minPoolAmountOut of shares for spending tokenAmountIn basetokens.
|
|
285
|
-
* Pay tokenAmountIn of baseToken to join the pool, getting poolAmountOut of the pool shares.
|
|
286
|
-
* @param {String} account
|
|
287
|
-
* @param {String} poolAddress
|
|
288
|
-
* @param {String} tokenAmountIn exact number of base tokens to spend
|
|
289
|
-
* @param {String} minPoolAmountOut minimum of pool shares expectex
|
|
290
|
-
* @param {number} tokenInDecimals optional number of decimals of the token
|
|
291
|
-
* @return {TransactionReceipt}
|
|
292
|
-
*/
|
|
293
|
-
joinswapExternAmountIn(account: string, poolAddress: string, tokenAmountIn: string, minPoolAmountOut: string, tokenInDecimals?: number): Promise<TransactionReceipt>;
|
|
294
|
-
/**
|
|
295
|
-
* Estimate gas cost for exitswapPoolAmountIn
|
|
296
|
-
* @param {String} address
|
|
297
|
-
* @param {String} poolAddress
|
|
298
|
-
* @param {String} poolAmountIn exact number of pool shares to spend
|
|
299
|
-
* @param {String} minTokenAmountOut minimum amount of basetokens expected
|
|
300
|
-
* @param {Contract} contractInstance optional contract instance
|
|
301
|
-
* @return {Promise<number>}
|
|
302
|
-
*/
|
|
303
|
-
estExitswapPoolAmountIn(address: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string, contractInstance?: Contract): Promise<number>;
|
|
304
|
-
/**
|
|
305
|
-
* Single side remove liquidity from the pool,
|
|
306
|
-
* expecting a minAmountOut of basetokens for spending poolAmountIn pool shares
|
|
307
|
-
* Pay poolAmountIn pool shares into the pool, getting minTokenAmountOut of the baseToken
|
|
308
|
-
* @param {String} account
|
|
309
|
-
* @param {String} poolAddress
|
|
310
|
-
* @param {String} poolAmountIn exact number of pool shares to spend
|
|
311
|
-
* @param {String} minTokenAmountOut minimum amount of basetokens expected
|
|
312
|
-
* @param {number} poolDecimals optional number of decimals of the poool
|
|
313
|
-
* @return {TransactionReceipt}
|
|
314
|
-
*/
|
|
315
|
-
exitswapPoolAmountIn(account: string, poolAddress: string, poolAmountIn: string, minTokenAmountOut: string, poolDecimals?: number): Promise<TransactionReceipt>;
|
|
316
|
-
/**
|
|
317
|
-
* Return the spot price of swapping tokenIn to tokenOut
|
|
318
|
-
* @param {String} poolAddress
|
|
319
|
-
* @param {String} tokenIn in token
|
|
320
|
-
* @param {String} tokenOut out token
|
|
321
|
-
* @param {String} swapMarketFe consume market swap fee
|
|
322
|
-
* @return {String}
|
|
323
|
-
*/
|
|
324
|
-
getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
|
|
325
|
-
/**
|
|
326
|
-
* How many tokensIn do you need in order to get exact tokenAmountOut.
|
|
327
|
-
* Returns: tokenAmountIn, swapFee, opcFee , consumeMarketSwapFee, publishMarketSwapFee
|
|
328
|
-
* Returns: tokenAmountIn, LPFee, opcFee , publishMarketSwapFee, consumeMarketSwapFee
|
|
329
|
-
* @param tokenIn token to be swaped
|
|
330
|
-
* @param tokenOut token to get
|
|
331
|
-
* @param tokenAmountOut exact amount of tokenOut
|
|
332
|
-
* @param swapMarketFee consume market swap fee
|
|
333
|
-
* @param {number} tokenInDecimals optional number of decimals of the token to be swaped
|
|
334
|
-
* @param {number} tokenOutDecimals optional number of decimals of the token to get
|
|
335
|
-
*/
|
|
336
|
-
getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string, tokenInDecimals?: number, tokenOutDecimals?: number): Promise<PoolPriceAndFees>;
|
|
337
|
-
/**
|
|
338
|
-
* How many tokensOut you will get for a exact tokenAmountIn
|
|
339
|
-
* Returns: tokenAmountOut, LPFee, opcFee , publishMarketSwapFee, consumeMarketSwapFee
|
|
340
|
-
* @param tokenIn token to be swaped
|
|
341
|
-
* @param tokenOut token to get
|
|
342
|
-
* @param tokenAmountIn exact amount of tokenIn
|
|
343
|
-
* @param swapMarketFee
|
|
344
|
-
* @param {number} tokenInDecimals optional number of decimals of the token to be swaped
|
|
345
|
-
* @param {number} tokenOutDecimals optional number of decimals of the token to get
|
|
346
|
-
*/
|
|
347
|
-
getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string, tokenInDecimals?: number, tokenOutDecimals?: number): Promise<PoolPriceAndFees>;
|
|
348
|
-
/**
|
|
349
|
-
* Returns number of poolshares obtain by staking exact tokenAmountIn tokens
|
|
350
|
-
* @param tokenIn tokenIn
|
|
351
|
-
* @param tokenAmountIn exact number of tokens staked
|
|
352
|
-
* @param {number} poolDecimals optional number of decimals of the poool
|
|
353
|
-
* @param {number} tokenInDecimals optional number of decimals of the token
|
|
354
|
-
*/
|
|
355
|
-
calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string, poolDecimals?: number, tokenInDecimals?: number): Promise<string>;
|
|
356
|
-
/**
|
|
357
|
-
* Returns number of tokens to be staked to the pool in order to get an exact number of poolshares
|
|
358
|
-
* @param tokenIn tokenIn
|
|
359
|
-
* @param poolAmountOut expected amount of pool shares
|
|
360
|
-
* @param {number} poolDecimals optional number of decimals of the pool
|
|
361
|
-
* @param {number} tokenInDecimals optional number of decimals of the token
|
|
362
|
-
*/
|
|
363
|
-
calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string, poolDecimals?: number, tokenInDecimals?: number): Promise<string>;
|
|
364
|
-
/**
|
|
365
|
-
* Returns expected amount of tokenOut for removing exact poolAmountIn pool shares from the pool
|
|
366
|
-
* @param tokenOut tokenOut
|
|
367
|
-
* @param poolAmountIn amount of shares spent
|
|
368
|
-
* @param {number} poolDecimals optional number of decimals of the pool
|
|
369
|
-
* @param {number} tokenOutDecimals optional number of decimals of the token
|
|
370
|
-
*/
|
|
371
|
-
calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string, poolDecimals?: number, tokenOutDecimals?: number): Promise<string>;
|
|
372
|
-
/**
|
|
373
|
-
* Returns number of poolshares needed to withdraw exact tokenAmountOut tokens
|
|
374
|
-
* @param tokenOut tokenOut
|
|
375
|
-
* @param tokenAmountOut expected amount of tokensOut
|
|
376
|
-
* @param {number} poolDecimals optional number of decimals of the pool
|
|
377
|
-
* @param {number} tokenOutDecimals optional number of decimals of the token
|
|
378
|
-
*/
|
|
379
|
-
calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string, poolDecimals?: number, tokenOutDecimals?: number): Promise<string>;
|
|
380
|
-
/**
|
|
381
|
-
* Get LOG_SWAP encoded topic
|
|
382
|
-
* @return {String}
|
|
383
|
-
*/
|
|
384
|
-
getSwapEventSignature(): string;
|
|
385
|
-
/**
|
|
386
|
-
* Get LOG_JOIN encoded topic
|
|
387
|
-
* @return {String}
|
|
388
|
-
*/
|
|
389
|
-
getJoinEventSignature(): string;
|
|
390
|
-
/**
|
|
391
|
-
* Get LOG_EXIT encoded topic
|
|
392
|
-
* @return {String}
|
|
393
|
-
*/
|
|
394
|
-
getExitEventSignature(): string;
|
|
395
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Pool';
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import Web3 from 'web3';
|
|
2
|
-
import { AbiItem } from 'web3-utils';
|
|
3
|
-
import { Contract } from 'web3-eth-contract';
|
|
4
|
-
import { TransactionReceipt } from 'web3-eth';
|
|
5
|
-
import { Datatoken } from '../../tokens';
|
|
6
|
-
import { Config } from '../../models/index.js';
|
|
7
|
-
export interface DispenserToken {
|
|
8
|
-
active: boolean;
|
|
9
|
-
owner: string;
|
|
10
|
-
maxTokens: string;
|
|
11
|
-
maxBalance: string;
|
|
12
|
-
balance: string;
|
|
13
|
-
isMinter: boolean;
|
|
14
|
-
allowedSwapper: string;
|
|
15
|
-
}
|
|
16
|
-
export declare class Dispenser {
|
|
17
|
-
web3: Web3;
|
|
18
|
-
dispenserAddress: string;
|
|
19
|
-
config: Config;
|
|
20
|
-
dispenserAbi: AbiItem | AbiItem[];
|
|
21
|
-
dispenserContract: Contract;
|
|
22
|
-
/**
|
|
23
|
-
* Instantiate Dispenser
|
|
24
|
-
* @param {any} web3
|
|
25
|
-
* @param {String} dispenserAddress
|
|
26
|
-
* @param {any} dispenserABI
|
|
27
|
-
*/
|
|
28
|
-
constructor(web3: Web3, network?: string | number, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
|
|
29
|
-
/**
|
|
30
|
-
* Get information about a datatoken dispenser
|
|
31
|
-
* @param {String} dtAddress
|
|
32
|
-
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
33
|
-
*/
|
|
34
|
-
status(dtAdress: string): Promise<DispenserToken>;
|
|
35
|
-
/**
|
|
36
|
-
* Estimate gas cost for create method
|
|
37
|
-
* @param {String} dtAddress Datatoken address
|
|
38
|
-
* @param {String} address Owner address
|
|
39
|
-
* @param {String} maxTokens max tokens to dispense
|
|
40
|
-
* @param {String} maxBalance max balance of requester
|
|
41
|
-
* @param {String} allowedSwapper if !=0, only this address can request DTs
|
|
42
|
-
* @return {Promise<any>}
|
|
43
|
-
*/
|
|
44
|
-
estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new Dispenser
|
|
47
|
-
* @param {String} dtAddress Datatoken address
|
|
48
|
-
* @param {String} address Owner address
|
|
49
|
-
* @param {String} maxTokens max tokens to dispense
|
|
50
|
-
* @param {String} maxBalance max balance of requester
|
|
51
|
-
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
|
52
|
-
* @return {Promise<TransactionReceipt>} transactionId
|
|
53
|
-
*/
|
|
54
|
-
create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
|
|
55
|
-
/**
|
|
56
|
-
* Estimate gas for activate method
|
|
57
|
-
* @param {String} dtAddress
|
|
58
|
-
* @param {Number} maxTokens max amount of tokens to dispense
|
|
59
|
-
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
60
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
61
|
-
* @return {Promise<any>}
|
|
62
|
-
*/
|
|
63
|
-
estGasActivate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<any>;
|
|
64
|
-
/**
|
|
65
|
-
* Activates a new dispener.
|
|
66
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
67
|
-
* @param {Number} maxTokens max amount of tokens to dispense
|
|
68
|
-
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
69
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
70
|
-
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
71
|
-
*/
|
|
72
|
-
activate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<TransactionReceipt>;
|
|
73
|
-
/**
|
|
74
|
-
* Estimate gas for deactivate method
|
|
75
|
-
* @param {String} dtAddress
|
|
76
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
77
|
-
* @return {Promise<any>}
|
|
78
|
-
*/
|
|
79
|
-
estGasDeactivate(dtAddress: string, address: string): Promise<any>;
|
|
80
|
-
/**
|
|
81
|
-
* Deactivate an existing dispenser.
|
|
82
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
83
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
84
|
-
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
85
|
-
*/
|
|
86
|
-
deactivate(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
87
|
-
/**
|
|
88
|
-
* Estimate gas for setAllowedSwapper method
|
|
89
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
90
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
91
|
-
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
92
|
-
* @return {Promise<any>}
|
|
93
|
-
*/
|
|
94
|
-
estGasSetAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<any>;
|
|
95
|
-
/**
|
|
96
|
-
* Sets a new allowedSwapper.
|
|
97
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
98
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
99
|
-
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
100
|
-
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
101
|
-
*/
|
|
102
|
-
setAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
|
|
103
|
-
/**
|
|
104
|
-
* Estimate gas for dispense method
|
|
105
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
106
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
107
|
-
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
108
|
-
* @return {Promise<any>}
|
|
109
|
-
*/
|
|
110
|
-
estGasDispense(dtAddress: string, address: string, amount: string, destination: string): Promise<any>;
|
|
111
|
-
/**
|
|
112
|
-
* Dispense datatokens to caller.
|
|
113
|
-
* The dispenser must be active, hold enough DT (or be able to mint more)
|
|
114
|
-
* and respect maxTokens/maxBalance requirements
|
|
115
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
116
|
-
* @param {String} address User address
|
|
117
|
-
* @param {String} amount amount of datatokens required.
|
|
118
|
-
* @param {String} destination who will receive the tokens
|
|
119
|
-
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
120
|
-
*/
|
|
121
|
-
dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
|
|
122
|
-
/**
|
|
123
|
-
* Estimate gas for ownerWithdraw method
|
|
124
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
125
|
-
* @param {String} address User address (must be owner of the datatoken)
|
|
126
|
-
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
127
|
-
* @return {Promise<any>}
|
|
128
|
-
*/
|
|
129
|
-
estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
|
|
130
|
-
/**
|
|
131
|
-
* Withdraw all tokens from the dispenser
|
|
132
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
133
|
-
* @param {String} address User address (must be owner of the dispenser)
|
|
134
|
-
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
135
|
-
*/
|
|
136
|
-
ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
137
|
-
/**
|
|
138
|
-
* Check if tokens can be dispensed
|
|
139
|
-
* @param {String} dtAddress
|
|
140
|
-
* @param {String} address User address that will receive datatokens
|
|
141
|
-
* @param {String} amount amount of datatokens required.
|
|
142
|
-
* @return {Promise<Boolean>}
|
|
143
|
-
*/
|
|
144
|
-
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
145
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Dispenser';
|