@oceanprotocol/lib 1.0.0-next.9 → 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 (63) hide show
  1. package/CHANGELOG.md +390 -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/Erc20.d.ts +21 -0
  20. package/dist/src/{interfaces/Erc721Interface.d.ts → @types/Erc721.d.ts} +2 -2
  21. package/dist/src/@types/FileMetadata.d.ts +29 -0
  22. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
  23. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
  24. package/dist/src/@types/Provider.d.ts +9 -0
  25. package/dist/src/@types/Router.d.ts +59 -0
  26. package/dist/src/@types/index.d.ts +6 -0
  27. package/dist/src/aquarius/Aquarius.d.ts +23 -1
  28. package/dist/src/factories/NFTFactory.d.ts +222 -14
  29. package/dist/src/index.d.ts +1 -1
  30. package/dist/src/models/Config.d.ts +128 -0
  31. package/dist/src/pools/Router.d.ts +189 -8
  32. package/dist/src/pools/balancer/Pool.d.ts +354 -29
  33. package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
  34. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +309 -17
  35. package/dist/src/pools/index.d.ts +2 -0
  36. package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
  37. package/dist/src/provider/Provider.d.ts +125 -6
  38. package/dist/src/tokens/Datatoken.d.ts +347 -8
  39. package/dist/src/tokens/NFT.d.ts +297 -5
  40. package/dist/src/utils/ContractUtils.d.ts +13 -4
  41. package/dist/src/utils/DatatokenName.d.ts +4 -0
  42. package/dist/src/utils/General.d.ts +4 -0
  43. package/dist/src/utils/PoolHelpers.d.ts +8 -0
  44. package/dist/src/utils/SignatureUtils.d.ts +0 -2
  45. package/dist/src/utils/TokenUtils.d.ts +65 -3
  46. package/dist/src/utils/index.d.ts +2 -0
  47. package/dist/test/TestContractHandler.d.ts +8 -36
  48. package/dist/test/config.d.ts +5 -0
  49. package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
  50. package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
  51. package/package.json +37 -32
  52. package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
  53. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  54. package/dist/src/interfaces/index.d.ts +0 -5
  55. package/dist/test/integration/config.d.ts +0 -3
  56. package/dist/test/unit/config.d.ts +0 -3
  57. package/docs/beginners_guide.md +0 -338
  58. package/docs/get-test-OCEAN.md +0 -24
  59. package/docs/overview.md +0 -394
  60. package/docs/quickstart_marketplace.md +0 -423
  61. package/docs/quickstart_simple.md +0 -272
  62. package/docs/services.md +0 -94
  63. package/docs/wallets.md +0 -98
package/docs/overview.md DELETED
@@ -1,394 +0,0 @@
1
- # Overview
2
-
3
- Here is an overview of all ot the main functions and submodules:
4
-
5
- ### Ocean instance
6
-
7
- Create/get datatoken, get dtfactory, user orders (history)
8
-
9
- ```
10
- import { Ocean } from '@oceanprotocol/lib'
11
- const ocean = await Ocean.getInstance(config)
12
- ```
13
-
14
- Then use the following submodules...
15
-
16
- # Assets
17
-
18
- Publish, get, list, search, order, consume/download
19
-
20
- ```Typescript
21
- ocean.asset.getInstance(config: InstantiableConfig): Promise<Assets>;
22
- ```
23
-
24
- ```Typescript
25
- ocean.asset.create(metadata: Metadata, publisher: Account, services?: Service[], dtAddress?: string, cap?: string, name?: string, symbol?: string, providerUri?: string): SubscribablePromise<CreateProgressStep, DDO>;
26
- ```
27
-
28
- ```Typescript
29
- ocean.asset.ownerAssets(owner: string): Promise<QueryResult>;
30
- ```
31
-
32
- ```Typescript
33
- ocean.asset.resolve(did: string): Promise<DDO>;
34
- ```
35
-
36
- ```Typescript
37
- ocean.asset.resolveByDTAddress(dtAddress: string, offset?: number, page?: number, sort?: number): Promise<DDO[]>;
38
- ```
39
-
40
- ```Typescript
41
- ocean.asset.editMetadata(ddo: DDO, newMetadata: EditableMetadata): Promise<DDO>;
42
- ```
43
-
44
- ```Typescript
45
- ocean.asset.updateMetadata(ddo: DDO, consumerAccount: string): Promise<TransactionReceipt>;
46
- ```
47
-
48
- ```Typescript
49
- ocean.asset.editServiceTimeout(ddo: DDO, serviceIndex: number, timeout: number): Promise<DDO>;
50
- ```
51
-
52
- ```Typescript
53
- ocean.asset.creator(did: string): Promise<string>;
54
- ```
55
-
56
- ```Typescript
57
- ocean.asset.query(query: SearchQuery): Promise<QueryResult>;
58
- ```
59
-
60
- ```Typescript
61
- ocean.asset.search(text: string): Promise<QueryResult>;
62
- ```
63
-
64
- ```Typescript
65
- ocean.asset.getServiceByType(did: string, serviceType: string): Promise<Service>;
66
- ```
67
-
68
- ```Typescript
69
- ocean.asset.getServiceByIndex(did: string, serviceIndex: number): Promise<Service>;
70
- ```
71
-
72
- ```Typescript
73
- ocean.asset.createAccessServiceAttributes(creator: Account, cost: string, datePublished: string, timeout?: number, providerUri?: string): Promise<ServiceAccess>;
74
- ```
75
-
76
- ```Typescript
77
- ocean.asset.initialize(did: string, serviceType: string, consumerAddress: string, serviceIndex: number, serviceEndpoint: string): Promise<any>;
78
- ```
79
-
80
- ```Typescript
81
- ocean.asset.order(did: string, serviceType: string, payerAddress: string, serviceIndex?: number, mpAddress?: string, consumerAddress?: string, searchPreviousOrders?: boolean): Promise<string>;
82
- ```
83
-
84
- ```Typescript
85
- ocean.asset.download(did: string, txId: string, tokenAddress: string, consumerAccount: Account, destination: string): Promise<string | true>;
86
- ```
87
-
88
- ```Typescript
89
- ocean.asset.simpleDownload(dtAddress: string, serviceEndpoint: string, txId: string, account: string): Promise<string>;
90
- ```
91
-
92
- ```Typescript
93
- ocean.asset.getOrderHistory(account: Account, serviceType?: string, fromBlock?: number): Promise<Order[]>;
94
- ```
95
-
96
- # Datatoken Pool
97
-
98
- Create, add/remove liquidity, check liquidity, price, buy datatokens
99
-
100
- ```Typescript
101
- ocean.pool.
102
- ```
103
-
104
- ```Typescript
105
- ocean.pool.createDTPool(account: string, token: string, amount: string, weight: string, fee: string): Promise<string>;
106
- ```
107
-
108
- ```Typescript
109
- ocean.pool.getDTAddress(poolAddress: string): Promise<string>;
110
- ```
111
-
112
- ```Typescript
113
- ocean.pool.getOceanReserve(poolAddress: string): Promise<string>;
114
- ```
115
-
116
- ```Typescript
117
- ocean.pool.getDTReserve(poolAddress: string): Promise<string>;
118
- ```
119
-
120
- ```Typescript
121
- ocean.pool.getMaxBuyQuantity(poolAddress: string, tokenAddress: string): Promise<string>;
122
- ```
123
-
124
- ```Typescript
125
- ocean.pool.getOceanMaxBuyQuantity(poolAddress: string): Promise<string>;
126
- ```
127
-
128
- ```Typescript
129
- ocean.pool.getDTMaxBuyQuantity(poolAddress: string): Promise<string>;
130
- ```
131
-
132
- ```Typescript
133
- ocean.pool.calcInGivenOut(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
134
- ```
135
-
136
- ```Typescript
137
- ocean.pool.calcOutGivenIn(poolAddress: string, tokenInAddress: string, tokenOutAddress: string, tokenInAmount: string): Promise<string>;
138
- ```
139
-
140
- ```Typescript
141
- ocean.pool.calcPoolOutGivenSingleIn(poolAddress: string, tokenInAddress: string, tokenInAmount: string): Promise<string>;
142
- ```
143
-
144
- ```Typescript
145
- ocean.pool.calcSingleInGivenPoolOut(poolAddress: string, tokenInAddress: string, poolShares: string): Promise<string>;
146
- ```
147
-
148
- ```Typescript
149
- ocean.pool.calcSingleOutGivenPoolIn(poolAddress: string, tokenOutAddress: string, poolShares: string): Promise<string>;
150
- ```
151
-
152
- ```Typescript
153
- ocean.pool.calcPoolInGivenSingleOut(poolAddress: string, tokenOutAddress: string, tokenOutAmount: string): Promise<string>;
154
- ```
155
-
156
- ```Typescript
157
- ocean.pool.getPoolSharesRequiredToRemoveDT(poolAddress: string, dtAmount: string): Promise<string>;
158
- ```
159
-
160
- ```Typescript
161
- ocean.pool.getDTRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
162
- ```
163
-
164
- ```Typescript
165
- ocean.pool.getPoolSharesRequiredToRemoveOcean(poolAddress: string, oceanAmount: string): Promise<string>;
166
- ```
167
-
168
- ```Typescript
169
- ocean.pool.getOceanRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<string>;
170
- ```
171
-
172
- ```Typescript
173
- ocean.pool.getTokensRemovedforPoolShares(poolAddress: string, poolShares: string): Promise<TokensReceived>;
174
- ```
175
-
176
- ```Typescript
177
- ocean.pool.getDTMaxAddLiquidity(poolAddress: string): Promise<string>;
178
- ```
179
-
180
- ```Typescript
181
- ocean.pool.getOceanMaxAddLiquidity(poolAddress: string): Promise<string>;
182
- ```
183
-
184
- ```Typescript
185
- ocean.pool.getMaxAddLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
186
- ```
187
-
188
- ```Typescript
189
- ocean.pool.getMaxRemoveLiquidity(poolAddress: string, tokenAddress: string): Promise<string>;
190
- ```
191
-
192
- ```Typescript
193
- ocean.pool.getDTMaxRemoveLiquidity(poolAddress: string): Promise<string>;
194
- ```
195
-
196
- ```Typescript
197
- ocean.pool.getOceanMaxRemoveLiquidity(poolAddress: string): Promise<string>;
198
- ```
199
-
200
- ```Typescript
201
- ocean.pool.buyDT(account: string, poolAddress: string, dtAmountWanted: string, maxOceanAmount: string, maxPrice?: string): Promise<TransactionReceipt>;
202
- ```
203
-
204
- ```Typescript
205
- ocean.pool.sellDT(account: string, poolAddress: string, dtAmount: string, oceanAmountWanted: string, maxPrice?: string): Promise<TransactionReceipt>;
206
- ```
207
-
208
- ```Typescript
209
- ocean.pool.addDTLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
210
- ```
211
-
212
- ```Typescript
213
- ocean.pool.removeDTLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
214
- ```
215
-
216
- ```Typescript
217
- ocean.pool.addOceanLiquidity(account: string, poolAddress: string, amount: string): Promise<TransactionReceipt>;
218
- ```
219
-
220
- ```Typescript
221
- ocean.pool.removeOceanLiquidity(account: string, poolAddress: string, amount: string, maximumPoolShares: string): Promise<TransactionReceipt>;
222
- ```
223
-
224
- ```Typescript
225
- ocean.pool.removePoolLiquidity(account: string, poolAddress: string, poolShares: string, minDT?: string, minOcean?: string): Promise<TransactionReceipt>;
226
- ```
227
-
228
- ```Typescript
229
- ocean.pool.getDTPrice(poolAddress: string): Promise<string>;
230
- ```
231
-
232
- ```Typescript
233
- ocean.pool.searchPoolforDT(dtAddress: string): Promise<string[]>;
234
- ```
235
-
236
- ```Typescript
237
- ocean.pool.getOceanNeeded(poolAddress: string, dtRequired: string): Promise<string>;
238
- ```
239
-
240
- ```Typescript
241
- ocean.pool.getOceanReceived(poolAddress: string, dtSold: string): Promise<string>;
242
- ```
243
-
244
- ```Typescript
245
- ocean.pool.getDTNeeded(poolAddress: string, OceanRequired: string): Promise<string>;
246
- ```
247
-
248
- ```Typescript
249
- ocean.pool.getPoolsbyCreator(account?: string): Promise<PoolDetails[]>;
250
- ```
251
-
252
- ```Typescript
253
- ocean.pool.getPoolDetails(poolAddress: string): Promise<PoolDetails>;
254
- ```
255
-
256
- ```Typescript
257
- ocean.pool.getPoolLogs(poolAddress: string, account?: string): Promise<PoolTransaction[]>;
258
- ```
259
-
260
- ```Typescript
261
- ocean.pool.getAllPoolLogs(account: string): Promise<PoolTransaction[]>;
262
- ```
263
-
264
- # Fixed rate exchange
265
-
266
- Create, price, buy datatokens
267
-
268
- ```Typescript
269
- ocean.exchange.create(datatoken: string, rate: string, address: string): Promise<string>;
270
- ```
271
-
272
- ```Typescript
273
- ocean.exchange.generateExchangeId(datatoken: string, owner: string): Promise<string>;
274
- ```
275
-
276
- ```Typescript
277
- ocean.exchange.buyDT(exchangeId: string, datatokenAmount: string, address: string): Promise<TransactionReceipt>;
278
- ```
279
-
280
- ```Typescript
281
- ocean.exchange.getNumberOfExchanges(): Promise<number>;
282
- ```
283
-
284
- ```Typescript
285
- ocean.exchange.setRate(exchangeId: string, newRate: number, address: string): Promise<TransactionReceipt>;
286
- ```
287
-
288
- ```Typescript
289
- ocean.exchange.activate(exchangeId: string, address: string): Promise<TransactionReceipt>;
290
- ```
291
-
292
- ```Typescript
293
- ocean.exchange.deactivate(exchangeId: string, address: string): Promise<TransactionReceipt>;
294
- ```
295
-
296
- ```Typescript
297
- ocean.exchange.getRate(exchangeId: string): Promise<string>;
298
- ```
299
-
300
- ```Typescript
301
- ocean.exchange.getSupply(exchangeId: string): Promise<string>;
302
- ```
303
-
304
- ```Typescript
305
- ocean.exchange.getOceanNeeded(exchangeId: string, datatokenAmount: string): Promise<string>;
306
- ```
307
-
308
- ```Typescript
309
- ocean.exchange.getExchange(exchangeId: string): Promise<FixedPriceExchange>;
310
- ```
311
-
312
- ```Typescript
313
- ocean.exchange.getExchanges(): Promise<string[]>;
314
- ```
315
-
316
- ```Typescript
317
- ocean.exchange.isActive(exchangeId: string): Promise<boolean>;
318
- ```
319
-
320
- ```Typescript
321
- ocean.exchange.CalcInGivenOut(exchangeId: string, datatokenAmount: string): Promise<string>;
322
- ```
323
-
324
- ```Typescript
325
- ocean.exchange.searchforDT(datatokenAddress: string, minSupply: string): Promise<FixedPriceExchange[]>;
326
- ```
327
-
328
- ```Typescript
329
- ocean.exchange.getExchangesbyCreator(account?: string): Promise<FixedPriceExchange[]>;
330
- ```
331
-
332
- ```Typescript
333
- ocean.exchange.getExchangeSwaps(exchangeId: string, account?: string): Promise<FixedPriceSwap[]>;
334
- ```
335
-
336
- ```Typescript
337
- ocean.exchange.getAllExchangesSwaps(account: string): Promise<FixedPriceSwap[]>;
338
- ```
339
-
340
- # Compute-to-data
341
-
342
- consume/start, stop, results, status, define-service
343
-
344
- ```Typescript
345
- ocean.compute.start(did: string, txId: string, tokenAddress: string, consumerAccount: Account, algorithmDid?: string, algorithmMeta?: MetadataAlgorithm, output?: Output, serviceIndex?: string, serviceType?: string, algorithmTransferTxId?: string, algorithmDatatoken?: string): Promise<ComputeJob>;
346
- ```
347
-
348
- ```Typescript
349
- ocean.compute.stop(consumerAccount: Account, did: string, jobId: string): Promise<ComputeJob>;
350
- ```
351
-
352
- ```Typescript
353
- ocean.compute.delete(consumerAccount: Account, did: string, jobId: string): Promise<ComputeJob>;
354
- ```
355
-
356
- ```Typescript
357
- ocean.compute.status(consumerAccount: Account, did?: string, jobId?: string): Promise<ComputeJob[]>;
358
- ```
359
-
360
- ```Typescript
361
- ocean.compute.result(consumerAccount: Account, did: string, jobId: string): Promise<ComputeJob>;
362
- ```
363
-
364
- ```Typescript
365
- ocean.compute.createServerAttributes(serverId: string, serverType: string, cost: string, cpu: string, gpu: string, memory: string, disk: string, maxExecutionTime: number): Server;
366
- ```
367
-
368
- ```Typescript
369
- ocean.compute.createContainerAttributes(image: string, tag: string, checksum: string): Container;
370
- ```
371
-
372
- ```Typescript
373
- ocean.compute.createClusterAttributes(type: string, url: string): Cluster;
374
- ```
375
-
376
- ```Typescript
377
- ocean.compute.createProviderAttributes(type: string, description: string, cluster: Cluster, containers: Container[], servers: Server[]): {
378
- type: string;
379
- description: string;
380
- environment: {
381
- cluster: Cluster;
382
- supportedServers: Server[];
383
- supportedContainers: Container[];
384
- };
385
- };
386
- ```
387
-
388
- ```Typescript
389
- ocean.compute.createComputeService(consumerAccount: Account, cost: string, datePublished: string, providerAttributes: any, computePrivacy?: ServiceComputePrivacy, timeout?: number, providerUri?: string): ServiceCompute;
390
- ```
391
-
392
- ```Typescript
393
- ocean.compute.order(consumerAccount: string, datasetDid: string, serviceIndex: number, algorithmDid?: string, algorithmMeta?: MetadataAlgorithm, mpAddress?: string): SubscribablePromise<OrderProgressStep, string>;
394
- ```