@oceanprotocol/lib 7.0.0-next.5 → 7.0.0-next.6

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 (95) hide show
  1. package/package.json +7 -1
  2. package/.mocharc.json +0 -8
  3. package/.nvmrc +0 -1
  4. package/CHANGELOG.md +0 -3263
  5. package/Cheatsheet.md +0 -326
  6. package/CodeExamples.md +0 -881
  7. package/ComputeExamples.md +0 -941
  8. package/dist/lib.cjs.map +0 -1
  9. package/dist/lib.module.mjs.map +0 -1
  10. package/dist/lib.umd.js.map +0 -1
  11. package/docs/.nojekyll +0 -1
  12. package/docs/README.md +0 -195
  13. package/docs/classes/Aquarius.md +0 -175
  14. package/docs/classes/Config.md +0 -481
  15. package/docs/classes/ConfigHelper.md +0 -66
  16. package/docs/classes/Datatoken.md +0 -1123
  17. package/docs/classes/Dispenser.md +0 -502
  18. package/docs/classes/Escrow.md +0 -285
  19. package/docs/classes/FixedRateExchange.md +0 -1068
  20. package/docs/classes/Logger.md +0 -191
  21. package/docs/classes/Nft.md +0 -970
  22. package/docs/classes/NftFactory.md +0 -861
  23. package/docs/classes/Provider.md +0 -727
  24. package/docs/classes/Router.md +0 -645
  25. package/docs/classes/SmartContract.md +0 -193
  26. package/docs/classes/SmartContractWithAddress.md +0 -268
  27. package/docs/enums/LogLevel.md +0 -63
  28. package/docs/interfaces/AbiInput.md +0 -63
  29. package/docs/interfaces/AbiItem.md +0 -107
  30. package/docs/interfaces/AbiOutput.md +0 -52
  31. package/docs/interfaces/Arweave.md +0 -32
  32. package/docs/interfaces/Asset.md +0 -227
  33. package/docs/interfaces/AssetDatatoken.md +0 -60
  34. package/docs/interfaces/AssetLastEvent.md +0 -63
  35. package/docs/interfaces/AssetNft.md +0 -105
  36. package/docs/interfaces/AssetPrice.md +0 -47
  37. package/docs/interfaces/ComputeAlgorithm.md +0 -82
  38. package/docs/interfaces/ComputeAsset.md +0 -56
  39. package/docs/interfaces/ComputeEnvFees.md +0 -30
  40. package/docs/interfaces/ComputeEnvFeesStructure.md +0 -20
  41. package/docs/interfaces/ComputeEnvironment.md +0 -177
  42. package/docs/interfaces/ComputeJob.md +0 -173
  43. package/docs/interfaces/ComputeOutput.md +0 -118
  44. package/docs/interfaces/ComputeResourcesPricingInfo.md +0 -30
  45. package/docs/interfaces/ComputeResourcesRequest.md +0 -34
  46. package/docs/interfaces/ComputeResult.md +0 -52
  47. package/docs/interfaces/ConsumeMarketFee.md +0 -41
  48. package/docs/interfaces/Credential.md +0 -30
  49. package/docs/interfaces/Credentials.md +0 -30
  50. package/docs/interfaces/DDO.md +0 -137
  51. package/docs/interfaces/DatatokenCreateParams.md +0 -107
  52. package/docs/interfaces/DatatokenRoles.md +0 -30
  53. package/docs/interfaces/DispenserCreationParams.md +0 -63
  54. package/docs/interfaces/DispenserParams.md +0 -52
  55. package/docs/interfaces/DispenserToken.md +0 -85
  56. package/docs/interfaces/DownloadResponse.md +0 -30
  57. package/docs/interfaces/Event.md +0 -73
  58. package/docs/interfaces/FeesInfo.md +0 -74
  59. package/docs/interfaces/FileInfo.md +0 -118
  60. package/docs/interfaces/Files.md +0 -41
  61. package/docs/interfaces/FixedPriceExchange.md +0 -162
  62. package/docs/interfaces/FreCreationParams.md +0 -118
  63. package/docs/interfaces/FreOrderParams.md +0 -85
  64. package/docs/interfaces/GraphqlQuery.md +0 -69
  65. package/docs/interfaces/Ipfs.md +0 -32
  66. package/docs/interfaces/Metadata.md +0 -193
  67. package/docs/interfaces/MetadataAlgorithm.md +0 -69
  68. package/docs/interfaces/MetadataAndTokenURI.md +0 -107
  69. package/docs/interfaces/MetadataProof.md +0 -52
  70. package/docs/interfaces/NftCreateData.md +0 -74
  71. package/docs/interfaces/NftRoles.md +0 -52
  72. package/docs/interfaces/Operation.md +0 -145
  73. package/docs/interfaces/OrderParams.md +0 -52
  74. package/docs/interfaces/PriceAndFees.md +0 -52
  75. package/docs/interfaces/ProviderComputeInitialize.md +0 -41
  76. package/docs/interfaces/ProviderComputeInitializeResults.md +0 -43
  77. package/docs/interfaces/ProviderFees.md +0 -96
  78. package/docs/interfaces/ProviderInitialize.md +0 -52
  79. package/docs/interfaces/PublisherTrustedAlgorithm.md +0 -47
  80. package/docs/interfaces/PublishingMarketFee.md +0 -41
  81. package/docs/interfaces/Purgatory.md +0 -34
  82. package/docs/interfaces/RunningPlatform.md +0 -30
  83. package/docs/interfaces/SearchQuery.md +0 -67
  84. package/docs/interfaces/Service.md +0 -138
  85. package/docs/interfaces/ServiceComputeOptions.md +0 -63
  86. package/docs/interfaces/ServiceEndpoint.md +0 -41
  87. package/docs/interfaces/Smartcontract-1.md +0 -58
  88. package/docs/interfaces/Stats.md +0 -47
  89. package/docs/interfaces/Template.md +0 -30
  90. package/docs/interfaces/TokenOrder.md +0 -63
  91. package/docs/interfaces/UrlFile.md +0 -71
  92. package/docs/interfaces/UserCustomParameters.md +0 -7
  93. package/docs/interfaces/ValidateMetadata.md +0 -52
  94. package/docs/modules.md +0 -850
  95. package/typedoc.json +0 -4
package/docs/modules.md DELETED
@@ -1,850 +0,0 @@
1
- [@oceanprotocol/lib](README.md) / Exports
2
-
3
- # @oceanprotocol/lib
4
-
5
- ## Table of contents
6
-
7
- ### Enumerations
8
-
9
- - [LogLevel](enums/LogLevel.md)
10
-
11
- ### Classes
12
-
13
- - [Aquarius](classes/Aquarius.md)
14
- - [Config](classes/Config.md)
15
- - [ConfigHelper](classes/ConfigHelper.md)
16
- - [Datatoken](classes/Datatoken.md)
17
- - [Dispenser](classes/Dispenser.md)
18
- - [FixedRateExchange](classes/FixedRateExchange.md)
19
- - [Logger](classes/Logger.md)
20
- - [Nft](classes/Nft.md)
21
- - [NftFactory](classes/NftFactory.md)
22
- - [Provider](classes/Provider.md)
23
- - [Router](classes/Router.md)
24
- - [SmartContract](classes/SmartContract.md)
25
- - [SmartContractWithAddress](classes/SmartContractWithAddress.md)
26
-
27
- ### Interfaces
28
-
29
- - [AbiInput](interfaces/AbiInput.md)
30
- - [AbiItem](interfaces/AbiItem.md)
31
- - [AbiOutput](interfaces/AbiOutput.md)
32
- - [Arweave](interfaces/Arweave.md)
33
- - [Asset](interfaces/Asset.md)
34
- - [AssetDatatoken](interfaces/AssetDatatoken.md)
35
- - [AssetLastEvent](interfaces/AssetLastEvent.md)
36
- - [AssetNft](interfaces/AssetNft.md)
37
- - [AssetPrice](interfaces/AssetPrice.md)
38
- - [ComputeAlgorithm](interfaces/ComputeAlgorithm.md)
39
- - [ComputeAsset](interfaces/ComputeAsset.md)
40
- - [ComputeEnvironment](interfaces/ComputeEnvironment.md)
41
- - [ComputeJob](interfaces/ComputeJob.md)
42
- - [ComputeOutput](interfaces/ComputeOutput.md)
43
- - [ComputeResult](interfaces/ComputeResult.md)
44
- - [ConsumeMarketFee](interfaces/ConsumeMarketFee.md)
45
- - [Credential](interfaces/Credential.md)
46
- - [Credentials](interfaces/Credentials.md)
47
- - [DDO](interfaces/DDO.md)
48
- - [DatatokenCreateParams](interfaces/DatatokenCreateParams.md)
49
- - [DatatokenRoles](interfaces/DatatokenRoles.md)
50
- - [DispenserCreationParams](interfaces/DispenserCreationParams.md)
51
- - [DispenserParams](interfaces/DispenserParams.md)
52
- - [DispenserToken](interfaces/DispenserToken.md)
53
- - [DownloadResponse](interfaces/DownloadResponse.md)
54
- - [Event](interfaces/Event.md)
55
- - [FeesInfo](interfaces/FeesInfo.md)
56
- - [FileInfo](interfaces/FileInfo.md)
57
- - [Files](interfaces/Files.md)
58
- - [FixedPriceExchange](interfaces/FixedPriceExchange.md)
59
- - [FreCreationParams](interfaces/FreCreationParams.md)
60
- - [FreOrderParams](interfaces/FreOrderParams.md)
61
- - [GraphqlQuery](interfaces/GraphqlQuery.md)
62
- - [Ipfs](interfaces/Ipfs.md)
63
- - [Metadata](interfaces/Metadata.md)
64
- - [MetadataAlgorithm](interfaces/MetadataAlgorithm.md)
65
- - [MetadataAndTokenURI](interfaces/MetadataAndTokenURI.md)
66
- - [MetadataProof](interfaces/MetadataProof.md)
67
- - [NftCreateData](interfaces/NftCreateData.md)
68
- - [NftRoles](interfaces/NftRoles.md)
69
- - [Operation](interfaces/Operation.md)
70
- - [OrderParams](interfaces/OrderParams.md)
71
- - [PriceAndFees](interfaces/PriceAndFees.md)
72
- - [ProviderComputeInitialize](interfaces/ProviderComputeInitialize.md)
73
- - [ProviderComputeInitializeResults](interfaces/ProviderComputeInitializeResults.md)
74
- - [ProviderFees](interfaces/ProviderFees.md)
75
- - [ProviderInitialize](interfaces/ProviderInitialize.md)
76
- - [PublisherTrustedAlgorithm](interfaces/PublisherTrustedAlgorithm.md)
77
- - [PublishingMarketFee](interfaces/PublishingMarketFee.md)
78
- - [Purgatory](interfaces/Purgatory.md)
79
- - [SearchQuery](interfaces/SearchQuery.md)
80
- - [Service](interfaces/Service.md)
81
- - [ServiceComputeOptions](interfaces/ServiceComputeOptions.md)
82
- - [ServiceEndpoint](interfaces/ServiceEndpoint.md)
83
- - [Smartcontract](interfaces/Smartcontract-1.md)
84
- - [Stats](interfaces/Stats.md)
85
- - [Template](interfaces/Template.md)
86
- - [TokenOrder](interfaces/TokenOrder.md)
87
- - [UrlFile](interfaces/UrlFile.md)
88
- - [UserCustomParameters](interfaces/UserCustomParameters.md)
89
- - [ValidateMetadata](interfaces/ValidateMetadata.md)
90
-
91
- ### Type Aliases
92
-
93
- - [AbiType](modules.md#abitype)
94
- - [ComputeResultType](modules.md#computeresulttype)
95
- - [ReceiptOrDecimal](modules.md#receiptordecimal)
96
- - [ReceiptOrEstimate](modules.md#receiptorestimate)
97
- - [StateMutabilityType](modules.md#statemutabilitytype)
98
-
99
- ### Variables
100
-
101
- - [FEE\_HISTORY\_NOT\_SUPPORTED](modules.md#fee_history_not_supported)
102
- - [GASLIMIT\_DEFAULT](modules.md#gaslimit_default)
103
- - [LoggerInstance](modules.md#loggerinstance)
104
- - [MAX\_UINT\_256](modules.md#max_uint_256)
105
- - [ProviderInstance](modules.md#providerinstance)
106
- - [ZERO\_ADDRESS](modules.md#zero_address)
107
- - [configHelperNetworks](modules.md#confighelpernetworks)
108
- - [minAbi](modules.md#minabi)
109
-
110
- ### Functions
111
-
112
- - [allowance](modules.md#allowance)
113
- - [allowanceWei](modules.md#allowancewei)
114
- - [amountToUnits](modules.md#amounttounits)
115
- - [approve](modules.md#approve)
116
- - [approveWei](modules.md#approvewei)
117
- - [balance](modules.md#balance)
118
- - [decimals](modules.md#decimals)
119
- - [downloadFile](modules.md#downloadfile)
120
- - [downloadFileBrowser](modules.md#downloadfilebrowser)
121
- - [generateDid](modules.md#generatedid)
122
- - [generateDtName](modules.md#generatedtname)
123
- - [getErrorMessage](modules.md#geterrormessage)
124
- - [getEventFromTx](modules.md#geteventfromtx)
125
- - [getFairGasPrice](modules.md#getfairgasprice)
126
- - [getHash](modules.md#gethash)
127
- - [getTokenDecimals](modules.md#gettokendecimals)
128
- - [sendTx](modules.md#sendtx)
129
- - [setContractDefaults](modules.md#setcontractdefaults)
130
- - [signHash](modules.md#signhash)
131
- - [sleep](modules.md#sleep)
132
- - [transfer](modules.md#transfer)
133
- - [unitsToAmount](modules.md#unitstoamount)
134
-
135
- ## Type Aliases
136
-
137
- ### AbiType
138
-
139
- Ƭ **AbiType**: ``"function"`` \| ``"constructor"`` \| ``"event"`` \| ``"fallback"``
140
-
141
- #### Defined in
142
-
143
- [@types/Contracts.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L1)
144
-
145
- ___
146
-
147
- ### ComputeResultType
148
-
149
- Ƭ **ComputeResultType**: ``"algorithmLog"`` \| ``"output"`` \| ``"configrationLog"`` \| ``"publishLog"``
150
-
151
- #### Defined in
152
-
153
- [@types/Compute.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Compute.ts#L3)
154
-
155
- ___
156
-
157
- ### ReceiptOrDecimal
158
-
159
- Ƭ **ReceiptOrDecimal**<`G`\>: `G` extends ``false`` ? `providers.TransactionResponse` : `number`
160
-
161
- #### Type parameters
162
-
163
- | Name | Type |
164
- | :------ | :------ |
165
- | `G` | extends `boolean` = ``false`` |
166
-
167
- #### Defined in
168
-
169
- [@types/ReturnTypes.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/ReturnTypes.ts#L5)
170
-
171
- ___
172
-
173
- ### ReceiptOrEstimate
174
-
175
- Ƭ **ReceiptOrEstimate**<`G`\>: `G` extends ``false`` ? `providers.TransactionResponse` : `BigNumber`
176
-
177
- #### Type parameters
178
-
179
- | Name | Type |
180
- | :------ | :------ |
181
- | `G` | extends `boolean` = ``false`` |
182
-
183
- #### Defined in
184
-
185
- [@types/ReturnTypes.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/ReturnTypes.ts#L2)
186
-
187
- ___
188
-
189
- ### StateMutabilityType
190
-
191
- Ƭ **StateMutabilityType**: ``"pure"`` \| ``"view"`` \| ``"nonpayable"`` \| ``"payable"``
192
-
193
- #### Defined in
194
-
195
- [@types/Contracts.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/@types/Contracts.ts#L2)
196
-
197
- ## Variables
198
-
199
- ### FEE\_HISTORY\_NOT\_SUPPORTED
200
-
201
- • `Const` **FEE\_HISTORY\_NOT\_SUPPORTED**: ``"Returned error: Method eth_feeHistory not supported."``
202
-
203
- #### Defined in
204
-
205
- [utils/Constants.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L5)
206
-
207
- ___
208
-
209
- ### GASLIMIT\_DEFAULT
210
-
211
- • `Const` **GASLIMIT\_DEFAULT**: ``1000000``
212
-
213
- #### Defined in
214
-
215
- [utils/Constants.ts:2](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L2)
216
-
217
- ___
218
-
219
- ### LoggerInstance
220
-
221
- • `Const` **LoggerInstance**: [`Logger`](classes/Logger.md)
222
-
223
- #### Defined in
224
-
225
- [utils/Logger.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Logger.ts#L45)
226
-
227
- ___
228
-
229
- ### MAX\_UINT\_256
230
-
231
- • `Const` **MAX\_UINT\_256**: ``"115792089237316195423570985008687907853269984665640564039457584007913129639934"``
232
-
233
- #### Defined in
234
-
235
- [utils/Constants.ts:3](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L3)
236
-
237
- ___
238
-
239
- ### ProviderInstance
240
-
241
- • `Const` **ProviderInstance**: [`Provider`](classes/Provider.md)
242
-
243
- #### Defined in
244
-
245
- [services/Provider.ts:916](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/services/Provider.ts#L916)
246
-
247
- ___
248
-
249
- ### ZERO\_ADDRESS
250
-
251
- • `Const` **ZERO\_ADDRESS**: ``"0x0000000000000000000000000000000000000000"``
252
-
253
- #### Defined in
254
-
255
- [utils/Constants.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/Constants.ts#L1)
256
-
257
- ___
258
-
259
- ### configHelperNetworks
260
-
261
- • `Const` **configHelperNetworks**: [`Config`](classes/Config.md)[]
262
-
263
- #### Defined in
264
-
265
- [config/ConfigHelper.ts:25](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/config/ConfigHelper.ts#L25)
266
-
267
- ___
268
-
269
- ### minAbi
270
-
271
- • `Const` **minAbi**: ({ `anonymous?`: `undefined` = false; `constant`: `boolean` = false; `inputs`: { `name`: `string` = '\_spender'; `type`: `string` = 'address' }[] ; `name`: `string` = 'approve'; `outputs`: { `name`: `string` = ''; `type`: `string` = 'bool' }[] ; `payable`: `boolean` = false; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'function' } \| { `anonymous?`: `undefined` = false; `constant?`: `undefined` = false; `inputs?`: `undefined` ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = true; `stateMutability`: `string` = 'payable'; `type`: `string` = 'fallback' } \| { `anonymous`: `boolean` = false; `constant?`: `undefined` = false; `inputs`: { `indexed`: `boolean` = true; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `payable?`: `undefined` = true; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' })[]
272
-
273
- #### Defined in
274
-
275
- [utils/minAbi.ts:1](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/minAbi.ts#L1)
276
-
277
- ## Functions
278
-
279
- ### allowance
280
-
281
- ▸ **allowance**(`signer`, `tokenAddress`, `account`, `spender`, `tokenDecimals?`): `Promise`<`string`\>
282
-
283
- Get Allowance for any Datatoken
284
-
285
- #### Parameters
286
-
287
- | Name | Type | Description |
288
- | :------ | :------ | :------ |
289
- | `signer` | `Signer` | The signer object |
290
- | `tokenAddress` | `string` | The address of the token |
291
- | `account` | `string` | The address of the caller |
292
- | `spender` | `string` | The address of the spender |
293
- | `tokenDecimals?` | `number` | optional number of decimals of the token |
294
-
295
- #### Returns
296
-
297
- `Promise`<`string`\>
298
-
299
- #### Defined in
300
-
301
- [utils/TokenUtils.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L143)
302
-
303
- ___
304
-
305
- ### allowanceWei
306
-
307
- ▸ **allowanceWei**(`signer`, `tokenAddress`, `account`, `spender`): `Promise`<`string`\>
308
-
309
- Get Allowance in wei for any erc20
310
-
311
- #### Parameters
312
-
313
- | Name | Type | Description |
314
- | :------ | :------ | :------ |
315
- | `signer` | `Signer` | The signer object |
316
- | `tokenAddress` | `string` | The address of the token |
317
- | `account` | `string` | The address of the caller |
318
- | `spender` | `string` | The address of the spneder |
319
-
320
- #### Returns
321
-
322
- `Promise`<`string`\>
323
-
324
- #### Defined in
325
-
326
- [utils/TokenUtils.ts:182](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L182)
327
-
328
- ___
329
-
330
- ### amountToUnits
331
-
332
- ▸ **amountToUnits**(`signer`, `token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
333
-
334
- Converts an amount of tokens to units
335
-
336
- #### Parameters
337
-
338
- | Name | Type | Description |
339
- | :------ | :------ | :------ |
340
- | `signer` | `Signer` | The signer object to use. |
341
- | `token` | `string` | The token to convert |
342
- | `amount` | `string` | The amount of tokens to convert |
343
- | `tokenDecimals?` | `number` | The number of decimals of the token |
344
-
345
- #### Returns
346
-
347
- `Promise`<`string`\>
348
-
349
- - The converted amount in units
350
-
351
- #### Defined in
352
-
353
- [utils/ContractUtils.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L82)
354
-
355
- ___
356
-
357
- ### approve
358
-
359
- ▸ **approve**<`G`\>(`signer`, `config`, `account`, `tokenAddress`, `spender`, `amount`, `force?`, `tokenDecimals?`, `estimateGas?`): `Promise`<[`ReceiptOrDecimal`](modules.md#receiptordecimal)<`G`\> \| `number`\>
360
-
361
- Approve spender to spent amount tokens
362
-
363
- #### Type parameters
364
-
365
- | Name | Type |
366
- | :------ | :------ |
367
- | `G` | extends `boolean` = ``false`` |
368
-
369
- #### Parameters
370
-
371
- | Name | Type | Default value | Description |
372
- | :------ | :------ | :------ | :------ |
373
- | `signer` | `Signer` | `undefined` | The signer object |
374
- | `config` | [`Config`](classes/Config.md) | `undefined` | The config object |
375
- | `account` | `string` | `undefined` | The address of the caller |
376
- | `tokenAddress` | `string` | `undefined` | The address of the token |
377
- | `spender` | `string` | `undefined` | The address of the spender |
378
- | `amount` | `string` | `undefined` | amount of ERC20 Datatokens (always expressed as wei) |
379
- | `force` | `boolean` | `false` | if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed |
380
- | `tokenDecimals?` | `number` | `undefined` | optional number of decimals of the token |
381
- | `estimateGas?` | `G` | `undefined` | if true, returns the estimate gas cost for calling the method |
382
-
383
- #### Returns
384
-
385
- `Promise`<[`ReceiptOrDecimal`](modules.md#receiptordecimal)<`G`\> \| `number`\>
386
-
387
- #### Defined in
388
-
389
- [utils/TokenUtils.ts:19](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L19)
390
-
391
- ___
392
-
393
- ### approveWei
394
-
395
- ▸ **approveWei**<`G`\>(`signer`, `config`, `account`, `tokenAddress`, `spender`, `amount`, `force?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
396
-
397
- Approve spender to spent amount tokens
398
-
399
- #### Type parameters
400
-
401
- | Name | Type |
402
- | :------ | :------ |
403
- | `G` | extends `boolean` = ``false`` |
404
-
405
- #### Parameters
406
-
407
- | Name | Type | Default value | Description |
408
- | :------ | :------ | :------ | :------ |
409
- | `signer` | `Signer` | `undefined` | The signer object |
410
- | `config` | [`Config`](classes/Config.md) | `undefined` | The config object |
411
- | `account` | `string` | `undefined` | The address of the caller |
412
- | `tokenAddress` | `string` | `undefined` | The address of the token |
413
- | `spender` | `string` | `undefined` | The address of the spender |
414
- | `amount` | `string` | `undefined` | amount of ERC20 tokens (always expressed as wei) |
415
- | `force` | `boolean` | `false` | if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed |
416
- | `estimateGas?` | `G` | `undefined` | if true, returns the estimate gas cost for calling the method |
417
-
418
- #### Returns
419
-
420
- `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
421
-
422
- #### Defined in
423
-
424
- [utils/TokenUtils.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L63)
425
-
426
- ___
427
-
428
- ### balance
429
-
430
- ▸ **balance**(`signer`, `tokenAddress`, `account`, `tokenDecimals?`): `Promise`<`string`\>
431
-
432
- Get balance for any Datatoken
433
-
434
- #### Parameters
435
-
436
- | Name | Type | Description |
437
- | :------ | :------ | :------ |
438
- | `signer` | `Signer` | The signer object |
439
- | `tokenAddress` | `string` | The address of the token |
440
- | `account` | `string` | The address of the caller |
441
- | `tokenDecimals?` | `number` | optional number of decimals of the token |
442
-
443
- #### Returns
444
-
445
- `Promise`<`string`\>
446
-
447
- #### Defined in
448
-
449
- [utils/TokenUtils.ts:163](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L163)
450
-
451
- ___
452
-
453
- ### decimals
454
-
455
- ▸ **decimals**(`signer`, `tokenAddress`): `Promise`<`number`\>
456
-
457
- Get decimals for any Datatoken
458
-
459
- #### Parameters
460
-
461
- | Name | Type | Description |
462
- | :------ | :------ | :------ |
463
- | `signer` | `Signer` | The signer object |
464
- | `tokenAddress` | `string` | The address of the token |
465
-
466
- #### Returns
467
-
468
- `Promise`<`number`\>
469
-
470
- Number of decimals of the token
471
-
472
- #### Defined in
473
-
474
- [utils/TokenUtils.ts:198](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L198)
475
-
476
- ___
477
-
478
- ### downloadFile
479
-
480
- ▸ **downloadFile**(`url`, `index?`): `Promise`<[`DownloadResponse`](interfaces/DownloadResponse.md)\>
481
-
482
- Triggers a file download from the specified URL when called from a browser context.
483
-
484
- #### Parameters
485
-
486
- | Name | Type | Description |
487
- | :------ | :------ | :------ |
488
- | `url` | `string` | The URL of the file to download |
489
- | `index?` | `number` | The file index |
490
-
491
- #### Returns
492
-
493
- `Promise`<[`DownloadResponse`](interfaces/DownloadResponse.md)\>
494
-
495
- - A Promise that resolves when the file has been downloaded
496
-
497
- #### Defined in
498
-
499
- [utils/FetchHelper.ts:35](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/FetchHelper.ts#L35)
500
-
501
- ___
502
-
503
- ### downloadFileBrowser
504
-
505
- ▸ **downloadFileBrowser**(`url`): `Promise`<`void`\>
506
-
507
- Triggers a file download from the specified URL when called from a browser context.
508
-
509
- #### Parameters
510
-
511
- | Name | Type | Description |
512
- | :------ | :------ | :------ |
513
- | `url` | `string` | The URL of the file to download |
514
-
515
- #### Returns
516
-
517
- `Promise`<`void`\>
518
-
519
- - A Promise that resolves when the file has been downloaded
520
-
521
- #### Defined in
522
-
523
- [utils/FetchHelper.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/FetchHelper.ts#L9)
524
-
525
- ___
526
-
527
- ### generateDid
528
-
529
- ▸ **generateDid**(`nftAddress`, `chainId`): `string`
530
-
531
- Generates a valid DID
532
-
533
- #### Parameters
534
-
535
- | Name | Type | Description |
536
- | :------ | :------ | :------ |
537
- | `nftAddress` | `string` | The NFT address |
538
- | `chainId` | `number` | The chain ID |
539
-
540
- #### Returns
541
-
542
- `string`
543
-
544
- - The DID
545
-
546
- #### Defined in
547
-
548
- [utils/DdoHelpers.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DdoHelpers.ts#L10)
549
-
550
- ___
551
-
552
- ### generateDtName
553
-
554
- ▸ **generateDtName**(`wordList?`): `Object`
555
-
556
- This function generates a datatoken name and symbol from a given word list.
557
-
558
- #### Parameters
559
-
560
- | Name | Type | Description |
561
- | :------ | :------ | :------ |
562
- | `wordList?` | `Object` | An object containing an array of nouns and adjectives. |
563
- | `wordList.adjectives` | `string`[] | An array of adjectives. |
564
- | `wordList.nouns` | `string`[] | An array of nouns. |
565
-
566
- #### Returns
567
-
568
- `Object`
569
-
570
- Returns an object containing the generated name and symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
571
-
572
- | Name | Type |
573
- | :------ | :------ |
574
- | `name` | `string` |
575
- | `symbol` | `string` |
576
-
577
- #### Defined in
578
-
579
- [utils/DatatokenName.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DatatokenName.ts#L10)
580
-
581
- ___
582
-
583
- ### getErrorMessage
584
-
585
- ▸ **getErrorMessage**(`error`): `string`
586
-
587
- #### Parameters
588
-
589
- | Name | Type |
590
- | :------ | :------ |
591
- | `error` | `Object` |
592
-
593
- #### Returns
594
-
595
- `string`
596
-
597
- #### Defined in
598
-
599
- [utils/ProviderErrors.ts:77](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ProviderErrors.ts#L77)
600
-
601
- ___
602
-
603
- ### getEventFromTx
604
-
605
- ▸ **getEventFromTx**(`txReceipt`, `eventName`): `any`
606
-
607
- #### Parameters
608
-
609
- | Name | Type |
610
- | :------ | :------ |
611
- | `txReceipt` | `any` |
612
- | `eventName` | `any` |
613
-
614
- #### Returns
615
-
616
- `any`
617
-
618
- #### Defined in
619
-
620
- [utils/ContractUtils.ts:96](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L96)
621
-
622
- ___
623
-
624
- ### getFairGasPrice
625
-
626
- ▸ **getFairGasPrice**(`signer`, `gasFeeMultiplier`): `Promise`<`string`\>
627
-
628
- Asynchronous function that returns a fair gas price based on the current gas price and a multiplier.
629
-
630
- #### Parameters
631
-
632
- | Name | Type | Description |
633
- | :------ | :------ | :------ |
634
- | `signer` | `Signer` | The signer object to use for fetching the current gas price. |
635
- | `gasFeeMultiplier` | `number` | The multiplier to apply to the current gas price. If not provided, the current gas price is returned as a string. |
636
-
637
- #### Returns
638
-
639
- `Promise`<`string`\>
640
-
641
- A Promise that resolves to a string representation of the fair gas price.
642
-
643
- #### Defined in
644
-
645
- [utils/ContractUtils.ts:30](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L30)
646
-
647
- ___
648
-
649
- ### getHash
650
-
651
- ▸ **getHash**(`data`): `string`
652
-
653
- Returns the SHA256 hash of the input data
654
-
655
- #### Parameters
656
-
657
- | Name | Type | Description |
658
- | :------ | :------ | :------ |
659
- | `data` | `any` | The input data |
660
-
661
- #### Returns
662
-
663
- `string`
664
-
665
- - The SHA256 hash of the input data
666
-
667
- #### Defined in
668
-
669
- [utils/DdoHelpers.ts:21](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/DdoHelpers.ts#L21)
670
-
671
- ___
672
-
673
- ### getTokenDecimals
674
-
675
- ▸ **getTokenDecimals**(`signer`, `token`): `Promise`<`any`\>
676
-
677
- Asynchronous function that returns the number of decimal places for a given token.
678
-
679
- #### Parameters
680
-
681
- | Name | Type | Description |
682
- | :------ | :------ | :------ |
683
- | `signer` | `Signer` | The signer object to use for fetching the token decimals. |
684
- | `token` | `string` | The address of the token contract. |
685
-
686
- #### Returns
687
-
688
- `Promise`<`any`\>
689
-
690
- A Promise that resolves to the number of decimal places for the token.
691
-
692
- #### Defined in
693
-
694
- [utils/ContractUtils.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L46)
695
-
696
- ___
697
-
698
- ### sendTx
699
-
700
- ▸ **sendTx**(`estGas`, `signer`, `gasFeeMultiplier`, `functionToSend`, `...args`): `Promise`<`providers.TransactionResponse`\>
701
-
702
- Send the transation on chain
703
-
704
- #### Parameters
705
-
706
- | Name | Type | Description |
707
- | :------ | :------ | :------ |
708
- | `estGas` | `BigNumber` | estimated gas for the transaction |
709
- | `signer` | `Signer` | signer object |
710
- | `gasFeeMultiplier` | `number` | number represinting the multiplier we apply to gas fees |
711
- | `functionToSend` | `ContractFunction`<`any`\> | function that we need to send |
712
- | `...args` | `any`[] | arguments of the function |
713
-
714
- #### Returns
715
-
716
- `Promise`<`providers.TransactionResponse`\>
717
-
718
- transaction receipt
719
-
720
- #### Defined in
721
-
722
- [utils/ContractUtils.ts:111](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L111)
723
-
724
- ___
725
-
726
- ### setContractDefaults
727
-
728
- ▸ **setContractDefaults**(`contract`, `config`): `Contract`
729
-
730
- #### Parameters
731
-
732
- | Name | Type |
733
- | :------ | :------ |
734
- | `contract` | `Contract` |
735
- | `config` | [`Config`](classes/Config.md) |
736
-
737
- #### Returns
738
-
739
- `Contract`
740
-
741
- #### Defined in
742
-
743
- [utils/ContractUtils.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L10)
744
-
745
- ___
746
-
747
- ### signHash
748
-
749
- ▸ **signHash**(`signer`, `message`): `Promise`<{ `r`: `string` ; `s`: `string` ; `v`: `string` }\>
750
-
751
- Signs the hash of a message using the provided signer.
752
-
753
- #### Parameters
754
-
755
- | Name | Type | Description |
756
- | :------ | :------ | :------ |
757
- | `signer` | `Signer` | The signer to use for signing the hash. |
758
- | `message` | `string` | The message to sign. |
759
-
760
- #### Returns
761
-
762
- `Promise`<{ `r`: `string` ; `s`: `string` ; `v`: `string` }\>
763
-
764
- - A Promise that resolves to the signature of the hash of the message.
765
-
766
- #### Defined in
767
-
768
- [utils/SignatureUtils.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/SignatureUtils.ts#L9)
769
-
770
- ___
771
-
772
- ### sleep
773
-
774
- ▸ **sleep**(`ms`): `Promise`<`unknown`\>
775
-
776
- Simple blocking sleep function
777
-
778
- #### Parameters
779
-
780
- | Name | Type | Description |
781
- | :------ | :------ | :------ |
782
- | `ms` | `number` | Number of milliseconds to wait |
783
-
784
- #### Returns
785
-
786
- `Promise`<`unknown`\>
787
-
788
- #### Defined in
789
-
790
- [utils/General.ts:5](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/General.ts#L5)
791
-
792
- ___
793
-
794
- ### transfer
795
-
796
- ▸ **transfer**<`G`\>(`signer`, `config`, `tokenAddress`, `recipient`, `amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
797
-
798
- Moves amount tokens from the caller’s account to recipient.
799
-
800
- #### Type parameters
801
-
802
- | Name | Type |
803
- | :------ | :------ |
804
- | `G` | extends `boolean` = ``false`` |
805
-
806
- #### Parameters
807
-
808
- | Name | Type | Description |
809
- | :------ | :------ | :------ |
810
- | `signer` | `Signer` | The signer object |
811
- | `config` | [`Config`](classes/Config.md) | The config object |
812
- | `tokenAddress` | `string` | The address of the token |
813
- | `recipient` | `string` | The address of the tokens receiver |
814
- | `amount` | `string` | amount of ERC20 Datatokens (not as wei) |
815
- | `estimateGas?` | `G` | if true returns the gas estimate |
816
-
817
- #### Returns
818
-
819
- `Promise`<[`ReceiptOrEstimate`](modules.md#receiptorestimate)<`G`\>\>
820
-
821
- #### Defined in
822
-
823
- [utils/TokenUtils.ts:111](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/TokenUtils.ts#L111)
824
-
825
- ___
826
-
827
- ### unitsToAmount
828
-
829
- ▸ **unitsToAmount**(`signer`, `token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
830
-
831
- Converts an amount of units to tokens
832
-
833
- #### Parameters
834
-
835
- | Name | Type | Description |
836
- | :------ | :------ | :------ |
837
- | `signer` | `Signer` | The signer object to use. |
838
- | `token` | `string` | The token to convert |
839
- | `amount` | `string` | The amount of units to convert |
840
- | `tokenDecimals?` | `number` | The number of decimals in the token |
841
-
842
- #### Returns
843
-
844
- `Promise`<`string`\>
845
-
846
- - The converted amount in tokens
847
-
848
- #### Defined in
849
-
850
- [utils/ContractUtils.ts:59](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/utils/ContractUtils.ts#L59)