@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.
- package/CHANGELOG.md +20 -0
- package/CodeExamples.md +1 -1
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.js +1 -1
- package/dist/lib.modern.js.map +1 -1
- package/dist/lib.module.js +1 -1
- package/dist/lib.module.js.map +1 -1
- package/dist/lib.umd.js +1 -1
- package/dist/lib.umd.js.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/README.md +192 -0
- package/docs/classes/Aquarius.md +171 -0
- package/docs/classes/Config.md +481 -0
- package/docs/classes/ConfigHelper.md +66 -0
- package/docs/classes/Datatoken.md +1123 -0
- package/docs/classes/DfRewards.md +345 -0
- package/docs/classes/DfStrategyV1.md +313 -0
- package/docs/classes/Dispenser.md +502 -0
- package/docs/classes/FixedRateExchange.md +1068 -0
- package/docs/classes/Logger.md +191 -0
- package/docs/classes/Nft.md +970 -0
- package/docs/classes/NftFactory.md +861 -0
- package/docs/classes/Provider.md +628 -0
- package/docs/classes/Router.md +645 -0
- package/docs/classes/SmartContract.md +193 -0
- package/docs/classes/SmartContractWithAddress.md +268 -0
- package/docs/classes/VeAllocate.md +372 -0
- package/docs/classes/VeFeeDistributor.md +325 -0
- package/docs/classes/VeFeeEstimate.md +281 -0
- package/docs/classes/VeOcean.md +513 -0
- package/docs/enums/LogLevel.md +63 -0
- package/docs/interfaces/AbiInput.md +63 -0
- package/docs/interfaces/AbiItem.md +107 -0
- package/docs/interfaces/AbiOutput.md +52 -0
- package/docs/interfaces/Arweave.md +32 -0
- package/docs/interfaces/Asset.md +227 -0
- package/docs/interfaces/AssetDatatoken.md +60 -0
- package/docs/interfaces/AssetLastEvent.md +63 -0
- package/docs/interfaces/AssetNft.md +105 -0
- package/docs/interfaces/AssetPrice.md +47 -0
- package/docs/interfaces/ComputeAlgorithm.md +82 -0
- package/docs/interfaces/ComputeAsset.md +56 -0
- package/docs/interfaces/ComputeEnvironment.md +173 -0
- package/docs/interfaces/ComputeJob.md +140 -0
- package/docs/interfaces/ComputeOutput.md +118 -0
- package/docs/interfaces/ComputeResult.md +52 -0
- package/docs/interfaces/ConsumeMarketFee.md +41 -0
- package/docs/interfaces/Credential.md +30 -0
- package/docs/interfaces/Credentials.md +30 -0
- package/docs/interfaces/DDO.md +137 -0
- package/docs/interfaces/DatatokenCreateParams.md +107 -0
- package/docs/interfaces/DatatokenRoles.md +30 -0
- package/docs/interfaces/DispenserCreationParams.md +63 -0
- package/docs/interfaces/DispenserParams.md +52 -0
- package/docs/interfaces/DispenserToken.md +85 -0
- package/docs/interfaces/DownloadResponse.md +30 -0
- package/docs/interfaces/Event.md +73 -0
- package/docs/interfaces/FeesInfo.md +74 -0
- package/docs/interfaces/FileInfo.md +118 -0
- package/docs/interfaces/Files.md +41 -0
- package/docs/interfaces/FixedPriceExchange.md +162 -0
- package/docs/interfaces/FreCreationParams.md +118 -0
- package/docs/interfaces/FreOrderParams.md +85 -0
- package/docs/interfaces/GraphqlQuery.md +69 -0
- package/docs/interfaces/Ipfs.md +32 -0
- package/docs/interfaces/Metadata.md +193 -0
- package/docs/interfaces/MetadataAlgorithm.md +69 -0
- package/docs/interfaces/MetadataAndTokenURI.md +107 -0
- package/docs/interfaces/MetadataProof.md +52 -0
- package/docs/interfaces/NftCreateData.md +74 -0
- package/docs/interfaces/NftRoles.md +52 -0
- package/docs/interfaces/Operation.md +145 -0
- package/docs/interfaces/OrderParams.md +52 -0
- package/docs/interfaces/PriceAndFees.md +52 -0
- package/docs/interfaces/ProviderComputeInitialize.md +41 -0
- package/docs/interfaces/ProviderComputeInitializeResults.md +30 -0
- package/docs/interfaces/ProviderFees.md +96 -0
- package/docs/interfaces/ProviderInitialize.md +52 -0
- package/docs/interfaces/PublisherTrustedAlgorithm.md +47 -0
- package/docs/interfaces/PublishingMarketFee.md +41 -0
- package/docs/interfaces/Purgatory.md +34 -0
- package/docs/interfaces/SearchQuery.md +67 -0
- package/docs/interfaces/Service.md +138 -0
- package/docs/interfaces/ServiceComputeOptions.md +63 -0
- package/docs/interfaces/ServiceEndpoint.md +41 -0
- package/docs/interfaces/Smartcontract-1.md +58 -0
- package/docs/interfaces/Stats.md +47 -0
- package/docs/interfaces/Template.md +30 -0
- package/docs/interfaces/TokenOrder.md +63 -0
- package/docs/interfaces/UrlFile.md +71 -0
- package/docs/interfaces/UserCustomParameters.md +7 -0
- package/docs/interfaces/ValidateMetadata.md +52 -0
- package/docs/modules.md +856 -0
- package/package.json +7 -8
- package/typedoc.json +4 -0
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / Router
|
|
2
|
+
|
|
3
|
+
# Class: Router
|
|
4
|
+
|
|
5
|
+
Provides an interface for FactoryRouter contract
|
|
6
|
+
|
|
7
|
+
## Hierarchy
|
|
8
|
+
|
|
9
|
+
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
|
10
|
+
|
|
11
|
+
↳ **`Router`**
|
|
12
|
+
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
### Constructors
|
|
16
|
+
|
|
17
|
+
- [constructor](Router.md#constructor)
|
|
18
|
+
|
|
19
|
+
### Properties
|
|
20
|
+
|
|
21
|
+
- [abi](Router.md#abi)
|
|
22
|
+
- [address](Router.md#address)
|
|
23
|
+
- [config](Router.md#config)
|
|
24
|
+
- [contract](Router.md#contract)
|
|
25
|
+
- [signer](Router.md#signer)
|
|
26
|
+
|
|
27
|
+
### Methods
|
|
28
|
+
|
|
29
|
+
- [addApprovedToken](Router.md#addapprovedtoken)
|
|
30
|
+
- [addDispenserContract](Router.md#adddispensercontract)
|
|
31
|
+
- [addFixedRateContract](Router.md#addfixedratecontract)
|
|
32
|
+
- [amountToUnits](Router.md#amounttounits)
|
|
33
|
+
- [buyDatatokenBatch](Router.md#buydatatokenbatch)
|
|
34
|
+
- [getContract](Router.md#getcontract)
|
|
35
|
+
- [getCurrentOPCFee](Router.md#getcurrentopcfee)
|
|
36
|
+
- [getDefaultAbi](Router.md#getdefaultabi)
|
|
37
|
+
- [getFairGasPrice](Router.md#getfairgasprice)
|
|
38
|
+
- [getNFTFactory](Router.md#getnftfactory)
|
|
39
|
+
- [getOPCFee](Router.md#getopcfee)
|
|
40
|
+
- [getOwner](Router.md#getowner)
|
|
41
|
+
- [isApprovedToken](Router.md#isapprovedtoken)
|
|
42
|
+
- [isFixedPrice](Router.md#isfixedprice)
|
|
43
|
+
- [removeApprovedToken](Router.md#removeapprovedtoken)
|
|
44
|
+
- [removeDispenserContract](Router.md#removedispensercontract)
|
|
45
|
+
- [removeFixedRateContract](Router.md#removefixedratecontract)
|
|
46
|
+
- [unitsToAmount](Router.md#unitstoamount)
|
|
47
|
+
- [updateOPCFee](Router.md#updateopcfee)
|
|
48
|
+
|
|
49
|
+
## Constructors
|
|
50
|
+
|
|
51
|
+
### constructor
|
|
52
|
+
|
|
53
|
+
• **new Router**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
|
54
|
+
|
|
55
|
+
Instantiate the smart contract.
|
|
56
|
+
|
|
57
|
+
#### Parameters
|
|
58
|
+
|
|
59
|
+
| Name | Type | Description |
|
|
60
|
+
| :------ | :------ | :------ |
|
|
61
|
+
| `address` | `string` | The address of the contract. |
|
|
62
|
+
| `signer` | `Signer` | The signer object. |
|
|
63
|
+
| `network?` | `string` \| `number` | Network id or name |
|
|
64
|
+
| `config?` | [`Config`](Config.md) | The configuration object. |
|
|
65
|
+
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
|
66
|
+
|
|
67
|
+
#### Inherited from
|
|
68
|
+
|
|
69
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
|
70
|
+
|
|
71
|
+
#### Defined in
|
|
72
|
+
|
|
73
|
+
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
|
74
|
+
|
|
75
|
+
## Properties
|
|
76
|
+
|
|
77
|
+
### abi
|
|
78
|
+
|
|
79
|
+
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
|
80
|
+
|
|
81
|
+
#### Inherited from
|
|
82
|
+
|
|
83
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
|
84
|
+
|
|
85
|
+
#### Defined in
|
|
86
|
+
|
|
87
|
+
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
|
88
|
+
|
|
89
|
+
___
|
|
90
|
+
|
|
91
|
+
### address
|
|
92
|
+
|
|
93
|
+
• **address**: `string`
|
|
94
|
+
|
|
95
|
+
#### Inherited from
|
|
96
|
+
|
|
97
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
|
98
|
+
|
|
99
|
+
#### Defined in
|
|
100
|
+
|
|
101
|
+
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
|
102
|
+
|
|
103
|
+
___
|
|
104
|
+
|
|
105
|
+
### config
|
|
106
|
+
|
|
107
|
+
• **config**: [`Config`](Config.md)
|
|
108
|
+
|
|
109
|
+
#### Inherited from
|
|
110
|
+
|
|
111
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
|
112
|
+
|
|
113
|
+
#### Defined in
|
|
114
|
+
|
|
115
|
+
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
|
116
|
+
|
|
117
|
+
___
|
|
118
|
+
|
|
119
|
+
### contract
|
|
120
|
+
|
|
121
|
+
• **contract**: `Contract`
|
|
122
|
+
|
|
123
|
+
#### Inherited from
|
|
124
|
+
|
|
125
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
|
126
|
+
|
|
127
|
+
#### Defined in
|
|
128
|
+
|
|
129
|
+
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
|
130
|
+
|
|
131
|
+
___
|
|
132
|
+
|
|
133
|
+
### signer
|
|
134
|
+
|
|
135
|
+
• **signer**: `Signer`
|
|
136
|
+
|
|
137
|
+
#### Inherited from
|
|
138
|
+
|
|
139
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
|
140
|
+
|
|
141
|
+
#### Defined in
|
|
142
|
+
|
|
143
|
+
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
|
144
|
+
|
|
145
|
+
## Methods
|
|
146
|
+
|
|
147
|
+
### addApprovedToken
|
|
148
|
+
|
|
149
|
+
▸ **addApprovedToken**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
150
|
+
|
|
151
|
+
Adds a token to the list of tokens with reduced fees
|
|
152
|
+
|
|
153
|
+
#### Type parameters
|
|
154
|
+
|
|
155
|
+
| Name | Type |
|
|
156
|
+
| :------ | :------ |
|
|
157
|
+
| `G` | extends `boolean` = ``false`` |
|
|
158
|
+
|
|
159
|
+
#### Parameters
|
|
160
|
+
|
|
161
|
+
| Name | Type | Description |
|
|
162
|
+
| :------ | :------ | :------ |
|
|
163
|
+
| `address` | `string` | caller address |
|
|
164
|
+
| `tokenAddress` | `string` | token address to add |
|
|
165
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
166
|
+
|
|
167
|
+
#### Returns
|
|
168
|
+
|
|
169
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
170
|
+
|
|
171
|
+
#### Defined in
|
|
172
|
+
|
|
173
|
+
[contracts/Router.ts:82](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L82)
|
|
174
|
+
|
|
175
|
+
___
|
|
176
|
+
|
|
177
|
+
### addDispenserContract
|
|
178
|
+
|
|
179
|
+
▸ **addDispenserContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
180
|
+
|
|
181
|
+
Adds an address to the list of dispensers
|
|
182
|
+
|
|
183
|
+
#### Type parameters
|
|
184
|
+
|
|
185
|
+
| Name | Type |
|
|
186
|
+
| :------ | :------ |
|
|
187
|
+
| `G` | extends `boolean` = ``false`` |
|
|
188
|
+
|
|
189
|
+
#### Parameters
|
|
190
|
+
|
|
191
|
+
| Name | Type | Description |
|
|
192
|
+
| :------ | :------ | :------ |
|
|
193
|
+
| `address` | `string` | caller address |
|
|
194
|
+
| `tokenAddress` | `string` | contract address to add |
|
|
195
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
|
|
199
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
200
|
+
|
|
201
|
+
#### Defined in
|
|
202
|
+
|
|
203
|
+
[contracts/Router.ts:201](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L201)
|
|
204
|
+
|
|
205
|
+
___
|
|
206
|
+
|
|
207
|
+
### addFixedRateContract
|
|
208
|
+
|
|
209
|
+
▸ **addFixedRateContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
210
|
+
|
|
211
|
+
Adds an address to the list of fixed rate contracts
|
|
212
|
+
|
|
213
|
+
#### Type parameters
|
|
214
|
+
|
|
215
|
+
| Name | Type |
|
|
216
|
+
| :------ | :------ |
|
|
217
|
+
| `G` | extends `boolean` = ``false`` |
|
|
218
|
+
|
|
219
|
+
#### Parameters
|
|
220
|
+
|
|
221
|
+
| Name | Type | Description |
|
|
222
|
+
| :------ | :------ | :------ |
|
|
223
|
+
| `address` | `string` | caller address |
|
|
224
|
+
| `tokenAddress` | `string` | contract address to add |
|
|
225
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
226
|
+
|
|
227
|
+
#### Returns
|
|
228
|
+
|
|
229
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
230
|
+
|
|
231
|
+
#### Defined in
|
|
232
|
+
|
|
233
|
+
[contracts/Router.ts:141](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L141)
|
|
234
|
+
|
|
235
|
+
___
|
|
236
|
+
|
|
237
|
+
### amountToUnits
|
|
238
|
+
|
|
239
|
+
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
|
240
|
+
|
|
241
|
+
Converts an amount of tokens to units
|
|
242
|
+
|
|
243
|
+
#### Parameters
|
|
244
|
+
|
|
245
|
+
| Name | Type | Description |
|
|
246
|
+
| :------ | :------ | :------ |
|
|
247
|
+
| `token` | `string` | The token to convert |
|
|
248
|
+
| `amount` | `string` | The amount of tokens to convert |
|
|
249
|
+
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
|
250
|
+
|
|
251
|
+
#### Returns
|
|
252
|
+
|
|
253
|
+
`Promise`<`string`\>
|
|
254
|
+
|
|
255
|
+
- The converted amount in units
|
|
256
|
+
|
|
257
|
+
#### Inherited from
|
|
258
|
+
|
|
259
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
|
260
|
+
|
|
261
|
+
#### Defined in
|
|
262
|
+
|
|
263
|
+
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
|
264
|
+
|
|
265
|
+
___
|
|
266
|
+
|
|
267
|
+
### buyDatatokenBatch
|
|
268
|
+
|
|
269
|
+
▸ **buyDatatokenBatch**<`G`\>(`operations`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
270
|
+
|
|
271
|
+
* Buys a batch of datatokens.
|
|
272
|
+
one single call to buy multiple DT for multiple assets.
|
|
273
|
+
require tokenIn approvals for router from user. (except for dispenser operations)
|
|
274
|
+
|
|
275
|
+
#### Type parameters
|
|
276
|
+
|
|
277
|
+
| Name | Type |
|
|
278
|
+
| :------ | :------ |
|
|
279
|
+
| `G` | extends `boolean` = ``false`` |
|
|
280
|
+
|
|
281
|
+
#### Parameters
|
|
282
|
+
|
|
283
|
+
| Name | Type | Description |
|
|
284
|
+
| :------ | :------ | :------ |
|
|
285
|
+
| `operations` | [`Operation`](../interfaces/Operation.md)[] | The operations to execute. |
|
|
286
|
+
| `estimateGas?` | `G` | Whether to return only the estimate gas or not. |
|
|
287
|
+
|
|
288
|
+
#### Returns
|
|
289
|
+
|
|
290
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
291
|
+
|
|
292
|
+
Transaction receipt
|
|
293
|
+
|
|
294
|
+
#### Defined in
|
|
295
|
+
|
|
296
|
+
[contracts/Router.ts:22](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L22)
|
|
297
|
+
|
|
298
|
+
___
|
|
299
|
+
|
|
300
|
+
### getContract
|
|
301
|
+
|
|
302
|
+
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
|
303
|
+
|
|
304
|
+
Returns a contract instance for the given address
|
|
305
|
+
|
|
306
|
+
#### Parameters
|
|
307
|
+
|
|
308
|
+
| Name | Type | Description |
|
|
309
|
+
| :------ | :------ | :------ |
|
|
310
|
+
| `address` | `string` | The address of the contract |
|
|
311
|
+
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
|
312
|
+
|
|
313
|
+
#### Returns
|
|
314
|
+
|
|
315
|
+
`Contract`
|
|
316
|
+
|
|
317
|
+
- The contract instance
|
|
318
|
+
|
|
319
|
+
#### Inherited from
|
|
320
|
+
|
|
321
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
|
322
|
+
|
|
323
|
+
#### Defined in
|
|
324
|
+
|
|
325
|
+
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
|
326
|
+
|
|
327
|
+
___
|
|
328
|
+
|
|
329
|
+
### getCurrentOPCFee
|
|
330
|
+
|
|
331
|
+
▸ **getCurrentOPCFee**(): `Promise`<`number`\>
|
|
332
|
+
|
|
333
|
+
Get Current OPF Fee
|
|
334
|
+
|
|
335
|
+
#### Returns
|
|
336
|
+
|
|
337
|
+
`Promise`<`number`\>
|
|
338
|
+
|
|
339
|
+
OPF fee
|
|
340
|
+
|
|
341
|
+
#### Defined in
|
|
342
|
+
|
|
343
|
+
[contracts/Router.ts:262](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L262)
|
|
344
|
+
|
|
345
|
+
___
|
|
346
|
+
|
|
347
|
+
### getDefaultAbi
|
|
348
|
+
|
|
349
|
+
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
|
350
|
+
|
|
351
|
+
#### Returns
|
|
352
|
+
|
|
353
|
+
[`AbiItem`](../interfaces/AbiItem.md)[]
|
|
354
|
+
|
|
355
|
+
#### Overrides
|
|
356
|
+
|
|
357
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
|
358
|
+
|
|
359
|
+
#### Defined in
|
|
360
|
+
|
|
361
|
+
[contracts/Router.ts:10](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L10)
|
|
362
|
+
|
|
363
|
+
___
|
|
364
|
+
|
|
365
|
+
### getFairGasPrice
|
|
366
|
+
|
|
367
|
+
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
|
368
|
+
|
|
369
|
+
Retruns the gas price
|
|
370
|
+
|
|
371
|
+
#### Returns
|
|
372
|
+
|
|
373
|
+
`Promise`<`string`\>
|
|
374
|
+
|
|
375
|
+
- The fair gas price
|
|
376
|
+
|
|
377
|
+
#### Inherited from
|
|
378
|
+
|
|
379
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
|
380
|
+
|
|
381
|
+
#### Defined in
|
|
382
|
+
|
|
383
|
+
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
|
384
|
+
|
|
385
|
+
___
|
|
386
|
+
|
|
387
|
+
### getNFTFactory
|
|
388
|
+
|
|
389
|
+
▸ **getNFTFactory**(): `Promise`<`string`\>
|
|
390
|
+
|
|
391
|
+
Get NFT Factory address
|
|
392
|
+
|
|
393
|
+
#### Returns
|
|
394
|
+
|
|
395
|
+
`Promise`<`string`\>
|
|
396
|
+
|
|
397
|
+
NFT Factory address
|
|
398
|
+
|
|
399
|
+
#### Defined in
|
|
400
|
+
|
|
401
|
+
[contracts/Router.ts:71](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L71)
|
|
402
|
+
|
|
403
|
+
___
|
|
404
|
+
|
|
405
|
+
### getOPCFee
|
|
406
|
+
|
|
407
|
+
▸ **getOPCFee**(`baseToken`): `Promise`<`number`\>
|
|
408
|
+
|
|
409
|
+
Get OPF Fee per token
|
|
410
|
+
|
|
411
|
+
#### Parameters
|
|
412
|
+
|
|
413
|
+
| Name | Type |
|
|
414
|
+
| :------ | :------ |
|
|
415
|
+
| `baseToken` | `string` |
|
|
416
|
+
|
|
417
|
+
#### Returns
|
|
418
|
+
|
|
419
|
+
`Promise`<`number`\>
|
|
420
|
+
|
|
421
|
+
OPC fee for a specific baseToken
|
|
422
|
+
|
|
423
|
+
#### Defined in
|
|
424
|
+
|
|
425
|
+
[contracts/Router.ts:255](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L255)
|
|
426
|
+
|
|
427
|
+
___
|
|
428
|
+
|
|
429
|
+
### getOwner
|
|
430
|
+
|
|
431
|
+
▸ **getOwner**(): `Promise`<`string`\>
|
|
432
|
+
|
|
433
|
+
Get Router Owner
|
|
434
|
+
|
|
435
|
+
#### Returns
|
|
436
|
+
|
|
437
|
+
`Promise`<`string`\>
|
|
438
|
+
|
|
439
|
+
Router Owner address
|
|
440
|
+
|
|
441
|
+
#### Defined in
|
|
442
|
+
|
|
443
|
+
[contracts/Router.ts:63](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L63)
|
|
444
|
+
|
|
445
|
+
___
|
|
446
|
+
|
|
447
|
+
### isApprovedToken
|
|
448
|
+
|
|
449
|
+
▸ **isApprovedToken**(`address`): `Promise`<`boolean`\>
|
|
450
|
+
|
|
451
|
+
Checks if a token is on approved tokens list,
|
|
452
|
+
if true opfFee is lower in pools with that token/DT
|
|
453
|
+
|
|
454
|
+
#### Parameters
|
|
455
|
+
|
|
456
|
+
| Name | Type | Description |
|
|
457
|
+
| :------ | :------ | :------ |
|
|
458
|
+
| `address` | `string` | The address of the token to check. |
|
|
459
|
+
|
|
460
|
+
#### Returns
|
|
461
|
+
|
|
462
|
+
`Promise`<`boolean`\>
|
|
463
|
+
|
|
464
|
+
true if is on the list.
|
|
465
|
+
|
|
466
|
+
#### Defined in
|
|
467
|
+
|
|
468
|
+
[contracts/Router.ts:46](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L46)
|
|
469
|
+
|
|
470
|
+
___
|
|
471
|
+
|
|
472
|
+
### isFixedPrice
|
|
473
|
+
|
|
474
|
+
▸ **isFixedPrice**(`address`): `Promise`<`boolean`\>
|
|
475
|
+
|
|
476
|
+
Check if an address is a Fixed Rate contract.
|
|
477
|
+
|
|
478
|
+
#### Parameters
|
|
479
|
+
|
|
480
|
+
| Name | Type | Description |
|
|
481
|
+
| :------ | :------ | :------ |
|
|
482
|
+
| `address` | `string` | The address of the fixed rate exchange to check. |
|
|
483
|
+
|
|
484
|
+
#### Returns
|
|
485
|
+
|
|
486
|
+
`Promise`<`boolean`\>
|
|
487
|
+
|
|
488
|
+
true if is a Fixed Rate contract
|
|
489
|
+
|
|
490
|
+
#### Defined in
|
|
491
|
+
|
|
492
|
+
[contracts/Router.ts:55](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L55)
|
|
493
|
+
|
|
494
|
+
___
|
|
495
|
+
|
|
496
|
+
### removeApprovedToken
|
|
497
|
+
|
|
498
|
+
▸ **removeApprovedToken**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
499
|
+
|
|
500
|
+
Removes a token if exists from the list of tokens with reduced fees
|
|
501
|
+
|
|
502
|
+
#### Type parameters
|
|
503
|
+
|
|
504
|
+
| Name | Type |
|
|
505
|
+
| :------ | :------ |
|
|
506
|
+
| `G` | extends `boolean` = ``false`` |
|
|
507
|
+
|
|
508
|
+
#### Parameters
|
|
509
|
+
|
|
510
|
+
| Name | Type | Description |
|
|
511
|
+
| :------ | :------ | :------ |
|
|
512
|
+
| `address` | `string` | caller address |
|
|
513
|
+
| `tokenAddress` | `string` | token address to remove |
|
|
514
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
515
|
+
|
|
516
|
+
#### Returns
|
|
517
|
+
|
|
518
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
519
|
+
|
|
520
|
+
#### Defined in
|
|
521
|
+
|
|
522
|
+
[contracts/Router.ts:112](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L112)
|
|
523
|
+
|
|
524
|
+
___
|
|
525
|
+
|
|
526
|
+
### removeDispenserContract
|
|
527
|
+
|
|
528
|
+
▸ **removeDispenserContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
529
|
+
|
|
530
|
+
Removes an address from the list of dispensers
|
|
531
|
+
|
|
532
|
+
#### Type parameters
|
|
533
|
+
|
|
534
|
+
| Name | Type |
|
|
535
|
+
| :------ | :------ |
|
|
536
|
+
| `G` | extends `boolean` = ``false`` |
|
|
537
|
+
|
|
538
|
+
#### Parameters
|
|
539
|
+
|
|
540
|
+
| Name | Type | Description |
|
|
541
|
+
| :------ | :------ | :------ |
|
|
542
|
+
| `address` | `string` | caller address |
|
|
543
|
+
| `tokenAddress` | `string` | address Contract to be removed |
|
|
544
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
545
|
+
|
|
546
|
+
#### Returns
|
|
547
|
+
|
|
548
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
549
|
+
|
|
550
|
+
#### Defined in
|
|
551
|
+
|
|
552
|
+
[contracts/Router.ts:230](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L230)
|
|
553
|
+
|
|
554
|
+
___
|
|
555
|
+
|
|
556
|
+
### removeFixedRateContract
|
|
557
|
+
|
|
558
|
+
▸ **removeFixedRateContract**<`G`\>(`address`, `tokenAddress`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
559
|
+
|
|
560
|
+
Removes an address from the list of fixed rate contracts
|
|
561
|
+
|
|
562
|
+
#### Type parameters
|
|
563
|
+
|
|
564
|
+
| Name | Type |
|
|
565
|
+
| :------ | :------ |
|
|
566
|
+
| `G` | extends `boolean` = ``false`` |
|
|
567
|
+
|
|
568
|
+
#### Parameters
|
|
569
|
+
|
|
570
|
+
| Name | Type | Description |
|
|
571
|
+
| :------ | :------ | :------ |
|
|
572
|
+
| `address` | `string` | caller address |
|
|
573
|
+
| `tokenAddress` | `string` | contract address to add |
|
|
574
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
575
|
+
|
|
576
|
+
#### Returns
|
|
577
|
+
|
|
578
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
579
|
+
|
|
580
|
+
#### Defined in
|
|
581
|
+
|
|
582
|
+
[contracts/Router.ts:171](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L171)
|
|
583
|
+
|
|
584
|
+
___
|
|
585
|
+
|
|
586
|
+
### unitsToAmount
|
|
587
|
+
|
|
588
|
+
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
|
589
|
+
|
|
590
|
+
Converts an amount of units to tokens
|
|
591
|
+
|
|
592
|
+
#### Parameters
|
|
593
|
+
|
|
594
|
+
| Name | Type | Description |
|
|
595
|
+
| :------ | :------ | :------ |
|
|
596
|
+
| `token` | `string` | The token to convert |
|
|
597
|
+
| `amount` | `string` | The amount of units to convert |
|
|
598
|
+
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
|
599
|
+
|
|
600
|
+
#### Returns
|
|
601
|
+
|
|
602
|
+
`Promise`<`string`\>
|
|
603
|
+
|
|
604
|
+
- The converted amount in tokens
|
|
605
|
+
|
|
606
|
+
#### Inherited from
|
|
607
|
+
|
|
608
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
|
609
|
+
|
|
610
|
+
#### Defined in
|
|
611
|
+
|
|
612
|
+
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
613
|
+
|
|
614
|
+
___
|
|
615
|
+
|
|
616
|
+
### updateOPCFee
|
|
617
|
+
|
|
618
|
+
▸ **updateOPCFee**<`G`\>(`address`, `newSwapOceanFee`, `newSwapNonOceanFee`, `newConsumeFee`, `newProviderFee`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
619
|
+
|
|
620
|
+
Updates OP Community Fees
|
|
621
|
+
|
|
622
|
+
#### Type parameters
|
|
623
|
+
|
|
624
|
+
| Name | Type |
|
|
625
|
+
| :------ | :------ |
|
|
626
|
+
| `G` | extends `boolean` = ``false`` |
|
|
627
|
+
|
|
628
|
+
#### Parameters
|
|
629
|
+
|
|
630
|
+
| Name | Type | Description |
|
|
631
|
+
| :------ | :------ | :------ |
|
|
632
|
+
| `address` | `string` | caller address |
|
|
633
|
+
| `newSwapOceanFee` | `number` | Amount charged for swapping with ocean approved tokens |
|
|
634
|
+
| `newSwapNonOceanFee` | `number` | Amount charged for swapping with non ocean approved tokens |
|
|
635
|
+
| `newConsumeFee` | `number` | Amount charged from consumeFees |
|
|
636
|
+
| `newProviderFee` | `number` | Amount charged for providerFees |
|
|
637
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
638
|
+
|
|
639
|
+
#### Returns
|
|
640
|
+
|
|
641
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
642
|
+
|
|
643
|
+
#### Defined in
|
|
644
|
+
|
|
645
|
+
[contracts/Router.ts:276](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/Router.ts#L276)
|