@oceanprotocol/lib 1.0.0-next.2 → 1.0.0-next.20

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 (55) hide show
  1. package/CHANGELOG.md +163 -1
  2. package/dist/lib.js +1 -1
  3. package/dist/lib.js.map +1 -1
  4. package/dist/lib.modern.js +1 -1
  5. package/dist/lib.modern.js.map +1 -1
  6. package/dist/lib.module.js +1 -1
  7. package/dist/lib.module.js.map +1 -1
  8. package/dist/lib.umd.js +1 -1
  9. package/dist/lib.umd.js.map +1 -1
  10. package/dist/src/@types/Asset.d.ts +83 -0
  11. package/dist/src/@types/Compute.d.ts +17 -0
  12. package/dist/src/@types/DDO/DDO.d.ts +43 -0
  13. package/dist/src/@types/DDO/Event.d.ts +20 -0
  14. package/dist/src/@types/DDO/Metadata.d.ts +88 -0
  15. package/dist/src/@types/DDO/Service.d.ts +96 -0
  16. package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
  17. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  18. package/dist/src/{interfaces/Erc20Interface.d.ts → @types/Erc20.d.ts} +5 -0
  19. package/dist/src/@types/Erc721.d.ts +12 -0
  20. package/dist/src/@types/FileMetadata.d.ts +30 -0
  21. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +8 -2
  22. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +13 -6
  23. package/dist/src/@types/Provider.d.ts +3 -2
  24. package/dist/src/@types/Router.d.ts +59 -0
  25. package/dist/src/@types/index.d.ts +6 -0
  26. package/dist/src/aquarius/Aquarius.d.ts +26 -4
  27. package/dist/src/factories/NFTFactory.d.ts +222 -18
  28. package/dist/src/index.d.ts +1 -1
  29. package/dist/src/models/Config.d.ts +132 -0
  30. package/dist/src/pools/Router.d.ts +190 -7
  31. package/dist/src/pools/balancer/Pool.d.ts +381 -26
  32. package/dist/src/pools/dispenser/Dispenser.d.ts +112 -3
  33. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +304 -13
  34. package/dist/src/pools/ssContracts/SideStaking.d.ts +109 -5
  35. package/dist/src/provider/Provider.d.ts +128 -12
  36. package/dist/src/tokens/Datatoken.d.ts +301 -13
  37. package/dist/src/tokens/NFT.d.ts +301 -3
  38. package/dist/src/utils/ConfigHelper.d.ts +1 -1
  39. package/dist/src/utils/Constants.d.ts +1 -0
  40. package/dist/src/utils/ContractUtils.d.ts +12 -0
  41. package/dist/src/utils/DatatokenName.d.ts +4 -0
  42. package/dist/src/utils/FetchHelper.d.ts +3 -2
  43. package/dist/src/utils/General.d.ts +4 -0
  44. package/dist/src/utils/TokenUtils.d.ts +39 -0
  45. package/dist/src/utils/index.d.ts +3 -2
  46. package/dist/src/utils/minAbi.d.ts +2 -0
  47. package/docs/beginners_guide.md +4 -4
  48. package/docs/overview.md +100 -9
  49. package/docs/quickstart_marketplace.md +34 -33
  50. package/docs/quickstart_simple.md +18 -16
  51. package/package.json +24 -23
  52. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  53. package/dist/src/interfaces/index.d.ts +0 -5
  54. package/dist/src/utils/ContractParams.d.ts +0 -4
  55. package/dist/src/utils/GasUtils.d.ts +0 -2
@@ -2,45 +2,228 @@ 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 '../interfaces/RouterInterface';
5
+ import { Operation } from '../@types/Router';
6
+ import { Config } from '../models/index.js';
7
+ /**
8
+ * Provides an interface for FactoryRouter contract
9
+ */
6
10
  export declare class Router {
7
11
  GASLIMIT_DEFAULT: number;
8
12
  routerAddress: string;
9
13
  RouterAbi: AbiItem | AbiItem[];
10
14
  web3: Web3;
11
- startBlock: number;
15
+ config: Config;
12
16
  router: Contract;
13
- constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], startBlock?: number);
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
+ */
14
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
+ */
15
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
+ */
16
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
+ */
17
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
+ */
18
49
  isFixedPrice(address: string): Promise<boolean>;
50
+ /** Get Router Owner
51
+ * @return {Promise<string>} Router Owner address
52
+ */
19
53
  getOwner(): Promise<string>;
54
+ /** Get NFT Factory address
55
+ * @return {Promise<string>} NFT Factory address
56
+ */
20
57
  getNFTFactory(): Promise<string>;
58
+ /** Check if an address is a pool template contract.
59
+ * @return {Promise<boolean>} true if is a Template
60
+ */
21
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
+ */
22
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
+ */
23
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
+ */
24
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
+ */
25
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
+ */
26
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
+ */
27
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
+ */
28
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
+ */
29
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
+ */
30
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
+ */
31
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
+ */
32
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
+ */
33
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
+ */
34
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
+ */
35
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
+ */
36
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
+ */
37
175
  removeDispenserContract(address: string, tokenAddress: string): Promise<TransactionReceipt>;
38
- getOPFFee(baseToken: string): Promise<number>;
39
- getCurrentOPFFee(): Promise<number>;
40
- estGasUpdateOPFFee(address: string, newFee: number): Promise<any>;
41
- updateOPFFee(address: string, newFee: number): 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
+ */
42
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
+ */
43
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
+ */
44
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
+ */
45
228
  removePoolTemplate(address: string, templateAddress: string): Promise<TransactionReceipt>;
46
229
  }