@oceanprotocol/lib 3.0.0-next.0 → 3.0.0-next.2

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