@oceanprotocol/lib 1.0.0-next.9 → 1.1.1
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 +408 -1
- package/CodeExamples.md +929 -0
- package/README.md +12 -80
- 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 +83 -0
- package/dist/src/@types/Compute.d.ts +18 -1
- package/dist/src/@types/DDO/DDO.d.ts +43 -0
- package/dist/src/@types/DDO/Event.d.ts +20 -0
- package/dist/src/@types/DDO/Metadata.d.ts +92 -0
- package/dist/src/@types/DDO/Service.d.ts +72 -6
- package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
- package/dist/src/@types/Erc20.d.ts +21 -0
- package/dist/src/{interfaces/Erc721Interface.d.ts → @types/Erc721.d.ts} +2 -2
- package/dist/src/@types/File.d.ts +23 -0
- package/dist/src/@types/FileInfo.d.ts +38 -0
- package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
- package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
- package/dist/src/@types/Provider.d.ts +9 -0
- package/dist/src/@types/Router.d.ts +59 -0
- package/dist/src/@types/index.d.ts +8 -1
- package/dist/src/aquarius/Aquarius.d.ts +23 -1
- package/dist/src/factories/NFTFactory.d.ts +222 -14
- package/dist/src/index.d.ts +1 -1
- package/dist/src/models/Config.d.ts +128 -0
- package/dist/src/pools/Router.d.ts +189 -8
- package/dist/src/pools/balancer/Pool.d.ts +354 -29
- package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +309 -17
- package/dist/src/pools/index.d.ts +2 -0
- package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
- package/dist/src/provider/Provider.d.ts +127 -8
- package/dist/src/tokens/Datatoken.d.ts +347 -8
- package/dist/src/tokens/NFT.d.ts +297 -5
- package/dist/src/utils/ContractUtils.d.ts +13 -4
- package/dist/src/utils/DatatokenName.d.ts +4 -0
- package/dist/src/utils/General.d.ts +4 -0
- package/dist/src/utils/PoolHelpers.d.ts +8 -0
- package/dist/src/utils/SignatureUtils.d.ts +0 -2
- package/dist/src/utils/TokenUtils.d.ts +82 -3
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/test/TestContractHandler.d.ts +8 -36
- package/dist/test/config.d.ts +5 -0
- package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
- package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
- package/package.json +42 -37
- package/dist/src/@types/FileMetadata.d.ts +0 -9
- package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
- package/dist/src/interfaces/RouterInterface.d.ts +0 -12
- package/dist/src/interfaces/index.d.ts +0 -5
- package/dist/test/integration/config.d.ts +0 -3
- package/dist/test/unit/config.d.ts +0 -3
- package/docs/beginners_guide.md +0 -338
- package/docs/get-test-OCEAN.md +0 -24
- package/docs/overview.md +0 -394
- package/docs/quickstart_marketplace.md +0 -423
- package/docs/quickstart_simple.md +0 -272
- package/docs/services.md +0 -94
- package/docs/wallets.md +0 -98
|
@@ -2,46 +2,227 @@ import { Contract } from 'web3-eth-contract';
|
|
|
2
2
|
import Web3 from 'web3';
|
|
3
3
|
import { TransactionReceipt } from 'web3-core';
|
|
4
4
|
import { AbiItem } from 'web3-utils';
|
|
5
|
-
import { Operation } from '
|
|
5
|
+
import { Operation } from '../@types/Router';
|
|
6
6
|
import { Config } from '../models/index.js';
|
|
7
|
+
/**
|
|
8
|
+
* Provides an interface for FactoryRouter contract
|
|
9
|
+
*/
|
|
7
10
|
export declare class Router {
|
|
8
|
-
GASLIMIT_DEFAULT: number;
|
|
9
11
|
routerAddress: string;
|
|
10
12
|
RouterAbi: AbiItem | AbiItem[];
|
|
11
13
|
web3: Web3;
|
|
12
14
|
config: Config;
|
|
13
15
|
router: Contract;
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Instantiate Router.
|
|
18
|
+
* @param {String} routerAddress
|
|
19
|
+
* @param {AbiItem | AbiItem[]} Router
|
|
20
|
+
* @param {Web3} web3
|
|
21
|
+
*/
|
|
22
|
+
constructor(routerAddress: string, web3: Web3, network?: string | number, RouterAbi?: AbiItem | AbiItem[], config?: Config);
|
|
23
|
+
/**
|
|
24
|
+
* Estimate gas cost for buyDTBatch method
|
|
25
|
+
* @param {String} address
|
|
26
|
+
* @param {Operation} operations Operations objects array
|
|
27
|
+
* @return {Promise<TransactionReceipt>} Transaction receipt
|
|
28
|
+
*/
|
|
15
29
|
estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* BuyDTBatch
|
|
32
|
+
* @param {String} address
|
|
33
|
+
* @param {Operation} operations Operations objects array
|
|
34
|
+
* @return {Promise<TransactionReceipt>} Transaction receipt
|
|
35
|
+
*/
|
|
16
36
|
buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
|
|
17
|
-
|
|
37
|
+
/** Check if a token is on approved tokens list, if true opfFee is lower in pools with that token/DT
|
|
38
|
+
* @return {Promise<boolean>} true if is on the list.
|
|
39
|
+
*/
|
|
40
|
+
isApprovedToken(address: string): Promise<boolean>;
|
|
41
|
+
/** Check if an address is a side staking contract.
|
|
42
|
+
* @return {Promise<boolean>} true if is a SS contract
|
|
43
|
+
*/
|
|
18
44
|
isSideStaking(address: string): Promise<boolean>;
|
|
45
|
+
/** Check if an address is a Fixed Rate contract.
|
|
46
|
+
* @return {Promise<boolean>} true if is a Fixed Rate contract
|
|
47
|
+
*/
|
|
19
48
|
isFixedPrice(address: string): Promise<boolean>;
|
|
49
|
+
/** Get Router Owner
|
|
50
|
+
* @return {Promise<string>} Router Owner address
|
|
51
|
+
*/
|
|
20
52
|
getOwner(): Promise<string>;
|
|
53
|
+
/** Get NFT Factory address
|
|
54
|
+
* @return {Promise<string>} NFT Factory address
|
|
55
|
+
*/
|
|
21
56
|
getNFTFactory(): Promise<string>;
|
|
57
|
+
/** Check if an address is a pool template contract.
|
|
58
|
+
* @return {Promise<boolean>} true if is a Template
|
|
59
|
+
*/
|
|
22
60
|
isPoolTemplate(address: string): Promise<boolean>;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Estimate gas cost for addApprovedToken
|
|
63
|
+
* @param {String} address
|
|
64
|
+
* @param {String} tokenAddress token address we want to add
|
|
65
|
+
* @param {Contract} routerContract optional contract instance
|
|
66
|
+
* @return {Promise<any>}
|
|
67
|
+
*/
|
|
68
|
+
estGasAddApprovedToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Add a new token to oceanTokens list, pools with baseToken in this list have NO opf Fee
|
|
71
|
+
* @param {String} address caller address
|
|
72
|
+
* @param {String} tokenAddress token address to add
|
|
73
|
+
* @return {Promise<TransactionReceipt>}
|
|
74
|
+
*/
|
|
75
|
+
addApprovedToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
76
|
+
/**
|
|
77
|
+
* Estimate gas cost for removeApprovedToken
|
|
78
|
+
* @param {String} address caller address
|
|
79
|
+
* @param {String} tokenAddress token address we want to add
|
|
80
|
+
* @param {Contract} routerContract optional contract instance
|
|
81
|
+
* @return {Promise<any>}
|
|
82
|
+
*/
|
|
83
|
+
estGasRemoveApprovedToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* Remove a token from oceanTokens list, pools without baseToken in this list have a opf Fee
|
|
86
|
+
* @param {String} address
|
|
87
|
+
* @param {String} tokenAddress address to remove
|
|
88
|
+
* @return {Promise<TransactionReceipt>}
|
|
89
|
+
*/
|
|
90
|
+
removeApprovedToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
91
|
+
/**
|
|
92
|
+
* Estimate gas cost for addSSContract method
|
|
93
|
+
* @param {String} address
|
|
94
|
+
* @param {String} tokenAddress contract address to add
|
|
95
|
+
* @return {Promise<TransactionReceipt>}
|
|
96
|
+
*/
|
|
27
97
|
estGasAddSSContract(address: string, tokenAddress: string): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* Add a new contract to ssContract list, after is added, can be used when deploying a new pool
|
|
100
|
+
* @param {String} address
|
|
101
|
+
* @param {String} tokenAddress contract address to add
|
|
102
|
+
* @return {Promise<TransactionReceipt>}
|
|
103
|
+
*/
|
|
28
104
|
addSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
105
|
+
/**
|
|
106
|
+
* Estimate gas cost for removeSSContract method
|
|
107
|
+
* @param {String} address caller address
|
|
108
|
+
* @param {String} tokenAddress contract address to add
|
|
109
|
+
* @return {Promise<TransactionReceipt>}
|
|
110
|
+
*/
|
|
29
111
|
estGasRemoveSSContract(address: string, tokenAddress: string): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* Removes a new contract from ssContract list
|
|
114
|
+
* @param {String} address caller address
|
|
115
|
+
* @param {String} tokenAddress contract address to removed
|
|
116
|
+
* @return {Promise<TransactionReceipt>}
|
|
117
|
+
*/
|
|
30
118
|
removeSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
119
|
+
/**
|
|
120
|
+
* Estimate gas cost for addFixedRateContract method
|
|
121
|
+
* @param {String} address
|
|
122
|
+
* @param {String} tokenAddress contract address to add
|
|
123
|
+
* @return {Promise<TransactionReceipt>}
|
|
124
|
+
*/
|
|
31
125
|
estGasAddFixedRateContract(address: string, tokenAddress: string): Promise<any>;
|
|
126
|
+
/**
|
|
127
|
+
* Add a new contract to fixedRate list, after is added, can be used when deploying a new pool
|
|
128
|
+
* @param {String} address
|
|
129
|
+
* @param {String} tokenAddress contract address to add
|
|
130
|
+
* @return {Promise<TransactionReceipt>}
|
|
131
|
+
*/
|
|
32
132
|
addFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
133
|
+
/**
|
|
134
|
+
* Estimate gas cost for addFixedRateContract method
|
|
135
|
+
* @param {String} address
|
|
136
|
+
* @param {String} tokenAddress contract address to add
|
|
137
|
+
* @return {Promise<TransactionReceipt>}
|
|
138
|
+
*/
|
|
33
139
|
estGasRemoveFixedRateContract(address: string, tokenAddress: string): Promise<any>;
|
|
140
|
+
/**
|
|
141
|
+
* Removes a contract from fixedRate list
|
|
142
|
+
* @param {String} address
|
|
143
|
+
* @param {String} tokenAddress contract address to add
|
|
144
|
+
* @return {Promise<TransactionReceipt>}
|
|
145
|
+
*/
|
|
34
146
|
removeFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
147
|
+
/**
|
|
148
|
+
* Estimate gas cost for addDispenserContract method
|
|
149
|
+
* @param {String} address
|
|
150
|
+
* @param {String} tokenAddress contract address to add
|
|
151
|
+
* @return {Promise<TransactionReceipt>}
|
|
152
|
+
*/
|
|
35
153
|
estGasAddDispenserContract(address: string, tokenAddress: string): Promise<any>;
|
|
154
|
+
/**
|
|
155
|
+
* Add a new contract to dispenser list, after is added, can be used when deploying a new pool
|
|
156
|
+
* @param {String} address
|
|
157
|
+
* @param {String} tokenAddress contract address to add
|
|
158
|
+
* @return {Promise<TransactionReceipt>}
|
|
159
|
+
*/
|
|
36
160
|
addDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
161
|
+
/**
|
|
162
|
+
* Estimate gas cost for addDispenserContract method
|
|
163
|
+
* @param {String} address
|
|
164
|
+
* @param {String} tokenAddress contract address to add
|
|
165
|
+
* @return {Promise<TransactionReceipt>}
|
|
166
|
+
*/
|
|
37
167
|
estGasRemoveDispenserContract(address: string, tokenAddress: string): Promise<any>;
|
|
168
|
+
/**
|
|
169
|
+
* Add a new contract to dispenser list, after is added, can be used when deploying a new pool
|
|
170
|
+
* @param {String} address
|
|
171
|
+
* @param {String} tokenAddress contract address to add
|
|
172
|
+
* @return {Promise<TransactionReceipt>}
|
|
173
|
+
*/
|
|
38
174
|
removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
|
|
175
|
+
/** Get OPF Fee per token
|
|
176
|
+
* @return {Promise<number>} OPC fee for a specific baseToken
|
|
177
|
+
*/
|
|
39
178
|
getOPCFee(baseToken: string): Promise<number>;
|
|
179
|
+
/** Get Current OPF Fee
|
|
180
|
+
* @return {Promise<number>} OPF fee
|
|
181
|
+
*/
|
|
40
182
|
getCurrentOPCFee(): Promise<number>;
|
|
183
|
+
/**
|
|
184
|
+
* Estimate gas cost for updateOPFFee method
|
|
185
|
+
* @param {String} address
|
|
186
|
+
* @param {String} newFee new OPF Fee
|
|
187
|
+
* @return {Promise<TransactionReceipt>}
|
|
188
|
+
*/
|
|
41
189
|
estGasUpdateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<any>;
|
|
190
|
+
/**
|
|
191
|
+
* Add a new contract to fixedRate list, after is added, can be used when deploying a new pool
|
|
192
|
+
* @param {String} address
|
|
193
|
+
* @param {number} newSwapOceanFee Amount charged for swapping with ocean approved tokens
|
|
194
|
+
* @param {number} newSwapNonOceanFee Amount charged for swapping with non ocean approved tokens
|
|
195
|
+
* @param {number} newConsumeFee Amount charged from consumeFees
|
|
196
|
+
* @param {number} newProviderFee Amount charged for providerFees
|
|
197
|
+
* @return {Promise<TransactionReceipt>}
|
|
198
|
+
*/
|
|
42
199
|
updateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<TransactionReceipt>;
|
|
200
|
+
/**
|
|
201
|
+
* Estimate gas cost for addPoolTemplate method
|
|
202
|
+
* @param {String} address
|
|
203
|
+
* @param {String} templateAddress template address to add
|
|
204
|
+
* @return {Promise<TransactionReceipt>}
|
|
205
|
+
*/
|
|
43
206
|
estGasAddPoolTemplate(address: string, templateAddress: string): Promise<any>;
|
|
207
|
+
/**
|
|
208
|
+
* Add a new template to poolTemplates mapping, after template is added,it can be used
|
|
209
|
+
* @param {String} address
|
|
210
|
+
* @param {String} templateAddress template address to add
|
|
211
|
+
* @return {Promise<TransactionReceipt>}
|
|
212
|
+
*/
|
|
44
213
|
addPoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
214
|
+
/**
|
|
215
|
+
* Estimate gas cost for removePoolTemplate method
|
|
216
|
+
* @param {String} address
|
|
217
|
+
* @param {String} templateAddress template address to remove
|
|
218
|
+
* @return {Promise<TransactionReceipt>}
|
|
219
|
+
*/
|
|
45
220
|
estGasRemovePoolTemplate(address: string, templateAddress: string): Promise<any>;
|
|
221
|
+
/**
|
|
222
|
+
* Remove template from poolTemplates mapping, after template is removed,it can be used anymore
|
|
223
|
+
* @param {String} address
|
|
224
|
+
* @param {String} templateAddress template address to remove
|
|
225
|
+
* @return {Promise<TransactionReceipt>}
|
|
226
|
+
*/
|
|
46
227
|
removePoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
|
|
47
228
|
}
|
|
@@ -2,69 +2,394 @@ 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 {
|
|
6
|
-
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee } from '../../interfaces';
|
|
5
|
+
import { CurrentFees, TokenInOutMarket, AmountsInMaxFee, AmountsOutMaxFee, PoolPriceAndFees } from '../../@types';
|
|
7
6
|
import { Config } from '../../models';
|
|
7
|
+
/**
|
|
8
|
+
* Provides an interface to Ocean friendly fork from Balancer BPool
|
|
9
|
+
*/
|
|
8
10
|
export declare class Pool {
|
|
9
11
|
poolAbi: AbiItem | AbiItem[];
|
|
10
12
|
web3: Web3;
|
|
11
|
-
GASLIMIT_DEFAULT: number;
|
|
12
|
-
private logger;
|
|
13
13
|
private config;
|
|
14
|
-
constructor(web3: Web3,
|
|
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
|
+
*/
|
|
15
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
|
+
*/
|
|
16
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
|
+
*/
|
|
17
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
|
+
*/
|
|
18
47
|
getNumTokens(poolAddress: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Get total supply of pool shares
|
|
50
|
+
* @param {String} poolAddress
|
|
51
|
+
* @return {String}
|
|
52
|
+
*/
|
|
19
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
|
+
*/
|
|
20
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
|
+
*/
|
|
21
67
|
getFinalTokens(poolAddress: string): Promise<string[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Returns the current controller address (ssBot)
|
|
70
|
+
* @param {String} poolAddress
|
|
71
|
+
* @return {String}
|
|
72
|
+
*/
|
|
22
73
|
getController(poolAddress: string): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the current baseToken address of the pool
|
|
76
|
+
* @param {String} poolAddress
|
|
77
|
+
* @return {String}
|
|
78
|
+
*/
|
|
23
79
|
getBaseToken(poolAddress: string): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the current datatoken address
|
|
82
|
+
* @param {String} poolAddress
|
|
83
|
+
* @return {String}
|
|
84
|
+
*/
|
|
24
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
|
+
*/
|
|
25
97
|
getMarketFeeCollector(poolAddress: string): Promise<string>;
|
|
26
|
-
|
|
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
|
+
*/
|
|
27
105
|
isBound(poolAddress: string, token: string): Promise<boolean>;
|
|
28
|
-
|
|
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
|
+
*/
|
|
29
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
|
+
*/
|
|
30
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
|
+
*/
|
|
31
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
|
+
*/
|
|
32
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
|
+
*/
|
|
33
149
|
getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
|
|
34
|
-
|
|
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
|
+
*/
|
|
35
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
|
+
*/
|
|
36
168
|
getCurrentOPCFees(poolAddress: string): Promise<CurrentFees>;
|
|
37
|
-
|
|
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
|
+
*/
|
|
38
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
|
+
*/
|
|
39
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
|
+
*/
|
|
40
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
|
+
*/
|
|
41
208
|
collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
42
|
-
|
|
43
|
-
|
|
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
|
+
*/
|
|
44
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
|
+
*/
|
|
45
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
|
+
*/
|
|
46
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
|
+
*/
|
|
47
270
|
swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
*/
|
|
60
324
|
getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
+
*/
|
|
67
384
|
getSwapEventSignature(): string;
|
|
385
|
+
/**
|
|
386
|
+
* Get LOG_JOIN encoded topic
|
|
387
|
+
* @return {String}
|
|
388
|
+
*/
|
|
68
389
|
getJoinEventSignature(): string;
|
|
390
|
+
/**
|
|
391
|
+
* Get LOG_EXIT encoded topic
|
|
392
|
+
* @return {String}
|
|
393
|
+
*/
|
|
69
394
|
getExitEventSignature(): string;
|
|
70
395
|
}
|