@oceanprotocol/lib 1.0.0-next.9 → 1.0.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 +390 -1
- package/CodeExamples.md +918 -0
- package/README.md +12 -80
- 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 +83 -0
- package/dist/src/@types/Compute.d.ts +18 -1
- package/dist/src/@types/DDO/DDO.d.ts +43 -0
- package/dist/src/@types/DDO/Event.d.ts +20 -0
- package/dist/src/@types/DDO/Metadata.d.ts +92 -0
- package/dist/src/@types/DDO/Service.d.ts +72 -6
- package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
- package/dist/src/@types/Erc20.d.ts +21 -0
- package/dist/src/{interfaces/Erc721Interface.d.ts → @types/Erc721.d.ts} +2 -2
- package/dist/src/@types/FileMetadata.d.ts +29 -0
- package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
- package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
- package/dist/src/@types/Provider.d.ts +9 -0
- package/dist/src/@types/Router.d.ts +59 -0
- package/dist/src/@types/index.d.ts +6 -0
- package/dist/src/aquarius/Aquarius.d.ts +23 -1
- package/dist/src/factories/NFTFactory.d.ts +222 -14
- package/dist/src/index.d.ts +1 -1
- package/dist/src/models/Config.d.ts +128 -0
- package/dist/src/pools/Router.d.ts +189 -8
- package/dist/src/pools/balancer/Pool.d.ts +354 -29
- package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +309 -17
- package/dist/src/pools/index.d.ts +2 -0
- package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
- package/dist/src/provider/Provider.d.ts +125 -6
- package/dist/src/tokens/Datatoken.d.ts +347 -8
- package/dist/src/tokens/NFT.d.ts +297 -5
- package/dist/src/utils/ContractUtils.d.ts +13 -4
- package/dist/src/utils/DatatokenName.d.ts +4 -0
- package/dist/src/utils/General.d.ts +4 -0
- package/dist/src/utils/PoolHelpers.d.ts +8 -0
- package/dist/src/utils/SignatureUtils.d.ts +0 -2
- package/dist/src/utils/TokenUtils.d.ts +65 -3
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/test/TestContractHandler.d.ts +8 -36
- package/dist/test/config.d.ts +5 -0
- package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
- package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
- package/package.json +37 -32
- package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
- package/dist/src/interfaces/RouterInterface.d.ts +0 -12
- package/dist/src/interfaces/index.d.ts +0 -5
- package/dist/test/integration/config.d.ts +0 -3
- package/dist/test/unit/config.d.ts +0 -3
- package/docs/beginners_guide.md +0 -338
- package/docs/get-test-OCEAN.md +0 -24
- package/docs/overview.md +0 -394
- package/docs/quickstart_marketplace.md +0 -423
- package/docs/quickstart_simple.md +0 -272
- package/docs/services.md +0 -94
- package/docs/wallets.md +0 -98
|
@@ -14,25 +14,132 @@ export interface DispenserToken {
|
|
|
14
14
|
allowedSwapper: string;
|
|
15
15
|
}
|
|
16
16
|
export declare class Dispenser {
|
|
17
|
-
GASLIMIT_DEFAULT: number;
|
|
18
17
|
web3: Web3;
|
|
19
18
|
dispenserAddress: string;
|
|
20
19
|
config: Config;
|
|
21
20
|
dispenserAbi: AbiItem | AbiItem[];
|
|
22
21
|
dispenserContract: Contract;
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Instantiate Dispenser
|
|
24
|
+
* @param {any} web3
|
|
25
|
+
* @param {String} dispenserAddress
|
|
26
|
+
* @param {any} dispenserABI
|
|
27
|
+
*/
|
|
28
|
+
constructor(web3: Web3, network?: string | number, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
|
|
29
|
+
/**
|
|
30
|
+
* Get information about a datatoken dispenser
|
|
31
|
+
* @param {String} dtAddress
|
|
32
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
33
|
+
*/
|
|
24
34
|
status(dtAdress: string): Promise<DispenserToken>;
|
|
35
|
+
/**
|
|
36
|
+
* Estimate gas cost for create method
|
|
37
|
+
* @param {String} dtAddress Datatoken address
|
|
38
|
+
* @param {String} address Owner address
|
|
39
|
+
* @param {String} maxTokens max tokens to dispense
|
|
40
|
+
* @param {String} maxBalance max balance of requester
|
|
41
|
+
* @param {String} allowedSwapper if !=0, only this address can request DTs
|
|
42
|
+
* @return {Promise<any>}
|
|
43
|
+
*/
|
|
25
44
|
estGasCreate(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Creates a new Dispenser
|
|
47
|
+
* @param {String} dtAddress Datatoken address
|
|
48
|
+
* @param {String} address Owner address
|
|
49
|
+
* @param {String} maxTokens max tokens to dispense
|
|
50
|
+
* @param {String} maxBalance max balance of requester
|
|
51
|
+
* @param {String} allowedSwapper only account that can ask tokens. set address(0) if not required
|
|
52
|
+
* @return {Promise<TransactionReceipt>} transactionId
|
|
53
|
+
*/
|
|
26
54
|
create(dtAddress: string, address: string, maxTokens: string, maxBalance: string, allowedSwapper: string): Promise<TransactionReceipt>;
|
|
55
|
+
/**
|
|
56
|
+
* Estimate gas for activate method
|
|
57
|
+
* @param {String} dtAddress
|
|
58
|
+
* @param {Number} maxTokens max amount of tokens to dispense
|
|
59
|
+
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
60
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
61
|
+
* @return {Promise<any>}
|
|
62
|
+
*/
|
|
27
63
|
estGasActivate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<any>;
|
|
64
|
+
/**
|
|
65
|
+
* Activates a new dispener.
|
|
66
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
67
|
+
* @param {Number} maxTokens max amount of tokens to dispense
|
|
68
|
+
* @param {Number} maxBalance max balance of user. If user balance is >, then dispense will be rejected
|
|
69
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
70
|
+
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
71
|
+
*/
|
|
28
72
|
activate(dtAddress: string, maxTokens: string, maxBalance: string, address: string): Promise<TransactionReceipt>;
|
|
73
|
+
/**
|
|
74
|
+
* Estimate gas for deactivate method
|
|
75
|
+
* @param {String} dtAddress
|
|
76
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
77
|
+
* @return {Promise<any>}
|
|
78
|
+
*/
|
|
29
79
|
estGasDeactivate(dtAddress: string, address: string): Promise<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Deactivate an existing dispenser.
|
|
82
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
83
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
84
|
+
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
85
|
+
*/
|
|
30
86
|
deactivate(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
87
|
+
/**
|
|
88
|
+
* Estimate gas for setAllowedSwapper method
|
|
89
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
90
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
91
|
+
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
92
|
+
* @return {Promise<any>}
|
|
93
|
+
*/
|
|
31
94
|
estGasSetAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<any>;
|
|
95
|
+
/**
|
|
96
|
+
* Sets a new allowedSwapper.
|
|
97
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
98
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
99
|
+
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
100
|
+
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
101
|
+
*/
|
|
32
102
|
setAllowedSwapper(dtAddress: string, address: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
|
|
103
|
+
/**
|
|
104
|
+
* Estimate gas for dispense method
|
|
105
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
106
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
107
|
+
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
108
|
+
* @return {Promise<any>}
|
|
109
|
+
*/
|
|
33
110
|
estGasDispense(dtAddress: string, address: string, amount: string, destination: string): Promise<any>;
|
|
111
|
+
/**
|
|
112
|
+
* Dispense datatokens to caller.
|
|
113
|
+
* The dispenser must be active, hold enough DT (or be able to mint more)
|
|
114
|
+
* and respect maxTokens/maxBalance requirements
|
|
115
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
116
|
+
* @param {String} address User address
|
|
117
|
+
* @param {String} amount amount of datatokens required.
|
|
118
|
+
* @param {String} destination who will receive the tokens
|
|
119
|
+
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
120
|
+
*/
|
|
34
121
|
dispense(dtAddress: string, address: string, amount: string, destination: string): Promise<TransactionReceipt>;
|
|
122
|
+
/**
|
|
123
|
+
* Estimate gas for ownerWithdraw method
|
|
124
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
125
|
+
* @param {String} address User address (must be owner of the datatoken)
|
|
126
|
+
* @param {String} newAllowedSwapper refers to the new allowedSwapper
|
|
127
|
+
* @return {Promise<any>}
|
|
128
|
+
*/
|
|
35
129
|
estGasOwnerWithdraw(dtAddress: string, address: string): Promise<any>;
|
|
130
|
+
/**
|
|
131
|
+
* Withdraw all tokens from the dispenser
|
|
132
|
+
* @param {String} dtAddress refers to datatoken address.
|
|
133
|
+
* @param {String} address User address (must be owner of the dispenser)
|
|
134
|
+
* @return {Promise<TransactionReceipt>} TransactionReceipt
|
|
135
|
+
*/
|
|
36
136
|
ownerWithdraw(dtAddress: string, address: string): Promise<TransactionReceipt>;
|
|
137
|
+
/**
|
|
138
|
+
* Check if tokens can be dispensed
|
|
139
|
+
* @param {String} dtAddress
|
|
140
|
+
* @param {String} address User address that will receive datatokens
|
|
141
|
+
* @param {String} amount amount of datatokens required.
|
|
142
|
+
* @return {Promise<Boolean>}
|
|
143
|
+
*/
|
|
37
144
|
isDispensable(dtAddress: string, datatoken: Datatoken, address: string, amount?: string): Promise<Boolean>;
|
|
38
145
|
}
|
|
@@ -3,6 +3,7 @@ import { Contract } from 'web3-eth-contract';
|
|
|
3
3
|
import { AbiItem } from 'web3-utils/types';
|
|
4
4
|
import Web3 from 'web3';
|
|
5
5
|
import { Config } from '../../models/index.js';
|
|
6
|
+
import { PriceAndFees } from '../..';
|
|
6
7
|
export interface FixedPriceExchange {
|
|
7
8
|
active: boolean;
|
|
8
9
|
exchangeOwner: string;
|
|
@@ -38,59 +39,350 @@ export declare enum FixedRateCreateProgressStep {
|
|
|
38
39
|
ApprovingDatatoken = 1
|
|
39
40
|
}
|
|
40
41
|
export declare class FixedRateExchange {
|
|
41
|
-
|
|
42
|
+
/** Ocean related functions */
|
|
42
43
|
oceanAddress: string;
|
|
43
44
|
fixedRateAddress: string;
|
|
44
45
|
fixedRateExchangeAbi: AbiItem | AbiItem[];
|
|
45
|
-
fixedRateContract: Contract;
|
|
46
46
|
web3: Web3;
|
|
47
|
-
|
|
47
|
+
fixedRateContract: Contract;
|
|
48
48
|
config: Config;
|
|
49
49
|
ssAbi: AbiItem | AbiItem[];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Instantiate FixedRateExchange
|
|
52
|
+
* @param {any} web3
|
|
53
|
+
* @param {any} fixedRateExchangeAbi
|
|
54
|
+
*/
|
|
55
|
+
constructor(web3: Web3, fixedRateAddress: string, network?: string | number, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
|
|
56
|
+
amountToUnits(token: string, amount: string, tokenDecimals: number): Promise<string>;
|
|
57
|
+
unitsToAmount(token: string, amount: string, tokenDecimals: number): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Creates unique exchange identifier.
|
|
60
|
+
* @param {String} baseToken baseToken contract address
|
|
61
|
+
* @param {String} datatoken Datatoken contract address
|
|
62
|
+
* @return {Promise<string>} exchangeId
|
|
63
|
+
*/
|
|
64
|
+
generateExchangeId(baseToken: string, datatoken: string): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* Estimate gas cost for buyDT
|
|
67
|
+
* @param {String} account
|
|
68
|
+
* @param {String} dtAmount datatoken amount we want to buy
|
|
69
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
70
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
71
|
+
* @param {String} consumeMarketFee fee recieved by the consume market when a dt is bought from a fixed rate exchange, percent
|
|
72
|
+
* @param {Contract} contractInstance optional contract instance
|
|
73
|
+
* @return {Promise<number>}
|
|
74
|
+
*/
|
|
75
|
+
estBuyDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, consumeMarketAddress: string, consumeMarketFee: string, contractInstance?: Contract): Promise<number>;
|
|
76
|
+
/**
|
|
77
|
+
* Atomic swap
|
|
78
|
+
* @param {String} exchangeId ExchangeId
|
|
79
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
80
|
+
* @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
|
81
|
+
* @param {String} address User address
|
|
82
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
83
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
84
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
85
|
+
*/
|
|
86
|
+
buyDT(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string): Promise<TransactionReceipt>;
|
|
87
|
+
/**
|
|
88
|
+
* Estimate gas cost for sellDT
|
|
89
|
+
* @param {String} account
|
|
90
|
+
* @param {String} dtAmount datatoken amount we want to sell
|
|
91
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
92
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
93
|
+
* @param {String} consumeMarketFee consumeMarketFee
|
|
94
|
+
* @param {Contract} contractInstance optional contract instance
|
|
95
|
+
* @return {Promise<number>}
|
|
96
|
+
*/
|
|
97
|
+
estSellDT(account: string, datatokenAddress: string, dtAmount: string, maxBaseTokenAmount: string, consumeMarketAddress: string, consumeMarketFee: string, contractInstance?: Contract): Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Atomic swap
|
|
100
|
+
* @param {String} exchangeId ExchangeId
|
|
101
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
102
|
+
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
|
103
|
+
* @param {String} address User address
|
|
104
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
105
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
106
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
107
|
+
*/
|
|
108
|
+
sellDT(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string): Promise<TransactionReceipt>;
|
|
109
|
+
/**
|
|
110
|
+
* Gets total number of exchanges
|
|
111
|
+
* @param {String} exchangeId ExchangeId
|
|
112
|
+
* @param {Number} datatokenAmount Amount of datatokens
|
|
113
|
+
* @return {Promise<Number>} no of available exchanges
|
|
114
|
+
*/
|
|
58
115
|
getNumberOfExchanges(): Promise<number>;
|
|
116
|
+
/**
|
|
117
|
+
* Estimate gas cost for setRate
|
|
118
|
+
* @param {String} account
|
|
119
|
+
* @param {String} exchangeId ExchangeId
|
|
120
|
+
* @param {String} newRate New rate
|
|
121
|
+
* @param {Contract} contractInstance optional contract instance
|
|
122
|
+
* @return {Promise<number>}
|
|
123
|
+
*/
|
|
59
124
|
estSetRate(account: string, exchangeId: string, newRate: string, contractInstance?: Contract): Promise<number>;
|
|
125
|
+
/**
|
|
126
|
+
* Set new rate
|
|
127
|
+
* @param {String} exchangeId ExchangeId
|
|
128
|
+
* @param {String} newRate New rate
|
|
129
|
+
* @param {String} address User account
|
|
130
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
131
|
+
*/
|
|
60
132
|
setRate(address: string, exchangeId: string, newRate: string): Promise<TransactionReceipt>;
|
|
133
|
+
/**
|
|
134
|
+
* Estimate gas cost for setRate
|
|
135
|
+
* @param {String} account
|
|
136
|
+
* @param {String} exchangeId ExchangeId
|
|
137
|
+
* @param {String} newAllowedSwapper new allowed swapper address
|
|
138
|
+
* @param {Contract} contractInstance optional contract instance
|
|
139
|
+
* @return {Promise<number>}
|
|
140
|
+
*/
|
|
61
141
|
estSetAllowedSwapper(account: string, exchangeId: string, newAllowedSwapper: string, contractInstance?: Contract): Promise<number>;
|
|
142
|
+
/**
|
|
143
|
+
* Set new rate
|
|
144
|
+
* @param {String} exchangeId ExchangeId
|
|
145
|
+
* @param {String} newAllowedSwapper newAllowedSwapper (set address zero if we want to remove allowed swapper)
|
|
146
|
+
* @param {String} address User account
|
|
147
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
148
|
+
*/
|
|
62
149
|
setAllowedSwapper(address: string, exchangeId: string, newAllowedSwapper: string): Promise<TransactionReceipt>;
|
|
150
|
+
/**
|
|
151
|
+
* Estimate gas cost for activate
|
|
152
|
+
* @param {String} account
|
|
153
|
+
* @param {String} exchangeId ExchangeId
|
|
154
|
+
* @param {Contract} contractInstance optional contract instance
|
|
155
|
+
* @return {Promise<number>}
|
|
156
|
+
*/
|
|
63
157
|
estActivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
158
|
+
/**
|
|
159
|
+
* Activate an exchange
|
|
160
|
+
* @param {String} exchangeId ExchangeId
|
|
161
|
+
* @param {String} address User address
|
|
162
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
163
|
+
*/
|
|
64
164
|
activate(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
165
|
+
/**
|
|
166
|
+
* Estimate gas cost for deactivate
|
|
167
|
+
* @param {String} account
|
|
168
|
+
* @param {String} exchangeId ExchangeId
|
|
169
|
+
* @param {Contract} contractInstance optional contract instance
|
|
170
|
+
* @return {Promise<number>}
|
|
171
|
+
*/
|
|
65
172
|
estDeactivate(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
173
|
+
/**
|
|
174
|
+
* Deactivate an exchange
|
|
175
|
+
* @param {String} exchangeId ExchangeId
|
|
176
|
+
* @param {String} address User address
|
|
177
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
178
|
+
*/
|
|
66
179
|
deactivate(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
180
|
+
/**
|
|
181
|
+
* Get Rate
|
|
182
|
+
* @param {String} exchangeId ExchangeId
|
|
183
|
+
* @return {Promise<string>} Rate (converted from wei)
|
|
184
|
+
*/
|
|
67
185
|
getRate(exchangeId: string): Promise<string>;
|
|
186
|
+
/**
|
|
187
|
+
* Get Datatoken Supply in the exchange
|
|
188
|
+
* @param {String} exchangeId ExchangeId
|
|
189
|
+
* @return {Promise<string>} dt supply formatted
|
|
190
|
+
*/
|
|
68
191
|
getDTSupply(exchangeId: string): Promise<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Get BaseToken Supply in the exchange
|
|
194
|
+
* @param {String} exchangeId ExchangeId
|
|
195
|
+
* @return {Promise<string>} dt supply formatted
|
|
196
|
+
*/
|
|
69
197
|
getBTSupply(exchangeId: string): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
|
|
200
|
+
* @param {String} exchangeId ExchangeId
|
|
201
|
+
* @return {Promise<string>} address of allowedSwapper
|
|
202
|
+
*/
|
|
70
203
|
getAllowedSwapper(exchangeId: string): Promise<string>;
|
|
71
|
-
|
|
72
|
-
|
|
204
|
+
/**
|
|
205
|
+
* calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
|
|
206
|
+
* @param {String} exchangeId ExchangeId
|
|
207
|
+
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
|
208
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
209
|
+
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
|
210
|
+
*/
|
|
211
|
+
calcBaseInGivenOutDT(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<PriceAndFees>;
|
|
212
|
+
/**
|
|
213
|
+
* getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
|
|
214
|
+
* @param {String} exchangeId ExchangeId
|
|
215
|
+
* @param {Number} datatokenAmount Amount of datatokens
|
|
216
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
217
|
+
* @return {Promise<string>} Amount of baseTokens user will receive
|
|
218
|
+
*/
|
|
219
|
+
getAmountBTOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<string>;
|
|
220
|
+
/**
|
|
221
|
+
* Get exchange details
|
|
222
|
+
* @param {String} exchangeId ExchangeId
|
|
223
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
224
|
+
*/
|
|
73
225
|
getExchange(exchangeId: string): Promise<FixedPriceExchange>;
|
|
226
|
+
/**
|
|
227
|
+
* Get fee details for an exchange
|
|
228
|
+
* @param {String} exchangeId ExchangeId
|
|
229
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
230
|
+
*/
|
|
74
231
|
getFeesInfo(exchangeId: string): Promise<FeesInfo>;
|
|
232
|
+
/**
|
|
233
|
+
* Get all exchanges
|
|
234
|
+
* @param {String} exchangeId ExchangeId
|
|
235
|
+
* @return {Promise<String[]>} Exchanges list
|
|
236
|
+
*/
|
|
75
237
|
getExchanges(): Promise<string[]>;
|
|
238
|
+
/**
|
|
239
|
+
* Check if an exchange is active
|
|
240
|
+
* @param {String} exchangeId ExchangeId
|
|
241
|
+
* @return {Promise<Boolean>} Result
|
|
242
|
+
*/
|
|
76
243
|
isActive(exchangeId: string): Promise<boolean>;
|
|
244
|
+
/**
|
|
245
|
+
* Estimate gas cost for activate
|
|
246
|
+
* @param {String} account
|
|
247
|
+
* @param {String} exchangeId ExchangeId
|
|
248
|
+
* @param {Contract} contractInstance optional contract instance
|
|
249
|
+
* @return {Promise<number>}
|
|
250
|
+
*/
|
|
77
251
|
estActivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
252
|
+
/**
|
|
253
|
+
* Activate minting option for fixed rate contract
|
|
254
|
+
* @param {String} exchangeId ExchangeId
|
|
255
|
+
* @param {String} address User address
|
|
256
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
257
|
+
*/
|
|
78
258
|
activateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
259
|
+
/**
|
|
260
|
+
* Estimate gas cost for deactivate
|
|
261
|
+
* @param {String} account
|
|
262
|
+
* @param {String} exchangeId ExchangeId
|
|
263
|
+
* @param {Contract} contractInstance optional contract instance
|
|
264
|
+
* @return {Promise<number>}
|
|
265
|
+
*/
|
|
79
266
|
estDeactivateMint(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
267
|
+
/**
|
|
268
|
+
* Deactivate minting for fixed rate
|
|
269
|
+
* @param {String} exchangeId ExchangeId
|
|
270
|
+
* @param {String} address User address
|
|
271
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
272
|
+
*/
|
|
80
273
|
deactivateMint(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
274
|
+
/**
|
|
275
|
+
* Estimate gas cost for collectBT
|
|
276
|
+
* @param {String} account
|
|
277
|
+
* @param {String} exchangeId ExchangeId
|
|
278
|
+
* @param {String} amount amount to be collected
|
|
279
|
+
* @param {Contract} contractInstance optional contract instance
|
|
280
|
+
* @return {Promise<number>}
|
|
281
|
+
*/
|
|
282
|
+
estCollectBT(account: string, exchangeId: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
283
|
+
/**
|
|
284
|
+
* Collect BaseTokens in the contract (anyone can call this, funds are sent to erc20.paymentCollector)
|
|
285
|
+
* @param {String} address User address
|
|
286
|
+
* @param {String} exchangeId ExchangeId
|
|
287
|
+
* @param {String} amount amount to be collected
|
|
288
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
289
|
+
*/
|
|
290
|
+
collectBT(address: string, exchangeId: string, amount: string): Promise<TransactionReceipt>;
|
|
291
|
+
/**
|
|
292
|
+
* Estimate gas cost for collecDT
|
|
293
|
+
* @param {String} account
|
|
294
|
+
* @param {String} exchangeId ExchangeId
|
|
295
|
+
* @param {String} amount amount to be collected
|
|
296
|
+
* @param {Contract} contractInstance optional contract instance
|
|
297
|
+
* @return {Promise<number>}
|
|
298
|
+
*/
|
|
299
|
+
estCollectDT(account: string, exchangeId: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
300
|
+
/**
|
|
301
|
+
* Collect datatokens in the contract (anyone can call this, funds are sent to erc20.paymentCollector)
|
|
302
|
+
* @param {String} address User address
|
|
303
|
+
* @param {String} exchangeId ExchangeId
|
|
304
|
+
* @param {String} amount amount to be collected
|
|
305
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
306
|
+
*/
|
|
307
|
+
collectDT(address: string, exchangeId: string, amount: string): Promise<TransactionReceipt>;
|
|
308
|
+
/**
|
|
309
|
+
* Estimate gas cost for collecMarketFee
|
|
310
|
+
* @param {String} account
|
|
311
|
+
* @param {String} exchangeId ExchangeId
|
|
312
|
+
* @param {Contract} contractInstance optional contract instance
|
|
313
|
+
* @return {Promise<number>}
|
|
314
|
+
*/
|
|
85
315
|
estCollectMarketFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
316
|
+
/**
|
|
317
|
+
* Collect market fee and send it to marketFeeCollector (anyone can call it)
|
|
318
|
+
* @param {String} exchangeId ExchangeId
|
|
319
|
+
* @param {String} address User address
|
|
320
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
321
|
+
*/
|
|
86
322
|
collectMarketFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
323
|
+
/**
|
|
324
|
+
* Estimate gas cost for collectOceanFee
|
|
325
|
+
* @param {String} account
|
|
326
|
+
* @param {String} exchangeId ExchangeId
|
|
327
|
+
* @param {Contract} contractInstance optional contract instance
|
|
328
|
+
* @return {Promise<number>}
|
|
329
|
+
*/
|
|
87
330
|
estCollectOceanFee(account: string, exchangeId: string, contractInstance?: Contract): Promise<number>;
|
|
331
|
+
/**
|
|
332
|
+
* Collect ocean fee and send it to OPF collector (anyone can call it)
|
|
333
|
+
* @param {String} exchangeId ExchangeId
|
|
334
|
+
* @param {String} address User address
|
|
335
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
336
|
+
*/
|
|
88
337
|
collectOceanFee(address: string, exchangeId: string): Promise<TransactionReceipt>;
|
|
338
|
+
/**
|
|
339
|
+
* Get OPF Collector of fixed rate contract
|
|
340
|
+
* @return {String}
|
|
341
|
+
*/
|
|
89
342
|
getOPCCollector(): Promise<string>;
|
|
343
|
+
/**
|
|
344
|
+
* Get Router address set in fixed rate contract
|
|
345
|
+
* @return {String}
|
|
346
|
+
*/
|
|
90
347
|
getRouter(): Promise<string>;
|
|
348
|
+
/**
|
|
349
|
+
* Get Exchange Owner given an exchangeId
|
|
350
|
+
* @param {String} exchangeId ExchangeId
|
|
351
|
+
* @return {String} return exchange owner
|
|
352
|
+
*/
|
|
91
353
|
getExchangeOwner(exchangeId: string): Promise<string>;
|
|
354
|
+
/**
|
|
355
|
+
* Estimate gas cost for updateMarketFee
|
|
356
|
+
* @param {String} account
|
|
357
|
+
* @param {String} exchangeId ExchangeId
|
|
358
|
+
* @param {String} newMarketFee New market fee
|
|
359
|
+
* @param {Contract} contractInstance optional contract instance
|
|
360
|
+
* @return {Promise<number>}
|
|
361
|
+
*/
|
|
92
362
|
estUpdateMarketFee(account: string, exchangeId: string, newMarketFee: string, contractInstance?: Contract): Promise<number>;
|
|
363
|
+
/**
|
|
364
|
+
* Set new market fee, only market fee collector can update it
|
|
365
|
+
* @param {String} address user address
|
|
366
|
+
* @param {String} exchangeId ExchangeId
|
|
367
|
+
* @param {String} newMarketFee New market fee
|
|
368
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
369
|
+
*/
|
|
93
370
|
updateMarketFee(address: string, exchangeId: string, newMarketFee: string): Promise<TransactionReceipt>;
|
|
371
|
+
/**
|
|
372
|
+
* Estimate gas cost for updateMarketFeeCollector
|
|
373
|
+
* @param {String} account
|
|
374
|
+
* @param {String} exchangeId ExchangeId
|
|
375
|
+
* @param {String} newMarketFee New market fee collector
|
|
376
|
+
* @param {Contract} contractInstance optional contract instance
|
|
377
|
+
* @return {Promise<number>}
|
|
378
|
+
*/
|
|
94
379
|
estUpdateMarketFeeCollector(account: string, exchangeId: string, newMarketFeeCollector: string, contractInstance?: Contract): Promise<number>;
|
|
380
|
+
/**
|
|
381
|
+
* Set new market fee collector, only market fee collector can update it
|
|
382
|
+
* @param {String} address user address
|
|
383
|
+
* @param {String} exchangeId ExchangeId
|
|
384
|
+
* @param {String} newMarketFeeCollector New market fee collector
|
|
385
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
386
|
+
*/
|
|
95
387
|
updateMarketFeeCollector(address: string, exchangeId: string, newMarketFeeCollector: string): Promise<TransactionReceipt>;
|
|
96
388
|
}
|
|
@@ -6,25 +6,128 @@ import { Config } from '../../models';
|
|
|
6
6
|
export declare class SideStaking {
|
|
7
7
|
ssAbi: AbiItem | AbiItem[];
|
|
8
8
|
web3: Web3;
|
|
9
|
-
GASLIMIT_DEFAULT: number;
|
|
10
9
|
config: Config;
|
|
11
|
-
constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[], config?: Config);
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
constructor(web3: Web3, network?: string | number, ssAbi?: AbiItem | AbiItem[], config?: Config);
|
|
11
|
+
unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Get (total vesting amount + token released from the contract when adding liquidity)
|
|
14
|
+
* @param {String} ssAddress side staking contract address
|
|
15
|
+
* @param {String} datatokenAddress datatoken address
|
|
16
|
+
* @return {String}
|
|
17
|
+
*/
|
|
14
18
|
getDatatokenCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Get actual dts in circulation (vested token withdrawn from the contract +
|
|
21
|
+
token released from the contract when adding liquidity)
|
|
22
|
+
* @param {String} ssAddress side staking contract address
|
|
23
|
+
* @param {String} datatokenAddress datatoken address
|
|
24
|
+
* @return {String}
|
|
25
|
+
*/
|
|
15
26
|
getDatatokenCurrentCirculatingSupply(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Get Publisher address
|
|
29
|
+
* @param {String} ssAddress side staking contract address
|
|
30
|
+
* @param {String} datatokenAddress datatoken address
|
|
31
|
+
* @return {String}
|
|
32
|
+
*/
|
|
16
33
|
getPublisherAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Get
|
|
36
|
+
* @param {String} ssAddress side staking contract address
|
|
37
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
38
|
+
* @return {String}
|
|
39
|
+
*/
|
|
17
40
|
getBaseToken(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Get Pool Address
|
|
43
|
+
* @param {String} ssAddress side staking contract address
|
|
44
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
45
|
+
* @return {String}
|
|
46
|
+
*/
|
|
18
47
|
getPoolAddress(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Get baseToken balance in the contract
|
|
50
|
+
* @param {String} ssAddress side staking contract address
|
|
51
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
52
|
+
* @return {String}
|
|
53
|
+
*/
|
|
19
54
|
getBaseTokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
20
|
-
|
|
55
|
+
/**
|
|
56
|
+
* Get dt balance in the staking contract available for being added as liquidity
|
|
57
|
+
* @param {String} ssAddress side staking contract address
|
|
58
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
59
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
60
|
+
* @return {String}
|
|
61
|
+
*/
|
|
62
|
+
getDatatokenBalance(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Get block when vesting ends
|
|
65
|
+
* @param {String} ssAddress side staking contract address
|
|
66
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
67
|
+
* @return {String} end block for vesting amount
|
|
68
|
+
*/
|
|
21
69
|
getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
22
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Get total amount vesting
|
|
72
|
+
* @param {String} ssAddress side staking contract address
|
|
73
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
74
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
75
|
+
* @return {String}
|
|
76
|
+
*/
|
|
77
|
+
getvestingAmount(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Get last block publisher got some vested tokens
|
|
80
|
+
* @param {String} ssAddress side staking contract address
|
|
81
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
82
|
+
* @return {String}
|
|
83
|
+
*/
|
|
23
84
|
getvestingLastBlock(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
24
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Get how much has been taken from the vesting amount
|
|
87
|
+
* @param {String} ssAddress side staking contract address
|
|
88
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
89
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
90
|
+
* @return {String}
|
|
91
|
+
*/
|
|
92
|
+
getvestingAmountSoFar(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Estimate gas cost for getVesting
|
|
95
|
+
* @param {String} account
|
|
96
|
+
* @param {String} ssAddress side staking contract address
|
|
97
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
98
|
+
* @param {Contract} contractInstance optional contract instance
|
|
99
|
+
* @return {Promise<number>}
|
|
100
|
+
*/
|
|
25
101
|
estGetVesting(account: string, ssAddress: string, datatokenAddress: string, contractInstance?: Contract): Promise<number>;
|
|
102
|
+
/** Send vested tokens available to the publisher address, can be called by anyone
|
|
103
|
+
*
|
|
104
|
+
* @param {String} account
|
|
105
|
+
* @param {String} ssAddress side staking contract address
|
|
106
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
107
|
+
* @return {TransactionReceipt}
|
|
108
|
+
*/
|
|
26
109
|
getVesting(account: string, ssAddress: string, datatokenAddress: string): Promise<TransactionReceipt>;
|
|
110
|
+
/**
|
|
111
|
+
* Estimate gas cost for getVesting
|
|
112
|
+
* @param {String} account
|
|
113
|
+
* @param {String} ssAddress side staking contract address
|
|
114
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
115
|
+
* @param {Contract} contractInstance optional contract instance
|
|
116
|
+
* @return {Promise<number>}
|
|
117
|
+
*/
|
|
27
118
|
estSetPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number, contractInstance?: Contract): Promise<number>;
|
|
119
|
+
/** Send vested tokens available to the publisher address, can be called by anyone
|
|
120
|
+
*
|
|
121
|
+
* @param {String} account
|
|
122
|
+
* @param {String} ssAddress side staking contract address
|
|
123
|
+
* @param {String} datatokenAddress datatokenAddress
|
|
124
|
+
* @return {TransactionReceipt}
|
|
125
|
+
*/
|
|
28
126
|
setPoolSwapFee(account: string, ssAddress: string, datatokenAddress: string, poolAddress: string, swapFee: number): Promise<TransactionReceipt>;
|
|
127
|
+
/**
|
|
128
|
+
* Get Router address set in side staking contract
|
|
129
|
+
* @param {String} ssAddress side staking contract address
|
|
130
|
+
* @return {String}
|
|
131
|
+
*/
|
|
29
132
|
getRouter(ssAddress: string): Promise<string>;
|
|
30
133
|
}
|