@oceanprotocol/lib 3.0.3 → 3.1.0
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 +17 -0
- 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/@types/Asset.d.ts +148 -148
- package/dist/src/@types/Compute.d.ts +71 -71
- package/dist/src/@types/Contracts.d.ts +26 -26
- package/dist/src/@types/DDO/ConsumerParameter.d.ts +37 -37
- package/dist/src/@types/DDO/Credentials.d.ts +8 -8
- package/dist/src/@types/DDO/DDO.d.ts +55 -55
- package/dist/src/@types/DDO/Event.d.ts +27 -27
- package/dist/src/@types/DDO/Metadata.d.ts +141 -141
- package/dist/src/@types/DDO/Service.d.ts +100 -100
- package/dist/src/@types/Datatoken.d.ts +38 -38
- package/dist/src/@types/Dispenser.d.ts +16 -16
- package/dist/src/@types/DownloadResponse.d.ts +4 -4
- package/dist/src/@types/File.d.ts +89 -89
- package/dist/src/@types/FileInfo.d.ts +43 -43
- package/dist/src/@types/FixedPrice.d.ts +51 -51
- package/dist/src/@types/NFT.d.ts +18 -18
- package/dist/src/@types/NFTFactory.d.ts +20 -20
- package/dist/src/@types/Provider.d.ts +33 -33
- package/dist/src/@types/ReturnTypes.d.ts +3 -3
- package/dist/src/@types/Router.d.ts +59 -59
- package/dist/src/@types/index.d.ts +20 -20
- package/dist/src/config/Config.d.ts +153 -153
- package/dist/src/config/ConfigHelper.d.ts +12 -12
- package/dist/src/config/index.d.ts +2 -2
- package/dist/src/contracts/Datatoken.d.ts +278 -260
- package/dist/src/contracts/Dispenser.d.ts +73 -73
- package/dist/src/contracts/FixedRateExchange.d.ts +209 -209
- package/dist/src/contracts/NFT.d.ts +220 -220
- package/dist/src/contracts/NFTFactory.d.ts +165 -165
- package/dist/src/contracts/Router.d.ts +107 -107
- package/dist/src/contracts/SmartContract.d.ts +45 -45
- package/dist/src/contracts/SmartContractWithAddress.d.ts +17 -17
- package/dist/src/contracts/df/DfRewards.d.ts +31 -31
- package/dist/src/contracts/df/DfStrategyV1.d.ts +21 -21
- package/dist/src/contracts/index.d.ts +14 -14
- package/dist/src/contracts/ve/VeAllocate.d.ts +38 -38
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +29 -29
- package/dist/src/contracts/ve/VeFeeEstimate.d.ts +14 -14
- package/dist/src/contracts/ve/VeOcean.d.ts +68 -68
- package/dist/src/index.d.ts +5 -5
- package/dist/src/services/Aquarius.d.ts +53 -53
- package/dist/src/services/Provider.d.ts +197 -197
- package/dist/src/services/index.d.ts +2 -2
- package/dist/src/utils/Constants.d.ts +4 -4
- package/dist/src/utils/ContractUtils.d.ts +46 -46
- package/dist/src/utils/DatatokenName.d.ts +14 -14
- package/dist/src/utils/DdoHelpers.d.ts +13 -13
- package/dist/src/utils/FetchHelper.d.ts +14 -14
- package/dist/src/utils/General.d.ts +5 -5
- package/dist/src/utils/Logger.d.ts +19 -19
- package/dist/src/utils/OrderUtils.d.ts +17 -0
- package/dist/src/utils/ProviderErrors.d.ts +1 -1
- package/dist/src/utils/SignatureUtils.d.ts +12 -12
- package/dist/src/utils/TokenUtils.d.ts +70 -70
- package/dist/src/utils/index.d.ts +12 -11
- package/dist/src/utils/minAbi.d.ts +38 -38
- package/dist/test/config.d.ts +19 -19
- package/dist/test/integration/CodeExamples.test.d.ts +1 -1
- package/dist/test/integration/ComputeExamples.test.d.ts +1 -1
- package/dist/test/integration/ComputeFlow.test.d.ts +1 -1
- package/dist/test/integration/Provider.test.d.ts +1 -1
- package/dist/test/integration/PublishEditConsume.test.d.ts +1 -1
- package/dist/test/integration/PublishFlows.test.d.ts +1 -1
- package/dist/test/integration/helpers.d.ts +7 -7
- package/dist/test/unit/DFRewards.test.d.ts +1 -1
- package/dist/test/unit/Datatoken.test.d.ts +1 -1
- package/dist/test/unit/Dispenser.test.d.ts +1 -1
- package/dist/test/unit/FixedRateExchange.test.d.ts +1 -1
- package/dist/test/unit/Nft.test.d.ts +1 -1
- package/dist/test/unit/NftFactory.test.d.ts +1 -1
- package/dist/test/unit/Router.test.d.ts +1 -1
- package/dist/test/unit/veOcean.test.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { Datatoken } from './Datatoken';
|
|
2
|
-
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
3
|
-
import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
4
|
-
export declare class Dispenser extends SmartContractWithAddress {
|
|
5
|
-
getDefaultAbi(): AbiItem[];
|
|
6
|
-
/**
|
|
7
|
-
* Get information about a datatoken dispenser
|
|
8
|
-
* @param {String} dtAddress
|
|
9
|
-
* @return {Promise<DispenserToken>}
|
|
10
|
-
*/
|
|
11
|
-
status(dtAdress: string): Promise<DispenserToken>;
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new Dispenser
|
|
14
|
-
* @param {String} dtAddress Datatoken address
|
|
15
|
-
* @param {String} address Owner address
|
|
16
|
-
* @param {String} maxTokens max tokens to dispense
|
|
17
|
-
* @param {String} maxBalance max balance of requester
|
|
18
|
-
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
|
19
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
|
-
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
21
|
-
*/
|
|
22
|
-
create<G extends boolean = false>(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
|
-
/**
|
|
24
|
-
* Activates a dispener.
|
|
25
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
26
|
-
* @param {Number} maxTokens max amount of tokens to dispense
|
|
27
|
-
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
28
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
29
|
-
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
30
|
-
*/
|
|
31
|
-
activate<G extends boolean = false>(dtAddress: string, maxTokens: string, maxBalance: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
32
|
-
/**
|
|
33
|
-
* Deactivate an existing dispenser.
|
|
34
|
-
* @param {String} dtAddress refers to datatoken address.
|
|
35
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
36
|
-
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
37
|
-
*/
|
|
38
|
-
deactivate<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
|
-
/**
|
|
40
|
-
* Sets a new allowed swapper.
|
|
41
|
-
* @param {String} dtAddress Datatoken address.
|
|
42
|
-
* @param {String} newAllowedSwapper The address of the new allowed swapper.
|
|
43
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
44
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
45
|
-
*/
|
|
46
|
-
setAllowedSwapper<G extends boolean = false>(dtAddress: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
|
-
/**
|
|
48
|
-
* Dispense datatokens to caller.
|
|
49
|
-
* The dispenser must be active, hold enough datatokens (or be able to mint more)
|
|
50
|
-
* and respect maxTokens/maxBalance requirements
|
|
51
|
-
* @param {String} dtAddress Datatoken address.
|
|
52
|
-
* @param {String} amount Amount of datatokens required.
|
|
53
|
-
* @param {String} destination address of tokens receiver
|
|
54
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
55
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
56
|
-
*/
|
|
57
|
-
dispense<G extends boolean = false>(dtAddress: string, amount: string, destination: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
58
|
-
/**
|
|
59
|
-
* Withdraw all tokens from the dispenser
|
|
60
|
-
* @param {String} dtAddress Datatoken address.
|
|
61
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
62
|
-
* @return {Promise<ReceiptOrEstimate>}
|
|
63
|
-
*/
|
|
64
|
-
ownerWithdraw<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
65
|
-
/**
|
|
66
|
-
* Check if tokens can be dispensed
|
|
67
|
-
* @param {String} dtAddress Datatoken address
|
|
68
|
-
* @param {String} address User address that will receive datatokens
|
|
69
|
-
* @param {String} amount amount of datatokens required.
|
|
70
|
-
* @return {Promise<Boolean>}
|
|
71
|
-
*/
|
|
72
|
-
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
73
|
-
}
|
|
1
|
+
import { Datatoken } from './Datatoken';
|
|
2
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
3
|
+
import { DispenserToken, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
4
|
+
export declare class Dispenser extends SmartContractWithAddress {
|
|
5
|
+
getDefaultAbi(): AbiItem[];
|
|
6
|
+
/**
|
|
7
|
+
* Get information about a datatoken dispenser
|
|
8
|
+
* @param {String} dtAddress
|
|
9
|
+
* @return {Promise<DispenserToken>}
|
|
10
|
+
*/
|
|
11
|
+
status(dtAdress: string): Promise<DispenserToken>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new Dispenser
|
|
14
|
+
* @param {String} dtAddress Datatoken address
|
|
15
|
+
* @param {String} address Owner address
|
|
16
|
+
* @param {String} maxTokens max tokens to dispense
|
|
17
|
+
* @param {String} maxBalance max balance of requester
|
|
18
|
+
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
|
19
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
|
+
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
21
|
+
*/
|
|
22
|
+
create<G extends boolean = false>(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
|
+
/**
|
|
24
|
+
* Activates a dispener.
|
|
25
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
26
|
+
* @param {Number} maxTokens max amount of tokens to dispense
|
|
27
|
+
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
28
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
29
|
+
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
30
|
+
*/
|
|
31
|
+
activate<G extends boolean = false>(dtAddress: string, maxTokens: string, maxBalance: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
32
|
+
/**
|
|
33
|
+
* Deactivate an existing dispenser.
|
|
34
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
35
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
36
|
+
* @return {Promise<ReceiptOrEstimate>} TransactionReceipt
|
|
37
|
+
*/
|
|
38
|
+
deactivate<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
|
+
/**
|
|
40
|
+
* Sets a new allowed swapper.
|
|
41
|
+
* @param {String} dtAddress Datatoken address.
|
|
42
|
+
* @param {String} newAllowedSwapper The address of the new allowed swapper.
|
|
43
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
44
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
45
|
+
*/
|
|
46
|
+
setAllowedSwapper<G extends boolean = false>(dtAddress: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
|
+
/**
|
|
48
|
+
* Dispense datatokens to caller.
|
|
49
|
+
* The dispenser must be active, hold enough datatokens (or be able to mint more)
|
|
50
|
+
* and respect maxTokens/maxBalance requirements
|
|
51
|
+
* @param {String} dtAddress Datatoken address.
|
|
52
|
+
* @param {String} amount Amount of datatokens required.
|
|
53
|
+
* @param {String} destination address of tokens receiver
|
|
54
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
55
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
56
|
+
*/
|
|
57
|
+
dispense<G extends boolean = false>(dtAddress: string, amount: string, destination: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
58
|
+
/**
|
|
59
|
+
* Withdraw all tokens from the dispenser
|
|
60
|
+
* @param {String} dtAddress Datatoken address.
|
|
61
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
62
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
63
|
+
*/
|
|
64
|
+
ownerWithdraw<G extends boolean = false>(dtAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
65
|
+
/**
|
|
66
|
+
* Check if tokens can be dispensed
|
|
67
|
+
* @param {String} dtAddress Datatoken address
|
|
68
|
+
* @param {String} address User address that will receive datatokens
|
|
69
|
+
* @param {String} amount amount of datatokens required.
|
|
70
|
+
* @return {Promise<Boolean>}
|
|
71
|
+
*/
|
|
72
|
+
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
73
|
+
}
|
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
import { PriceAndFees, FeesInfo, FixedPriceExchange, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
2
|
-
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
3
|
-
export declare class FixedRateExchange extends SmartContractWithAddress {
|
|
4
|
-
getDefaultAbi(): AbiItem[];
|
|
5
|
-
/**
|
|
6
|
-
* Creates unique exchange identifier.
|
|
7
|
-
* @param {String} baseToken baseToken contract address
|
|
8
|
-
* @param {String} datatoken Datatoken contract address
|
|
9
|
-
* @return {Promise<string>} exchangeId
|
|
10
|
-
*/
|
|
11
|
-
generateExchangeId(baseToken: string, datatoken: string): Promise<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Atomic swap
|
|
14
|
-
* @param {String} exchangeId ExchangeId
|
|
15
|
-
* @param {String} datatokenAmount Amount of datatokens
|
|
16
|
-
* @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
|
17
|
-
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
18
|
-
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
19
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
21
|
-
*/
|
|
22
|
-
buyDatatokens<G extends boolean = false>(exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
|
-
/**
|
|
24
|
-
* Sell datatokenAmount while expecting at least minBaseTokenAmount
|
|
25
|
-
* @param {String} exchangeId ExchangeId
|
|
26
|
-
* @param {String} datatokenAmount Amount of datatokens
|
|
27
|
-
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
|
28
|
-
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
29
|
-
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
30
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
31
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
32
|
-
*/
|
|
33
|
-
sellDatatokens<G extends boolean = false>(exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
34
|
-
/**
|
|
35
|
-
* Gets total number of exchanges
|
|
36
|
-
* @return {Promise<Number>} no of available exchanges
|
|
37
|
-
*/
|
|
38
|
-
getNumberOfExchanges(): Promise<number>;
|
|
39
|
-
/**
|
|
40
|
-
* Set new rate
|
|
41
|
-
* @param {String} exchangeId Exchange ID
|
|
42
|
-
* @param {String} newRate New rate
|
|
43
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
44
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
45
|
-
*/
|
|
46
|
-
setRate<G extends boolean = false>(exchangeId: string, newRate: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
|
-
/**
|
|
48
|
-
* Sets a new allowedSwapper
|
|
49
|
-
* @param {String} exchangeId Exchange ID
|
|
50
|
-
* @param {String} newAllowedSwapper The address of the new allowed swapper (set address zero if we want to remove allowed swapper)
|
|
51
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
52
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
53
|
-
*/
|
|
54
|
-
setAllowedSwapper<G extends boolean = false>(exchangeId: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
55
|
-
/**
|
|
56
|
-
* Activate an exchange
|
|
57
|
-
* @param {String} exchangeId ExchangeId
|
|
58
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
59
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
60
|
-
*/
|
|
61
|
-
activate<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
62
|
-
/**
|
|
63
|
-
* Deactivate an exchange
|
|
64
|
-
* @param {String} exchangeId ExchangeId
|
|
65
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
66
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
67
|
-
*/
|
|
68
|
-
deactivate<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
69
|
-
/**
|
|
70
|
-
* Get Exchange Rate
|
|
71
|
-
* @param {String} exchangeId Exchange ID
|
|
72
|
-
* @return {Promise<string>} Rate (converted from wei)
|
|
73
|
-
*/
|
|
74
|
-
getRate(exchangeId: string): Promise<string>;
|
|
75
|
-
/**
|
|
76
|
-
* Get Datatoken Supply in the exchange
|
|
77
|
-
* @param {String} exchangeId Exchange Id
|
|
78
|
-
* @return {Promise<string>} dt supply formatted
|
|
79
|
-
*/
|
|
80
|
-
getDatatokenSupply(exchangeId: string): Promise<string>;
|
|
81
|
-
/**
|
|
82
|
-
* Returns basetoken supply in the exchange
|
|
83
|
-
* @param {String} exchangeId Exchange Id
|
|
84
|
-
* @return {Promise<string>} dt supply formatted
|
|
85
|
-
*/
|
|
86
|
-
getBasetokenSupply(exchangeId: string): Promise<string>;
|
|
87
|
-
/**
|
|
88
|
-
* Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
|
|
89
|
-
* @param {String} exchangeId Exchange Id
|
|
90
|
-
* @return {Promise<string>} address of allowed swapper
|
|
91
|
-
*/
|
|
92
|
-
getAllowedSwapper(exchangeId: string): Promise<string>;
|
|
93
|
-
/**
|
|
94
|
-
* calcBaseInGivenDatatokensOut - Calculates how many base tokens are needed to get specified amount of datatokens
|
|
95
|
-
* @param {String} exchangeId Exchange Id
|
|
96
|
-
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
|
97
|
-
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
98
|
-
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
|
99
|
-
*/
|
|
100
|
-
calcBaseInGivenDatatokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<PriceAndFees>;
|
|
101
|
-
/**
|
|
102
|
-
* Returns amount in baseToken that user will receive for datatokenAmount sold
|
|
103
|
-
* @param {String} exchangeId Exchange Id
|
|
104
|
-
* @param {Number} datatokenAmount Amount of datatokens
|
|
105
|
-
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
106
|
-
* @return {Promise<string>} Amount of baseTokens user will receive
|
|
107
|
-
*/
|
|
108
|
-
getAmountBasetokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* Get exchange details
|
|
111
|
-
* @param {String} exchangeId Exchange Id
|
|
112
|
-
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
113
|
-
*/
|
|
114
|
-
getExchange(exchangeId: string): Promise<FixedPriceExchange>;
|
|
115
|
-
/**
|
|
116
|
-
* Get fee details for an exchange
|
|
117
|
-
* @param {String} exchangeId Exchange Id
|
|
118
|
-
* @return {Promise<FeesInfo>} Exchange details
|
|
119
|
-
*/
|
|
120
|
-
getFeesInfo(exchangeId: string): Promise<FeesInfo>;
|
|
121
|
-
/**
|
|
122
|
-
* Returns all exchanges
|
|
123
|
-
* @param {String} exchangeId Exchang eId
|
|
124
|
-
* @return {Promise<String[]>} Exchanges list
|
|
125
|
-
*/
|
|
126
|
-
getExchanges(): Promise<string[]>;
|
|
127
|
-
/**
|
|
128
|
-
* Check if an exchange is active
|
|
129
|
-
* @param {String} exchangeId ExchangeId
|
|
130
|
-
* @return {Promise<Boolean>}
|
|
131
|
-
*/
|
|
132
|
-
isActive(exchangeId: string): Promise<boolean>;
|
|
133
|
-
/**
|
|
134
|
-
* Activate minting option for fixed rate contract
|
|
135
|
-
* @param {String} exchangeId Exchang eId
|
|
136
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
137
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
138
|
-
*/
|
|
139
|
-
activateMint<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
140
|
-
/**
|
|
141
|
-
* Deactivate minting for fixed rate
|
|
142
|
-
* @param {String} exchangeId ExchangeId
|
|
143
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
144
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
145
|
-
*/
|
|
146
|
-
deactivateMint<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
147
|
-
/**
|
|
148
|
-
* Collect BaseTokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
149
|
-
* @param {String} exchangeId Exchange Id
|
|
150
|
-
* @param {String} amount amount to be collected
|
|
151
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
152
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
153
|
-
*/
|
|
154
|
-
collectBasetokens<G extends boolean = false>(exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
155
|
-
/**
|
|
156
|
-
* Collect datatokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
157
|
-
* @param {String} exchangeId Exchange Id
|
|
158
|
-
* @param {String} amount amount to be collected
|
|
159
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
160
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
161
|
-
*/
|
|
162
|
-
collectDatatokens<G extends boolean = false>(exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
163
|
-
/**
|
|
164
|
-
* Collect market fee and send it to marketFeeCollector (anyone can call it)
|
|
165
|
-
* @param {String} exchangeId Exchange Id
|
|
166
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
167
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
168
|
-
*/
|
|
169
|
-
collectMarketFee<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
170
|
-
/**
|
|
171
|
-
* Collect ocean fee and send it to OPF collector (anyone can call it)
|
|
172
|
-
* @param {String} exchangeId Exchange Id
|
|
173
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
174
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
175
|
-
*/
|
|
176
|
-
collectOceanFee<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
177
|
-
/**
|
|
178
|
-
* Get OPF Collector of fixed rate contract
|
|
179
|
-
* @return {String}
|
|
180
|
-
*/
|
|
181
|
-
getOPCCollector(): Promise<string>;
|
|
182
|
-
/**
|
|
183
|
-
* Get Router address set in fixed rate contract
|
|
184
|
-
* @return {String}
|
|
185
|
-
*/
|
|
186
|
-
getRouter(): Promise<string>;
|
|
187
|
-
/**
|
|
188
|
-
* Get Exchange Owner given an exchangeId
|
|
189
|
-
* @param {String} exchangeId Exchange Id
|
|
190
|
-
* @return {String} return exchange owner
|
|
191
|
-
*/
|
|
192
|
-
getExchangeOwner(exchangeId: string): Promise<string>;
|
|
193
|
-
/**
|
|
194
|
-
* Set new market fee, only market fee collector can update it
|
|
195
|
-
* @param {String} exchangeId Exchange Id
|
|
196
|
-
* @param {String} newMarketFee New market fee
|
|
197
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
198
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
199
|
-
*/
|
|
200
|
-
updateMarketFee<G extends boolean = false>(exchangeId: string, newMarketFee: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
201
|
-
/**
|
|
202
|
-
* Set new market fee collector, only market fee collector can update it
|
|
203
|
-
* @param {String} exchangeId Exchange Id
|
|
204
|
-
* @param {String} newMarketFeeCollector New market fee collector
|
|
205
|
-
* @param {Boolean} estimateGas if True, return gas estimate
|
|
206
|
-
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
207
|
-
*/
|
|
208
|
-
updateMarketFeeCollector<G extends boolean = false>(exchangeId: string, newMarketFeeCollector: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
209
|
-
}
|
|
1
|
+
import { PriceAndFees, FeesInfo, FixedPriceExchange, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
2
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
3
|
+
export declare class FixedRateExchange extends SmartContractWithAddress {
|
|
4
|
+
getDefaultAbi(): AbiItem[];
|
|
5
|
+
/**
|
|
6
|
+
* Creates unique exchange identifier.
|
|
7
|
+
* @param {String} baseToken baseToken contract address
|
|
8
|
+
* @param {String} datatoken Datatoken contract address
|
|
9
|
+
* @return {Promise<string>} exchangeId
|
|
10
|
+
*/
|
|
11
|
+
generateExchangeId(baseToken: string, datatoken: string): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Atomic swap
|
|
14
|
+
* @param {String} exchangeId ExchangeId
|
|
15
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
16
|
+
* @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
|
17
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
18
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
19
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
21
|
+
*/
|
|
22
|
+
buyDatatokens<G extends boolean = false>(exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
|
+
/**
|
|
24
|
+
* Sell datatokenAmount while expecting at least minBaseTokenAmount
|
|
25
|
+
* @param {String} exchangeId ExchangeId
|
|
26
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
27
|
+
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
|
28
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
29
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
30
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
31
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
32
|
+
*/
|
|
33
|
+
sellDatatokens<G extends boolean = false>(exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
34
|
+
/**
|
|
35
|
+
* Gets total number of exchanges
|
|
36
|
+
* @return {Promise<Number>} no of available exchanges
|
|
37
|
+
*/
|
|
38
|
+
getNumberOfExchanges(): Promise<number>;
|
|
39
|
+
/**
|
|
40
|
+
* Set new rate
|
|
41
|
+
* @param {String} exchangeId Exchange ID
|
|
42
|
+
* @param {String} newRate New rate
|
|
43
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
44
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
45
|
+
*/
|
|
46
|
+
setRate<G extends boolean = false>(exchangeId: string, newRate: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets a new allowedSwapper
|
|
49
|
+
* @param {String} exchangeId Exchange ID
|
|
50
|
+
* @param {String} newAllowedSwapper The address of the new allowed swapper (set address zero if we want to remove allowed swapper)
|
|
51
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
52
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
53
|
+
*/
|
|
54
|
+
setAllowedSwapper<G extends boolean = false>(exchangeId: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
55
|
+
/**
|
|
56
|
+
* Activate an exchange
|
|
57
|
+
* @param {String} exchangeId ExchangeId
|
|
58
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
59
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
60
|
+
*/
|
|
61
|
+
activate<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
62
|
+
/**
|
|
63
|
+
* Deactivate an exchange
|
|
64
|
+
* @param {String} exchangeId ExchangeId
|
|
65
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
66
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
67
|
+
*/
|
|
68
|
+
deactivate<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
69
|
+
/**
|
|
70
|
+
* Get Exchange Rate
|
|
71
|
+
* @param {String} exchangeId Exchange ID
|
|
72
|
+
* @return {Promise<string>} Rate (converted from wei)
|
|
73
|
+
*/
|
|
74
|
+
getRate(exchangeId: string): Promise<string>;
|
|
75
|
+
/**
|
|
76
|
+
* Get Datatoken Supply in the exchange
|
|
77
|
+
* @param {String} exchangeId Exchange Id
|
|
78
|
+
* @return {Promise<string>} dt supply formatted
|
|
79
|
+
*/
|
|
80
|
+
getDatatokenSupply(exchangeId: string): Promise<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Returns basetoken supply in the exchange
|
|
83
|
+
* @param {String} exchangeId Exchange Id
|
|
84
|
+
* @return {Promise<string>} dt supply formatted
|
|
85
|
+
*/
|
|
86
|
+
getBasetokenSupply(exchangeId: string): Promise<string>;
|
|
87
|
+
/**
|
|
88
|
+
* Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
|
|
89
|
+
* @param {String} exchangeId Exchange Id
|
|
90
|
+
* @return {Promise<string>} address of allowed swapper
|
|
91
|
+
*/
|
|
92
|
+
getAllowedSwapper(exchangeId: string): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* calcBaseInGivenDatatokensOut - Calculates how many base tokens are needed to get specified amount of datatokens
|
|
95
|
+
* @param {String} exchangeId Exchange Id
|
|
96
|
+
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
|
97
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
98
|
+
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
|
99
|
+
*/
|
|
100
|
+
calcBaseInGivenDatatokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<PriceAndFees>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns amount in baseToken that user will receive for datatokenAmount sold
|
|
103
|
+
* @param {String} exchangeId Exchange Id
|
|
104
|
+
* @param {Number} datatokenAmount Amount of datatokens
|
|
105
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
106
|
+
* @return {Promise<string>} Amount of baseTokens user will receive
|
|
107
|
+
*/
|
|
108
|
+
getAmountBasetokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Get exchange details
|
|
111
|
+
* @param {String} exchangeId Exchange Id
|
|
112
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
113
|
+
*/
|
|
114
|
+
getExchange(exchangeId: string): Promise<FixedPriceExchange>;
|
|
115
|
+
/**
|
|
116
|
+
* Get fee details for an exchange
|
|
117
|
+
* @param {String} exchangeId Exchange Id
|
|
118
|
+
* @return {Promise<FeesInfo>} Exchange details
|
|
119
|
+
*/
|
|
120
|
+
getFeesInfo(exchangeId: string): Promise<FeesInfo>;
|
|
121
|
+
/**
|
|
122
|
+
* Returns all exchanges
|
|
123
|
+
* @param {String} exchangeId Exchang eId
|
|
124
|
+
* @return {Promise<String[]>} Exchanges list
|
|
125
|
+
*/
|
|
126
|
+
getExchanges(): Promise<string[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if an exchange is active
|
|
129
|
+
* @param {String} exchangeId ExchangeId
|
|
130
|
+
* @return {Promise<Boolean>}
|
|
131
|
+
*/
|
|
132
|
+
isActive(exchangeId: string): Promise<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* Activate minting option for fixed rate contract
|
|
135
|
+
* @param {String} exchangeId Exchang eId
|
|
136
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
137
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
138
|
+
*/
|
|
139
|
+
activateMint<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
140
|
+
/**
|
|
141
|
+
* Deactivate minting for fixed rate
|
|
142
|
+
* @param {String} exchangeId ExchangeId
|
|
143
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
144
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
145
|
+
*/
|
|
146
|
+
deactivateMint<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
147
|
+
/**
|
|
148
|
+
* Collect BaseTokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
149
|
+
* @param {String} exchangeId Exchange Id
|
|
150
|
+
* @param {String} amount amount to be collected
|
|
151
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
152
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
153
|
+
*/
|
|
154
|
+
collectBasetokens<G extends boolean = false>(exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
155
|
+
/**
|
|
156
|
+
* Collect datatokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
157
|
+
* @param {String} exchangeId Exchange Id
|
|
158
|
+
* @param {String} amount amount to be collected
|
|
159
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
160
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
161
|
+
*/
|
|
162
|
+
collectDatatokens<G extends boolean = false>(exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
163
|
+
/**
|
|
164
|
+
* Collect market fee and send it to marketFeeCollector (anyone can call it)
|
|
165
|
+
* @param {String} exchangeId Exchange Id
|
|
166
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
167
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
168
|
+
*/
|
|
169
|
+
collectMarketFee<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
170
|
+
/**
|
|
171
|
+
* Collect ocean fee and send it to OPF collector (anyone can call it)
|
|
172
|
+
* @param {String} exchangeId Exchange Id
|
|
173
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
174
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
175
|
+
*/
|
|
176
|
+
collectOceanFee<G extends boolean = false>(exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
177
|
+
/**
|
|
178
|
+
* Get OPF Collector of fixed rate contract
|
|
179
|
+
* @return {String}
|
|
180
|
+
*/
|
|
181
|
+
getOPCCollector(): Promise<string>;
|
|
182
|
+
/**
|
|
183
|
+
* Get Router address set in fixed rate contract
|
|
184
|
+
* @return {String}
|
|
185
|
+
*/
|
|
186
|
+
getRouter(): Promise<string>;
|
|
187
|
+
/**
|
|
188
|
+
* Get Exchange Owner given an exchangeId
|
|
189
|
+
* @param {String} exchangeId Exchange Id
|
|
190
|
+
* @return {String} return exchange owner
|
|
191
|
+
*/
|
|
192
|
+
getExchangeOwner(exchangeId: string): Promise<string>;
|
|
193
|
+
/**
|
|
194
|
+
* Set new market fee, only market fee collector can update it
|
|
195
|
+
* @param {String} exchangeId Exchange Id
|
|
196
|
+
* @param {String} newMarketFee New market fee
|
|
197
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
198
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
199
|
+
*/
|
|
200
|
+
updateMarketFee<G extends boolean = false>(exchangeId: string, newMarketFee: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
201
|
+
/**
|
|
202
|
+
* Set new market fee collector, only market fee collector can update it
|
|
203
|
+
* @param {String} exchangeId Exchange Id
|
|
204
|
+
* @param {String} newMarketFeeCollector New market fee collector
|
|
205
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
206
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
207
|
+
*/
|
|
208
|
+
updateMarketFeeCollector<G extends boolean = false>(exchangeId: string, newMarketFeeCollector: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
209
|
+
}
|