@oceanprotocol/lib 2.7.0 → 3.0.0-next.1
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/CodeExamples.md +273 -166
- package/ComputeExamples.md +106 -101
- 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/Contracts.d.ts +26 -0
- package/dist/src/@types/DDO/Metadata.d.ts +2 -2
- package/dist/src/@types/File.d.ts +1 -1
- package/dist/src/@types/ReturnTypes.d.ts +3 -2
- package/dist/src/@types/index.d.ts +1 -0
- package/dist/src/config/Config.d.ts +1 -1
- package/dist/src/config/ConfigHelper.d.ts +6 -0
- package/dist/src/contracts/Datatoken.d.ts +90 -72
- package/dist/src/contracts/Dispenser.d.ts +27 -27
- package/dist/src/contracts/FixedRateExchange.d.ts +57 -60
- package/dist/src/contracts/NFT.d.ts +57 -34
- package/dist/src/contracts/NFTFactory.d.ts +78 -57
- package/dist/src/contracts/Router.d.ts +33 -18
- package/dist/src/contracts/SmartContract.d.ts +35 -12
- package/dist/src/contracts/SmartContractWithAddress.d.ts +7 -8
- package/dist/src/contracts/df/DfRewards.d.ts +6 -7
- package/dist/src/contracts/df/DfStrategyV1.d.ts +3 -5
- package/dist/src/contracts/ve/VeAllocate.d.ts +4 -7
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +6 -7
- package/dist/src/contracts/ve/VeFeeEstimate.d.ts +2 -2
- package/dist/src/contracts/ve/VeOcean.d.ts +12 -13
- package/dist/src/services/Aquarius.d.ts +3 -4
- package/dist/src/services/Provider.d.ts +124 -76
- package/dist/src/utils/ContractUtils.d.ts +36 -16
- package/dist/src/utils/DatatokenName.d.ts +5 -2
- package/dist/src/utils/DdoHelpers.d.ts +11 -0
- package/dist/src/utils/FetchHelper.d.ts +11 -0
- package/dist/src/utils/General.d.ts +1 -0
- package/dist/src/utils/ProviderErrors.d.ts +1 -0
- package/dist/src/utils/SignatureUtils.d.ts +8 -2
- package/dist/src/utils/TokenUtils.d.ts +43 -43
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/minAbi.d.ts +38 -2
- package/dist/test/config.d.ts +17 -3
- package/dist/test/integration/helpers.d.ts +7 -0
- package/package.json +10 -5
- package/dist/test/TestContractHandler.d.ts +0 -16
- /package/dist/test/integration/{SimplePublishConsumeFlow.test.d.ts → PublishEditConsume.test.d.ts} +0 -0
|
@@ -1,62 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types';
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
2
|
+
import { AbiItem, FreCreationParams, DatatokenCreateParams, DispenserCreationParams, NftCreateData, Template, TokenOrder, ReceiptOrEstimate } from '../@types';
|
|
3
3
|
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
4
|
/**
|
|
5
5
|
* Provides an interface for NFT Factory contract
|
|
6
6
|
*/
|
|
7
7
|
export declare class NftFactory extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
8
|
+
getDefaultAbi(): AbiItem[];
|
|
9
9
|
/**
|
|
10
|
-
* Create new NFT
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @return {Promise<string>}
|
|
10
|
+
* Create new data NFT
|
|
11
|
+
* @param {NFTCreateData} nftData The data needed to create an NFT.
|
|
12
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
13
|
+
* @return {Promise<string|BigNumber>} The transaction hash or the gas estimate.
|
|
14
14
|
*/
|
|
15
|
-
createNFT<G extends boolean = false>(
|
|
16
|
-
/**
|
|
15
|
+
createNFT<G extends boolean = false>(nftData: NftCreateData, estimateGas?: G): Promise<G extends false ? string : BigNumber>;
|
|
16
|
+
/**
|
|
17
|
+
* Get Current NFT Count (NFT created)
|
|
17
18
|
* @return {Promise<number>} Number of NFT created from this factory
|
|
18
19
|
*/
|
|
19
20
|
getCurrentNFTCount(): Promise<number>;
|
|
20
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Get Current Datatoken Count
|
|
21
23
|
* @return {Promise<number>} Number of DTs created from this factory
|
|
22
24
|
*/
|
|
23
25
|
getCurrentTokenCount(): Promise<number>;
|
|
24
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Get Factory Owner
|
|
25
28
|
* @return {Promise<string>} Factory Owner address
|
|
26
29
|
*/
|
|
27
30
|
getOwner(): Promise<string>;
|
|
28
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Get Current NFT Template Count
|
|
29
33
|
* @return {Promise<number>} Number of NFT Template added to this factory
|
|
30
34
|
*/
|
|
31
35
|
getCurrentNFTTemplateCount(): Promise<number>;
|
|
32
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Get Current Template Datatoken (ERC20) Count
|
|
33
38
|
* @return {Promise<number>} Number of Datatoken Template added to this factory
|
|
34
39
|
*/
|
|
35
40
|
getCurrentTokenTemplateCount(): Promise<number>;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
41
|
+
/**
|
|
42
|
+
* Get NFT Template
|
|
43
|
+
* @param {number} index Template index
|
|
38
44
|
* @return {Promise<Template>} Number of Template added to this factory
|
|
39
45
|
*/
|
|
40
46
|
getNFTTemplate(index: number): Promise<Template>;
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
47
|
+
/**
|
|
48
|
+
* Get Datatoken (ERC20) Template
|
|
49
|
+
* @param {number} index Template index
|
|
43
50
|
* @return {Promise<Template>} DT Template info
|
|
44
51
|
*/
|
|
45
52
|
getTokenTemplate(index: number): Promise<Template>;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
53
|
+
/**
|
|
54
|
+
* Check if Datatoken is deployed from the factory
|
|
55
|
+
* @param {String} datatoken Datatoken address to check
|
|
48
56
|
* @return {Promise<Boolean>} return true if deployed from this factory
|
|
49
57
|
*/
|
|
50
58
|
checkDatatoken(datatoken: string): Promise<Boolean>;
|
|
51
|
-
/**
|
|
52
|
-
*
|
|
59
|
+
/**
|
|
60
|
+
* Check if NFT is deployed from the factory
|
|
61
|
+
* @param {String} nftAddress nftAddress address to check
|
|
53
62
|
* @return {Promise<String>} return address(0) if it's not, or the nftAddress if true
|
|
54
63
|
*/
|
|
55
64
|
checkNFT(nftAddress: string): Promise<String>;
|
|
56
65
|
/**
|
|
57
66
|
* Add a new NFT token template - only factory Owner
|
|
58
|
-
* @param {String} address
|
|
67
|
+
* @param {String} address caller address
|
|
59
68
|
* @param {String} templateAddress template address to add
|
|
69
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
60
70
|
* @return {Promise<ReceiptOrEstimate>}
|
|
61
71
|
*/
|
|
62
72
|
addNFTTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -64,6 +74,7 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
64
74
|
* Disable token template - only factory Owner
|
|
65
75
|
* @param {String} address
|
|
66
76
|
* @param {Number} templateIndex index of the template we want to disable
|
|
77
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
67
78
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
68
79
|
*/
|
|
69
80
|
disableNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -71,74 +82,84 @@ export declare class NftFactory extends SmartContractWithAddress {
|
|
|
71
82
|
* Reactivate a previously disabled token template - only factory Owner
|
|
72
83
|
* @param {String} address
|
|
73
84
|
* @param {Number} templateIndex index of the template we want to reactivate
|
|
85
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
74
86
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
75
87
|
*/
|
|
76
88
|
reactivateNFTTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
77
89
|
/**
|
|
78
90
|
* Add a new NFT token template - only factory Owner
|
|
79
|
-
* @param {String} address
|
|
91
|
+
* @param {String} address caller address
|
|
80
92
|
* @param {String} templateAddress template address to add
|
|
93
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
81
94
|
* @return {Promise<ReceiptOrEstimate>}
|
|
82
95
|
*/
|
|
83
96
|
addTokenTemplate<G extends boolean = false>(address: string, templateAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
84
97
|
/**
|
|
85
98
|
* Disable token template - only factory Owner
|
|
86
|
-
* @param {String} address
|
|
99
|
+
* @param {String} address caller address
|
|
87
100
|
* @param {Number} templateIndex index of the template we want to disable
|
|
101
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
88
102
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
89
103
|
*/
|
|
90
104
|
disableTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
91
105
|
/**
|
|
92
106
|
* Reactivate a previously disabled token template - only factory Owner
|
|
93
|
-
* @param {String} address
|
|
107
|
+
* @param {String} address caller address
|
|
94
108
|
* @param {Number} templateIndex index of the template we want to reactivate
|
|
109
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
95
110
|
* @return {Promise<ReceiptOrEstimate>} current token template count
|
|
96
111
|
*/
|
|
97
112
|
reactivateTokenTemplate<G extends boolean = false>(address: string, templateIndex: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
98
113
|
/**
|
|
99
|
-
* @dev startMultipleTokenOrder
|
|
100
114
|
* Used as a proxy to order multiple services
|
|
101
115
|
* Users can have inifinite approvals for fees for factory instead of having one approval/ Datatoken contract
|
|
102
116
|
* Requires previous approval of all :
|
|
103
117
|
* - consumeFeeTokens
|
|
104
118
|
* - publishMarketFeeTokens
|
|
105
119
|
* - ERC20 Datatokens
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
120
|
+
* @param {TokenOrder[]} orders array of of orders
|
|
121
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
108
122
|
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
109
123
|
*/
|
|
110
|
-
startMultipleTokenOrder<G extends boolean = false>(
|
|
124
|
+
startMultipleTokenOrder<G extends boolean = false>(orders: TokenOrder[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
111
125
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
* @param _ErcCreateData input data for Datatoken creation
|
|
126
|
+
* Creates a new NFT, then a datatoken,all in one call
|
|
127
|
+
* @param {NftCreateData} nftCreateData - The data required to create an NFT.
|
|
128
|
+
* @param {DatatokenCreateParams} dtParams - The parameters required to create a datatoken.
|
|
129
|
+
* @param {boolean} [estimateGas] - Whether to return only estimate gas or not.
|
|
117
130
|
* @return {Promise<ReceiptOrEstimate>} transaction receipt
|
|
118
131
|
*/
|
|
119
|
-
createNftWithDatatoken<G extends boolean = false>(
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
* @param
|
|
125
|
-
* @param
|
|
126
|
-
* @param
|
|
127
|
-
* @
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* @param
|
|
136
|
-
* @param
|
|
137
|
-
* @
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
createNftWithDatatoken<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
133
|
+
/**
|
|
134
|
+
* Creates an NFT with a datatoken with a fixed rate all in one call.
|
|
135
|
+
* be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
|
136
|
+
* @param {NftCreateData} nftCreateData - The data required to create an NFT.
|
|
137
|
+
* @param {DatatokenCreateParams} dtParams - The parameters required to create a datatoken.
|
|
138
|
+
* @param {FreCreationParams} freParams - The parameters required to create a fixed-rate exchange contract.
|
|
139
|
+
* @param {boolean} [estimateGas] - Whether to return only estimate gas or not.
|
|
140
|
+
* @returns {Promis<ReceiptOrEstimate<G>>}
|
|
141
|
+
*/
|
|
142
|
+
createNftWithDatatokenWithFixedRate<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, freParams: FreCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
143
|
+
/**
|
|
144
|
+
* Creates an NFT with a datatoken with a dispenser in one call.
|
|
145
|
+
* Be aware if Fixed Rate creation fails, you are still going to pay a lot of gas
|
|
146
|
+
* @param {NftCreateData} nftCreateData - The data required to create an NFT.
|
|
147
|
+
* @param {DatatokenCreateParams} dtParams - The parameters required to create a datatoken.
|
|
148
|
+
* @param {DispenserCreationParams} dispenserParams - The parameters required to create a dispenser contract.
|
|
149
|
+
* @param {boolean} [estimateGas] - Whether to estimate gas or not.
|
|
150
|
+
* @returns {Promis<ReceiptOrEstimate<G>>}
|
|
151
|
+
*/
|
|
152
|
+
createNftWithDatatokenWithDispenser<G extends boolean = false>(nftCreateData: NftCreateData, dtParams: DatatokenCreateParams, dispenserParams: DispenserCreationParams, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
153
|
+
/**
|
|
154
|
+
* Gets the parameters required to create an ERC20 token.
|
|
155
|
+
* @param {DatatokenCreateParams} dtParams - The parameters required to create a datatoken.
|
|
156
|
+
* @returns {Promise<any>}
|
|
157
|
+
*/
|
|
142
158
|
private getErcCreationParams;
|
|
159
|
+
/**
|
|
160
|
+
* Gets the parameters required to create a fixed-rate exchange contract.
|
|
161
|
+
* @param {FreCreationParams} freParams - The parameters required to create a fixed-rate exchange contract.
|
|
162
|
+
* @returns {Promise<any> }
|
|
163
|
+
*/
|
|
143
164
|
private getFreCreationParams;
|
|
144
165
|
}
|
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
import { AbiItem } from '
|
|
2
|
-
import { Operation, ReceiptOrEstimate } from '../@types';
|
|
1
|
+
import { Operation, ReceiptOrEstimate, AbiItem } from '../@types';
|
|
3
2
|
import { SmartContractWithAddress } from './SmartContractWithAddress';
|
|
4
3
|
/**
|
|
5
4
|
* Provides an interface for FactoryRouter contract
|
|
6
5
|
*/
|
|
7
6
|
export declare class Router extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* * Buys a batch of datatokens.
|
|
10
|
+
* one single call to buy multiple DT for multiple assets.
|
|
11
|
+
* require tokenIn approvals for router from user. (except for dispenser operations)
|
|
12
|
+
* @param {Operation[]} operations - The operations to execute.
|
|
13
|
+
* @param {boolean} [estimateGas=false] - Whether to return only the estimate gas or not.
|
|
13
14
|
* @return {Promise<ReceiptOrEstimate>} Transaction receipt
|
|
14
15
|
*/
|
|
15
|
-
buyDatatokenBatch<G extends boolean = false>(
|
|
16
|
-
/**
|
|
16
|
+
buyDatatokenBatch<G extends boolean = false>(operations: Operation[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
17
|
+
/**
|
|
18
|
+
* Checks if a token is on approved tokens list,
|
|
19
|
+
* if true opfFee is lower in pools with that token/DT
|
|
20
|
+
* @param {string} address - The address of the token to check.
|
|
17
21
|
* @return {Promise<boolean>} true if is on the list.
|
|
18
22
|
*/
|
|
19
23
|
isApprovedToken(address: string): Promise<boolean>;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Check if an address is a Fixed Rate contract.
|
|
26
|
+
* @param {string} address - The address of the fixed rate exchange to check.
|
|
21
27
|
* @return {Promise<boolean>} true if is a Fixed Rate contract
|
|
22
28
|
*/
|
|
23
29
|
isFixedPrice(address: string): Promise<boolean>;
|
|
24
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Get Router Owner
|
|
25
32
|
* @return {Promise<string>} Router Owner address
|
|
26
33
|
*/
|
|
27
34
|
getOwner(): Promise<string>;
|
|
28
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Get NFT Factory address
|
|
29
37
|
* @return {Promise<string>} NFT Factory address
|
|
30
38
|
*/
|
|
31
39
|
getNFTFactory(): Promise<string>;
|
|
@@ -33,41 +41,47 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
33
41
|
* Adds a token to the list of tokens with reduced fees
|
|
34
42
|
* @param {String} address caller address
|
|
35
43
|
* @param {String} tokenAddress token address to add
|
|
44
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
36
45
|
* @return {Promise<ReceiptOrEstimate>}
|
|
37
46
|
*/
|
|
38
47
|
addApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
39
48
|
/**
|
|
40
49
|
* Removes a token if exists from the list of tokens with reduced fees
|
|
41
|
-
* @param {String} address
|
|
42
|
-
* @param {String} tokenAddress address to remove
|
|
50
|
+
* @param {String} address caller address
|
|
51
|
+
* @param {String} tokenAddress token address to remove
|
|
52
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
43
53
|
* @return {Promise<ReceiptOrEstimate>}
|
|
44
54
|
*/
|
|
45
55
|
removeApprovedToken<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
46
56
|
/**
|
|
47
57
|
* Adds an address to the list of fixed rate contracts
|
|
48
|
-
* @param {String} address
|
|
58
|
+
* @param {String} address caller address
|
|
49
59
|
* @param {String} tokenAddress contract address to add
|
|
60
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
50
61
|
* @return {Promise<ReceiptOrEstimate>}
|
|
51
62
|
*/
|
|
52
63
|
addFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
53
64
|
/**
|
|
54
65
|
* Removes an address from the list of fixed rate contracts
|
|
55
|
-
* @param {String} address
|
|
66
|
+
* @param {String} address caller address
|
|
56
67
|
* @param {String} tokenAddress contract address to add
|
|
68
|
+
* @param {Boolean} [estimateGas] if True, return gas estimate
|
|
57
69
|
* @return {Promise<ReceiptOrEstimate>}
|
|
58
70
|
*/
|
|
59
71
|
removeFixedRateContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
60
72
|
/**
|
|
61
73
|
* Adds an address to the list of dispensers
|
|
62
|
-
* @param {String} address
|
|
74
|
+
* @param {String} address caller address
|
|
63
75
|
* @param {String} tokenAddress contract address to add
|
|
76
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
64
77
|
* @return {Promise<ReceiptOrEstimate>}
|
|
65
78
|
*/
|
|
66
79
|
addDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
67
80
|
/**
|
|
68
81
|
* Removes an address from the list of dispensers
|
|
69
|
-
* @param {String} address
|
|
82
|
+
* @param {String} address caller address
|
|
70
83
|
* @param {String} tokenAddress address Contract to be removed
|
|
84
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
71
85
|
* @return {Promise<ReceiptOrEstimate>}
|
|
72
86
|
*/
|
|
73
87
|
removeDispenserContract<G extends boolean = false>(address: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -81,11 +95,12 @@ export declare class Router extends SmartContractWithAddress {
|
|
|
81
95
|
getCurrentOPCFee(): Promise<number>;
|
|
82
96
|
/**
|
|
83
97
|
* Updates OP Community Fees
|
|
84
|
-
* @param {String} address
|
|
98
|
+
* @param {String} address caller address
|
|
85
99
|
* @param {number} newSwapOceanFee Amount charged for swapping with ocean approved tokens
|
|
86
100
|
* @param {number} newSwapNonOceanFee Amount charged for swapping with non ocean approved tokens
|
|
87
101
|
* @param {number} newConsumeFee Amount charged from consumeFees
|
|
88
102
|
* @param {number} newProviderFee Amount charged for providerFees
|
|
103
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
89
104
|
* @return {Promise<ReceiptOrEstimate>}
|
|
90
105
|
*/
|
|
91
106
|
updateOPCFee<G extends boolean = false>(address: string, newSwapOceanFee: number, newSwapNonOceanFee: number, newConsumeFee: number, newProviderFee: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
@@ -1,22 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { AbiItem } from 'web3-utils';
|
|
1
|
+
import { Signer, Contract } from 'ethers';
|
|
2
|
+
import { AbiItem } from '../@types';
|
|
4
3
|
import { Config } from '../config';
|
|
5
4
|
export declare abstract class SmartContract {
|
|
6
|
-
|
|
5
|
+
signer: Signer;
|
|
7
6
|
config: Config;
|
|
8
|
-
abi: AbiItem
|
|
9
|
-
abstract getDefaultAbi():
|
|
7
|
+
abi: AbiItem[];
|
|
8
|
+
abstract getDefaultAbi(): any;
|
|
10
9
|
/**
|
|
11
10
|
* Instantiate the smart contract.
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {string | number} network Network id or name
|
|
14
|
-
* @param {Config} config
|
|
15
|
-
* @param {AbiItem
|
|
11
|
+
* @param {Signer} signer The signer object.
|
|
12
|
+
* @param {string | number} [network] Network id or name
|
|
13
|
+
* @param {Config} [config] The configuration object.
|
|
14
|
+
* @param {AbiItem[]} [abi] ABI array of the smart contract
|
|
15
|
+
*/
|
|
16
|
+
constructor(signer: Signer, network?: string | number, config?: Config, abi?: AbiItem[]);
|
|
17
|
+
/**
|
|
18
|
+
* Converts an amount of tokens to units
|
|
19
|
+
* @param {string} token - The token to convert
|
|
20
|
+
* @param {string} amount - The amount of tokens to convert
|
|
21
|
+
* @param {number} [tokenDecimals] - The number of decimals of the token
|
|
22
|
+
* @returns {Promise<string>} - The converted amount in units
|
|
16
23
|
*/
|
|
17
|
-
constructor(web3: Web3, network?: string | number, config?: Config, abi?: AbiItem | AbiItem[]);
|
|
18
24
|
protected amountToUnits(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Converts an amount of units to tokens
|
|
27
|
+
* @param {string} token - The token to convert
|
|
28
|
+
* @param {string} amount - The amount of units to convert
|
|
29
|
+
* @param {number} [tokenDecimals] - The number of decimals in the token
|
|
30
|
+
* @returns {Promise<string>} - The converted amount in tokens
|
|
31
|
+
*/
|
|
19
32
|
protected unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Retruns the gas price
|
|
35
|
+
* @returns {Promise<string>} - The fair gas price
|
|
36
|
+
*/
|
|
20
37
|
protected getFairGasPrice(): Promise<string>;
|
|
21
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Returns a contract instance for the given address
|
|
40
|
+
* @param {string} address - The address of the contract
|
|
41
|
+
* @param {AbiItem[]} [abi] - The ABI of the contract
|
|
42
|
+
* @returns {Contract} - The contract instance
|
|
43
|
+
*/
|
|
44
|
+
protected getContract(address: string, abi?: AbiItem[]): Contract;
|
|
22
45
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { AbiItem } from 'web3-utils';
|
|
1
|
+
import { Signer, Contract } from 'ethers';
|
|
2
|
+
import { AbiItem } from '../@types';
|
|
4
3
|
import { Config } from '../config';
|
|
5
4
|
import { SmartContract } from './SmartContract';
|
|
6
5
|
export declare abstract class SmartContractWithAddress extends SmartContract {
|
|
@@ -8,11 +7,11 @@ export declare abstract class SmartContractWithAddress extends SmartContract {
|
|
|
8
7
|
contract: Contract;
|
|
9
8
|
/**
|
|
10
9
|
* Instantiate the smart contract.
|
|
11
|
-
* @param {string} address
|
|
12
|
-
* @param {
|
|
10
|
+
* @param {string} address The address of the contract.
|
|
11
|
+
* @param {Signer} signer The signer object.
|
|
13
12
|
* @param {string | number} network Network id or name
|
|
14
|
-
* @param {Config} config
|
|
15
|
-
* @param {AbiItem
|
|
13
|
+
* @param {Config} config The configuration object.
|
|
14
|
+
* @param {AbiItem[]} abi ABI array of the smart contract
|
|
16
15
|
*/
|
|
17
|
-
constructor(address: string,
|
|
16
|
+
constructor(address: string, signer: Signer, network?: string | number, config?: Config, abi?: AbiItem[]);
|
|
18
17
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
-
import { ReceiptOrEstimate } from '../../@types';
|
|
2
|
+
import { AbiItem, ReceiptOrEstimate } from '../../@types';
|
|
4
3
|
/**
|
|
5
4
|
* Provides an interface for DFRewards contract
|
|
6
5
|
*/
|
|
7
6
|
export declare class DfRewards extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
9
8
|
/** Get available DF Rewards for a token
|
|
10
9
|
* @param {String} userAddress user address
|
|
11
10
|
* @param {String} tokenAddress token address
|
|
@@ -14,19 +13,19 @@ export declare class DfRewards extends SmartContractWithAddress {
|
|
|
14
13
|
getAvailableRewards(userAddress: string, tokenAddress: string): Promise<string>;
|
|
15
14
|
/**
|
|
16
15
|
* claim rewards for any address
|
|
17
|
-
* @param {String} fromUserAddress user that generates the tx
|
|
18
16
|
* @param {String} userAddress user address to claim
|
|
19
17
|
* @param {String} tokenAddress token address
|
|
18
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
20
19
|
* @return {Promise<ReceiptOrEstimate>}
|
|
21
20
|
*/
|
|
22
|
-
claimRewards<G extends boolean = false>(
|
|
21
|
+
claimRewards<G extends boolean = false>(userAddress: string, tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
22
|
/**
|
|
24
23
|
* allocate rewards to address. An approve must exist before calling this function.
|
|
25
|
-
* @param {String} fromUserAddress user that generates the tx
|
|
26
24
|
* @param {String[]} userAddresses array of users that will receive rewards
|
|
27
25
|
* @param {String[]} amounts array of amounts
|
|
28
26
|
* @param {String} tokenAddress token address
|
|
27
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
29
28
|
* @return {Promise<ReceiptOrEstimate>}
|
|
30
29
|
*/
|
|
31
|
-
allocateRewards<G extends boolean = false>(
|
|
30
|
+
allocateRewards<G extends boolean = false>(userAddresses: string[], amounts: string[], tokenAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
32
31
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
-
import { ReceiptOrEstimate } from '../../@types';
|
|
2
|
+
import { ReceiptOrEstimate, AbiItem } from '../../@types';
|
|
4
3
|
/**
|
|
5
4
|
* Provides an interface for dfStrategyV1 contract
|
|
6
5
|
*/
|
|
7
6
|
export declare class DfStrategyV1 extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
9
8
|
/** Get available DF Rewards for multiple tokens
|
|
10
9
|
* @param {String} userAddress user address
|
|
11
10
|
* @param {String} tokenAddresses array of tokens
|
|
@@ -14,10 +13,9 @@ export declare class DfStrategyV1 extends SmartContractWithAddress {
|
|
|
14
13
|
getMultipleAvailableRewards(userAddress: string, tokenAddresses: string[]): Promise<string[]>;
|
|
15
14
|
/**
|
|
16
15
|
* claim multiple token rewards for any address
|
|
17
|
-
* @param {String} fromUserAddress user that generates the tx
|
|
18
16
|
* @param {String} userAddress user address to claim
|
|
19
17
|
* @param {String} tokenAddresses array of tokens
|
|
20
18
|
* @return {Promise<ReceiptOrEstimate>}
|
|
21
19
|
*/
|
|
22
|
-
claimMultipleRewards<G extends boolean = false>(
|
|
20
|
+
claimMultipleRewards<G extends boolean = false>(userAddress: string, tokenAddresses: string[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
21
|
}
|
|
@@ -1,31 +1,28 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
-
import { ReceiptOrEstimate } from '../../@types';
|
|
2
|
+
import { ReceiptOrEstimate, AbiItem } from '../../@types';
|
|
4
3
|
/**
|
|
5
4
|
* Provides an interface for veOcean contract
|
|
6
5
|
*/
|
|
7
6
|
export declare class VeAllocate extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
9
8
|
/**
|
|
10
9
|
* set a specific percentage of veOcean to a specific nft
|
|
11
10
|
* Maximum allocated percentage is 10000, so 1% is specified as 100
|
|
12
|
-
* @param {String} userAddress user address
|
|
13
11
|
* @param {String} amount Percentage used
|
|
14
12
|
* @param {String} nft NFT address to allocate to
|
|
15
13
|
* @param {String} chainId chainId of NFT
|
|
16
14
|
* @return {Promise<ReceiptOrEstimate>}
|
|
17
15
|
*/
|
|
18
|
-
setAllocation<G extends boolean = false>(
|
|
16
|
+
setAllocation<G extends boolean = false>(amount: string, nft: string, chainId: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
19
17
|
/**
|
|
20
18
|
* set specific percetage of veOcean to multiple nfts
|
|
21
19
|
* Maximum allocated percentage is 10000, so 1% is specified as 100
|
|
22
|
-
* @param {String} userAddress user address
|
|
23
20
|
* @param {String[]} amount Array of percentages used
|
|
24
21
|
* @param {String[]} nft Array of NFT addresses
|
|
25
22
|
* @param {String[]} chainId Array of chainIds
|
|
26
23
|
* @return {Promise<ReceiptOrEstimate>}
|
|
27
24
|
*/
|
|
28
|
-
setBatchAllocation<G extends boolean = false>(
|
|
25
|
+
setBatchAllocation<G extends boolean = false>(amount: string[], nft: string[], chainId: number[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
29
26
|
/** Get totalAllocation for address
|
|
30
27
|
* @param {String} userAddress user address
|
|
31
28
|
* @return {Promise<number>}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
-
import { ReceiptOrEstimate } from '../../@types';
|
|
2
|
+
import { ReceiptOrEstimate, AbiItem } from '../../@types';
|
|
4
3
|
/**
|
|
5
4
|
* Provides an interface for veOcean contract
|
|
6
5
|
*/
|
|
7
6
|
export declare class VeFeeDistributor extends SmartContractWithAddress {
|
|
8
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
9
8
|
/**
|
|
10
9
|
* Claim fees for `userAddress`
|
|
11
10
|
* Each call to claim look at a maximum of 50 user veOCEAN points.
|
|
@@ -13,18 +12,18 @@ export declare class VeFeeDistributor extends SmartContractWithAddress {
|
|
|
13
12
|
may need to be called more than once to claim all available
|
|
14
13
|
fees. In the `Claimed` event that fires, if `claim_epoch` is
|
|
15
14
|
less than `max_epoch`, the account may claim again
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
17
16
|
* @return {Promise<ReceiptOrEstimate>}
|
|
18
17
|
*/
|
|
19
|
-
claim<G extends boolean = false>(
|
|
18
|
+
claim<G extends boolean = false>(estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
20
19
|
/**
|
|
21
20
|
* Make multiple fee claims in a single call
|
|
22
21
|
Used to claim for many accounts at once, or to make
|
|
23
22
|
multiple claims for the same address when that address
|
|
24
23
|
has significant veOCEAN history
|
|
25
|
-
* @param {String} fromUserAddress user address that sends the tx
|
|
26
24
|
* @param {String} addresses array of addresses to claim
|
|
25
|
+
* @param {Boolean} estimateGas if True, return gas estimate
|
|
27
26
|
* @return {Promise<ReceiptOrEstimate>}
|
|
28
27
|
*/
|
|
29
|
-
claimMany<G extends boolean = false>(
|
|
28
|
+
claimMany<G extends boolean = false>(addresses: string[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
30
29
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AbiItem } from 'web3-utils';
|
|
2
1
|
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
2
|
+
import { AbiItem } from '../../@types';
|
|
3
3
|
/**
|
|
4
4
|
* Provides an interface for veOcean contract
|
|
5
5
|
*/
|
|
6
6
|
export declare class VeFeeEstimate extends SmartContractWithAddress {
|
|
7
|
-
getDefaultAbi(): AbiItem
|
|
7
|
+
getDefaultAbi(): AbiItem[];
|
|
8
8
|
/**
|
|
9
9
|
* estimateClaim
|
|
10
10
|
* @param {String} userAddress user address
|