@oceanprotocol/lib 0.20.2 → 1.0.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +1 -1
  3. package/dist/lib.js +2 -0
  4. package/dist/lib.js.map +1 -0
  5. package/dist/lib.modern.js +2 -0
  6. package/dist/lib.modern.js.map +1 -0
  7. package/dist/lib.module.js +2 -0
  8. package/dist/lib.module.js.map +1 -0
  9. package/dist/lib.umd.js +2 -0
  10. package/dist/lib.umd.js.map +1 -0
  11. package/dist/src/@types/Asset.d.ts +119 -0
  12. package/dist/{node/ocean/interfaces → src/@types}/Compute.d.ts +13 -12
  13. package/dist/src/@types/DDO/Credentials.d.ts +8 -0
  14. package/dist/src/@types/DDO/DDO.d.ts +58 -0
  15. package/dist/src/@types/DDO/Event.d.ts +27 -0
  16. package/dist/src/@types/DDO/Metadata.d.ts +126 -0
  17. package/dist/src/@types/DDO/Service.d.ts +124 -0
  18. package/dist/src/@types/Dispenser.d.ts +7 -0
  19. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  20. package/dist/src/@types/Erc20.d.ts +11 -0
  21. package/dist/src/@types/Erc721.d.ts +12 -0
  22. package/dist/src/@types/FileMetadata.d.ts +38 -0
  23. package/dist/src/@types/FixedPrice.d.ts +19 -0
  24. package/dist/src/@types/Pool.d.ts +36 -0
  25. package/dist/src/@types/Provider.d.ts +16 -0
  26. package/dist/src/@types/Router.d.ts +59 -0
  27. package/dist/src/@types/index.d.ts +14 -0
  28. package/dist/src/aquarius/Aquarius.d.ts +36 -0
  29. package/dist/src/aquarius/index.d.ts +1 -0
  30. package/dist/src/factories/NFTFactory.d.ts +273 -0
  31. package/dist/src/factories/index.d.ts +1 -0
  32. package/dist/src/index.d.ts +7 -0
  33. package/dist/src/models/Config.d.ts +166 -0
  34. package/dist/src/models/index.d.ts +1 -0
  35. package/dist/src/pools/Router.d.ts +229 -0
  36. package/dist/src/pools/balancer/Pool.d.ts +408 -0
  37. package/dist/src/pools/balancer/index.d.ts +1 -0
  38. package/dist/src/pools/dispenser/Dispenser.d.ts +146 -0
  39. package/dist/src/pools/dispenser/index.d.ts +1 -0
  40. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +375 -0
  41. package/dist/src/pools/fixedRate/index.d.ts +1 -0
  42. package/dist/src/pools/index.d.ts +3 -0
  43. package/dist/src/pools/ssContracts/SideStaking.d.ts +132 -0
  44. package/dist/src/pools/ssContracts/index.d.ts +1 -0
  45. package/dist/src/provider/Provider.d.ts +142 -0
  46. package/dist/src/provider/index.d.ts +1 -0
  47. package/dist/src/tokens/Datatoken.d.ts +362 -0
  48. package/dist/src/tokens/NFT.d.ts +355 -0
  49. package/dist/src/tokens/index.d.ts +2 -0
  50. package/dist/src/utils/ConfigHelper.d.ts +6 -0
  51. package/dist/src/utils/Constants.d.ts +2 -0
  52. package/dist/src/utils/ContractUtils.d.ts +11 -0
  53. package/dist/src/utils/ConversionTypeHelper.d.ts +3 -0
  54. package/dist/src/utils/DatatokenName.d.ts +11 -0
  55. package/dist/src/utils/DdoHelpers.d.ts +2 -0
  56. package/dist/src/utils/FetchHelper.d.ts +6 -0
  57. package/dist/{node → src}/utils/Logger.d.ts +0 -0
  58. package/dist/src/utils/SignatureUtils.d.ts +8 -0
  59. package/dist/src/utils/TokenUtils.d.ts +39 -0
  60. package/dist/src/utils/index.d.ts +9 -0
  61. package/dist/src/utils/minAbi.d.ts +2 -0
  62. package/dist/test/TestContractHandler.d.ts +44 -0
  63. package/dist/test/integration/ComputeFlow.test.d.ts +1 -0
  64. package/dist/test/integration/Provider.test.d.ts +1 -0
  65. package/dist/test/integration/PublishFlows.test.d.ts +1 -0
  66. package/dist/test/integration/SimplePublishConsumeFlow.test.d.ts +1 -0
  67. package/dist/test/integration/config.d.ts +3 -0
  68. package/dist/test/unit/NftFactory.test.d.ts +1 -0
  69. package/dist/test/unit/config.d.ts +3 -0
  70. package/dist/test/unit/pools/Router.test.d.ts +1 -0
  71. package/dist/test/unit/pools/balancer/Pool.test.d.ts +1 -0
  72. package/dist/test/unit/pools/dispenser/Dispenser.test.d.ts +1 -0
  73. package/dist/test/unit/pools/fixedRate/FixedRateExchange.test.d.ts +1 -0
  74. package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +1 -0
  75. package/dist/test/unit/tokens/Datatoken.test.d.ts +1 -0
  76. package/dist/test/unit/tokens/Nft.test.d.ts +1 -0
  77. package/docs/beginners_guide.md +4 -4
  78. package/docs/overview.md +100 -9
  79. package/docs/quickstart_marketplace.md +34 -33
  80. package/docs/quickstart_simple.md +18 -16
  81. package/package.json +41 -33
  82. package/dist/node/Instantiable.abstract.d.ts +0 -25
  83. package/dist/node/balancer/OceanPool.d.ts +0 -95
  84. package/dist/node/balancer/Pool.d.ts +0 -56
  85. package/dist/node/balancer/PoolFactory.d.ts +0 -15
  86. package/dist/node/datatokens/ContractEvent.d.ts +0 -19
  87. package/dist/node/datatokens/ContractHandler.d.ts +0 -12
  88. package/dist/node/datatokens/Datatokens.d.ts +0 -44
  89. package/dist/node/datatokens/EventHandler.d.ts +0 -19
  90. package/dist/node/datatokens/Network.d.ts +0 -5
  91. package/dist/node/datatokens/Web3Provider.d.ts +0 -5
  92. package/dist/node/datatokens/contracts/ContractBase.d.ts +0 -27
  93. package/dist/node/ddo/DDO.d.ts +0 -36
  94. package/dist/node/ddo/interfaces/AdditionalInformation.d.ts +0 -16
  95. package/dist/node/ddo/interfaces/Authentication.d.ts +0 -4
  96. package/dist/node/ddo/interfaces/BestPrice.d.ts +0 -10
  97. package/dist/node/ddo/interfaces/Consumable.d.ts +0 -5
  98. package/dist/node/ddo/interfaces/Credentials.d.ts +0 -9
  99. package/dist/node/ddo/interfaces/Curation.d.ts +0 -6
  100. package/dist/node/ddo/interfaces/DataTokenInfo.d.ts +0 -10
  101. package/dist/node/ddo/interfaces/EditableMetadata.d.ts +0 -9
  102. package/dist/node/ddo/interfaces/EditableMetadataLinks.d.ts +0 -5
  103. package/dist/node/ddo/interfaces/Event.d.ts +0 -7
  104. package/dist/node/ddo/interfaces/File.d.ts +0 -13
  105. package/dist/node/ddo/interfaces/Metadata.d.ts +0 -15
  106. package/dist/node/ddo/interfaces/MetadataAlgorithm.d.ts +0 -12
  107. package/dist/node/ddo/interfaces/MetadataMain.d.ts +0 -12
  108. package/dist/node/ddo/interfaces/Proof.d.ts +0 -6
  109. package/dist/node/ddo/interfaces/PublicKey.d.ts +0 -8
  110. package/dist/node/ddo/interfaces/PurgatoryData.d.ts +0 -4
  111. package/dist/node/ddo/interfaces/Service.d.ts +0 -99
  112. package/dist/node/ddo/interfaces/ServicePrices.d.ts +0 -4
  113. package/dist/node/ddo/interfaces/Status.d.ts +0 -5
  114. package/dist/node/ddo/interfaces/index.d.ts +0 -17
  115. package/dist/node/dispenser/Dispenser.d.ts +0 -44
  116. package/dist/node/exchange/FixedRateExchange.d.ts +0 -59
  117. package/dist/node/index.d.ts +0 -1
  118. package/dist/node/lib.d.ts +0 -15
  119. package/dist/node/lib.js +0 -2
  120. package/dist/node/lib.js.map +0 -1
  121. package/dist/node/lib.module.js +0 -2
  122. package/dist/node/lib.module.js.map +0 -1
  123. package/dist/node/lib.umd.js +0 -2
  124. package/dist/node/lib.umd.js.map +0 -1
  125. package/dist/node/metadatacache/MetadataCache.d.ts +0 -41
  126. package/dist/node/metadatacache/OnChainMetaData.d.ts +0 -31
  127. package/dist/node/models/Config.d.ts +0 -31
  128. package/dist/node/ocean/Account.d.ts +0 -16
  129. package/dist/node/ocean/Accounts.d.ts +0 -9
  130. package/dist/node/ocean/Assets.d.ts +0 -56
  131. package/dist/node/ocean/AssetsCredential.d.ts +0 -6
  132. package/dist/node/ocean/Compute.d.ts +0 -75
  133. package/dist/node/ocean/DID.d.ts +0 -8
  134. package/dist/node/ocean/EventAccessControl.d.ts +0 -9
  135. package/dist/node/ocean/Ocean.d.ts +0 -34
  136. package/dist/node/ocean/OceanAuth.d.ts +0 -15
  137. package/dist/node/ocean/Versions.d.ts +0 -25
  138. package/dist/node/ocean/utils/SignatureUtils.d.ts +0 -13
  139. package/dist/node/ocean/utils/Utils.d.ts +0 -8
  140. package/dist/node/ocean/utils/WebServiceConnector.d.ts +0 -16
  141. package/dist/node/provider/Provider.d.ts +0 -56
  142. package/dist/node/utils/AssetResolverHelper.d.ts +0 -8
  143. package/dist/node/utils/ConfigHelper.d.ts +0 -17
  144. package/dist/node/utils/ContractUtils.d.ts +0 -5
  145. package/dist/node/utils/ConversionTypeHelpers.d.ts +0 -8
  146. package/dist/node/utils/Datatokens.d.ts +0 -7
  147. package/dist/node/utils/GeneratorHelpers.d.ts +0 -1
  148. package/dist/node/utils/PromiseResolver.d.ts +0 -3
  149. package/dist/node/utils/SubscribableObserver.d.ts +0 -12
  150. package/dist/node/utils/SubscribablePromise.d.ts +0 -14
  151. package/dist/node/utils/Timeout.d.ts +0 -1
  152. package/dist/node/utils/index.d.ts +0 -9
@@ -0,0 +1,229 @@
1
+ import { Contract } from 'web3-eth-contract';
2
+ import Web3 from 'web3';
3
+ import { TransactionReceipt } from 'web3-core';
4
+ import { AbiItem } from 'web3-utils';
5
+ import { Operation } from '../@types/Router';
6
+ import { Config } from '../models/index.js';
7
+ /**
8
+ * Provides an interface for FactoryRouter contract
9
+ */
10
+ export declare class Router {
11
+ GASLIMIT_DEFAULT: number;
12
+ routerAddress: string;
13
+ RouterAbi: AbiItem | AbiItem[];
14
+ web3: Web3;
15
+ config: Config;
16
+ router: Contract;
17
+ /**
18
+ * Instantiate Router.
19
+ * @param {String} routerAddress
20
+ * @param {AbiItem | AbiItem[]} Router
21
+ * @param {Web3} web3
22
+ */
23
+ constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], config?: Config);
24
+ /**
25
+ * Estimate gas cost for buyDTBatch method
26
+ * @param {String} address
27
+ * @param {Operation} operations Operations objects array
28
+ * @return {Promise<TransactionReceipt>} Transaction receipt
29
+ */
30
+ estGasBuyDTBatch(address: string, operations: Operation[]): Promise<any>;
31
+ /**
32
+ * BuyDTBatch
33
+ * @param {String} address
34
+ * @param {Operation} operations Operations objects array
35
+ * @return {Promise<TransactionReceipt>} Transaction receipt
36
+ */
37
+ buyDTBatch(address: string, operations: Operation[]): Promise<TransactionReceipt>;
38
+ /** Check if a token is on ocean tokens list, if true opfFee is ZERO in pools with that token/DT
39
+ * @return {Promise<boolean>} true if is on the list.
40
+ */
41
+ isOceanTokens(address: string): Promise<boolean>;
42
+ /** Check if an address is a side staking contract.
43
+ * @return {Promise<boolean>} true if is a SS contract
44
+ */
45
+ isSideStaking(address: string): Promise<boolean>;
46
+ /** Check if an address is a Fixed Rate contract.
47
+ * @return {Promise<boolean>} true if is a Fixed Rate contract
48
+ */
49
+ isFixedPrice(address: string): Promise<boolean>;
50
+ /** Get Router Owner
51
+ * @return {Promise<string>} Router Owner address
52
+ */
53
+ getOwner(): Promise<string>;
54
+ /** Get NFT Factory address
55
+ * @return {Promise<string>} NFT Factory address
56
+ */
57
+ getNFTFactory(): Promise<string>;
58
+ /** Check if an address is a pool template contract.
59
+ * @return {Promise<boolean>} true if is a Template
60
+ */
61
+ isPoolTemplate(address: string): Promise<boolean>;
62
+ /**
63
+ * Estimate gas cost for addOceanToken
64
+ * @param {String} address
65
+ * @param {String} tokenAddress token address we want to add
66
+ * @param {Contract} routerContract optional contract instance
67
+ * @return {Promise<any>}
68
+ */
69
+ estGasAddOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
70
+ /**
71
+ * Add a new token to oceanTokens list, pools with baseToken in this list have NO opf Fee
72
+ * @param {String} address caller address
73
+ * @param {String} tokenAddress token address to add
74
+ * @return {Promise<TransactionReceipt>}
75
+ */
76
+ addOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
77
+ /**
78
+ * Estimate gas cost for removeOceanToken
79
+ * @param {String} address caller address
80
+ * @param {String} tokenAddress token address we want to add
81
+ * @param {Contract} routerContract optional contract instance
82
+ * @return {Promise<any>}
83
+ */
84
+ estGasRemoveOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
85
+ /**
86
+ * Remove a token from oceanTokens list, pools without baseToken in this list have a opf Fee
87
+ * @param {String} address
88
+ * @param {String} tokenAddress address to remove
89
+ * @return {Promise<TransactionReceipt>}
90
+ */
91
+ removeOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
92
+ /**
93
+ * Estimate gas cost for addSSContract method
94
+ * @param {String} address
95
+ * @param {String} tokenAddress contract address to add
96
+ * @return {Promise<TransactionReceipt>}
97
+ */
98
+ estGasAddSSContract(address: string, tokenAddress: string): Promise<any>;
99
+ /**
100
+ * Add a new contract to ssContract list, after is added, can be used when deploying a new pool
101
+ * @param {String} address
102
+ * @param {String} tokenAddress contract address to add
103
+ * @return {Promise<TransactionReceipt>}
104
+ */
105
+ addSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
106
+ /**
107
+ * Estimate gas cost for removeSSContract method
108
+ * @param {String} address caller address
109
+ * @param {String} tokenAddress contract address to add
110
+ * @return {Promise<TransactionReceipt>}
111
+ */
112
+ estGasRemoveSSContract(address: string, tokenAddress: string): Promise<any>;
113
+ /**
114
+ * Removes a new contract from ssContract list
115
+ * @param {String} address caller address
116
+ * @param {String} tokenAddress contract address to removed
117
+ * @return {Promise<TransactionReceipt>}
118
+ */
119
+ removeSSContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
120
+ /**
121
+ * Estimate gas cost for addFixedRateContract method
122
+ * @param {String} address
123
+ * @param {String} tokenAddress contract address to add
124
+ * @return {Promise<TransactionReceipt>}
125
+ */
126
+ estGasAddFixedRateContract(address: string, tokenAddress: string): Promise<any>;
127
+ /**
128
+ * Add a new contract to fixedRate list, after is added, can be used when deploying a new pool
129
+ * @param {String} address
130
+ * @param {String} tokenAddress contract address to add
131
+ * @return {Promise<TransactionReceipt>}
132
+ */
133
+ addFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
134
+ /**
135
+ * Estimate gas cost for addFixedRateContract method
136
+ * @param {String} address
137
+ * @param {String} tokenAddress contract address to add
138
+ * @return {Promise<TransactionReceipt>}
139
+ */
140
+ estGasRemoveFixedRateContract(address: string, tokenAddress: string): Promise<any>;
141
+ /**
142
+ * Removes a contract from fixedRate list
143
+ * @param {String} address
144
+ * @param {String} tokenAddress contract address to add
145
+ * @return {Promise<TransactionReceipt>}
146
+ */
147
+ removeFixedRateContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
148
+ /**
149
+ * Estimate gas cost for addDispenserContract method
150
+ * @param {String} address
151
+ * @param {String} tokenAddress contract address to add
152
+ * @return {Promise<TransactionReceipt>}
153
+ */
154
+ estGasAddDispenserContract(address: string, tokenAddress: string): Promise<any>;
155
+ /**
156
+ * Add a new contract to dispenser list, after is added, can be used when deploying a new pool
157
+ * @param {String} address
158
+ * @param {String} tokenAddress contract address to add
159
+ * @return {Promise<TransactionReceipt>}
160
+ */
161
+ addDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
162
+ /**
163
+ * Estimate gas cost for addDispenserContract method
164
+ * @param {String} address
165
+ * @param {String} tokenAddress contract address to add
166
+ * @return {Promise<TransactionReceipt>}
167
+ */
168
+ estGasRemoveDispenserContract(address: string, tokenAddress: string): Promise<any>;
169
+ /**
170
+ * Add a new contract to dispenser list, after is added, can be used when deploying a new pool
171
+ * @param {String} address
172
+ * @param {String} tokenAddress contract address to add
173
+ * @return {Promise<TransactionReceipt>}
174
+ */
175
+ removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
176
+ /** Get OPF Fee per token
177
+ * @return {Promise<number>} OPC fee for a specific baseToken
178
+ */
179
+ getOPCFee(baseToken: string): Promise<number>;
180
+ /** Get Current OPF Fee
181
+ * @return {Promise<number>} OPF fee
182
+ */
183
+ getCurrentOPCFee(): Promise<number>;
184
+ /**
185
+ * Estimate gas cost for updateOPFFee method
186
+ * @param {String} address
187
+ * @param {String} newFee new OPF Fee
188
+ * @return {Promise<TransactionReceipt>}
189
+ */
190
+ estGasUpdateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<any>;
191
+ /**
192
+ * Add a new contract to fixedRate list, after is added, can be used when deploying a new pool
193
+ * @param {String} address
194
+ * @param {number} newSwapOceanFee Amount charged for swapping with ocean approved tokens
195
+ * @param {number} newSwapNonOceanFee Amount charged for swapping with non ocean approved tokens
196
+ * @param {number} newConsumeFee Amount charged from consumeFees
197
+ * @param {number} newProviderFee Amount charged for providerFees
198
+ * @return {Promise<TransactionReceipt>}
199
+ */
200
+ updateOPCFee(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number): Promise<TransactionReceipt>;
201
+ /**
202
+ * Estimate gas cost for addPoolTemplate method
203
+ * @param {String} address
204
+ * @param {String} templateAddress template address to add
205
+ * @return {Promise<TransactionReceipt>}
206
+ */
207
+ estGasAddPoolTemplate(address: string, templateAddress: string): Promise<any>;
208
+ /**
209
+ * Add a new template to poolTemplates mapping, after template is added,it can be used
210
+ * @param {String} address
211
+ * @param {String} templateAddress template address to add
212
+ * @return {Promise<TransactionReceipt>}
213
+ */
214
+ addPoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
215
+ /**
216
+ * Estimate gas cost for removePoolTemplate method
217
+ * @param {String} address
218
+ * @param {String} templateAddress template address to remove
219
+ * @return {Promise<TransactionReceipt>}
220
+ */
221
+ estGasRemovePoolTemplate(address: string, templateAddress: string): Promise<any>;
222
+ /**
223
+ * Remove template from poolTemplates mapping, after template is removed,it can be used anymore
224
+ * @param {String} address
225
+ * @param {String} templateAddress template address to remove
226
+ * @return {Promise<TransactionReceipt>}
227
+ */
228
+ removePoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
229
+ }
@@ -0,0 +1,408 @@
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 } 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
+ GASLIMIT_DEFAULT: number;
14
+ private config;
15
+ constructor(web3: Web3, poolAbi?: AbiItem | AbiItem[], config?: Config);
16
+ /**
17
+ * Get user shares of pool tokens
18
+ * @param {String} account
19
+ * @param {String} poolAddress
20
+ * @return {String}
21
+ */
22
+ sharesBalance(account: string, poolAddress: string): Promise<string>;
23
+ /**
24
+ * Estimate gas cost for setSwapFee
25
+ * @param {String} account
26
+ * @param {String} tokenAddress
27
+ * @param {String} spender
28
+ * @param {String} amount
29
+ * @param {String} force
30
+ * @param {Contract} contractInstance optional contract instance
31
+ * @return {Promise<number>}
32
+ */
33
+ estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
34
+ /**
35
+ * Set pool fee
36
+ * @param {String} account
37
+ * @param {String} poolAddress
38
+ * @param {String} fee 0.1=10% fee(max allowed)
39
+ */
40
+ setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
41
+ /**
42
+ * Get number of tokens composing this pool
43
+ * @param {String} poolAddress
44
+ * @return {String}
45
+ */
46
+ getNumTokens(poolAddress: string): Promise<string>;
47
+ /**
48
+ * Get total supply of pool shares
49
+ * @param {String} poolAddress
50
+ * @return {String}
51
+ */
52
+ getPoolSharesTotalSupply(poolAddress: string): Promise<string>;
53
+ /**
54
+ * Get tokens composing this pool
55
+ * @param {String} poolAddress
56
+ * @return {String[]}
57
+ */
58
+ getCurrentTokens(poolAddress: string): Promise<string[]>;
59
+ /**
60
+ * Get the final tokens composing this pool
61
+ * @param {String} poolAddress
62
+ * @return {String[]}
63
+ */
64
+ getFinalTokens(poolAddress: string): Promise<string[]>;
65
+ /**
66
+ * Get controller address of this pool
67
+ * @param {String} poolAddress
68
+ * @return {String}
69
+ */
70
+ getController(poolAddress: string): Promise<string>;
71
+ /**
72
+ * Get baseToken address of this pool
73
+ * @param {String} poolAddress
74
+ * @return {String}
75
+ */
76
+ getBaseToken(poolAddress: string): Promise<string>;
77
+ /**
78
+ * Get datatoken address of this pool
79
+ * @param {String} poolAddress
80
+ * @return {String}
81
+ */
82
+ getDatatoken(poolAddress: string): Promise<string>;
83
+ /**
84
+ * Get marketFeeCollector of this pool
85
+ * @param {String} poolAddress
86
+ * @return {String}
87
+ */
88
+ getMarketFeeCollector(poolAddress: string): Promise<string>;
89
+ /**
90
+ * Get OPC Collector of this pool
91
+ * @param {String} poolAddress
92
+ * @return {String}
93
+ */
94
+ getOPCCollector(poolAddress: string): Promise<string>;
95
+ /**
96
+ * Get if a token is bounded to a pool
97
+ * @param {String} poolAddress
98
+ * @param {String} token Address of the token
99
+ * @return {Boolean}
100
+ */
101
+ isBound(poolAddress: string, token: string): Promise<boolean>;
102
+ /**
103
+ * Get how many tokens are in the pool
104
+ * @param {String} poolAddress
105
+ * @param {String} token Address of the token
106
+ * @return {String}
107
+ */
108
+ getReserve(poolAddress: string, token: string): Promise<string>;
109
+ /**
110
+ * Get if a pool is finalized
111
+ * @param {String} poolAddress
112
+ * @return {Boolean}
113
+ */
114
+ isFinalized(poolAddress: string): Promise<boolean>;
115
+ /**
116
+ * Get pool fee
117
+ * @param {String} poolAddress
118
+ * @return {String} Swap fee. To get the percentage value, substract by 100. E.g. `0.1` represents a 10% swap fee.
119
+ */
120
+ getSwapFee(poolAddress: string): Promise<string>;
121
+ /**
122
+ * The normalized weight of a token. The combined normalized weights of all tokens will sum up to 1. (Note: the actual sum may be 1 plus or minus a few wei due to division precision loss)
123
+ * @param {String} poolAddress
124
+ * @param {String} token
125
+ * @return {String}
126
+ */
127
+ getNormalizedWeight(poolAddress: string, token: string): Promise<string>;
128
+ /**
129
+ * getDenormalizedWeight of a token in pool
130
+ * @param {String} poolAddress
131
+ * @param {String} token
132
+ * @return {String}
133
+ */
134
+ getDenormalizedWeight(poolAddress: string, token: string): Promise<string>;
135
+ /**
136
+ * getTotalDenormalizedWeight in pool
137
+ * @param {String} poolAddress
138
+ * @return {String}
139
+ */
140
+ getTotalDenormalizedWeight(poolAddress: string): Promise<string>;
141
+ /**
142
+ * Get Market Fees available to be collected for a specific token
143
+ * @param {String} poolAddress
144
+ * @param {String} token token we want to check fees
145
+ * @return {String}
146
+ */
147
+ getMarketFees(poolAddress: string, token: string): Promise<string>;
148
+ /**
149
+ * Get Community Get the current amount of fees which can be withdrawned by the Market
150
+ * @return {CurrentFees}
151
+ */
152
+ getCurrentMarketFees(poolAddress: string): Promise<CurrentFees>;
153
+ /**
154
+ * Get getCurrentOPFFees Get the current amount of fees which can be withdrawned by OPF
155
+ * @return {CurrentFees}
156
+ */
157
+ getCurrentOPCFees(poolAddress: string): Promise<CurrentFees>;
158
+ /**
159
+ * Get Community Fees available to be collected for a specific token
160
+ * @param {String} poolAddress
161
+ * @param {String} token token we want to check fees
162
+ * @return {String}
163
+ */
164
+ getCommunityFees(poolAddress: string, token: string): Promise<string>;
165
+ /**
166
+ * Estimate gas cost for collectOPF
167
+ * @param {String} address
168
+ * @param {String} poolAddress
169
+ * @param {Contract} contractInstance optional contract instance
170
+ * @return {Promise<number>}
171
+ */
172
+ estCollectOPC(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
173
+ /**
174
+ * collectOPF - collect opf fee - can be called by anyone
175
+ * @param {String} address
176
+ * @param {String} poolAddress
177
+ * @return {TransactionReceipt}
178
+ */
179
+ collectOPC(address: string, poolAddress: string): Promise<TransactionReceipt>;
180
+ /**
181
+ * Estimate gas cost for collectMarketFee
182
+ * @param {String} address
183
+ * @param {String} poolAddress
184
+ * @param {String} to address that will receive fees
185
+ * @param {Contract} contractInstance optional contract instance
186
+ * @return {Promise<number>}
187
+ */
188
+ estCollectMarketFee(address: string, poolAddress: string, contractInstance?: Contract): Promise<number>;
189
+ /**
190
+ * collectOPF - collect market fees - can be called by the publishMarketCollector
191
+ * @param {String} address
192
+ * @param {String} poolAddress
193
+ * @param {String} to address that will receive fees
194
+ * @return {TransactionReceipt}
195
+ */
196
+ collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
197
+ /**
198
+ * Estimate gas cost for updateMarketFeeCollector
199
+ * @param {String} address
200
+ * @param {String} poolAddress
201
+ * @param {String} newCollector new market fee collector address
202
+ * @param {Contract} contractInstance optional contract instance
203
+ * @return {Promise<number>}
204
+ */
205
+ estUpdateMarketFeeCollector(address: string, poolAddress: string, newCollector: string, contractInstance?: Contract): Promise<number>;
206
+ /**
207
+ * updateMarketFeeCollector - updates marketFeeCollector - can be called only by the marketFeeCollector
208
+ * @param {String} address
209
+ * @param {String} poolAddress
210
+ * @param {String} newCollector new market fee collector address
211
+ * @return {TransactionReceipt}
212
+ */
213
+ updateMarketFeeCollector(address: string, poolAddress: string, newCollector: string): Promise<TransactionReceipt>;
214
+ /**
215
+ * Estimate gas cost for swapExactAmountIn
216
+ * @param {String} address
217
+ * @param {String} poolAddress
218
+ * @param {TokenInOutMarket} tokenInOutMarket
219
+ * @param {AmountsInMaxFee} amountsInOutMaxFee
220
+ * @param {Contract} contractInstance optional contract instance
221
+ * @return {Promise<number>}
222
+ */
223
+ estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
224
+ /**
225
+ * swapExactAmountIn - Trades an exact tokenAmountIn of tokenIn taken from the caller by the pool,
226
+ * in exchange for at least minAmountOut of tokenOut given to the caller from the pool, with a maximum marginal price of maxPrice.
227
+ * Returns (tokenAmountOut, spotPriceAfter), where tokenAmountOut is the amount of token that came out of the pool,
228
+ * and spotPriceAfter is the new marginal spot price, ie, the result of getSpotPrice after the call.
229
+ * (These values are what are limited by the arguments; you are guaranteed tokenAmountOut >= minAmountOut and spotPriceAfter <= maxPrice).
230
+ * @param {String} address
231
+ * @param {String} poolAddress
232
+ * @param {TokenInOutMarket} tokenInOutMarket
233
+ * @param {AmountsInMaxFee} amountsInOutMaxFee
234
+ * @return {TransactionReceipt}
235
+ */
236
+ swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
237
+ /**
238
+ * Estimate gas cost for swapExactAmountOut
239
+ * @param {String} address
240
+ * @param {String} poolAddress
241
+ * @param {TokenInOutMarket} tokenInOutMarket
242
+ * @param {AmountsOutMaxFee} amountsInOutMaxFee
243
+ * @param {Contract} contractInstance optional contract instance
244
+ * @return {Promise<number>}
245
+ */
246
+ estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
247
+ /**
248
+ * swapExactAmountOut
249
+ * @param {String} account
250
+ * @param {String} poolAddress
251
+ * @param {TokenInOutMarket} tokenInOutMarket
252
+ * @param {AmountsOutMaxFee} amountsInOutMaxFee
253
+ * @return {TransactionReceipt}
254
+ */
255
+ swapExactAmountOut(account: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee): Promise<TransactionReceipt>;
256
+ /**
257
+ * Estimate gas cost for swapExactAmountOut
258
+ * @param {String} address
259
+ * @param {String} poolAddress
260
+ * @param {String} poolAmountOut will be converted to wei
261
+ * @param {String[]} maxAmountsIn array holding maxAmount per each token, will be converted to wei
262
+ * @param {Contract} contractInstance optional contract instance
263
+ * @return {Promise<number>}
264
+ */
265
+ estJoinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[], contractInstance?: Contract): Promise<number>;
266
+ /**
267
+ * Join the pool, getting poolAmountOut pool tokens. This will pull some of each of the currently trading tokens in the pool, meaning you must have called approve for each token for this pool. These values are limited by the array of maxAmountsIn in the order of the pool tokens.
268
+ * @param {String} address
269
+ * @param {String} poolAddress
270
+ * @param {String} poolAmountOut will be converted to wei
271
+ * @param {String[]} maxAmountsIn array holding maxAmount per each token, will be converted to wei
272
+ * @return {TransactionReceipt}
273
+ */
274
+ joinPool(address: string, poolAddress: string, poolAmountOut: string, maxAmountsIn: string[]): Promise<TransactionReceipt>;
275
+ /**
276
+ * Estimate gas cost for exitPool
277
+ * @param {String} address
278
+ * @param {String} poolAddress
279
+ ``* @param {String} poolAmountIn will be converted to wei
280
+ * @param {String[]} minAmountsOut array holding minAmount per each token, will be converted to wei
281
+ * @param {Contract} contractInstance optional contract instance
282
+ * @return {Promise<number>}
283
+ */
284
+ estExitPool(address: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[], contractInstance?: Contract): Promise<number>;
285
+ /**
286
+ * Exit the pool, paying poolAmountIn pool tokens and getting some of each of the currently trading tokens in return. These values are limited by the array of minAmountsOut in the order of the pool tokens.
287
+ * @param {String} account
288
+ * @param {String} poolAddress
289
+ * @param {String} poolAmountIn will be converted to wei
290
+ * @param {String[]} minAmountsOut array holding minAmount per each token, will be converted to wei
291
+ * @return {TransactionReceipt}
292
+ */
293
+ exitPool(account: string, poolAddress: string, poolAmountIn: string, minAmountsOut: string[]): Promise<TransactionReceipt>;
294
+ /**
295
+ * Estimate gas cost for joinswapExternAmountIn
296
+ * @param {String} address
297
+ * @param {String} poolAddress
298
+ * @param {String} tokenIn
299
+ * @param {String} tokenAmountIn will be converted to wei
300
+ * @param {String} minPoolAmountOut will be converted to wei
301
+ * @param {Contract} contractInstance optional contract instance
302
+ * @return {Promise<number>}
303
+ */
304
+ estJoinswapExternAmountIn(address: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string, contractInstance?: Contract): Promise<number>;
305
+ /**
306
+ * Pay tokenAmountIn of token tokenIn to join the pool, getting poolAmountOut of the pool shares.
307
+ * @param {String} account
308
+ * @param {String} poolAddress
309
+ * @param {String} tokenIn
310
+ * @param {String} tokenAmountIn will be converted to wei
311
+ * @param {String} minPoolAmountOut will be converted to wei
312
+ * @return {TransactionReceipt}
313
+ */
314
+ joinswapExternAmountIn(account: string, poolAddress: string, tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string): Promise<TransactionReceipt>;
315
+ /**
316
+ * Estimate gas cost for joinswapPoolAmountOut
317
+ * @param {String} address
318
+ * @param {String} poolAddress
319
+ * @param {String} tokenIn
320
+ * @param {String} poolAmountOut will be converted to wei
321
+ * @param {String} maxAmountIn will be converted to wei
322
+ * @param {Contract} contractInstance optional contract instance
323
+ * @return {Promise<number>}
324
+ */
325
+ estJoinswapPoolAmountOut(address: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string, contractInstance?: Contract): Promise<number>;
326
+ /**
327
+ * Specify poolAmountOut pool shares that you want to get, and a token tokenIn to pay with. This costs tokenAmountIn tokens (these went into the pool).
328
+ * @param {String} account
329
+ * @param {String} poolAddress
330
+ * @param {String} tokenIn
331
+ * @param {String} poolAmountOut will be converted to wei
332
+ * @param {String} maxAmountIn will be converted to wei
333
+ * @return {TransactionReceipt}
334
+ */
335
+ joinswapPoolAmountOut(account: string, poolAddress: string, tokenIn: string, poolAmountOut: string, maxAmountIn: string): Promise<TransactionReceipt>;
336
+ /**
337
+ * Estimate gas cost for joinswapExternAmountIn
338
+ * @param {String} address
339
+ @param {String} poolAddress
340
+ * @param {String} tokenOut
341
+ * @param {String} poolAmountIn will be converted to wei
342
+ * @param {String} minTokenAmountOut will be converted to wei
343
+ * @param {Contract} contractInstance optional contract instance
344
+ * @return {Promise<number>}
345
+ */
346
+ estExitswapPoolAmountIn(address: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string, contractInstance?: Contract): Promise<number>;
347
+ /**
348
+ * Pay poolAmountIn pool shares into the pool, getting minTokenAmountOut of the given token tokenOut out of the pool.
349
+ * @param {String} account
350
+ * @param {String} poolAddress
351
+ * @param {String} tokenOut
352
+ * @param {String} poolAmountIn will be converted to wei
353
+ * @param {String} minTokenAmountOut will be converted to wei
354
+ * @return {TransactionReceipt}
355
+ */
356
+ exitswapPoolAmountIn(account: string, poolAddress: string, tokenOut: string, poolAmountIn: string, minTokenAmountOut: string): Promise<TransactionReceipt>;
357
+ /**
358
+ * Estimate gas cost for joinswapExternAmountIn
359
+ * @param {String} address
360
+ * @param {String} poolAddress
361
+ * @param {String} tokenOut
362
+ * @param {String} tokenAmountOut will be converted to wei
363
+ * @param {String} maxPoolAmountIn will be converted to wei
364
+ * @param {Contract} contractInstance optional contract instance
365
+ * @return {Promise<number>}
366
+ */
367
+ estExitswapExternAmountOut(address: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string, contractInstance?: Contract): Promise<number>;
368
+ /**
369
+ * Specify tokenAmountOut of token tokenOut that you want to get out of the pool. This costs poolAmountIn pool shares (these went into the pool).
370
+ * @param {String} account
371
+ * @param {String} poolAddress
372
+ * @param {String} tokenOut
373
+ * @param {String} tokenAmountOut will be converted to wei
374
+ * @param {String} maxPoolAmountIn will be converted to wei
375
+ * @return {TransactionReceipt}
376
+ */
377
+ exitswapExternAmountOut(account: string, poolAddress: string, tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string): Promise<TransactionReceipt>;
378
+ /**
379
+ * Get Spot Price of swaping tokenIn to tokenOut
380
+ * @param {String} poolAddress
381
+ * @param {String} tokenIn
382
+ * @param {String} tokenOut
383
+ * @param {String} swapMarketFe
384
+ * @return {String}
385
+ */
386
+ getSpotPrice(poolAddress: string, tokenIn: string, tokenOut: string, swapMarketFee: string): Promise<string>;
387
+ getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string): Promise<string>;
388
+ getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string): Promise<string>;
389
+ calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string): Promise<string>;
390
+ calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string): Promise<string>;
391
+ calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string): Promise<string>;
392
+ calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string): Promise<string>;
393
+ /**
394
+ * Get LOG_SWAP encoded topic
395
+ * @return {String}
396
+ */
397
+ getSwapEventSignature(): string;
398
+ /**
399
+ * Get LOG_JOIN encoded topic
400
+ * @return {String}
401
+ */
402
+ getJoinEventSignature(): string;
403
+ /**
404
+ * Get LOG_EXIT encoded topic
405
+ * @return {String}
406
+ */
407
+ getExitEventSignature(): string;
408
+ }
@@ -0,0 +1 @@
1
+ export * from './Pool';