@oceanprotocol/lib 3.0.0-next.1 → 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 (96) hide show
  1. package/CHANGELOG.md +20 -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/docs/.nojekyll +1 -0
  12. package/docs/README.md +192 -0
  13. package/docs/classes/Aquarius.md +171 -0
  14. package/docs/classes/Config.md +481 -0
  15. package/docs/classes/ConfigHelper.md +66 -0
  16. package/docs/classes/Datatoken.md +1123 -0
  17. package/docs/classes/DfRewards.md +345 -0
  18. package/docs/classes/DfStrategyV1.md +313 -0
  19. package/docs/classes/Dispenser.md +502 -0
  20. package/docs/classes/FixedRateExchange.md +1068 -0
  21. package/docs/classes/Logger.md +191 -0
  22. package/docs/classes/Nft.md +970 -0
  23. package/docs/classes/NftFactory.md +861 -0
  24. package/docs/classes/Provider.md +628 -0
  25. package/docs/classes/Router.md +645 -0
  26. package/docs/classes/SmartContract.md +193 -0
  27. package/docs/classes/SmartContractWithAddress.md +268 -0
  28. package/docs/classes/VeAllocate.md +372 -0
  29. package/docs/classes/VeFeeDistributor.md +325 -0
  30. package/docs/classes/VeFeeEstimate.md +281 -0
  31. package/docs/classes/VeOcean.md +513 -0
  32. package/docs/enums/LogLevel.md +63 -0
  33. package/docs/interfaces/AbiInput.md +63 -0
  34. package/docs/interfaces/AbiItem.md +107 -0
  35. package/docs/interfaces/AbiOutput.md +52 -0
  36. package/docs/interfaces/Arweave.md +32 -0
  37. package/docs/interfaces/Asset.md +227 -0
  38. package/docs/interfaces/AssetDatatoken.md +60 -0
  39. package/docs/interfaces/AssetLastEvent.md +63 -0
  40. package/docs/interfaces/AssetNft.md +105 -0
  41. package/docs/interfaces/AssetPrice.md +47 -0
  42. package/docs/interfaces/ComputeAlgorithm.md +82 -0
  43. package/docs/interfaces/ComputeAsset.md +56 -0
  44. package/docs/interfaces/ComputeEnvironment.md +173 -0
  45. package/docs/interfaces/ComputeJob.md +140 -0
  46. package/docs/interfaces/ComputeOutput.md +118 -0
  47. package/docs/interfaces/ComputeResult.md +52 -0
  48. package/docs/interfaces/ConsumeMarketFee.md +41 -0
  49. package/docs/interfaces/Credential.md +30 -0
  50. package/docs/interfaces/Credentials.md +30 -0
  51. package/docs/interfaces/DDO.md +137 -0
  52. package/docs/interfaces/DatatokenCreateParams.md +107 -0
  53. package/docs/interfaces/DatatokenRoles.md +30 -0
  54. package/docs/interfaces/DispenserCreationParams.md +63 -0
  55. package/docs/interfaces/DispenserParams.md +52 -0
  56. package/docs/interfaces/DispenserToken.md +85 -0
  57. package/docs/interfaces/DownloadResponse.md +30 -0
  58. package/docs/interfaces/Event.md +73 -0
  59. package/docs/interfaces/FeesInfo.md +74 -0
  60. package/docs/interfaces/FileInfo.md +118 -0
  61. package/docs/interfaces/Files.md +41 -0
  62. package/docs/interfaces/FixedPriceExchange.md +162 -0
  63. package/docs/interfaces/FreCreationParams.md +118 -0
  64. package/docs/interfaces/FreOrderParams.md +85 -0
  65. package/docs/interfaces/GraphqlQuery.md +69 -0
  66. package/docs/interfaces/Ipfs.md +32 -0
  67. package/docs/interfaces/Metadata.md +193 -0
  68. package/docs/interfaces/MetadataAlgorithm.md +69 -0
  69. package/docs/interfaces/MetadataAndTokenURI.md +107 -0
  70. package/docs/interfaces/MetadataProof.md +52 -0
  71. package/docs/interfaces/NftCreateData.md +74 -0
  72. package/docs/interfaces/NftRoles.md +52 -0
  73. package/docs/interfaces/Operation.md +145 -0
  74. package/docs/interfaces/OrderParams.md +52 -0
  75. package/docs/interfaces/PriceAndFees.md +52 -0
  76. package/docs/interfaces/ProviderComputeInitialize.md +41 -0
  77. package/docs/interfaces/ProviderComputeInitializeResults.md +30 -0
  78. package/docs/interfaces/ProviderFees.md +96 -0
  79. package/docs/interfaces/ProviderInitialize.md +52 -0
  80. package/docs/interfaces/PublisherTrustedAlgorithm.md +47 -0
  81. package/docs/interfaces/PublishingMarketFee.md +41 -0
  82. package/docs/interfaces/Purgatory.md +34 -0
  83. package/docs/interfaces/SearchQuery.md +67 -0
  84. package/docs/interfaces/Service.md +138 -0
  85. package/docs/interfaces/ServiceComputeOptions.md +63 -0
  86. package/docs/interfaces/ServiceEndpoint.md +41 -0
  87. package/docs/interfaces/Smartcontract-1.md +58 -0
  88. package/docs/interfaces/Stats.md +47 -0
  89. package/docs/interfaces/Template.md +30 -0
  90. package/docs/interfaces/TokenOrder.md +63 -0
  91. package/docs/interfaces/UrlFile.md +71 -0
  92. package/docs/interfaces/UserCustomParameters.md +7 -0
  93. package/docs/interfaces/ValidateMetadata.md +52 -0
  94. package/docs/modules.md +856 -0
  95. package/package.json +7 -8
  96. package/typedoc.json +4 -0
@@ -0,0 +1,502 @@
1
+ [@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Dispenser
2
+
3
+ # Class: Dispenser
4
+
5
+ ## Hierarchy
6
+
7
+ - [`SmartContractWithAddress`](SmartContractWithAddress.md)
8
+
9
+ ↳ **`Dispenser`**
10
+
11
+ ## Table of contents
12
+
13
+ ### Constructors
14
+
15
+ - [constructor](Dispenser.md#constructor)
16
+
17
+ ### Properties
18
+
19
+ - [abi](Dispenser.md#abi)
20
+ - [address](Dispenser.md#address)
21
+ - [config](Dispenser.md#config)
22
+ - [contract](Dispenser.md#contract)
23
+ - [signer](Dispenser.md#signer)
24
+
25
+ ### Methods
26
+
27
+ - [activate](Dispenser.md#activate)
28
+ - [amountToUnits](Dispenser.md#amounttounits)
29
+ - [create](Dispenser.md#create)
30
+ - [deactivate](Dispenser.md#deactivate)
31
+ - [dispense](Dispenser.md#dispense)
32
+ - [getContract](Dispenser.md#getcontract)
33
+ - [getDefaultAbi](Dispenser.md#getdefaultabi)
34
+ - [getFairGasPrice](Dispenser.md#getfairgasprice)
35
+ - [isDispensable](Dispenser.md#isdispensable)
36
+ - [ownerWithdraw](Dispenser.md#ownerwithdraw)
37
+ - [setAllowedSwapper](Dispenser.md#setallowedswapper)
38
+ - [status](Dispenser.md#status)
39
+ - [unitsToAmount](Dispenser.md#unitstoamount)
40
+
41
+ ## Constructors
42
+
43
+ ### constructor
44
+
45
+ • **new Dispenser**(`address`, `signer`, `network?`, `config?`, `abi?`)
46
+
47
+ Instantiate the smart contract.
48
+
49
+ #### Parameters
50
+
51
+ | Name | Type | Description |
52
+ | :------ | :------ | :------ |
53
+ | `address` | `string` | The address of the contract. |
54
+ | `signer` | `Signer` | The signer object. |
55
+ | `network?` | `string` \| `number` | Network id or name |
56
+ | `config?` | [`Config`](Config.md) | The configuration object. |
57
+ | `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
58
+
59
+ #### Inherited from
60
+
61
+ [SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
62
+
63
+ #### Defined in
64
+
65
+ [contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
66
+
67
+ ## Properties
68
+
69
+ ### abi
70
+
71
+ • **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
72
+
73
+ #### Inherited from
74
+
75
+ [SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
76
+
77
+ #### Defined in
78
+
79
+ [contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
80
+
81
+ ___
82
+
83
+ ### address
84
+
85
+ • **address**: `string`
86
+
87
+ #### Inherited from
88
+
89
+ [SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
90
+
91
+ #### Defined in
92
+
93
+ [contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
94
+
95
+ ___
96
+
97
+ ### config
98
+
99
+ • **config**: [`Config`](Config.md)
100
+
101
+ #### Inherited from
102
+
103
+ [SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
104
+
105
+ #### Defined in
106
+
107
+ [contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
108
+
109
+ ___
110
+
111
+ ### contract
112
+
113
+ • **contract**: `Contract`
114
+
115
+ #### Inherited from
116
+
117
+ [SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
118
+
119
+ #### Defined in
120
+
121
+ [contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
122
+
123
+ ___
124
+
125
+ ### signer
126
+
127
+ • **signer**: `Signer`
128
+
129
+ #### Inherited from
130
+
131
+ [SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
132
+
133
+ #### Defined in
134
+
135
+ [contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
136
+
137
+ ## Methods
138
+
139
+ ### activate
140
+
141
+ ▸ **activate**<`G`\>(`dtAddress`, `maxTokens`, `maxBalance`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
142
+
143
+ Activates a dispener.
144
+
145
+ #### Type parameters
146
+
147
+ | Name | Type |
148
+ | :------ | :------ |
149
+ | `G` | extends `boolean` = ``false`` |
150
+
151
+ #### Parameters
152
+
153
+ | Name | Type | Description |
154
+ | :------ | :------ | :------ |
155
+ | `dtAddress` | `string` | refers to datatoken address. |
156
+ | `maxTokens` | `string` | max amount of tokens to dispense |
157
+ | `maxBalance` | `string` | max balance of user. If user balance is >, then dispense will be rejected |
158
+ | `estimateGas?` | `G` | if True, return gas estimate |
159
+
160
+ #### Returns
161
+
162
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
163
+
164
+ TransactionReceipt
165
+
166
+ #### Defined in
167
+
168
+ [contracts/Dispenser.ts:86](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L86)
169
+
170
+ ___
171
+
172
+ ### amountToUnits
173
+
174
+ ▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
175
+
176
+ Converts an amount of tokens to units
177
+
178
+ #### Parameters
179
+
180
+ | Name | Type | Description |
181
+ | :------ | :------ | :------ |
182
+ | `token` | `string` | The token to convert |
183
+ | `amount` | `string` | The amount of tokens to convert |
184
+ | `tokenDecimals?` | `number` | The number of decimals of the token |
185
+
186
+ #### Returns
187
+
188
+ `Promise`<`string`\>
189
+
190
+ - The converted amount in units
191
+
192
+ #### Inherited from
193
+
194
+ [SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
195
+
196
+ #### Defined in
197
+
198
+ [contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
199
+
200
+ ___
201
+
202
+ ### create
203
+
204
+ ▸ **create**<`G`\>(`dtAddress`, `address`, `maxTokens`, `maxBalance`, `allowedSwapper`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
205
+
206
+ Creates a new Dispenser
207
+
208
+ #### Type parameters
209
+
210
+ | Name | Type |
211
+ | :------ | :------ |
212
+ | `G` | extends `boolean` = ``false`` |
213
+
214
+ #### Parameters
215
+
216
+ | Name | Type | Description |
217
+ | :------ | :------ | :------ |
218
+ | `dtAddress` | `string` | Datatoken address |
219
+ | `address` | `string` | Owner address |
220
+ | `maxTokens` | `string` | max tokens to dispense |
221
+ | `maxBalance` | `string` | max balance of requester |
222
+ | `allowedSwapper` | `string` | only account that can ask tokens. set address(0) if not required |
223
+ | `estimateGas?` | `G` | if True, return gas estimate |
224
+
225
+ #### Returns
226
+
227
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
228
+
229
+ transactionId
230
+
231
+ #### Defined in
232
+
233
+ [contracts/Dispenser.ts:45](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L45)
234
+
235
+ ___
236
+
237
+ ### deactivate
238
+
239
+ ▸ **deactivate**<`G`\>(`dtAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
240
+
241
+ Deactivate an existing dispenser.
242
+
243
+ #### Type parameters
244
+
245
+ | Name | Type |
246
+ | :------ | :------ |
247
+ | `G` | extends `boolean` = ``false`` |
248
+
249
+ #### Parameters
250
+
251
+ | Name | Type | Description |
252
+ | :------ | :------ | :------ |
253
+ | `dtAddress` | `string` | refers to datatoken address. |
254
+ | `estimateGas?` | `G` | if True, return gas estimate |
255
+
256
+ #### Returns
257
+
258
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
259
+
260
+ TransactionReceipt
261
+
262
+ #### Defined in
263
+
264
+ [contracts/Dispenser.ts:118](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L118)
265
+
266
+ ___
267
+
268
+ ### dispense
269
+
270
+ ▸ **dispense**<`G`\>(`dtAddress`, `amount?`, `destination`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
271
+
272
+ Dispense datatokens to caller.
273
+ The dispenser must be active, hold enough datatokens (or be able to mint more)
274
+ and respect maxTokens/maxBalance requirements
275
+
276
+ #### Type parameters
277
+
278
+ | Name | Type |
279
+ | :------ | :------ |
280
+ | `G` | extends `boolean` = ``false`` |
281
+
282
+ #### Parameters
283
+
284
+ | Name | Type | Default value | Description |
285
+ | :------ | :------ | :------ | :------ |
286
+ | `dtAddress` | `string` | `undefined` | Datatoken address. |
287
+ | `amount` | `string` | `'1'` | Amount of datatokens required. |
288
+ | `destination` | `string` | `undefined` | address of tokens receiver |
289
+ | `estimateGas?` | `G` | `undefined` | if True, return gas estimate |
290
+
291
+ #### Returns
292
+
293
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
294
+
295
+ #### Defined in
296
+
297
+ [contracts/Dispenser.ts:175](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L175)
298
+
299
+ ___
300
+
301
+ ### getContract
302
+
303
+ ▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
304
+
305
+ Returns a contract instance for the given address
306
+
307
+ #### Parameters
308
+
309
+ | Name | Type | Description |
310
+ | :------ | :------ | :------ |
311
+ | `address` | `string` | The address of the contract |
312
+ | `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
313
+
314
+ #### Returns
315
+
316
+ `Contract`
317
+
318
+ - The contract instance
319
+
320
+ #### Inherited from
321
+
322
+ [SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
323
+
324
+ #### Defined in
325
+
326
+ [contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
327
+
328
+ ___
329
+
330
+ ### getDefaultAbi
331
+
332
+ ▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
333
+
334
+ #### Returns
335
+
336
+ [`AbiItem`](../interfaces/AbiItem.md)[]
337
+
338
+ #### Overrides
339
+
340
+ [SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
341
+
342
+ #### Defined in
343
+
344
+ [contracts/Dispenser.ts:9](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L9)
345
+
346
+ ___
347
+
348
+ ### getFairGasPrice
349
+
350
+ ▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
351
+
352
+ Retruns the gas price
353
+
354
+ #### Returns
355
+
356
+ `Promise`<`string`\>
357
+
358
+ - The fair gas price
359
+
360
+ #### Inherited from
361
+
362
+ [SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
363
+
364
+ #### Defined in
365
+
366
+ [contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
367
+
368
+ ___
369
+
370
+ ### isDispensable
371
+
372
+ ▸ **isDispensable**(`dtAddress`, `datatoken`, `address`, `amount?`): `Promise`<`Boolean`\>
373
+
374
+ Check if tokens can be dispensed
375
+
376
+ #### Parameters
377
+
378
+ | Name | Type | Default value | Description |
379
+ | :------ | :------ | :------ | :------ |
380
+ | `dtAddress` | `string` | `undefined` | Datatoken address |
381
+ | `datatoken` | [`Datatoken`](Datatoken.md) | `undefined` | - |
382
+ | `address` | `string` | `undefined` | User address that will receive datatokens |
383
+ | `amount` | `string` | `'1'` | amount of datatokens required. |
384
+
385
+ #### Returns
386
+
387
+ `Promise`<`Boolean`\>
388
+
389
+ #### Defined in
390
+
391
+ [contracts/Dispenser.ts:231](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L231)
392
+
393
+ ___
394
+
395
+ ### ownerWithdraw
396
+
397
+ ▸ **ownerWithdraw**<`G`\>(`dtAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
398
+
399
+ Withdraw all tokens from the dispenser
400
+
401
+ #### Type parameters
402
+
403
+ | Name | Type |
404
+ | :------ | :------ |
405
+ | `G` | extends `boolean` = ``false`` |
406
+
407
+ #### Parameters
408
+
409
+ | Name | Type | Description |
410
+ | :------ | :------ | :------ |
411
+ | `dtAddress` | `string` | Datatoken address. |
412
+ | `estimateGas?` | `G` | if True, return gas estimate |
413
+
414
+ #### Returns
415
+
416
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
417
+
418
+ #### Defined in
419
+
420
+ [contracts/Dispenser.ts:206](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L206)
421
+
422
+ ___
423
+
424
+ ### setAllowedSwapper
425
+
426
+ ▸ **setAllowedSwapper**<`G`\>(`dtAddress`, `newAllowedSwapper`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
427
+
428
+ Sets a new allowed swapper.
429
+
430
+ #### Type parameters
431
+
432
+ | Name | Type |
433
+ | :------ | :------ |
434
+ | `G` | extends `boolean` = ``false`` |
435
+
436
+ #### Parameters
437
+
438
+ | Name | Type | Description |
439
+ | :------ | :------ | :------ |
440
+ | `dtAddress` | `string` | Datatoken address. |
441
+ | `newAllowedSwapper` | `string` | The address of the new allowed swapper. |
442
+ | `estimateGas?` | `G` | if True, return gas estimate |
443
+
444
+ #### Returns
445
+
446
+ `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
447
+
448
+ #### Defined in
449
+
450
+ [contracts/Dispenser.ts:143](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L143)
451
+
452
+ ___
453
+
454
+ ### status
455
+
456
+ ▸ **status**(`dtAdress`): `Promise`<[`DispenserToken`](../interfaces/DispenserToken.md)\>
457
+
458
+ Get information about a datatoken dispenser
459
+
460
+ #### Parameters
461
+
462
+ | Name | Type |
463
+ | :------ | :------ |
464
+ | `dtAdress` | `string` |
465
+
466
+ #### Returns
467
+
468
+ `Promise`<[`DispenserToken`](../interfaces/DispenserToken.md)\>
469
+
470
+ #### Defined in
471
+
472
+ [contracts/Dispenser.ts:18](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Dispenser.ts#L18)
473
+
474
+ ___
475
+
476
+ ### unitsToAmount
477
+
478
+ ▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
479
+
480
+ Converts an amount of units to tokens
481
+
482
+ #### Parameters
483
+
484
+ | Name | Type | Description |
485
+ | :------ | :------ | :------ |
486
+ | `token` | `string` | The token to convert |
487
+ | `amount` | `string` | The amount of units to convert |
488
+ | `tokenDecimals?` | `number` | The number of decimals in the token |
489
+
490
+ #### Returns
491
+
492
+ `Promise`<`string`\>
493
+
494
+ - The converted amount in tokens
495
+
496
+ #### Inherited from
497
+
498
+ [SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
499
+
500
+ #### Defined in
501
+
502
+ [contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)