@oceanprotocol/lib 1.0.0-next.7 → 1.0.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +405 -1
  2. package/CodeExamples.md +918 -0
  3. package/README.md +12 -80
  4. package/dist/lib.js +1 -1
  5. package/dist/lib.js.map +1 -1
  6. package/dist/lib.modern.js +1 -1
  7. package/dist/lib.modern.js.map +1 -1
  8. package/dist/lib.module.js +1 -1
  9. package/dist/lib.module.js.map +1 -1
  10. package/dist/lib.umd.js +1 -1
  11. package/dist/lib.umd.js.map +1 -1
  12. package/dist/src/@types/Asset.d.ts +83 -0
  13. package/dist/src/@types/Compute.d.ts +18 -1
  14. package/dist/src/@types/DDO/DDO.d.ts +43 -0
  15. package/dist/src/@types/DDO/Event.d.ts +20 -0
  16. package/dist/src/@types/DDO/Metadata.d.ts +92 -0
  17. package/dist/src/@types/DDO/Service.d.ts +72 -6
  18. package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
  19. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  20. package/dist/src/@types/Erc20.d.ts +21 -0
  21. package/dist/src/@types/Erc721.d.ts +12 -0
  22. package/dist/src/@types/FileMetadata.d.ts +29 -0
  23. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
  24. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
  25. package/dist/src/@types/Provider.d.ts +9 -0
  26. package/dist/src/@types/Router.d.ts +59 -0
  27. package/dist/src/@types/index.d.ts +6 -0
  28. package/dist/src/aquarius/Aquarius.d.ts +26 -4
  29. package/dist/src/factories/NFTFactory.d.ts +222 -13
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/models/Config.d.ts +128 -0
  32. package/dist/src/pools/Router.d.ts +193 -12
  33. package/dist/src/pools/balancer/Pool.d.ts +357 -37
  34. package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
  35. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +311 -19
  36. package/dist/src/pools/index.d.ts +2 -0
  37. package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
  38. package/dist/src/provider/Provider.d.ts +137 -14
  39. package/dist/src/tokens/Datatoken.d.ts +347 -7
  40. package/dist/src/tokens/NFT.d.ts +301 -6
  41. package/dist/src/utils/ConfigHelper.d.ts +1 -1
  42. package/dist/src/utils/Constants.d.ts +1 -0
  43. package/dist/src/utils/ContractUtils.d.ts +13 -2
  44. package/dist/src/utils/DatatokenName.d.ts +4 -0
  45. package/dist/src/utils/FetchHelper.d.ts +3 -2
  46. package/dist/src/utils/General.d.ts +4 -0
  47. package/dist/src/utils/PoolHelpers.d.ts +8 -0
  48. package/dist/src/utils/SignatureUtils.d.ts +0 -2
  49. package/dist/src/utils/TokenUtils.d.ts +69 -0
  50. package/dist/src/utils/index.d.ts +3 -0
  51. package/dist/src/utils/minAbi.d.ts +2 -0
  52. package/dist/test/TestContractHandler.d.ts +8 -36
  53. package/dist/test/config.d.ts +5 -0
  54. package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
  55. package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
  56. package/package.json +38 -34
  57. package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
  58. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  59. package/dist/src/interfaces/index.d.ts +0 -5
  60. package/dist/test/integration/config.d.ts +0 -3
  61. package/dist/test/unit/config.d.ts +0 -3
  62. package/docs/beginners_guide.md +0 -338
  63. package/docs/get-test-OCEAN.md +0 -24
  64. package/docs/overview.md +0 -394
  65. package/docs/quickstart_marketplace.md +0 -423
  66. package/docs/quickstart_simple.md +0 -272
  67. package/docs/services.md +0 -94
  68. 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 '../interfaces/RouterInterface';
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
- constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], config?: Config);
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
- isOceanTokens(address: string): Promise<boolean>;
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
- estGasAddOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
24
- addOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
25
- estGasRemoveOceanToken(address: string, tokenAddress: string, contractInstance?: Contract): Promise<any>;
26
- removeOceanToken(address: string, tokenAddress: string): Promise<TransactionReceipt>;
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>;
39
- getOPFFee(baseToken: string): Promise<number>;
40
- getCurrentOPFFee(): Promise<number>;
41
- estGasUpdateOPFFee(address: string, newFee: number): Promise<any>;
42
- updateOPFFee(address: string, newFee: number): Promise<TransactionReceipt>;
175
+ /** Get OPF Fee per token
176
+ * @return {Promise<number>} OPC fee for a specific baseToken
177
+ */
178
+ getOPCFee(baseToken: string): Promise<number>;
179
+ /** Get Current OPF Fee
180
+ * @return {Promise<number>} OPF fee
181
+ */
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
+ */
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
+ */
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
  }