@oceanprotocol/lib 1.1.7 → 2.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 +47 -16
- package/CodeExamples.md +28 -315
- package/README.md +4 -7
- 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 +4 -4
- package/dist/src/@types/Compute.d.ts +1 -1
- package/dist/src/@types/DDO/DDO.d.ts +2 -5
- package/dist/src/@types/{Erc20.d.ts → Datatoken.d.ts} +18 -1
- package/dist/src/@types/Dispenser.d.ts +9 -0
- package/dist/src/@types/FixedPrice.d.ts +24 -0
- package/dist/src/@types/{Erc721.d.ts → NFT.d.ts} +6 -0
- package/dist/src/@types/NFTFactory.d.ts +20 -0
- package/dist/src/@types/Provider.d.ts +8 -0
- package/dist/src/@types/ReturnTypes.d.ts +2 -0
- package/dist/src/@types/Router.d.ts +1 -1
- package/dist/src/@types/index.d.ts +11 -8
- package/dist/src/{models → config}/Config.d.ts +2 -23
- package/dist/src/{utils → config}/ConfigHelper.d.ts +1 -1
- package/dist/src/config/index.d.ts +2 -0
- package/dist/src/contracts/Datatoken.d.ts +232 -0
- package/dist/src/contracts/Dispenser.d.ts +73 -0
- package/dist/src/contracts/FixedRateExchange.d.ts +212 -0
- package/dist/src/contracts/NFT.d.ts +197 -0
- package/dist/src/contracts/NFTFactory.d.ts +144 -0
- package/dist/src/contracts/Router.d.ts +92 -0
- package/dist/src/contracts/SmartContract.d.ts +22 -0
- package/dist/src/contracts/SmartContractWithAddress.d.ts +18 -0
- package/dist/src/contracts/index.d.ts +11 -0
- package/dist/src/contracts/ve/VeAllocate.d.ts +41 -0
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +30 -0
- package/dist/src/contracts/ve/VeOcean.d.ts +69 -0
- package/dist/src/index.d.ts +4 -7
- package/dist/src/{aquarius → services}/Aquarius.d.ts +4 -14
- package/dist/src/{provider → services}/Provider.d.ts +5 -13
- package/dist/src/services/index.d.ts +2 -0
- package/dist/src/utils/Constants.d.ts +2 -0
- package/dist/src/utils/ContractUtils.d.ts +14 -8
- package/dist/src/utils/DdoHelpers.d.ts +1 -1
- package/dist/src/utils/FetchHelper.d.ts +1 -4
- package/dist/src/utils/Logger.d.ts +0 -1
- package/dist/src/utils/TokenUtils.d.ts +17 -39
- package/dist/src/utils/index.d.ts +6 -7
- package/dist/test/TestContractHandler.d.ts +4 -4
- package/dist/test/config.d.ts +1 -1
- package/dist/test/unit/{tokens/Datatoken.test.d.ts → Datatoken.test.d.ts} +0 -0
- package/dist/test/unit/{pools/dispenser/Dispenser.test.d.ts → Dispenser.test.d.ts} +0 -0
- package/dist/test/unit/{pools/fixedRate/FixedRateExchange.test.d.ts → FixedRateExchange.test.d.ts} +0 -0
- package/dist/test/unit/{tokens/Nft.test.d.ts → Nft.test.d.ts} +0 -0
- package/dist/test/unit/{factories/NftFactory.test.d.ts → NftFactory.test.d.ts} +0 -0
- package/dist/test/unit/{pools/Router.test.d.ts → Router.test.d.ts} +0 -0
- package/dist/test/unit/{pools/balancer/Pool.test.d.ts → veOcean.test.d.ts} +0 -0
- package/package.json +6 -19
- package/dist/src/@types/Pool.d.ts +0 -45
- package/dist/src/aquarius/index.d.ts +0 -1
- package/dist/src/factories/NFTFactory.d.ts +0 -275
- package/dist/src/factories/index.d.ts +0 -1
- package/dist/src/models/index.d.ts +0 -1
- package/dist/src/pools/Router.d.ts +0 -228
- package/dist/src/pools/balancer/Pool.d.ts +0 -395
- package/dist/src/pools/balancer/index.d.ts +0 -1
- package/dist/src/pools/dispenser/Dispenser.d.ts +0 -145
- package/dist/src/pools/dispenser/index.d.ts +0 -1
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +0 -388
- package/dist/src/pools/fixedRate/index.d.ts +0 -1
- package/dist/src/pools/index.d.ts +0 -5
- package/dist/src/pools/ssContracts/SideStaking.d.ts +0 -133
- package/dist/src/pools/ssContracts/index.d.ts +0 -1
- package/dist/src/provider/index.d.ts +0 -1
- package/dist/src/tokens/Datatoken.d.ts +0 -413
- package/dist/src/tokens/NFT.d.ts +0 -364
- package/dist/src/tokens/index.d.ts +0 -2
- package/dist/src/utils/ConversionTypeHelper.d.ts +0 -3
- package/dist/src/utils/PoolHelpers.d.ts +0 -8
- package/dist/test/unit/pools/ssContracts/SideStaking.test.d.ts +0 -1
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils/types';
|
|
2
|
+
import { PriceAndFees, FeesInfo, FixedPriceExchange, ReceiptOrEstimate } from '../@types';
|
|
3
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
|
+
export declare class FixedRateExchange extends SmartContractWithAddress {
|
|
5
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
6
|
+
/**
|
|
7
|
+
* Creates unique exchange identifier.
|
|
8
|
+
* @param {String} baseToken baseToken contract address
|
|
9
|
+
* @param {String} datatoken Datatoken contract address
|
|
10
|
+
* @return {Promise<string>} exchangeId
|
|
11
|
+
*/
|
|
12
|
+
generateExchangeId(baseToken: string, datatoken: string): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Atomic swap
|
|
15
|
+
* @param {String} exchangeId ExchangeId
|
|
16
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
17
|
+
* @param {String} maxBaseTokenAmount max amount of baseToken we want to pay for datatokenAmount
|
|
18
|
+
* @param {String} address User address
|
|
19
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
20
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
21
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
22
|
+
*/
|
|
23
|
+
buyDatatokens<G extends boolean = false>(address: string, exchangeId: string, datatokenAmount: string, maxBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
24
|
+
/**
|
|
25
|
+
* Sell datatokenAmount while expecting at least minBaseTokenAmount
|
|
26
|
+
* @param {String} exchangeId ExchangeId
|
|
27
|
+
* @param {String} datatokenAmount Amount of datatokens
|
|
28
|
+
* @param {String} minBaseTokenAmount min amount of baseToken we want to receive back
|
|
29
|
+
* @param {String} address User address
|
|
30
|
+
* @param {String} consumeMarketAddress consumeMarketAddress
|
|
31
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
32
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
33
|
+
*/
|
|
34
|
+
sellDatatokens<G extends boolean = false>(address: string, exchangeId: string, datatokenAmount: string, minBaseTokenAmount: string, consumeMarketAddress?: string, consumeMarketFee?: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets total number of exchanges
|
|
37
|
+
* @param {String} exchangeId ExchangeId
|
|
38
|
+
* @param {Number} datatokenAmount Amount of datatokens
|
|
39
|
+
* @return {Promise<Number>} no of available exchanges
|
|
40
|
+
*/
|
|
41
|
+
getNumberOfExchanges(): Promise<number>;
|
|
42
|
+
/**
|
|
43
|
+
* Set new rate
|
|
44
|
+
* @param {String} exchangeId ExchangeId
|
|
45
|
+
* @param {String} newRate New rate
|
|
46
|
+
* @param {String} address User account
|
|
47
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
48
|
+
*/
|
|
49
|
+
setRate<G extends boolean = false>(address: string, exchangeId: string, newRate: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
50
|
+
/**
|
|
51
|
+
* Sets a new allowedSwapper
|
|
52
|
+
* @param {String} exchangeId ExchangeId
|
|
53
|
+
* @param {String} newAllowedSwapper newAllowedSwapper (set address zero if we want to remove allowed swapper)
|
|
54
|
+
* @param {String} address User account
|
|
55
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
56
|
+
*/
|
|
57
|
+
setAllowedSwapper<G extends boolean = false>(address: string, exchangeId: string, newAllowedSwapper: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
58
|
+
/**
|
|
59
|
+
* Activate an exchange
|
|
60
|
+
* @param {String} exchangeId ExchangeId
|
|
61
|
+
* @param {String} address User address
|
|
62
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
63
|
+
*/
|
|
64
|
+
activate<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
65
|
+
/**
|
|
66
|
+
* Deactivate an exchange
|
|
67
|
+
* @param {String} exchangeId ExchangeId
|
|
68
|
+
* @param {String} address User address
|
|
69
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
70
|
+
*/
|
|
71
|
+
deactivate<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
72
|
+
/**
|
|
73
|
+
* Get Rate
|
|
74
|
+
* @param {String} exchangeId ExchangeId
|
|
75
|
+
* @return {Promise<string>} Rate (converted from wei)
|
|
76
|
+
*/
|
|
77
|
+
getRate(exchangeId: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Get Datatoken Supply in the exchange
|
|
80
|
+
* @param {String} exchangeId ExchangeId
|
|
81
|
+
* @return {Promise<string>} dt supply formatted
|
|
82
|
+
*/
|
|
83
|
+
getDatatokenSupply(exchangeId: string): Promise<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Get BaseToken Supply in the exchange
|
|
86
|
+
* @param {String} exchangeId ExchangeId
|
|
87
|
+
* @return {Promise<string>} dt supply formatted
|
|
88
|
+
*/
|
|
89
|
+
getBasetokenSupply(exchangeId: string): Promise<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Get Allower Swapper (if set this is the only account which can use this exchange, else is set at address(0))
|
|
92
|
+
* @param {String} exchangeId ExchangeId
|
|
93
|
+
* @return {Promise<string>} address of allowedSwapper
|
|
94
|
+
*/
|
|
95
|
+
getAllowedSwapper(exchangeId: string): Promise<string>;
|
|
96
|
+
/**
|
|
97
|
+
* calcBaseInGivenDatatokensOut - Calculates how many base tokens are needed to get specified amount of datatokens
|
|
98
|
+
* @param {String} exchangeId ExchangeId
|
|
99
|
+
* @param {string} datatokenAmount Amount of datatokens user wants to buy
|
|
100
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
101
|
+
* @return {Promise<PriceAndFees>} how many base tokens are needed and fees
|
|
102
|
+
*/
|
|
103
|
+
calcBaseInGivenDatatokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<PriceAndFees>;
|
|
104
|
+
/**
|
|
105
|
+
* getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
|
|
106
|
+
* @param {String} exchangeId ExchangeId
|
|
107
|
+
* @param {Number} datatokenAmount Amount of datatokens
|
|
108
|
+
* @param {String} consumeMarketFee consumeMarketFee in fraction
|
|
109
|
+
* @return {Promise<string>} Amount of baseTokens user will receive
|
|
110
|
+
*/
|
|
111
|
+
getAmountBasetokensOut(exchangeId: string, datatokenAmount: string, consumeMarketFee?: string): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Get exchange details
|
|
114
|
+
* @param {String} exchangeId ExchangeId
|
|
115
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
116
|
+
*/
|
|
117
|
+
getExchange(exchangeId: string): Promise<FixedPriceExchange>;
|
|
118
|
+
/**
|
|
119
|
+
* Get fee details for an exchange
|
|
120
|
+
* @param {String} exchangeId ExchangeId
|
|
121
|
+
* @return {Promise<FixedPricedExchange>} Exchange details
|
|
122
|
+
*/
|
|
123
|
+
getFeesInfo(exchangeId: string): Promise<FeesInfo>;
|
|
124
|
+
/**
|
|
125
|
+
* Get all exchanges
|
|
126
|
+
* @param {String} exchangeId ExchangeId
|
|
127
|
+
* @return {Promise<String[]>} Exchanges list
|
|
128
|
+
*/
|
|
129
|
+
getExchanges(): Promise<string[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Check if an exchange is active
|
|
132
|
+
* @param {String} exchangeId ExchangeId
|
|
133
|
+
* @return {Promise<Boolean>} Result
|
|
134
|
+
*/
|
|
135
|
+
isActive(exchangeId: string): Promise<boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Activate minting option for fixed rate contract
|
|
138
|
+
* @param {String} exchangeId ExchangeId
|
|
139
|
+
* @param {String} address User address
|
|
140
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
141
|
+
*/
|
|
142
|
+
activateMint<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
143
|
+
/**
|
|
144
|
+
* Deactivate minting for fixed rate
|
|
145
|
+
* @param {String} exchangeId ExchangeId
|
|
146
|
+
* @param {String} address User address
|
|
147
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
148
|
+
*/
|
|
149
|
+
deactivateMint<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
150
|
+
/**
|
|
151
|
+
* Collect BaseTokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
152
|
+
* @param {String} address User address
|
|
153
|
+
* @param {String} exchangeId ExchangeId
|
|
154
|
+
* @param {String} amount amount to be collected
|
|
155
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
156
|
+
*/
|
|
157
|
+
collectBasetokens<G extends boolean = false>(address: string, exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
158
|
+
/**
|
|
159
|
+
* Collect datatokens in the contract (anyone can call this, funds are sent to Datatoken.paymentCollector)
|
|
160
|
+
* @param {String} address User address
|
|
161
|
+
* @param {String} exchangeId ExchangeId
|
|
162
|
+
* @param {String} amount amount to be collected
|
|
163
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
164
|
+
*/
|
|
165
|
+
collectDatatokens<G extends boolean = false>(address: string, exchangeId: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
166
|
+
/**
|
|
167
|
+
* Collect market fee and send it to marketFeeCollector (anyone can call it)
|
|
168
|
+
* @param {String} exchangeId ExchangeId
|
|
169
|
+
* @param {String} address User address
|
|
170
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
171
|
+
*/
|
|
172
|
+
collectMarketFee<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
173
|
+
/**
|
|
174
|
+
* Collect ocean fee and send it to OPF collector (anyone can call it)
|
|
175
|
+
* @param {String} exchangeId ExchangeId
|
|
176
|
+
* @param {String} address User address
|
|
177
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
178
|
+
*/
|
|
179
|
+
collectOceanFee<G extends boolean = false>(address: string, exchangeId: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
180
|
+
/**
|
|
181
|
+
* Get OPF Collector of fixed rate contract
|
|
182
|
+
* @return {String}
|
|
183
|
+
*/
|
|
184
|
+
getOPCCollector(): Promise<string>;
|
|
185
|
+
/**
|
|
186
|
+
* Get Router address set in fixed rate contract
|
|
187
|
+
* @return {String}
|
|
188
|
+
*/
|
|
189
|
+
getRouter(): Promise<string>;
|
|
190
|
+
/**
|
|
191
|
+
* Get Exchange Owner given an exchangeId
|
|
192
|
+
* @param {String} exchangeId ExchangeId
|
|
193
|
+
* @return {String} return exchange owner
|
|
194
|
+
*/
|
|
195
|
+
getExchangeOwner(exchangeId: string): Promise<string>;
|
|
196
|
+
/**
|
|
197
|
+
* Set new market fee, only market fee collector can update it
|
|
198
|
+
* @param {String} address user address
|
|
199
|
+
* @param {String} exchangeId ExchangeId
|
|
200
|
+
* @param {String} newMarketFee New market fee
|
|
201
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
202
|
+
*/
|
|
203
|
+
updateMarketFee<G extends boolean = false>(address: string, exchangeId: string, newMarketFee: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
204
|
+
/**
|
|
205
|
+
* Set new market fee collector, only market fee collector can update it
|
|
206
|
+
* @param {String} address user address
|
|
207
|
+
* @param {String} exchangeId ExchangeId
|
|
208
|
+
* @param {String} newMarketFeeCollector New market fee collector
|
|
209
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
210
|
+
*/
|
|
211
|
+
updateMarketFeeCollector<G extends boolean = false>(address: string, exchangeId: string, newMarketFeeCollector: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
212
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { TransactionReceipt } from 'web3-eth';
|
|
3
|
+
import { MetadataProof, MetadataAndTokenURI, NftRoles, ReceiptOrEstimate } from '../@types';
|
|
4
|
+
import { SmartContract } from './SmartContract';
|
|
5
|
+
export declare class Nft extends SmartContract {
|
|
6
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
7
|
+
/**
|
|
8
|
+
* Create new ERC20 Datatoken - only user with DatatokenDeployer permission can succeed
|
|
9
|
+
* @param {String} nftAddress NFT address
|
|
10
|
+
* @param {String} address User address
|
|
11
|
+
* @param {String} minter User set as initial minter for the Datatoken
|
|
12
|
+
* @param {String} paymentCollector initial paymentCollector for this DT
|
|
13
|
+
* @param {String} mpFeeAddress Consume marketplace fee address
|
|
14
|
+
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
|
15
|
+
* @param {String} feeAmount amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI
|
|
16
|
+
* @param {String} cap Maximum cap (Number) - will be converted to wei
|
|
17
|
+
* @param {String} name Token name
|
|
18
|
+
* @param {String} symbol Token symbol
|
|
19
|
+
* @param {Number} templateIndex NFT template index
|
|
20
|
+
* @return {Promise<string>} ERC20 Datatoken address
|
|
21
|
+
*/
|
|
22
|
+
createDatatoken<G extends boolean = false>(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, estimateGas?: G): Promise<G extends false ? string : number>;
|
|
23
|
+
/**
|
|
24
|
+
* Add Manager for NFT Contract (only NFT Owner can succeed)
|
|
25
|
+
* @param {String} nftAddress NFT contract address
|
|
26
|
+
* @param {String} address NFT Owner adress
|
|
27
|
+
* @param {String} manager User adress which is going to be assing manager
|
|
28
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
29
|
+
*/
|
|
30
|
+
addManager<G extends boolean = false>(nftAddress: string, address: string, manager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
31
|
+
/**
|
|
32
|
+
* Removes a specific manager for NFT Contract (only NFT Owner can succeed)
|
|
33
|
+
* @param {String} nftAddress NFT contract address
|
|
34
|
+
* @param {String} address NFT Owner adress
|
|
35
|
+
* @param {String} manager User adress which is going to be removed as manager
|
|
36
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
37
|
+
*/
|
|
38
|
+
removeManager<G extends boolean = false>(nftAddress: string, address: string, manager: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
|
+
/**
|
|
40
|
+
* Add DatatokenDeployer permission - only Manager can succeed
|
|
41
|
+
* @param {String} nftAddress NFT contract address
|
|
42
|
+
* @param {String} address NFT Manager adress
|
|
43
|
+
* @param {String} datatokenDeployer User adress which is going to have DatatokenDeployer permission
|
|
44
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
45
|
+
*/
|
|
46
|
+
addDatatokenDeployer<G extends boolean = false>(nftAddress: string, address: string, datatokenDeployer: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
47
|
+
/**
|
|
48
|
+
* Remove DatatokenDeployer permission - only Manager can succeed
|
|
49
|
+
* @param {String} nftAddress NFT contract address
|
|
50
|
+
* @param {String} address NFT Manager adress
|
|
51
|
+
* @param {String} datatokenDeployer Address of the user to be revoked DatatokenDeployer Permission
|
|
52
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
53
|
+
*/
|
|
54
|
+
removeDatatokenDeployer<G extends boolean = false>(nftAddress: string, address: string, datatokenDeployer: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
55
|
+
/**
|
|
56
|
+
* Add Metadata Updater permission - only Manager can succeed
|
|
57
|
+
* @param {String} nftAddress NFT contract address
|
|
58
|
+
* @param {String} address NFT Manager adress
|
|
59
|
+
* @param {String} metadataUpdater User adress which is going to have Metadata Updater permission
|
|
60
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
61
|
+
*/
|
|
62
|
+
addMetadataUpdater<G extends boolean = false>(nftAddress: string, address: string, metadataUpdater: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
63
|
+
/**
|
|
64
|
+
* Remove Metadata Updater permission - only Manager can succeed
|
|
65
|
+
* @param {String} nftAddress NFT contract address
|
|
66
|
+
* @param {String} address NFT Manager adress
|
|
67
|
+
* @param {String} metadataUpdater Address of the user to be revoked Metadata updater Permission
|
|
68
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
69
|
+
*/
|
|
70
|
+
removeMetadataUpdater<G extends boolean = false>(nftAddress: string, address: string, metadataUpdater: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
71
|
+
/**
|
|
72
|
+
* Add Store Updater permission - only Manager can succeed
|
|
73
|
+
* @param {String} nftAddress NFT contract address
|
|
74
|
+
* @param {String} address NFT Manager adress
|
|
75
|
+
* @param {String} storeUpdater User adress which is going to have Store Updater permission
|
|
76
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
77
|
+
*/
|
|
78
|
+
addStoreUpdater<G extends boolean = false>(nftAddress: string, address: string, storeUpdater: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
79
|
+
/**
|
|
80
|
+
* Remove Store Updater permission - only Manager can succeed
|
|
81
|
+
* @param {String} nftAddress NFT contract address
|
|
82
|
+
* @param {String} address NFT Manager adress
|
|
83
|
+
* @param {String} storeUpdater Address of the user to be revoked Store Updater Permission
|
|
84
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
85
|
+
*/
|
|
86
|
+
removeStoreUpdater<G extends boolean = false>(nftAddress: string, address: string, storeUpdater: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
87
|
+
/**
|
|
88
|
+
* This function allows to remove all ROLES at NFT level: Managers, DatatokenDeployer, MetadataUpdater, StoreUpdater
|
|
89
|
+
* Even NFT Owner has to readd himself as Manager
|
|
90
|
+
* Permissions at Datatoken level stay.
|
|
91
|
+
* Only NFT Owner can call it.
|
|
92
|
+
* @param {String} nftAddress NFT contract address
|
|
93
|
+
* @param {String} address NFT Owner adress
|
|
94
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
95
|
+
*/
|
|
96
|
+
cleanPermissions<G extends boolean = false>(nftAddress: string, address: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
97
|
+
/**
|
|
98
|
+
* Transfers the NFT
|
|
99
|
+
* will clean all permissions both on NFT and Datatoken level.
|
|
100
|
+
* @param {String} nftAddress NFT contract address
|
|
101
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
102
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
103
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
104
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
105
|
+
*/
|
|
106
|
+
transferNft<G extends boolean = false>(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
107
|
+
/**
|
|
108
|
+
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
|
109
|
+
* will clean all permissions both on NFT and Datatoken level.
|
|
110
|
+
* @param {String} nftAddress NFT contract address
|
|
111
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
112
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
113
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
114
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
115
|
+
*/
|
|
116
|
+
safeTransferNft<G extends boolean = false>(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
117
|
+
/**
|
|
118
|
+
* Creates or update Metadata cached by Aquarius. Also, updates the METADATA_DECRYPTOR key
|
|
119
|
+
* @param {String} nftAddress NFT contract address
|
|
120
|
+
* @param {String} address Caller address NFT Owner adress
|
|
121
|
+
* @param {String} address Caller address NFT Owner adress
|
|
122
|
+
* @param {String} address Caller address NFT Owner adress
|
|
123
|
+
* @param {String} address Caller address NFT Owner adress
|
|
124
|
+
* @param {String} address Caller address NFT Owner adress
|
|
125
|
+
* @param {String} address Caller address NFT Owner adress
|
|
126
|
+
* @param {String} address Caller address NFT Owner adress
|
|
127
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
128
|
+
*/
|
|
129
|
+
setMetadata<G extends boolean = false>(nftAddress: string, address: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
130
|
+
/**
|
|
131
|
+
* Helper function to improve UX sets both MetaData & TokenURI in one tx
|
|
132
|
+
* @param {String} nftAddress NFT contract address
|
|
133
|
+
* @param {String} address Caller address
|
|
134
|
+
* @param {MetadataAndTokenURI} metadataAndTokenURI metaDataAndTokenURI object
|
|
135
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
136
|
+
*/
|
|
137
|
+
setMetadataAndTokenURI<G extends boolean = false>(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
138
|
+
/**
|
|
139
|
+
* setMetadataState Used for updating the metadata State
|
|
140
|
+
* @param {String} nftAddress NFT contract address
|
|
141
|
+
* @param {String} address Caller address => metadata updater
|
|
142
|
+
* @param {Number} metadataState new metadata state
|
|
143
|
+
* @return {Promise<ReceiptOrEstimate>} trxReceipt
|
|
144
|
+
*/
|
|
145
|
+
setMetadataState<G extends boolean = false>(nftAddress: string, address: string, metadataState: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
146
|
+
/** set TokenURI on an nft
|
|
147
|
+
* @param nftAddress NFT contract address
|
|
148
|
+
* @param address user adress
|
|
149
|
+
* @param data input data for TokenURI
|
|
150
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
151
|
+
*/
|
|
152
|
+
setTokenURI<G extends boolean = false>(nftAddress: string, address: string, data: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
153
|
+
/** Get Owner
|
|
154
|
+
* @param {String} nftAddress NFT contract address
|
|
155
|
+
* @return {Promise<string>} string
|
|
156
|
+
*/
|
|
157
|
+
getNftOwner(nftAddress: string): Promise<string>;
|
|
158
|
+
/** Get users NFT Permissions
|
|
159
|
+
* @param {String} nftAddress NFT contract address
|
|
160
|
+
* @param {String} address user adress
|
|
161
|
+
* @return {Promise<NftRoles>}
|
|
162
|
+
*/
|
|
163
|
+
getNftPermissions(nftAddress: string, address: string): Promise<NftRoles>;
|
|
164
|
+
/** Get users Metadata, return Metadata details
|
|
165
|
+
* @param {String} nftAddress NFT contract address
|
|
166
|
+
* @return {Promise<Objecta>}
|
|
167
|
+
*/
|
|
168
|
+
getMetadata(nftAddress: string): Promise<Object>;
|
|
169
|
+
/** Get users DatatokenDeployer role
|
|
170
|
+
* @param {String} nftAddress NFT contract address
|
|
171
|
+
* @param {String} address user adress
|
|
172
|
+
* @return {Promise<boolean>}
|
|
173
|
+
*/
|
|
174
|
+
isDatatokenDeployer(nftAddress: string, address: string): Promise<boolean>;
|
|
175
|
+
/** setData
|
|
176
|
+
* This function allows to store data with a preset key (keccak256(ERC20Address)) into NFT 725 Store
|
|
177
|
+
* only ERC20Deployer can succeed
|
|
178
|
+
* @param nftAddress erc721 contract adress
|
|
179
|
+
* @param address user adress
|
|
180
|
+
* @param key Key of the data to be stored into 725Y standard
|
|
181
|
+
* @param value Data to be stored into 725Y standard
|
|
182
|
+
* @return {Promise<ReceiptOrEstimate>} transactionId
|
|
183
|
+
*/
|
|
184
|
+
setData(nftAddress: string, address: string, key: string, value: string): Promise<TransactionReceipt>;
|
|
185
|
+
/** Gets data at a given `key`
|
|
186
|
+
* @param {String} nftAddress NFT contract address
|
|
187
|
+
* @param {String} key the key which value to retrieve
|
|
188
|
+
* @return {Promise<string>} The data stored at the key
|
|
189
|
+
*/
|
|
190
|
+
getData(nftAddress: string, key: string): Promise<string>;
|
|
191
|
+
/** Gets data at a given `key`
|
|
192
|
+
* @param {String} nftAddress NFT contract address
|
|
193
|
+
* @param {String} id
|
|
194
|
+
* @return {Promise<string>} The data stored at the key
|
|
195
|
+
*/
|
|
196
|
+
getTokenURI(nftAddress: string, id: number): Promise<string>;
|
|
197
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types';
|
|
3
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
|
+
/**
|
|
5
|
+
* Provides an interface for NFT Factory contract
|
|
6
|
+
*/
|
|
7
|
+
export declare class NftFactory extends SmartContractWithAddress {
|
|
8
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Create new NFT
|
|
11
|
+
* @param {String} address
|
|
12
|
+
* @param {NFTCreateData} nftData
|
|
13
|
+
* @return {Promise<string>} NFT datatoken address
|
|
14
|
+
*/
|
|
15
|
+
createNFT<G extends boolean = false>(address: string, nftData: NftCreateData, estimateGas?: G): Promise<G extends false ? string : number>;
|
|
16
|
+
/** Get Current NFT Count (NFT created)
|
|
17
|
+
* @return {Promise<number>} Number of NFT created from this factory
|
|
18
|
+
*/
|
|
19
|
+
getCurrentNFTCount(): Promise<number>;
|
|
20
|
+
/** Get Current Datatoken Count
|
|
21
|
+
* @return {Promise<number>} Number of DTs created from this factory
|
|
22
|
+
*/
|
|
23
|
+
getCurrentTokenCount(): Promise<number>;
|
|
24
|
+
/** Get Factory Owner
|
|
25
|
+
* @return {Promise<string>} Factory Owner address
|
|
26
|
+
*/
|
|
27
|
+
getOwner(): Promise<string>;
|
|
28
|
+
/** Get Current NFT Template Count
|
|
29
|
+
* @return {Promise<number>} Number of NFT Template added to this factory
|
|
30
|
+
*/
|
|
31
|
+
getCurrentNFTTemplateCount(): Promise<number>;
|
|
32
|
+
/** Get Current Template Datatoken (ERC20) Count
|
|
33
|
+
* @return {Promise<number>} Number of Datatoken Template added to this factory
|
|
34
|
+
*/
|
|
35
|
+
getCurrentTokenTemplateCount(): Promise<number>;
|
|
36
|
+
/** Get NFT Template
|
|
37
|
+
* @param {Number} index Template index
|
|
38
|
+
* @return {Promise<Template>} Number of Template added to this factory
|
|
39
|
+
*/
|
|
40
|
+
getNFTTemplate(index: number): Promise<Template>;
|
|
41
|
+
/** Get Datatoken (ERC20) Template
|
|
42
|
+
* @param {Number} index Template index
|
|
43
|
+
* @return {Promise<Template>} DT Template info
|
|
44
|
+
*/
|
|
45
|
+
getTokenTemplate(index: number): Promise<Template>;
|
|
46
|
+
/** Check if Datatoken is deployed from the factory
|
|
47
|
+
* @param {String} datatoken Datatoken address we want to check
|
|
48
|
+
* @return {Promise<Boolean>} return true if deployed from this factory
|
|
49
|
+
*/
|
|
50
|
+
checkDatatoken(datatoken: string): Promise<Boolean>;
|
|
51
|
+
/** Check if NFT is deployed from the factory
|
|
52
|
+
* @param {String} nftAddress nftAddress address we want to check
|
|
53
|
+
* @return {Promise<String>} return address(0) if it's not, or the nftAddress if true
|
|
54
|
+
*/
|
|
55
|
+
checkNFT(nftAddress: string): Promise<String>;
|
|
56
|
+
/**
|
|
57
|
+
* Add a new NFT token template - only factory Owner
|
|
58
|
+
* @param {String} address
|
|
59
|
+
* @param {String} templateAddress template address to add
|
|
60
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
61
|
+
*/
|
|
62
|
+
addNFTTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
63
|
+
/**
|
|
64
|
+
* Disable token template - only factory Owner
|
|
65
|
+
* @param {String} address
|
|
66
|
+
* @param {Number} templateIndex index of the template we want to disable
|
|
67
|
+
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
68
|
+
*/
|
|
69
|
+
disableNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
70
|
+
/**
|
|
71
|
+
* Reactivate a previously disabled token template - only factory Owner
|
|
72
|
+
* @param {String} address
|
|
73
|
+
* @param {Number} templateIndex index of the template we want to reactivate
|
|
74
|
+
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
75
|
+
*/
|
|
76
|
+
reactivateNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
77
|
+
/**
|
|
78
|
+
* Add a new NFT token template - only factory Owner
|
|
79
|
+
* @param {String} address
|
|
80
|
+
* @param {String} templateAddress template address to add
|
|
81
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
82
|
+
*/
|
|
83
|
+
addTokenTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
84
|
+
/**
|
|
85
|
+
* Disable token template - only factory Owner
|
|
86
|
+
* @param {String} address
|
|
87
|
+
* @param {Number} templateIndex index of the template we want to disable
|
|
88
|
+
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
89
|
+
*/
|
|
90
|
+
disableTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
91
|
+
/**
|
|
92
|
+
* Reactivate a previously disabled token template - only factory Owner
|
|
93
|
+
* @param {String} address
|
|
94
|
+
* @param {Number} templateIndex index of the template we want to reactivate
|
|
95
|
+
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
96
|
+
*/
|
|
97
|
+
reactivateTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
98
|
+
/**
|
|
99
|
+
* @dev startMultipleTokenOrder
|
|
100
|
+
* Used as a proxy to order multiple services
|
|
101
|
+
* Users can have inifinite approvals for fees for factory instead of having one approval/ Datatoken contract
|
|
102
|
+
* Requires previous approval of all :
|
|
103
|
+
* - consumeFeeTokens
|
|
104
|
+
* - publishMarketFeeTokens
|
|
105
|
+
* - ERC20 Datatokens
|
|
106
|
+
* @param address Caller address
|
|
107
|
+
* @param orders an array of struct tokenOrder
|
|
108
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
109
|
+
*/
|
|
110
|
+
startMultipleTokenOrder<G extends boolean = false>(address: string, orders: TokenOrder[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
111
|
+
/**
|
|
112
|
+
* @dev createNftWithDatatoken
|
|
113
|
+
* Creates a new NFT, then a Datatoken,all in one call
|
|
114
|
+
* @param address Caller address
|
|
115
|
+
* @param _NftCreateData input data for nft creation
|
|
116
|
+
* @param _ErcCreateData input data for Datatoken creation
|
|
117
|
+
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
118
|
+
*/
|
|
119
|
+
createNftWithDatatoken<G extends boolean = false>(address: string, nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
120
|
+
/**
|
|
121
|
+
* @dev createNftWithDatatokenWithFixedRate
|
|
122
|
+
* Creates a new NFT, then a Datatoken, then a FixedRateExchange, all in one call
|
|
123
|
+
* Use this carefully, because if Fixed Rate creation fails, you are still going to pay a lot of gas
|
|
124
|
+
* @param address Caller address
|
|
125
|
+
* @param nftCreateData input data for NFT Creation
|
|
126
|
+
* @param dtParams input data for Datatoken Creation
|
|
127
|
+
* @param freParams input data for FixedRate Creation
|
|
128
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
129
|
+
*/
|
|
130
|
+
createNftWithDatatokenWithFixedRate<G extends boolean = false>(address: string, nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, freParams: FreCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
131
|
+
/**
|
|
132
|
+
* @dev createNftWithDatatokenWithDispenser
|
|
133
|
+
* Creates a new NFT, then a Datatoken, then a Dispenser, all in one call
|
|
134
|
+
* Use this carefully, because if Dispenser creation fails, you are still going to pay a lot of gas
|
|
135
|
+
* @param address Caller address
|
|
136
|
+
* @param nftCreateData input data for NFT Creation
|
|
137
|
+
* @param dtParams input data for Datatoken Creation
|
|
138
|
+
* @param dispenserParams input data for Dispenser Creation
|
|
139
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
140
|
+
*/
|
|
141
|
+
createNftWithDatatokenWithDispenser<G extends boolean = false>(address: string, nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, dispenserParams: DispenserCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
142
|
+
private getErcCreationParams;
|
|
143
|
+
private getFreCreationParams;
|
|
144
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { Operation, ReceiptOrEstimate } from '../@types';
|
|
3
|
+
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
|
+
/**
|
|
5
|
+
* Provides an interface for FactoryRouter contract
|
|
6
|
+
*/
|
|
7
|
+
export declare class Router extends SmartContractWithAddress {
|
|
8
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
9
|
+
/**
|
|
10
|
+
* buyDatatokenBatch
|
|
11
|
+
* @param {String} address
|
|
12
|
+
* @param {Operation} operations Operations objects array
|
|
13
|
+
* @return {Promise<ReceiptOrEstimate>} Transaction receipt
|
|
14
|
+
*/
|
|
15
|
+
buyDatatokenBatch<G extends boolean = false>(address: string, operations: Operation[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
16
|
+
/** Check if a token is on approved tokens list, if true opfFee is lower in pools with that token/DT
|
|
17
|
+
* @return {Promise<boolean>} true if is on the list.
|
|
18
|
+
*/
|
|
19
|
+
isApprovedToken(address: string): Promise<boolean>;
|
|
20
|
+
/** Check if an address is a Fixed Rate contract.
|
|
21
|
+
* @return {Promise<boolean>} true if is a Fixed Rate contract
|
|
22
|
+
*/
|
|
23
|
+
isFixedPrice(address: string): Promise<boolean>;
|
|
24
|
+
/** Get Router Owner
|
|
25
|
+
* @return {Promise<string>} Router Owner address
|
|
26
|
+
*/
|
|
27
|
+
getOwner(): Promise<string>;
|
|
28
|
+
/** Get NFT Factory address
|
|
29
|
+
* @return {Promise<string>} NFT Factory address
|
|
30
|
+
*/
|
|
31
|
+
getNFTFactory(): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Adds a token to the list of tokens with reduced fees
|
|
34
|
+
* @param {String} address caller address
|
|
35
|
+
* @param {String} tokenAddress token address to add
|
|
36
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
37
|
+
*/
|
|
38
|
+
addApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
|
+
/**
|
|
40
|
+
* Removes a token if exists from the list of tokens with reduced fees
|
|
41
|
+
* @param {String} address
|
|
42
|
+
* @param {String} tokenAddress address to remove
|
|
43
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
44
|
+
*/
|
|
45
|
+
removeApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
46
|
+
/**
|
|
47
|
+
* Adds an address to the list of fixed rate contracts
|
|
48
|
+
* @param {String} address
|
|
49
|
+
* @param {String} tokenAddress contract address to add
|
|
50
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
51
|
+
*/
|
|
52
|
+
addFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
53
|
+
/**
|
|
54
|
+
* Removes an address from the list of fixed rate contracts
|
|
55
|
+
* @param {String} address
|
|
56
|
+
* @param {String} tokenAddress contract address to add
|
|
57
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
58
|
+
*/
|
|
59
|
+
removeFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
60
|
+
/**
|
|
61
|
+
* Adds an address to the list of dispensers
|
|
62
|
+
* @param {String} address
|
|
63
|
+
* @param {String} tokenAddress contract address to add
|
|
64
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
65
|
+
*/
|
|
66
|
+
addDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
67
|
+
/**
|
|
68
|
+
* Removes an address from the list of dispensers
|
|
69
|
+
* @param {String} address
|
|
70
|
+
* @param {String} tokenAddress address Contract to be removed
|
|
71
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
72
|
+
*/
|
|
73
|
+
removeDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
74
|
+
/** Get OPF Fee per token
|
|
75
|
+
* @return {Promise<number>} OPC fee for a specific baseToken
|
|
76
|
+
*/
|
|
77
|
+
getOPCFee(baseToken: string): Promise<number>;
|
|
78
|
+
/** Get Current OPF Fee
|
|
79
|
+
* @return {Promise<number>} OPF fee
|
|
80
|
+
*/
|
|
81
|
+
getCurrentOPCFee(): Promise<number>;
|
|
82
|
+
/**
|
|
83
|
+
* Updates OP Community Fees
|
|
84
|
+
* @param {String} address
|
|
85
|
+
* @param {number} newSwapOceanFee Amount charged for swapping with ocean approved tokens
|
|
86
|
+
* @param {number} newSwapNonOceanFee Amount charged for swapping with non ocean approved tokens
|
|
87
|
+
* @param {number} newConsumeFee Amount charged from consumeFees
|
|
88
|
+
* @param {number} newProviderFee Amount charged for providerFees
|
|
89
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
90
|
+
*/
|
|
91
|
+
updateOPCFee<G extends boolean = false>(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
92
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Contract } from 'web3-eth-contract';
|
|
3
|
+
import { AbiItem } from 'web3-utils';
|
|
4
|
+
import { Config } from '../config';
|
|
5
|
+
export declare abstract class SmartContract {
|
|
6
|
+
web3: Web3;
|
|
7
|
+
config: Config;
|
|
8
|
+
abi: AbiItem | AbiItem[];
|
|
9
|
+
abstract getDefaultAbi(): AbiItem | AbiItem[];
|
|
10
|
+
/**
|
|
11
|
+
* Instantiate the smart contract.
|
|
12
|
+
* @param {Web3} web3
|
|
13
|
+
* @param {string | number} network Network id or name
|
|
14
|
+
* @param {Config} config Configutation of the smart contract
|
|
15
|
+
* @param {AbiItem | AbiItem[]} abi ABI of the smart contract
|
|
16
|
+
*/
|
|
17
|
+
constructor(web3: Web3, network?: string | number, config?: Config, abi?: AbiItem | AbiItem[]);
|
|
18
|
+
protected amountToUnits(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
19
|
+
protected unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
20
|
+
protected getFairGasPrice(): Promise<string>;
|
|
21
|
+
protected getContract(address: string, account?: string, abi?: AbiItem | AbiItem[]): Contract;
|
|
22
|
+
}
|