@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.
- package/CHANGELOG.md +27 -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/dist/src/utils/ContractUtils.d.ts +2 -0
- 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,1068 @@
|
|
|
1
|
+
[@oceanprotocol/lib](../README.md) / [Exports](../modules.md) / FixedRateExchange
|
|
2
|
+
|
|
3
|
+
# Class: FixedRateExchange
|
|
4
|
+
|
|
5
|
+
## Hierarchy
|
|
6
|
+
|
|
7
|
+
- [`SmartContractWithAddress`](SmartContractWithAddress.md)
|
|
8
|
+
|
|
9
|
+
↳ **`FixedRateExchange`**
|
|
10
|
+
|
|
11
|
+
## Table of contents
|
|
12
|
+
|
|
13
|
+
### Constructors
|
|
14
|
+
|
|
15
|
+
- [constructor](FixedRateExchange.md#constructor)
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
- [abi](FixedRateExchange.md#abi)
|
|
20
|
+
- [address](FixedRateExchange.md#address)
|
|
21
|
+
- [config](FixedRateExchange.md#config)
|
|
22
|
+
- [contract](FixedRateExchange.md#contract)
|
|
23
|
+
- [signer](FixedRateExchange.md#signer)
|
|
24
|
+
|
|
25
|
+
### Methods
|
|
26
|
+
|
|
27
|
+
- [activate](FixedRateExchange.md#activate)
|
|
28
|
+
- [activateMint](FixedRateExchange.md#activatemint)
|
|
29
|
+
- [amountToUnits](FixedRateExchange.md#amounttounits)
|
|
30
|
+
- [buyDatatokens](FixedRateExchange.md#buydatatokens)
|
|
31
|
+
- [calcBaseInGivenDatatokensOut](FixedRateExchange.md#calcbaseingivendatatokensout)
|
|
32
|
+
- [collectBasetokens](FixedRateExchange.md#collectbasetokens)
|
|
33
|
+
- [collectDatatokens](FixedRateExchange.md#collectdatatokens)
|
|
34
|
+
- [collectMarketFee](FixedRateExchange.md#collectmarketfee)
|
|
35
|
+
- [collectOceanFee](FixedRateExchange.md#collectoceanfee)
|
|
36
|
+
- [deactivate](FixedRateExchange.md#deactivate)
|
|
37
|
+
- [deactivateMint](FixedRateExchange.md#deactivatemint)
|
|
38
|
+
- [generateExchangeId](FixedRateExchange.md#generateexchangeid)
|
|
39
|
+
- [getAllowedSwapper](FixedRateExchange.md#getallowedswapper)
|
|
40
|
+
- [getAmountBasetokensOut](FixedRateExchange.md#getamountbasetokensout)
|
|
41
|
+
- [getBasetokenSupply](FixedRateExchange.md#getbasetokensupply)
|
|
42
|
+
- [getContract](FixedRateExchange.md#getcontract)
|
|
43
|
+
- [getDatatokenSupply](FixedRateExchange.md#getdatatokensupply)
|
|
44
|
+
- [getDefaultAbi](FixedRateExchange.md#getdefaultabi)
|
|
45
|
+
- [getExchange](FixedRateExchange.md#getexchange)
|
|
46
|
+
- [getExchangeOwner](FixedRateExchange.md#getexchangeowner)
|
|
47
|
+
- [getExchanges](FixedRateExchange.md#getexchanges)
|
|
48
|
+
- [getFairGasPrice](FixedRateExchange.md#getfairgasprice)
|
|
49
|
+
- [getFeesInfo](FixedRateExchange.md#getfeesinfo)
|
|
50
|
+
- [getNumberOfExchanges](FixedRateExchange.md#getnumberofexchanges)
|
|
51
|
+
- [getOPCCollector](FixedRateExchange.md#getopccollector)
|
|
52
|
+
- [getRate](FixedRateExchange.md#getrate)
|
|
53
|
+
- [getRouter](FixedRateExchange.md#getrouter)
|
|
54
|
+
- [isActive](FixedRateExchange.md#isactive)
|
|
55
|
+
- [sellDatatokens](FixedRateExchange.md#selldatatokens)
|
|
56
|
+
- [setAllowedSwapper](FixedRateExchange.md#setallowedswapper)
|
|
57
|
+
- [setRate](FixedRateExchange.md#setrate)
|
|
58
|
+
- [unitsToAmount](FixedRateExchange.md#unitstoamount)
|
|
59
|
+
- [updateMarketFee](FixedRateExchange.md#updatemarketfee)
|
|
60
|
+
- [updateMarketFeeCollector](FixedRateExchange.md#updatemarketfeecollector)
|
|
61
|
+
|
|
62
|
+
## Constructors
|
|
63
|
+
|
|
64
|
+
### constructor
|
|
65
|
+
|
|
66
|
+
• **new FixedRateExchange**(`address`, `signer`, `network?`, `config?`, `abi?`)
|
|
67
|
+
|
|
68
|
+
Instantiate the smart contract.
|
|
69
|
+
|
|
70
|
+
#### Parameters
|
|
71
|
+
|
|
72
|
+
| Name | Type | Description |
|
|
73
|
+
| :------ | :------ | :------ |
|
|
74
|
+
| `address` | `string` | The address of the contract. |
|
|
75
|
+
| `signer` | `Signer` | The signer object. |
|
|
76
|
+
| `network?` | `string` \| `number` | Network id or name |
|
|
77
|
+
| `config?` | [`Config`](Config.md) | The configuration object. |
|
|
78
|
+
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | ABI array of the smart contract |
|
|
79
|
+
|
|
80
|
+
#### Inherited from
|
|
81
|
+
|
|
82
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[constructor](SmartContractWithAddress.md#constructor)
|
|
83
|
+
|
|
84
|
+
#### Defined in
|
|
85
|
+
|
|
86
|
+
[contracts/SmartContractWithAddress.ts:17](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L17)
|
|
87
|
+
|
|
88
|
+
## Properties
|
|
89
|
+
|
|
90
|
+
### abi
|
|
91
|
+
|
|
92
|
+
• **abi**: [`AbiItem`](../interfaces/AbiItem.md)[]
|
|
93
|
+
|
|
94
|
+
#### Inherited from
|
|
95
|
+
|
|
96
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[abi](SmartContractWithAddress.md#abi)
|
|
97
|
+
|
|
98
|
+
#### Defined in
|
|
99
|
+
|
|
100
|
+
[contracts/SmartContract.ts:14](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L14)
|
|
101
|
+
|
|
102
|
+
___
|
|
103
|
+
|
|
104
|
+
### address
|
|
105
|
+
|
|
106
|
+
• **address**: `string`
|
|
107
|
+
|
|
108
|
+
#### Inherited from
|
|
109
|
+
|
|
110
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[address](SmartContractWithAddress.md#address)
|
|
111
|
+
|
|
112
|
+
#### Defined in
|
|
113
|
+
|
|
114
|
+
[contracts/SmartContractWithAddress.ts:6](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L6)
|
|
115
|
+
|
|
116
|
+
___
|
|
117
|
+
|
|
118
|
+
### config
|
|
119
|
+
|
|
120
|
+
• **config**: [`Config`](Config.md)
|
|
121
|
+
|
|
122
|
+
#### Inherited from
|
|
123
|
+
|
|
124
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[config](SmartContractWithAddress.md#config)
|
|
125
|
+
|
|
126
|
+
#### Defined in
|
|
127
|
+
|
|
128
|
+
[contracts/SmartContract.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L13)
|
|
129
|
+
|
|
130
|
+
___
|
|
131
|
+
|
|
132
|
+
### contract
|
|
133
|
+
|
|
134
|
+
• **contract**: `Contract`
|
|
135
|
+
|
|
136
|
+
#### Inherited from
|
|
137
|
+
|
|
138
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[contract](SmartContractWithAddress.md#contract)
|
|
139
|
+
|
|
140
|
+
#### Defined in
|
|
141
|
+
|
|
142
|
+
[contracts/SmartContractWithAddress.ts:7](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContractWithAddress.ts#L7)
|
|
143
|
+
|
|
144
|
+
___
|
|
145
|
+
|
|
146
|
+
### signer
|
|
147
|
+
|
|
148
|
+
• **signer**: `Signer`
|
|
149
|
+
|
|
150
|
+
#### Inherited from
|
|
151
|
+
|
|
152
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[signer](SmartContractWithAddress.md#signer)
|
|
153
|
+
|
|
154
|
+
#### Defined in
|
|
155
|
+
|
|
156
|
+
[contracts/SmartContract.ts:12](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L12)
|
|
157
|
+
|
|
158
|
+
## Methods
|
|
159
|
+
|
|
160
|
+
### activate
|
|
161
|
+
|
|
162
|
+
▸ **activate**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
163
|
+
|
|
164
|
+
Activate an exchange
|
|
165
|
+
|
|
166
|
+
#### Type parameters
|
|
167
|
+
|
|
168
|
+
| Name | Type |
|
|
169
|
+
| :------ | :------ |
|
|
170
|
+
| `G` | extends `boolean` = ``false`` |
|
|
171
|
+
|
|
172
|
+
#### Parameters
|
|
173
|
+
|
|
174
|
+
| Name | Type | Description |
|
|
175
|
+
| :------ | :------ | :------ |
|
|
176
|
+
| `exchangeId` | `string` | ExchangeId |
|
|
177
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
178
|
+
|
|
179
|
+
#### Returns
|
|
180
|
+
|
|
181
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
182
|
+
|
|
183
|
+
transaction receipt
|
|
184
|
+
|
|
185
|
+
#### Defined in
|
|
186
|
+
|
|
187
|
+
[contracts/FixedRateExchange.ts:210](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L210)
|
|
188
|
+
|
|
189
|
+
___
|
|
190
|
+
|
|
191
|
+
### activateMint
|
|
192
|
+
|
|
193
|
+
▸ **activateMint**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
194
|
+
|
|
195
|
+
Activate minting option for fixed rate contract
|
|
196
|
+
|
|
197
|
+
#### Type parameters
|
|
198
|
+
|
|
199
|
+
| Name | Type |
|
|
200
|
+
| :------ | :------ |
|
|
201
|
+
| `G` | extends `boolean` = ``false`` |
|
|
202
|
+
|
|
203
|
+
#### Parameters
|
|
204
|
+
|
|
205
|
+
| Name | Type | Description |
|
|
206
|
+
| :------ | :------ | :------ |
|
|
207
|
+
| `exchangeId` | `string` | Exchang eId |
|
|
208
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
209
|
+
|
|
210
|
+
#### Returns
|
|
211
|
+
|
|
212
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
213
|
+
|
|
214
|
+
transaction receipt
|
|
215
|
+
|
|
216
|
+
#### Defined in
|
|
217
|
+
|
|
218
|
+
[contracts/FixedRateExchange.ts:462](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L462)
|
|
219
|
+
|
|
220
|
+
___
|
|
221
|
+
|
|
222
|
+
### amountToUnits
|
|
223
|
+
|
|
224
|
+
▸ `Protected` **amountToUnits**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
|
225
|
+
|
|
226
|
+
Converts an amount of tokens to units
|
|
227
|
+
|
|
228
|
+
#### Parameters
|
|
229
|
+
|
|
230
|
+
| Name | Type | Description |
|
|
231
|
+
| :------ | :------ | :------ |
|
|
232
|
+
| `token` | `string` | The token to convert |
|
|
233
|
+
| `amount` | `string` | The amount of tokens to convert |
|
|
234
|
+
| `tokenDecimals?` | `number` | The number of decimals of the token |
|
|
235
|
+
|
|
236
|
+
#### Returns
|
|
237
|
+
|
|
238
|
+
`Promise`<`string`\>
|
|
239
|
+
|
|
240
|
+
- The converted amount in units
|
|
241
|
+
|
|
242
|
+
#### Inherited from
|
|
243
|
+
|
|
244
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[amountToUnits](SmartContractWithAddress.md#amounttounits)
|
|
245
|
+
|
|
246
|
+
#### Defined in
|
|
247
|
+
|
|
248
|
+
[contracts/SmartContract.ts:43](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L43)
|
|
249
|
+
|
|
250
|
+
___
|
|
251
|
+
|
|
252
|
+
### buyDatatokens
|
|
253
|
+
|
|
254
|
+
▸ **buyDatatokens**<`G`\>(`exchangeId`, `datatokenAmount`, `maxBaseTokenAmount`, `consumeMarketAddress?`, `consumeMarketFee?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
255
|
+
|
|
256
|
+
Atomic swap
|
|
257
|
+
|
|
258
|
+
#### Type parameters
|
|
259
|
+
|
|
260
|
+
| Name | Type |
|
|
261
|
+
| :------ | :------ |
|
|
262
|
+
| `G` | extends `boolean` = ``false`` |
|
|
263
|
+
|
|
264
|
+
#### Parameters
|
|
265
|
+
|
|
266
|
+
| Name | Type | Default value | Description |
|
|
267
|
+
| :------ | :------ | :------ | :------ |
|
|
268
|
+
| `exchangeId` | `string` | `undefined` | ExchangeId |
|
|
269
|
+
| `datatokenAmount` | `string` | `undefined` | Amount of datatokens |
|
|
270
|
+
| `maxBaseTokenAmount` | `string` | `undefined` | max amount of baseToken we want to pay for datatokenAmount |
|
|
271
|
+
| `consumeMarketAddress` | `string` | `ZERO_ADDRESS` | consumeMarketAddress |
|
|
272
|
+
| `consumeMarketFee` | `string` | `'0'` | consumeMarketFee in fraction |
|
|
273
|
+
| `estimateGas?` | `G` | `undefined` | if True, return gas estimate |
|
|
274
|
+
|
|
275
|
+
#### Returns
|
|
276
|
+
|
|
277
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
278
|
+
|
|
279
|
+
transaction receipt
|
|
280
|
+
|
|
281
|
+
#### Defined in
|
|
282
|
+
|
|
283
|
+
[contracts/FixedRateExchange.ts:38](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L38)
|
|
284
|
+
|
|
285
|
+
___
|
|
286
|
+
|
|
287
|
+
### calcBaseInGivenDatatokensOut
|
|
288
|
+
|
|
289
|
+
▸ **calcBaseInGivenDatatokensOut**(`exchangeId`, `datatokenAmount`, `consumeMarketFee?`): `Promise`<[`PriceAndFees`](../interfaces/PriceAndFees.md)\>
|
|
290
|
+
|
|
291
|
+
calcBaseInGivenDatatokensOut - Calculates how many base tokens are needed to get specified amount of datatokens
|
|
292
|
+
|
|
293
|
+
#### Parameters
|
|
294
|
+
|
|
295
|
+
| Name | Type | Default value | Description |
|
|
296
|
+
| :------ | :------ | :------ | :------ |
|
|
297
|
+
| `exchangeId` | `string` | `undefined` | Exchange Id |
|
|
298
|
+
| `datatokenAmount` | `string` | `undefined` | Amount of datatokens user wants to buy |
|
|
299
|
+
| `consumeMarketFee` | `string` | `'0'` | consumeMarketFee in fraction |
|
|
300
|
+
|
|
301
|
+
#### Returns
|
|
302
|
+
|
|
303
|
+
`Promise`<[`PriceAndFees`](../interfaces/PriceAndFees.md)\>
|
|
304
|
+
|
|
305
|
+
how many base tokens are needed and fees
|
|
306
|
+
|
|
307
|
+
#### Defined in
|
|
308
|
+
|
|
309
|
+
[contracts/FixedRateExchange.ts:305](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L305)
|
|
310
|
+
|
|
311
|
+
___
|
|
312
|
+
|
|
313
|
+
### collectBasetokens
|
|
314
|
+
|
|
315
|
+
▸ **collectBasetokens**<`G`\>(`exchangeId`, `amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
316
|
+
|
|
317
|
+
Collect BaseTokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
318
|
+
|
|
319
|
+
#### Type parameters
|
|
320
|
+
|
|
321
|
+
| Name | Type |
|
|
322
|
+
| :------ | :------ |
|
|
323
|
+
| `G` | extends `boolean` = ``false`` |
|
|
324
|
+
|
|
325
|
+
#### Parameters
|
|
326
|
+
|
|
327
|
+
| Name | Type | Description |
|
|
328
|
+
| :------ | :------ | :------ |
|
|
329
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
330
|
+
| `amount` | `string` | amount to be collected |
|
|
331
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
332
|
+
|
|
333
|
+
#### Returns
|
|
334
|
+
|
|
335
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
336
|
+
|
|
337
|
+
transaction receipt
|
|
338
|
+
|
|
339
|
+
#### Defined in
|
|
340
|
+
|
|
341
|
+
[contracts/FixedRateExchange.ts:519](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L519)
|
|
342
|
+
|
|
343
|
+
___
|
|
344
|
+
|
|
345
|
+
### collectDatatokens
|
|
346
|
+
|
|
347
|
+
▸ **collectDatatokens**<`G`\>(`exchangeId`, `amount`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
348
|
+
|
|
349
|
+
Collect datatokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
350
|
+
|
|
351
|
+
#### Type parameters
|
|
352
|
+
|
|
353
|
+
| Name | Type |
|
|
354
|
+
| :------ | :------ |
|
|
355
|
+
| `G` | extends `boolean` = ``false`` |
|
|
356
|
+
|
|
357
|
+
#### Parameters
|
|
358
|
+
|
|
359
|
+
| Name | Type | Description |
|
|
360
|
+
| :------ | :------ | :------ |
|
|
361
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
362
|
+
| `amount` | `string` | amount to be collected |
|
|
363
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
364
|
+
|
|
365
|
+
#### Returns
|
|
366
|
+
|
|
367
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
368
|
+
|
|
369
|
+
transaction receipt
|
|
370
|
+
|
|
371
|
+
#### Defined in
|
|
372
|
+
|
|
373
|
+
[contracts/FixedRateExchange.ts:555](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L555)
|
|
374
|
+
|
|
375
|
+
___
|
|
376
|
+
|
|
377
|
+
### collectMarketFee
|
|
378
|
+
|
|
379
|
+
▸ **collectMarketFee**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
380
|
+
|
|
381
|
+
Collect market fee and send it to marketFeeCollector (anyone can call it)
|
|
382
|
+
|
|
383
|
+
#### Type parameters
|
|
384
|
+
|
|
385
|
+
| Name | Type |
|
|
386
|
+
| :------ | :------ |
|
|
387
|
+
| `G` | extends `boolean` = ``false`` |
|
|
388
|
+
|
|
389
|
+
#### Parameters
|
|
390
|
+
|
|
391
|
+
| Name | Type | Description |
|
|
392
|
+
| :------ | :------ | :------ |
|
|
393
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
394
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
395
|
+
|
|
396
|
+
#### Returns
|
|
397
|
+
|
|
398
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
399
|
+
|
|
400
|
+
transaction receipt
|
|
401
|
+
|
|
402
|
+
#### Defined in
|
|
403
|
+
|
|
404
|
+
[contracts/FixedRateExchange.ts:590](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L590)
|
|
405
|
+
|
|
406
|
+
___
|
|
407
|
+
|
|
408
|
+
### collectOceanFee
|
|
409
|
+
|
|
410
|
+
▸ **collectOceanFee**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
411
|
+
|
|
412
|
+
Collect ocean fee and send it to OPF collector (anyone can call it)
|
|
413
|
+
|
|
414
|
+
#### Type parameters
|
|
415
|
+
|
|
416
|
+
| Name | Type |
|
|
417
|
+
| :------ | :------ |
|
|
418
|
+
| `G` | extends `boolean` = ``false`` |
|
|
419
|
+
|
|
420
|
+
#### Parameters
|
|
421
|
+
|
|
422
|
+
| Name | Type | Description |
|
|
423
|
+
| :------ | :------ | :------ |
|
|
424
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
425
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
426
|
+
|
|
427
|
+
#### Returns
|
|
428
|
+
|
|
429
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
430
|
+
|
|
431
|
+
transaction receipt
|
|
432
|
+
|
|
433
|
+
#### Defined in
|
|
434
|
+
|
|
435
|
+
[contracts/FixedRateExchange.ts:617](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L617)
|
|
436
|
+
|
|
437
|
+
___
|
|
438
|
+
|
|
439
|
+
### deactivate
|
|
440
|
+
|
|
441
|
+
▸ **deactivate**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
442
|
+
|
|
443
|
+
Deactivate an exchange
|
|
444
|
+
|
|
445
|
+
#### Type parameters
|
|
446
|
+
|
|
447
|
+
| Name | Type |
|
|
448
|
+
| :------ | :------ |
|
|
449
|
+
| `G` | extends `boolean` = ``false`` |
|
|
450
|
+
|
|
451
|
+
#### Parameters
|
|
452
|
+
|
|
453
|
+
| Name | Type | Description |
|
|
454
|
+
| :------ | :------ | :------ |
|
|
455
|
+
| `exchangeId` | `string` | ExchangeId |
|
|
456
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
457
|
+
|
|
458
|
+
#### Returns
|
|
459
|
+
|
|
460
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
461
|
+
|
|
462
|
+
transaction receipt
|
|
463
|
+
|
|
464
|
+
#### Defined in
|
|
465
|
+
|
|
466
|
+
[contracts/FixedRateExchange.ts:236](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L236)
|
|
467
|
+
|
|
468
|
+
___
|
|
469
|
+
|
|
470
|
+
### deactivateMint
|
|
471
|
+
|
|
472
|
+
▸ **deactivateMint**<`G`\>(`exchangeId`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
473
|
+
|
|
474
|
+
Deactivate minting for fixed rate
|
|
475
|
+
|
|
476
|
+
#### Type parameters
|
|
477
|
+
|
|
478
|
+
| Name | Type |
|
|
479
|
+
| :------ | :------ |
|
|
480
|
+
| `G` | extends `boolean` = ``false`` |
|
|
481
|
+
|
|
482
|
+
#### Parameters
|
|
483
|
+
|
|
484
|
+
| Name | Type | Description |
|
|
485
|
+
| :------ | :------ | :------ |
|
|
486
|
+
| `exchangeId` | `string` | ExchangeId |
|
|
487
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
488
|
+
|
|
489
|
+
#### Returns
|
|
490
|
+
|
|
491
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
492
|
+
|
|
493
|
+
transaction receipt
|
|
494
|
+
|
|
495
|
+
#### Defined in
|
|
496
|
+
|
|
497
|
+
[contracts/FixedRateExchange.ts:490](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L490)
|
|
498
|
+
|
|
499
|
+
___
|
|
500
|
+
|
|
501
|
+
### generateExchangeId
|
|
502
|
+
|
|
503
|
+
▸ **generateExchangeId**(`baseToken`, `datatoken`): `Promise`<`string`\>
|
|
504
|
+
|
|
505
|
+
Creates unique exchange identifier.
|
|
506
|
+
|
|
507
|
+
#### Parameters
|
|
508
|
+
|
|
509
|
+
| Name | Type | Description |
|
|
510
|
+
| :------ | :------ | :------ |
|
|
511
|
+
| `baseToken` | `string` | baseToken contract address |
|
|
512
|
+
| `datatoken` | `string` | Datatoken contract address |
|
|
513
|
+
|
|
514
|
+
#### Returns
|
|
515
|
+
|
|
516
|
+
`Promise`<`string`\>
|
|
517
|
+
|
|
518
|
+
exchangeId
|
|
519
|
+
|
|
520
|
+
#### Defined in
|
|
521
|
+
|
|
522
|
+
[contracts/FixedRateExchange.ts:23](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L23)
|
|
523
|
+
|
|
524
|
+
___
|
|
525
|
+
|
|
526
|
+
### getAllowedSwapper
|
|
527
|
+
|
|
528
|
+
▸ **getAllowedSwapper**(`exchangeId`): `Promise`<`string`\>
|
|
529
|
+
|
|
530
|
+
Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
|
|
531
|
+
|
|
532
|
+
#### Parameters
|
|
533
|
+
|
|
534
|
+
| Name | Type | Description |
|
|
535
|
+
| :------ | :------ | :------ |
|
|
536
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
537
|
+
|
|
538
|
+
#### Returns
|
|
539
|
+
|
|
540
|
+
`Promise`<`string`\>
|
|
541
|
+
|
|
542
|
+
address of allowed swapper
|
|
543
|
+
|
|
544
|
+
#### Defined in
|
|
545
|
+
|
|
546
|
+
[contracts/FixedRateExchange.ts:294](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L294)
|
|
547
|
+
|
|
548
|
+
___
|
|
549
|
+
|
|
550
|
+
### getAmountBasetokensOut
|
|
551
|
+
|
|
552
|
+
▸ **getAmountBasetokensOut**(`exchangeId`, `datatokenAmount`, `consumeMarketFee?`): `Promise`<`string`\>
|
|
553
|
+
|
|
554
|
+
Returns amount in baseToken that user will receive for datatokenAmount sold
|
|
555
|
+
|
|
556
|
+
#### Parameters
|
|
557
|
+
|
|
558
|
+
| Name | Type | Default value | Description |
|
|
559
|
+
| :------ | :------ | :------ | :------ |
|
|
560
|
+
| `exchangeId` | `string` | `undefined` | Exchange Id |
|
|
561
|
+
| `datatokenAmount` | `string` | `undefined` | Amount of datatokens |
|
|
562
|
+
| `consumeMarketFee` | `string` | `'0'` | consumeMarketFee in fraction |
|
|
563
|
+
|
|
564
|
+
#### Returns
|
|
565
|
+
|
|
566
|
+
`Promise`<`string`\>
|
|
567
|
+
|
|
568
|
+
Amount of baseTokens user will receive
|
|
569
|
+
|
|
570
|
+
#### Defined in
|
|
571
|
+
|
|
572
|
+
[contracts/FixedRateExchange.ts:352](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L352)
|
|
573
|
+
|
|
574
|
+
___
|
|
575
|
+
|
|
576
|
+
### getBasetokenSupply
|
|
577
|
+
|
|
578
|
+
▸ **getBasetokenSupply**(`exchangeId`): `Promise`<`string`\>
|
|
579
|
+
|
|
580
|
+
Returns basetoken supply in the exchange
|
|
581
|
+
|
|
582
|
+
#### Parameters
|
|
583
|
+
|
|
584
|
+
| Name | Type | Description |
|
|
585
|
+
| :------ | :------ | :------ |
|
|
586
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
587
|
+
|
|
588
|
+
#### Returns
|
|
589
|
+
|
|
590
|
+
`Promise`<`string`\>
|
|
591
|
+
|
|
592
|
+
dt supply formatted
|
|
593
|
+
|
|
594
|
+
#### Defined in
|
|
595
|
+
|
|
596
|
+
[contracts/FixedRateExchange.ts:283](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L283)
|
|
597
|
+
|
|
598
|
+
___
|
|
599
|
+
|
|
600
|
+
### getContract
|
|
601
|
+
|
|
602
|
+
▸ `Protected` **getContract**(`address`, `abi?`): `Contract`
|
|
603
|
+
|
|
604
|
+
Returns a contract instance for the given address
|
|
605
|
+
|
|
606
|
+
#### Parameters
|
|
607
|
+
|
|
608
|
+
| Name | Type | Description |
|
|
609
|
+
| :------ | :------ | :------ |
|
|
610
|
+
| `address` | `string` | The address of the contract |
|
|
611
|
+
| `abi?` | [`AbiItem`](../interfaces/AbiItem.md)[] | The ABI of the contract |
|
|
612
|
+
|
|
613
|
+
#### Returns
|
|
614
|
+
|
|
615
|
+
`Contract`
|
|
616
|
+
|
|
617
|
+
- The contract instance
|
|
618
|
+
|
|
619
|
+
#### Inherited from
|
|
620
|
+
|
|
621
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getContract](SmartContractWithAddress.md#getcontract)
|
|
622
|
+
|
|
623
|
+
#### Defined in
|
|
624
|
+
|
|
625
|
+
[contracts/SmartContract.ts:80](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L80)
|
|
626
|
+
|
|
627
|
+
___
|
|
628
|
+
|
|
629
|
+
### getDatatokenSupply
|
|
630
|
+
|
|
631
|
+
▸ **getDatatokenSupply**(`exchangeId`): `Promise`<`string`\>
|
|
632
|
+
|
|
633
|
+
Get Datatoken Supply in the exchange
|
|
634
|
+
|
|
635
|
+
#### Parameters
|
|
636
|
+
|
|
637
|
+
| Name | Type | Description |
|
|
638
|
+
| :------ | :------ | :------ |
|
|
639
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
640
|
+
|
|
641
|
+
#### Returns
|
|
642
|
+
|
|
643
|
+
`Promise`<`string`\>
|
|
644
|
+
|
|
645
|
+
dt supply formatted
|
|
646
|
+
|
|
647
|
+
#### Defined in
|
|
648
|
+
|
|
649
|
+
[contracts/FixedRateExchange.ts:272](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L272)
|
|
650
|
+
|
|
651
|
+
___
|
|
652
|
+
|
|
653
|
+
### getDefaultAbi
|
|
654
|
+
|
|
655
|
+
▸ **getDefaultAbi**(): [`AbiItem`](../interfaces/AbiItem.md)[]
|
|
656
|
+
|
|
657
|
+
#### Returns
|
|
658
|
+
|
|
659
|
+
[`AbiItem`](../interfaces/AbiItem.md)[]
|
|
660
|
+
|
|
661
|
+
#### Overrides
|
|
662
|
+
|
|
663
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getDefaultAbi](SmartContractWithAddress.md#getdefaultabi)
|
|
664
|
+
|
|
665
|
+
#### Defined in
|
|
666
|
+
|
|
667
|
+
[contracts/FixedRateExchange.ts:13](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L13)
|
|
668
|
+
|
|
669
|
+
___
|
|
670
|
+
|
|
671
|
+
### getExchange
|
|
672
|
+
|
|
673
|
+
▸ **getExchange**(`exchangeId`): `Promise`<[`FixedPriceExchange`](../interfaces/FixedPriceExchange.md)\>
|
|
674
|
+
|
|
675
|
+
Get exchange details
|
|
676
|
+
|
|
677
|
+
#### Parameters
|
|
678
|
+
|
|
679
|
+
| Name | Type | Description |
|
|
680
|
+
| :------ | :------ | :------ |
|
|
681
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
682
|
+
|
|
683
|
+
#### Returns
|
|
684
|
+
|
|
685
|
+
`Promise`<[`FixedPriceExchange`](../interfaces/FixedPriceExchange.md)\>
|
|
686
|
+
|
|
687
|
+
Exchange details
|
|
688
|
+
|
|
689
|
+
#### Defined in
|
|
690
|
+
|
|
691
|
+
[contracts/FixedRateExchange.ts:372](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L372)
|
|
692
|
+
|
|
693
|
+
___
|
|
694
|
+
|
|
695
|
+
### getExchangeOwner
|
|
696
|
+
|
|
697
|
+
▸ **getExchangeOwner**(`exchangeId`): `Promise`<`string`\>
|
|
698
|
+
|
|
699
|
+
Get Exchange Owner given an exchangeId
|
|
700
|
+
|
|
701
|
+
#### Parameters
|
|
702
|
+
|
|
703
|
+
| Name | Type | Description |
|
|
704
|
+
| :------ | :------ | :------ |
|
|
705
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
706
|
+
|
|
707
|
+
#### Returns
|
|
708
|
+
|
|
709
|
+
`Promise`<`string`\>
|
|
710
|
+
|
|
711
|
+
return exchange owner
|
|
712
|
+
|
|
713
|
+
#### Defined in
|
|
714
|
+
|
|
715
|
+
[contracts/FixedRateExchange.ts:661](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L661)
|
|
716
|
+
|
|
717
|
+
___
|
|
718
|
+
|
|
719
|
+
### getExchanges
|
|
720
|
+
|
|
721
|
+
▸ **getExchanges**(): `Promise`<`string`[]\>
|
|
722
|
+
|
|
723
|
+
Returns all exchanges
|
|
724
|
+
|
|
725
|
+
#### Returns
|
|
726
|
+
|
|
727
|
+
`Promise`<`string`[]\>
|
|
728
|
+
|
|
729
|
+
Exchanges list
|
|
730
|
+
|
|
731
|
+
#### Defined in
|
|
732
|
+
|
|
733
|
+
[contracts/FixedRateExchange.ts:442](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L442)
|
|
734
|
+
|
|
735
|
+
___
|
|
736
|
+
|
|
737
|
+
### getFairGasPrice
|
|
738
|
+
|
|
739
|
+
▸ `Protected` **getFairGasPrice**(): `Promise`<`string`\>
|
|
740
|
+
|
|
741
|
+
Retruns the gas price
|
|
742
|
+
|
|
743
|
+
#### Returns
|
|
744
|
+
|
|
745
|
+
`Promise`<`string`\>
|
|
746
|
+
|
|
747
|
+
- The fair gas price
|
|
748
|
+
|
|
749
|
+
#### Inherited from
|
|
750
|
+
|
|
751
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[getFairGasPrice](SmartContractWithAddress.md#getfairgasprice)
|
|
752
|
+
|
|
753
|
+
#### Defined in
|
|
754
|
+
|
|
755
|
+
[contracts/SmartContract.ts:70](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L70)
|
|
756
|
+
|
|
757
|
+
___
|
|
758
|
+
|
|
759
|
+
### getFeesInfo
|
|
760
|
+
|
|
761
|
+
▸ **getFeesInfo**(`exchangeId`): `Promise`<[`FeesInfo`](../interfaces/FeesInfo.md)\>
|
|
762
|
+
|
|
763
|
+
Get fee details for an exchange
|
|
764
|
+
|
|
765
|
+
#### Parameters
|
|
766
|
+
|
|
767
|
+
| Name | Type | Description |
|
|
768
|
+
| :------ | :------ | :------ |
|
|
769
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
770
|
+
|
|
771
|
+
#### Returns
|
|
772
|
+
|
|
773
|
+
`Promise`<[`FeesInfo`](../interfaces/FeesInfo.md)\>
|
|
774
|
+
|
|
775
|
+
Exchange details
|
|
776
|
+
|
|
777
|
+
#### Defined in
|
|
778
|
+
|
|
779
|
+
[contracts/FixedRateExchange.ts:414](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L414)
|
|
780
|
+
|
|
781
|
+
___
|
|
782
|
+
|
|
783
|
+
### getNumberOfExchanges
|
|
784
|
+
|
|
785
|
+
▸ **getNumberOfExchanges**(): `Promise`<`number`\>
|
|
786
|
+
|
|
787
|
+
Gets total number of exchanges
|
|
788
|
+
|
|
789
|
+
#### Returns
|
|
790
|
+
|
|
791
|
+
`Promise`<`number`\>
|
|
792
|
+
|
|
793
|
+
no of available exchanges
|
|
794
|
+
|
|
795
|
+
#### Defined in
|
|
796
|
+
|
|
797
|
+
[contracts/FixedRateExchange.ts:140](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L140)
|
|
798
|
+
|
|
799
|
+
___
|
|
800
|
+
|
|
801
|
+
### getOPCCollector
|
|
802
|
+
|
|
803
|
+
▸ **getOPCCollector**(): `Promise`<`string`\>
|
|
804
|
+
|
|
805
|
+
Get OPF Collector of fixed rate contract
|
|
806
|
+
|
|
807
|
+
#### Returns
|
|
808
|
+
|
|
809
|
+
`Promise`<`string`\>
|
|
810
|
+
|
|
811
|
+
#### Defined in
|
|
812
|
+
|
|
813
|
+
[contracts/FixedRateExchange.ts:642](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L642)
|
|
814
|
+
|
|
815
|
+
___
|
|
816
|
+
|
|
817
|
+
### getRate
|
|
818
|
+
|
|
819
|
+
▸ **getRate**(`exchangeId`): `Promise`<`string`\>
|
|
820
|
+
|
|
821
|
+
Get Exchange Rate
|
|
822
|
+
|
|
823
|
+
#### Parameters
|
|
824
|
+
|
|
825
|
+
| Name | Type | Description |
|
|
826
|
+
| :------ | :------ | :------ |
|
|
827
|
+
| `exchangeId` | `string` | Exchange ID |
|
|
828
|
+
|
|
829
|
+
#### Returns
|
|
830
|
+
|
|
831
|
+
`Promise`<`string`\>
|
|
832
|
+
|
|
833
|
+
Rate (converted from wei)
|
|
834
|
+
|
|
835
|
+
#### Defined in
|
|
836
|
+
|
|
837
|
+
[contracts/FixedRateExchange.ts:262](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L262)
|
|
838
|
+
|
|
839
|
+
___
|
|
840
|
+
|
|
841
|
+
### getRouter
|
|
842
|
+
|
|
843
|
+
▸ **getRouter**(): `Promise`<`string`\>
|
|
844
|
+
|
|
845
|
+
Get Router address set in fixed rate contract
|
|
846
|
+
|
|
847
|
+
#### Returns
|
|
848
|
+
|
|
849
|
+
`Promise`<`string`\>
|
|
850
|
+
|
|
851
|
+
#### Defined in
|
|
852
|
+
|
|
853
|
+
[contracts/FixedRateExchange.ts:651](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L651)
|
|
854
|
+
|
|
855
|
+
___
|
|
856
|
+
|
|
857
|
+
### isActive
|
|
858
|
+
|
|
859
|
+
▸ **isActive**(`exchangeId`): `Promise`<`boolean`\>
|
|
860
|
+
|
|
861
|
+
Check if an exchange is active
|
|
862
|
+
|
|
863
|
+
#### Parameters
|
|
864
|
+
|
|
865
|
+
| Name | Type | Description |
|
|
866
|
+
| :------ | :------ | :------ |
|
|
867
|
+
| `exchangeId` | `string` | ExchangeId |
|
|
868
|
+
|
|
869
|
+
#### Returns
|
|
870
|
+
|
|
871
|
+
`Promise`<`boolean`\>
|
|
872
|
+
|
|
873
|
+
#### Defined in
|
|
874
|
+
|
|
875
|
+
[contracts/FixedRateExchange.ts:451](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L451)
|
|
876
|
+
|
|
877
|
+
___
|
|
878
|
+
|
|
879
|
+
### sellDatatokens
|
|
880
|
+
|
|
881
|
+
▸ **sellDatatokens**<`G`\>(`exchangeId`, `datatokenAmount`, `minBaseTokenAmount`, `consumeMarketAddress?`, `consumeMarketFee?`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
882
|
+
|
|
883
|
+
Sell datatokenAmount while expecting at least minBaseTokenAmount
|
|
884
|
+
|
|
885
|
+
#### Type parameters
|
|
886
|
+
|
|
887
|
+
| Name | Type |
|
|
888
|
+
| :------ | :------ |
|
|
889
|
+
| `G` | extends `boolean` = ``false`` |
|
|
890
|
+
|
|
891
|
+
#### Parameters
|
|
892
|
+
|
|
893
|
+
| Name | Type | Default value | Description |
|
|
894
|
+
| :------ | :------ | :------ | :------ |
|
|
895
|
+
| `exchangeId` | `string` | `undefined` | ExchangeId |
|
|
896
|
+
| `datatokenAmount` | `string` | `undefined` | Amount of datatokens |
|
|
897
|
+
| `minBaseTokenAmount` | `string` | `undefined` | min amount of baseToken we want to receive back |
|
|
898
|
+
| `consumeMarketAddress` | `string` | `ZERO_ADDRESS` | consumeMarketAddress |
|
|
899
|
+
| `consumeMarketFee` | `string` | `'0'` | consumeMarketFee in fraction |
|
|
900
|
+
| `estimateGas?` | `G` | `undefined` | if True, return gas estimate |
|
|
901
|
+
|
|
902
|
+
#### Returns
|
|
903
|
+
|
|
904
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
905
|
+
|
|
906
|
+
transaction receipt
|
|
907
|
+
|
|
908
|
+
#### Defined in
|
|
909
|
+
|
|
910
|
+
[contracts/FixedRateExchange.ts:93](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L93)
|
|
911
|
+
|
|
912
|
+
___
|
|
913
|
+
|
|
914
|
+
### setAllowedSwapper
|
|
915
|
+
|
|
916
|
+
▸ **setAllowedSwapper**<`G`\>(`exchangeId`, `newAllowedSwapper`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
917
|
+
|
|
918
|
+
Sets a new allowedSwapper
|
|
919
|
+
|
|
920
|
+
#### Type parameters
|
|
921
|
+
|
|
922
|
+
| Name | Type |
|
|
923
|
+
| :------ | :------ |
|
|
924
|
+
| `G` | extends `boolean` = ``false`` |
|
|
925
|
+
|
|
926
|
+
#### Parameters
|
|
927
|
+
|
|
928
|
+
| Name | Type | Description |
|
|
929
|
+
| :------ | :------ | :------ |
|
|
930
|
+
| `exchangeId` | `string` | Exchange ID |
|
|
931
|
+
| `newAllowedSwapper` | `string` | The address of the new allowed swapper (set address zero if we want to remove allowed swapper) |
|
|
932
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
933
|
+
|
|
934
|
+
#### Returns
|
|
935
|
+
|
|
936
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
937
|
+
|
|
938
|
+
transaction receipt
|
|
939
|
+
|
|
940
|
+
#### Defined in
|
|
941
|
+
|
|
942
|
+
[contracts/FixedRateExchange.ts:182](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L182)
|
|
943
|
+
|
|
944
|
+
___
|
|
945
|
+
|
|
946
|
+
### setRate
|
|
947
|
+
|
|
948
|
+
▸ **setRate**<`G`\>(`exchangeId`, `newRate`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
949
|
+
|
|
950
|
+
Set new rate
|
|
951
|
+
|
|
952
|
+
#### Type parameters
|
|
953
|
+
|
|
954
|
+
| Name | Type |
|
|
955
|
+
| :------ | :------ |
|
|
956
|
+
| `G` | extends `boolean` = ``false`` |
|
|
957
|
+
|
|
958
|
+
#### Parameters
|
|
959
|
+
|
|
960
|
+
| Name | Type | Description |
|
|
961
|
+
| :------ | :------ | :------ |
|
|
962
|
+
| `exchangeId` | `string` | Exchange ID |
|
|
963
|
+
| `newRate` | `string` | New rate |
|
|
964
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
965
|
+
|
|
966
|
+
#### Returns
|
|
967
|
+
|
|
968
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
969
|
+
|
|
970
|
+
transaction receipt
|
|
971
|
+
|
|
972
|
+
#### Defined in
|
|
973
|
+
|
|
974
|
+
[contracts/FixedRateExchange.ts:152](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L152)
|
|
975
|
+
|
|
976
|
+
___
|
|
977
|
+
|
|
978
|
+
### unitsToAmount
|
|
979
|
+
|
|
980
|
+
▸ `Protected` **unitsToAmount**(`token`, `amount`, `tokenDecimals?`): `Promise`<`string`\>
|
|
981
|
+
|
|
982
|
+
Converts an amount of units to tokens
|
|
983
|
+
|
|
984
|
+
#### Parameters
|
|
985
|
+
|
|
986
|
+
| Name | Type | Description |
|
|
987
|
+
| :------ | :------ | :------ |
|
|
988
|
+
| `token` | `string` | The token to convert |
|
|
989
|
+
| `amount` | `string` | The amount of units to convert |
|
|
990
|
+
| `tokenDecimals?` | `number` | The number of decimals in the token |
|
|
991
|
+
|
|
992
|
+
#### Returns
|
|
993
|
+
|
|
994
|
+
`Promise`<`string`\>
|
|
995
|
+
|
|
996
|
+
- The converted amount in tokens
|
|
997
|
+
|
|
998
|
+
#### Inherited from
|
|
999
|
+
|
|
1000
|
+
[SmartContractWithAddress](SmartContractWithAddress.md).[unitsToAmount](SmartContractWithAddress.md#unitstoamount)
|
|
1001
|
+
|
|
1002
|
+
#### Defined in
|
|
1003
|
+
|
|
1004
|
+
[contracts/SmartContract.ts:58](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/SmartContract.ts#L58)
|
|
1005
|
+
|
|
1006
|
+
___
|
|
1007
|
+
|
|
1008
|
+
### updateMarketFee
|
|
1009
|
+
|
|
1010
|
+
▸ **updateMarketFee**<`G`\>(`exchangeId`, `newMarketFee`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
1011
|
+
|
|
1012
|
+
Set new market fee, only market fee collector can update it
|
|
1013
|
+
|
|
1014
|
+
#### Type parameters
|
|
1015
|
+
|
|
1016
|
+
| Name | Type |
|
|
1017
|
+
| :------ | :------ |
|
|
1018
|
+
| `G` | extends `boolean` = ``false`` |
|
|
1019
|
+
|
|
1020
|
+
#### Parameters
|
|
1021
|
+
|
|
1022
|
+
| Name | Type | Description |
|
|
1023
|
+
| :------ | :------ | :------ |
|
|
1024
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
1025
|
+
| `newMarketFee` | `string` | New market fee |
|
|
1026
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
1027
|
+
|
|
1028
|
+
#### Returns
|
|
1029
|
+
|
|
1030
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
1031
|
+
|
|
1032
|
+
transaction receipt
|
|
1033
|
+
|
|
1034
|
+
#### Defined in
|
|
1035
|
+
|
|
1036
|
+
[contracts/FixedRateExchange.ts:673](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L673)
|
|
1037
|
+
|
|
1038
|
+
___
|
|
1039
|
+
|
|
1040
|
+
### updateMarketFeeCollector
|
|
1041
|
+
|
|
1042
|
+
▸ **updateMarketFeeCollector**<`G`\>(`exchangeId`, `newMarketFeeCollector`, `estimateGas?`): `Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
1043
|
+
|
|
1044
|
+
Set new market fee collector, only market fee collector can update it
|
|
1045
|
+
|
|
1046
|
+
#### Type parameters
|
|
1047
|
+
|
|
1048
|
+
| Name | Type |
|
|
1049
|
+
| :------ | :------ |
|
|
1050
|
+
| `G` | extends `boolean` = ``false`` |
|
|
1051
|
+
|
|
1052
|
+
#### Parameters
|
|
1053
|
+
|
|
1054
|
+
| Name | Type | Description |
|
|
1055
|
+
| :------ | :------ | :------ |
|
|
1056
|
+
| `exchangeId` | `string` | Exchange Id |
|
|
1057
|
+
| `newMarketFeeCollector` | `string` | New market fee collector |
|
|
1058
|
+
| `estimateGas?` | `G` | if True, return gas estimate |
|
|
1059
|
+
|
|
1060
|
+
#### Returns
|
|
1061
|
+
|
|
1062
|
+
`Promise`<[`ReceiptOrEstimate`](../modules.md#receiptorestimate)<`G`\>\>
|
|
1063
|
+
|
|
1064
|
+
transaction receipt
|
|
1065
|
+
|
|
1066
|
+
#### Defined in
|
|
1067
|
+
|
|
1068
|
+
[contracts/FixedRateExchange.ts:703](https://github.com/oceanprotocol/ocean.js/blob/c99bc5c6/src/contracts/FixedRateExchange.ts#L703)
|