@oceanprotocol/lib 1.0.0-next.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +408 -1
- package/CodeExamples.md +929 -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/File.d.ts +23 -0
- package/dist/src/@types/FileInfo.d.ts +38 -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 +8 -1
- package/dist/src/aquarius/Aquarius.d.ts +23 -1
- package/dist/src/factories/NFTFactory.d.ts +222 -13
- package/dist/src/index.d.ts +1 -1
- package/dist/src/models/Config.d.ts +128 -0
- package/dist/src/pools/Router.d.ts +193 -12
- package/dist/src/pools/balancer/Pool.d.ts +357 -32
- package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +311 -19
- 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 +127 -8
- package/dist/src/tokens/Datatoken.d.ts +347 -7
- 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 +82 -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 +43 -38
- package/dist/src/@types/FileMetadata.d.ts +0 -9
- 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
package/dist/src/tokens/NFT.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import { TransactionReceipt } from 'web3-eth';
|
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
5
|
import { MetadataProof } from '../../src/@types';
|
|
6
6
|
import { Config } from '../models/index.js';
|
|
7
|
-
import { MetadataAndTokenURI } from '
|
|
7
|
+
import { MetadataAndTokenURI } from '../@types';
|
|
8
|
+
/**
|
|
9
|
+
* ERC721 ROLES
|
|
10
|
+
*/
|
|
8
11
|
interface Roles {
|
|
9
12
|
manager: boolean;
|
|
10
13
|
deployERC20: boolean;
|
|
@@ -12,51 +15,340 @@ interface Roles {
|
|
|
12
15
|
store: boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare class Nft {
|
|
15
|
-
GASLIMIT_DEFAULT: number;
|
|
16
18
|
factory721Address: string;
|
|
17
19
|
factory721Abi: AbiItem | AbiItem[];
|
|
18
20
|
nftAbi: AbiItem | AbiItem[];
|
|
19
21
|
web3: Web3;
|
|
20
22
|
startBlock: number;
|
|
21
23
|
config: Config;
|
|
22
|
-
constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
constructor(web3: Web3, network?: string | number, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
25
|
+
/**
|
|
26
|
+
* Estimate gas cost for createERC20 token creation
|
|
27
|
+
* @param {String} nftAddress ERC721 addreess
|
|
28
|
+
* @param {String} address User address
|
|
29
|
+
* @param {String} minter User set as initial minter for the ERC20
|
|
30
|
+
* @param {String} paymentCollector initial paymentCollector for this DT
|
|
31
|
+
* @param {String} mpFeeAddress Consume marketplace fee address
|
|
32
|
+
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
|
33
|
+
* @param {String} feeAmount amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI
|
|
34
|
+
* @param {String} cap Maximum cap (Number) - will be converted to wei
|
|
35
|
+
* @param {String} name Token name
|
|
36
|
+
* @param {String} symbol Token symbol
|
|
37
|
+
* @param {Number} templateIndex NFT template index
|
|
38
|
+
* @param {Contract} nftContract optional contract instance
|
|
39
|
+
* @return {Promise<any>}
|
|
40
|
+
*/
|
|
41
|
+
estGasCreateErc20(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, contractInstance?: Contract): Promise<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Create new ERC20 datatoken - only user with ERC20Deployer permission can succeed
|
|
44
|
+
* @param {String} nftAddress ERC721 addreess
|
|
45
|
+
* @param {String} address User address
|
|
46
|
+
* @param {String} minter User set as initial minter for the ERC20
|
|
47
|
+
* @param {String} paymentCollector initial paymentCollector for this DT
|
|
48
|
+
* @param {String} mpFeeAddress Consume marketplace fee address
|
|
49
|
+
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
|
50
|
+
* @param {String} feeAmount amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI
|
|
51
|
+
* @param {String} cap Maximum cap (Number) - will be converted to wei
|
|
52
|
+
* @param {String} name Token name
|
|
53
|
+
* @param {String} symbol Token symbol
|
|
54
|
+
* @param {Number} templateIndex NFT template index
|
|
55
|
+
* @return {Promise<string>} ERC20 datatoken address
|
|
56
|
+
*/
|
|
57
|
+
createErc20(nftAddress: string, address: string, minter: string, paymentCollector: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Estimate gas cost for add manager call
|
|
60
|
+
* @param {String} nftAddress erc721 contract adress
|
|
61
|
+
* @param {String} address NFT Owner adress
|
|
62
|
+
* @param {String} manager User adress which is going to be assing manager
|
|
63
|
+
* @param {Contract} nftContract optional contract instance
|
|
64
|
+
* @return {Promise<any>}
|
|
65
|
+
*/
|
|
25
66
|
estGasAddManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
|
|
67
|
+
/**
|
|
68
|
+
* Add Manager for NFT Contract (only NFT Owner can succeed)
|
|
69
|
+
* @param {String} nftAddress erc721 contract adress
|
|
70
|
+
* @param {String} address NFT Owner adress
|
|
71
|
+
* @param {String} manager User adress which is going to be assing manager
|
|
72
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
73
|
+
*/
|
|
26
74
|
addManager(nftAddress: string, address: string, manager: string): Promise<any>;
|
|
75
|
+
/**
|
|
76
|
+
* Estimate gas cost for removeManager method
|
|
77
|
+
* @param {String} nftAddress erc721 contract adress
|
|
78
|
+
* @param {String} address NFT Owner adress
|
|
79
|
+
* @param {String} manager User adress which is going to be removed as manager
|
|
80
|
+
* @param {Contract} nftContract optional contract instance
|
|
81
|
+
* @return {Promise<any>}
|
|
82
|
+
*/
|
|
27
83
|
estGasRemoveManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* Removes a specific manager for NFT Contract (only NFT Owner can succeed)
|
|
86
|
+
* @param {String} nftAddress erc721 contract adress
|
|
87
|
+
* @param {String} address NFT Owner adress
|
|
88
|
+
* @param {String} manager User adress which is going to be removed as manager
|
|
89
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
90
|
+
*/
|
|
28
91
|
removeManager(nftAddress: string, address: string, manager: string): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Estimate gas cost for addToCreateERC20List method
|
|
94
|
+
* @param {String} nftAddress erc721 contract adress
|
|
95
|
+
* @param {String} address NFT Manager adress
|
|
96
|
+
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
|
97
|
+
* @param {Contract} nftContract optional contract instance
|
|
98
|
+
* @return {Promise<any>}
|
|
99
|
+
*/
|
|
29
100
|
estGasAddErc20Deployer(nftAddress: string, address: string, erc20Deployer: string, contractInstance?: Contract): Promise<any>;
|
|
101
|
+
/**
|
|
102
|
+
* Add ERC20Deployer permission - only Manager can succeed
|
|
103
|
+
* @param {String} nftAddress erc721 contract adress
|
|
104
|
+
* @param {String} address NFT Manager adress
|
|
105
|
+
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
|
106
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
107
|
+
*/
|
|
30
108
|
addErc20Deployer(nftAddress: string, address: string, erc20Deployer: string): Promise<TransactionReceipt>;
|
|
109
|
+
/**
|
|
110
|
+
* Estimate gas cost for removeFromCreateERC20List method
|
|
111
|
+
* @param {String} nftAddress erc721 contract adress
|
|
112
|
+
* @param {String} address NFT Manager adress
|
|
113
|
+
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
|
114
|
+
* @param {Contract} nftContract optional contract instance
|
|
115
|
+
* @return {Promise<any>}
|
|
116
|
+
*/
|
|
31
117
|
estGasRemoveErc20Deployer(nftAddress: string, address: string, erc20Deployer: string, contractInstance?: Contract): Promise<any>;
|
|
118
|
+
/**
|
|
119
|
+
* Remove ERC20Deployer permission - only Manager can succeed
|
|
120
|
+
* @param {String} nftAddress erc721 contract adress
|
|
121
|
+
* @param {String} address NFT Manager adress
|
|
122
|
+
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
|
123
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
124
|
+
*/
|
|
32
125
|
removeErc20Deployer(nftAddress: string, address: string, erc20Deployer: string): Promise<TransactionReceipt>;
|
|
126
|
+
/**
|
|
127
|
+
* Estimate gas cost for addToMetadataList method
|
|
128
|
+
* @param {String} nftAddress erc721 contract adress
|
|
129
|
+
* @param {String} address NFT Manager adress
|
|
130
|
+
* @param {String} metadataUpdater User adress which is going to have Metadata Updater permission
|
|
131
|
+
* @param {Contract} nftContract optional contract instance
|
|
132
|
+
* @return {Promise<any>}
|
|
133
|
+
*/
|
|
33
134
|
estGasAddMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
135
|
+
/**
|
|
136
|
+
* Add Metadata Updater permission - only Manager can succeed
|
|
137
|
+
* @param {String} nftAddress erc721 contract adress
|
|
138
|
+
* @param {String} address NFT Manager adress
|
|
139
|
+
* @param {String} metadataUpdater User adress which is going to have Metadata Updater permission
|
|
140
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
141
|
+
*/
|
|
34
142
|
addMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string): Promise<TransactionReceipt>;
|
|
143
|
+
/**
|
|
144
|
+
* Estimate gas cost for removeFromMetadataList method
|
|
145
|
+
* @param {String} nftAddress erc721 contract adress
|
|
146
|
+
* @param {String} address NFT Manager adress
|
|
147
|
+
* @param {String} metadataUpdater Address of the user to be revoked Metadata updater Permission
|
|
148
|
+
* @param {Contract} nftContract optional contract instance
|
|
149
|
+
* @return {Promise<any>}
|
|
150
|
+
*/
|
|
35
151
|
esGasRemoveMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
152
|
+
/**
|
|
153
|
+
* Remove Metadata Updater permission - only Manager can succeed
|
|
154
|
+
* @param {String} nftAddress erc721 contract adress
|
|
155
|
+
* @param {String} address NFT Manager adress
|
|
156
|
+
* @param {String} metadataUpdater Address of the user to be revoked Metadata updater Permission
|
|
157
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
158
|
+
*/
|
|
36
159
|
removeMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string): Promise<TransactionReceipt>;
|
|
160
|
+
/**
|
|
161
|
+
* Estimate gas cost for addTo725StoreList method
|
|
162
|
+
* @param {String} nftAddress erc721 contract adress
|
|
163
|
+
* @param {String} address NFT Manager adress
|
|
164
|
+
* @param {String} storeUpdater User adress which is going to have Store Updater permission
|
|
165
|
+
* @param {Contract} nftContract optional contract instance
|
|
166
|
+
* @return {Promise<any>}
|
|
167
|
+
*/
|
|
37
168
|
estGasAddStoreUpdater(nftAddress: string, address: string, storeUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
169
|
+
/**
|
|
170
|
+
* Add Store Updater permission - only Manager can succeed
|
|
171
|
+
* @param {String} nftAddress erc721 contract adress
|
|
172
|
+
* @param {String} address NFT Manager adress
|
|
173
|
+
* @param {String} storeUpdater User adress which is going to have Store Updater permission
|
|
174
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
175
|
+
*/
|
|
38
176
|
addStoreUpdater(nftAddress: string, address: string, storeUpdater: string): Promise<TransactionReceipt>;
|
|
177
|
+
/**
|
|
178
|
+
* Estimate gas cost for removeFrom725StoreList method
|
|
179
|
+
* @param {String} nftAddress erc721 contract adress
|
|
180
|
+
* @param {String} address NFT Manager adress
|
|
181
|
+
* @param {String} storeUpdater Address of the user to be revoked Store Updater Permission
|
|
182
|
+
* @param {Contract} nftContract optional contract instance
|
|
183
|
+
* @return {Promise<any>}
|
|
184
|
+
*/
|
|
39
185
|
estGasRemoveStoreUpdater(nftAddress: string, address: string, storeUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
186
|
+
/**
|
|
187
|
+
* Remove Store Updater permission - only Manager can succeed
|
|
188
|
+
* @param {String} nftAddress erc721 contract adress
|
|
189
|
+
* @param {String} address NFT Manager adress
|
|
190
|
+
* @param {String} storeUpdater Address of the user to be revoked Store Updater Permission
|
|
191
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
192
|
+
*/
|
|
40
193
|
removeStoreUpdater(nftAddress: string, address: string, storeUpdater: string): Promise<TransactionReceipt>;
|
|
194
|
+
/**
|
|
195
|
+
* Estimate gas cost for cleanPermissions method
|
|
196
|
+
* @param {String} nftAddress erc721 contract adress
|
|
197
|
+
* @param {String} address NFT Owner adress
|
|
198
|
+
* @param {Contract} nftContract optional contract instance
|
|
199
|
+
* @return {Promise<any>}
|
|
200
|
+
*/
|
|
41
201
|
estGasCleanPermissions(nftAddress: string, address: string, contractInstance?: Contract): Promise<any>;
|
|
202
|
+
/**
|
|
203
|
+
* This function allows to remove all ROLES at erc721 level: Managers, ERC20Deployer, MetadataUpdater, StoreUpdater
|
|
204
|
+
* Even NFT Owner has to readd himself as Manager
|
|
205
|
+
* Permissions at erc20 level stay.
|
|
206
|
+
* Only NFT Owner can call it.
|
|
207
|
+
* @param {String} nftAddress erc721 contract adress
|
|
208
|
+
* @param {String} address NFT Owner adress
|
|
209
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
210
|
+
*/
|
|
42
211
|
cleanPermissions(nftAddress: string, address: string): Promise<TransactionReceipt>;
|
|
212
|
+
/**
|
|
213
|
+
* Estimate gas cost for transfer NFT method
|
|
214
|
+
* @param {String} nftAddress erc721 contract adress
|
|
215
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
216
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
217
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
218
|
+
* @param {Contract} nftContract optional contract instance
|
|
219
|
+
* @return {Promise<any>}
|
|
220
|
+
*/
|
|
43
221
|
estGasTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
|
|
222
|
+
/**
|
|
223
|
+
* Transfers the NFT
|
|
224
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
225
|
+
* @param {String} nftAddress erc721 contract adress
|
|
226
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
227
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
228
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
229
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
230
|
+
*/
|
|
44
231
|
transferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
232
|
+
/**
|
|
233
|
+
* Estimate gas cost for safeTransfer NFT method
|
|
234
|
+
* @param {String} nftAddress erc721 contract adress
|
|
235
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
236
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
237
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
238
|
+
* @param {Contract} nftContract optional contract instance
|
|
239
|
+
* @return {Promise<any>}
|
|
240
|
+
*/
|
|
45
241
|
estGasSafeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
|
|
242
|
+
/**
|
|
243
|
+
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
|
244
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
245
|
+
* @param {String} nftAddress erc721 contract adress
|
|
246
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
247
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
248
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
249
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
250
|
+
*/
|
|
46
251
|
safeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
252
|
+
/**
|
|
253
|
+
* Estimate gas cost for setMetadata method
|
|
254
|
+
* @param {String} nftAddress erc721 contract adress
|
|
255
|
+
* @param {String} metadataUpdater metadataUpdater address
|
|
256
|
+
* @param {Number} metadataState User which will receive the NFT, will also be set as Manager
|
|
257
|
+
* @param {String} metadataDecryptorUrl
|
|
258
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
259
|
+
* @param {Contract} nftContract optional contract instance
|
|
260
|
+
* @return {Promise<any>}
|
|
261
|
+
*/
|
|
47
262
|
estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
|
|
263
|
+
/**
|
|
264
|
+
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
|
265
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
266
|
+
* @param {String} nftAddress erc721 contract adress
|
|
267
|
+
* @param {String} address Caller address NFT Owner adress
|
|
268
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
269
|
+
*/
|
|
48
270
|
setMetadata(nftAddress: string, address: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): Promise<TransactionReceipt>;
|
|
271
|
+
/**
|
|
272
|
+
* Estimate gas cost for setMetadata method
|
|
273
|
+
* @param {String} nftAddress erc721 contract adress
|
|
274
|
+
* @param {String} metadataUpdater metadataUpdater address
|
|
275
|
+
* @param {MetaDataAndTokenURI} metadataAndTokenURI metaDataAndTokenURI object
|
|
276
|
+
* @param {Contract} nftContract optional contract instance
|
|
277
|
+
* @return {Promise<any>}
|
|
278
|
+
*/
|
|
49
279
|
estGasSetMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI, contractInstance?: Contract): Promise<any>;
|
|
280
|
+
/**
|
|
281
|
+
* Helper function to improve UX sets both MetaData & TokenURI in one tx
|
|
282
|
+
* @param {String} nftAddress erc721 contract adress
|
|
283
|
+
* @param {String} address Caller address
|
|
284
|
+
* @param {MetadataAndTokenURI} metadataAndTokenURI metaDataAndTokenURI object
|
|
285
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
286
|
+
*/
|
|
50
287
|
setMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI): Promise<TransactionReceipt>;
|
|
288
|
+
/**
|
|
289
|
+
* Estimate gas cost for setMetadataState method
|
|
290
|
+
* @param {String} nftAddress erc721 contract adress
|
|
291
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
292
|
+
* @param {Number} metadataState new metadata state
|
|
293
|
+
* @param {Contract} nftContract optional contract instance
|
|
294
|
+
* @return {Promise<any>}
|
|
295
|
+
*/
|
|
51
296
|
estGasSetMetadataState(nftAddress: string, metadataUpdater: string, metadataState: number, contractInstance?: Contract): Promise<any>;
|
|
297
|
+
/**
|
|
298
|
+
* setMetadataState Used for updating the metadata State
|
|
299
|
+
* @param {String} nftAddress erc721 contract adress
|
|
300
|
+
* @param {String} address Caller address => metadata updater
|
|
301
|
+
* @param {Number} metadataState new metadata state
|
|
302
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
303
|
+
*/
|
|
52
304
|
setMetadataState(nftAddress: string, address: string, metadataState: number): Promise<TransactionReceipt>;
|
|
305
|
+
/** Estimate gas cost for setTokenURI method
|
|
306
|
+
* @param nftAddress erc721 contract adress
|
|
307
|
+
* @param address user adress
|
|
308
|
+
* @param data input data for TokenURI
|
|
309
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
310
|
+
*/
|
|
53
311
|
estSetTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
|
|
312
|
+
/** set TokenURI on an nft
|
|
313
|
+
* @param nftAddress erc721 contract adress
|
|
314
|
+
* @param address user adress
|
|
315
|
+
* @param data input data for TokenURI
|
|
316
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
317
|
+
*/
|
|
54
318
|
setTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
|
|
319
|
+
/** Get Owner
|
|
320
|
+
* @param {String} nftAddress erc721 contract adress
|
|
321
|
+
* @return {Promise<string>} string
|
|
322
|
+
*/
|
|
55
323
|
getNftOwner(nftAddress: string): Promise<string>;
|
|
324
|
+
/** Get users NFT Permissions
|
|
325
|
+
* @param {String} nftAddress erc721 contract adress
|
|
326
|
+
* @param {String} address user adress
|
|
327
|
+
* @return {Promise<Roles>}
|
|
328
|
+
*/
|
|
56
329
|
getNftPermissions(nftAddress: string, address: string): Promise<Roles>;
|
|
330
|
+
/** Get users Metadata, return Metadata details
|
|
331
|
+
* @param {String} nftAddress erc721 contract adress
|
|
332
|
+
* @return {Promise<Objecta>}
|
|
333
|
+
*/
|
|
57
334
|
getMetadata(nftAddress: string): Promise<Object>;
|
|
335
|
+
/** Get users ERC20Deployer role
|
|
336
|
+
* @param {String} nftAddress erc721 contract adress
|
|
337
|
+
* @param {String} address user adress
|
|
338
|
+
* @return {Promise<Roles>}
|
|
339
|
+
*/
|
|
58
340
|
isErc20Deployer(nftAddress: string, address: string): Promise<boolean>;
|
|
341
|
+
/** Gets data at a given `key`
|
|
342
|
+
* @param {String} nftAddress erc721 contract adress
|
|
343
|
+
* @param {String} key the key which value to retrieve
|
|
344
|
+
* @return {Promise<string>} The data stored at the key
|
|
345
|
+
*/
|
|
59
346
|
getData(nftAddress: string, key: string): Promise<string>;
|
|
347
|
+
/** Gets data at a given `key`
|
|
348
|
+
* @param {String} nftAddress erc721 contract adress
|
|
349
|
+
* @param {String} id
|
|
350
|
+
* @return {Promise<string>} The data stored at the key
|
|
351
|
+
*/
|
|
60
352
|
getTokenURI(nftAddress: string, id: number): Promise<string>;
|
|
61
353
|
}
|
|
62
354
|
export {};
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { Contract } from 'web3-eth-contract';
|
|
3
|
-
import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '
|
|
3
|
+
import { Erc20CreateParams, FreCreationParams, FreOrderParams, PoolCreationParams } from '../@types';
|
|
4
4
|
import { Config } from '../models';
|
|
5
5
|
export declare function setContractDefaults(contract: Contract, config: Config): Contract;
|
|
6
6
|
export declare function getFairGasPrice(web3: Web3, config: Config): Promise<string>;
|
|
7
7
|
export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
|
|
8
|
+
export declare function getFreOrderParams(freParams: FreOrderParams): any;
|
|
8
9
|
export declare function getFreCreationParams(freParams: FreCreationParams): any;
|
|
9
|
-
export declare function getPoolCreationParams(poolParams: PoolCreationParams): any
|
|
10
|
-
export declare function unitsToAmount(web3: Web3, token: string, amount: string): Promise<string>;
|
|
11
|
-
export declare function amountToUnits(web3: Web3, token: string, amount: string): Promise<string>;
|
|
10
|
+
export declare function getPoolCreationParams(web3: Web3, poolParams: PoolCreationParams): Promise<any>;
|
|
11
|
+
export declare function unitsToAmount(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
12
|
+
export declare function amountToUnits(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Estimates the gas used when a function would be executed on chain
|
|
15
|
+
* @param {string} from account that calls the function
|
|
16
|
+
* @param {Function} functionToEstimateGas function that we need to estimate the gas
|
|
17
|
+
* @param {...any[]} args arguments of the function
|
|
18
|
+
* @return {Promise<number>} gas cost of the function
|
|
19
|
+
*/
|
|
20
|
+
export declare function estimateGas(from: string, functionToEstimateGas: Function, ...args: any[]): Promise<any>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate new datatoken name & symbol from a word list
|
|
3
|
+
* @return {<{ name: String; symbol: String }>} datatoken name & symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
|
|
4
|
+
*/
|
|
1
5
|
export declare function generateDtName(wordList?: {
|
|
2
6
|
nouns: string[];
|
|
3
7
|
adjectives: string[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Decimal from 'decimal.js';
|
|
2
|
+
import { Pool } from '..';
|
|
3
|
+
export declare function calcMaxExactOut(balance: string): Decimal;
|
|
4
|
+
export declare function calcMaxExactIn(balance: string): Decimal;
|
|
5
|
+
export declare function getMaxSwapExactOut(poolInstance: Pool, poolAddress: string, tokenAddress: string): Promise<Decimal>;
|
|
6
|
+
export declare function getMaxSwapExactIn(poolInstance: Pool, poolAddress: string, tokenAddress: string): Promise<Decimal>;
|
|
7
|
+
export declare function getMaxAddLiquidity(poolInstance: Pool, poolAddress: string, tokenAddress: string): Promise<Decimal>;
|
|
8
|
+
export declare function getMaxRemoveLiquidity(poolInstance: Pool, poolAddress: string, tokenAddress: string): Promise<Decimal>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
export declare function signText(web3: Web3, text: string, publicKey: string, password?: string): Promise<string>;
|
|
3
2
|
export declare function signHash(web3: Web3, message: string, address: string): Promise<{
|
|
4
3
|
v: string;
|
|
5
4
|
r: string;
|
|
6
5
|
s: string;
|
|
7
6
|
}>;
|
|
8
|
-
export declare function signWithHash(web3: Web3, text: string, publicKey: string, password?: string): Promise<string>;
|
|
@@ -1,7 +1,86 @@
|
|
|
1
1
|
import { Contract } from 'web3-eth-contract';
|
|
2
2
|
import { TransactionReceipt } from 'web3-core';
|
|
3
3
|
import Web3 from 'web3';
|
|
4
|
+
/**
|
|
5
|
+
* Estimate gas cost for approval function
|
|
6
|
+
* @param {String} account
|
|
7
|
+
* @param {String} tokenAddress
|
|
8
|
+
* @param {String} spender
|
|
9
|
+
* @param {String} amount
|
|
10
|
+
* @param {String} force
|
|
11
|
+
* @param {Contract} contractInstance optional contract instance
|
|
12
|
+
* @return {Promise<number>}
|
|
13
|
+
*/
|
|
4
14
|
export declare function estApprove(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Approve spender to spent amount tokens
|
|
17
|
+
* @param {String} account
|
|
18
|
+
* @param {String} tokenAddress
|
|
19
|
+
* @param {String} spender
|
|
20
|
+
* @param {String} amount amount of ERC20 tokens (always expressed as wei)
|
|
21
|
+
* @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
|
22
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
23
|
+
*/
|
|
24
|
+
export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, tokenDecimals?: number): Promise<TransactionReceipt | string>;
|
|
25
|
+
/**
|
|
26
|
+
* Approve spender to spent amount tokens
|
|
27
|
+
* @param {String} account
|
|
28
|
+
* @param {String} tokenAddress
|
|
29
|
+
* @param {String} spender
|
|
30
|
+
* @param {String} amount amount of ERC20 tokens (always expressed as wei)
|
|
31
|
+
* @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
|
32
|
+
*/
|
|
33
|
+
export declare function approveWei(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
34
|
+
/**
|
|
35
|
+
* Estimate gas cost for transfer function
|
|
36
|
+
* @param {String} account
|
|
37
|
+
* @param {String} tokenAddress
|
|
38
|
+
* @param {String} recipient
|
|
39
|
+
* @param {String} amount
|
|
40
|
+
* @param {String} force
|
|
41
|
+
* @param {Contract} contractInstance optional contract instance
|
|
42
|
+
* @return {Promise<number>}
|
|
43
|
+
*/
|
|
44
|
+
export declare function estTransfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Moves amount tokens from the caller’s account to recipient.
|
|
47
|
+
* @param {String} account
|
|
48
|
+
* @param {String} tokenAddress
|
|
49
|
+
* @param {String} recipient
|
|
50
|
+
* @param {String} amount amount of ERC20 tokens (not as wei)
|
|
51
|
+
* @param {String} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
|
|
52
|
+
*/
|
|
53
|
+
export declare function transfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string): Promise<TransactionReceipt | string>;
|
|
54
|
+
/**
|
|
55
|
+
* Get Allowance for any erc20
|
|
56
|
+
* @param {Web3} web3
|
|
57
|
+
* @param {String } tokenAdress
|
|
58
|
+
* @param {String} account
|
|
59
|
+
* @param {String} spender
|
|
60
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
61
|
+
*/
|
|
62
|
+
export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string, tokenDecimals?: number): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Get Allowance for any erc20
|
|
65
|
+
* @param {Web3} web3
|
|
66
|
+
* @param {String } tokenAdress
|
|
67
|
+
* @param {String} account
|
|
68
|
+
* @param {String} spender
|
|
69
|
+
*/
|
|
70
|
+
export declare function allowanceWei(web3: Web3, tokenAddress: string, account: string, spender: string, tokenDecimals?: number): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Get balance for any erc20
|
|
73
|
+
* @param {Web3} web3
|
|
74
|
+
* @param {String} tokenAdress
|
|
75
|
+
* @param {String} owner
|
|
76
|
+
* @param {String} spender
|
|
77
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
78
|
+
*/
|
|
79
|
+
export declare function balance(web3: Web3, tokenAddress: string, account: string, tokenDecimals?: number): Promise<string>;
|
|
80
|
+
/**
|
|
81
|
+
* Get decimals for any erc20
|
|
82
|
+
* @param {Web3} web3
|
|
83
|
+
* @param {String} tokenAdress
|
|
84
|
+
* @return {Promise<number>} Number of decimals of the token
|
|
85
|
+
*/
|
|
86
|
+
export declare function decimals(web3: Web3, tokenAddress: string): Promise<number>;
|
|
@@ -1,44 +1,16 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
ERC721Template: Contract;
|
|
9
|
-
Router: Contract;
|
|
10
|
-
SideStaking: Contract;
|
|
11
|
-
FixedRate: Contract;
|
|
12
|
-
Dispenser: Contract;
|
|
13
|
-
OPFCollector: Contract;
|
|
14
|
-
PoolTemplate: Contract;
|
|
15
|
-
MockERC20: Contract;
|
|
16
|
-
MockOcean: Contract;
|
|
17
|
-
ERC721FactoryBytecode: string;
|
|
18
|
-
ERC20TemplateBytecode: string;
|
|
19
|
-
ERC721TemplateBytecode: string;
|
|
20
|
-
RouterBytecode: string;
|
|
21
|
-
SideStakingBytecode: string;
|
|
22
|
-
FixedRateBytecode: string;
|
|
23
|
-
DispenserBytecode: string;
|
|
24
|
-
PoolTemplateBytecode: string;
|
|
25
|
-
OPFCollectorBytecode: string;
|
|
26
|
-
MockERC20Bytecode: string;
|
|
27
|
-
OPFBytecode: string;
|
|
28
|
-
factory721Address: string;
|
|
29
|
-
template721Address: string;
|
|
30
|
-
template20Address: string;
|
|
2
|
+
export interface Addresses {
|
|
3
|
+
opfCommunityFeeCollectorAddress: string;
|
|
4
|
+
poolTemplateAddress: string;
|
|
5
|
+
erc20TemplateAddress: string;
|
|
6
|
+
erc721TemplateAddress: string;
|
|
7
|
+
oceanAddress: string;
|
|
31
8
|
routerAddress: string;
|
|
32
9
|
sideStakingAddress: string;
|
|
33
10
|
fixedRateAddress: string;
|
|
34
11
|
dispenserAddress: string;
|
|
35
|
-
|
|
36
|
-
opfCollectorAddress: string;
|
|
37
|
-
oceanAddress: string;
|
|
12
|
+
erc721FactoryAddress: string;
|
|
38
13
|
daiAddress: string;
|
|
39
14
|
usdcAddress: string;
|
|
40
|
-
web3: Web3;
|
|
41
|
-
constructor(web3: Web3, ERC721TemplateABI: AbiItem | AbiItem[], ERC20TemplateABI: AbiItem | AbiItem[], PoolTemplateABI?: AbiItem | AbiItem[], ERC721FactoryABI?: AbiItem | AbiItem[], RouterABI?: AbiItem | AbiItem[], SideStakingABI?: AbiItem | AbiItem[], FixedRateABI?: AbiItem | AbiItem[], DispenserABI?: AbiItem | AbiItem[], OPFABI?: AbiItem | AbiItem[], template721Bytecode?: string, template20Bytecode?: string, poolTemplateBytecode?: string, factory721Bytecode?: string, routerBytecode?: string, sideStakingBytecode?: string, fixedRateBytecode?: string, dispenserBytecode?: string, opfBytecode?: string);
|
|
42
|
-
getAccounts(): Promise<string[]>;
|
|
43
|
-
deployContracts(owner: string, routerABI?: AbiItem | AbiItem[]): Promise<void>;
|
|
44
15
|
}
|
|
16
|
+
export declare const deployContracts: (web3: Web3, owner: string) => Promise<Addresses>;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|