@oceanprotocol/lib 1.0.0-next.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +405 -1
  2. package/CodeExamples.md +918 -0
  3. package/README.md +12 -80
  4. package/dist/lib.js +1 -1
  5. package/dist/lib.js.map +1 -1
  6. package/dist/lib.modern.js +1 -1
  7. package/dist/lib.modern.js.map +1 -1
  8. package/dist/lib.module.js +1 -1
  9. package/dist/lib.module.js.map +1 -1
  10. package/dist/lib.umd.js +1 -1
  11. package/dist/lib.umd.js.map +1 -1
  12. package/dist/src/@types/Asset.d.ts +83 -0
  13. package/dist/src/@types/Compute.d.ts +18 -1
  14. package/dist/src/@types/DDO/DDO.d.ts +43 -0
  15. package/dist/src/@types/DDO/Event.d.ts +20 -0
  16. package/dist/src/@types/DDO/Metadata.d.ts +92 -0
  17. package/dist/src/@types/DDO/Service.d.ts +72 -6
  18. package/dist/src/{interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
  19. package/dist/src/@types/DownloadResponse.d.ts +4 -0
  20. package/dist/src/@types/Erc20.d.ts +21 -0
  21. package/dist/src/@types/Erc721.d.ts +12 -0
  22. package/dist/src/@types/FileMetadata.d.ts +29 -0
  23. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
  24. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
  25. package/dist/src/@types/Provider.d.ts +9 -0
  26. package/dist/src/@types/Router.d.ts +59 -0
  27. package/dist/src/@types/index.d.ts +6 -0
  28. package/dist/src/aquarius/Aquarius.d.ts +26 -4
  29. package/dist/src/factories/NFTFactory.d.ts +222 -13
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/models/Config.d.ts +128 -0
  32. package/dist/src/pools/Router.d.ts +193 -12
  33. package/dist/src/pools/balancer/Pool.d.ts +357 -37
  34. package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
  35. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +311 -19
  36. package/dist/src/pools/index.d.ts +2 -0
  37. package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
  38. package/dist/src/provider/Provider.d.ts +137 -14
  39. package/dist/src/tokens/Datatoken.d.ts +347 -7
  40. package/dist/src/tokens/NFT.d.ts +301 -6
  41. package/dist/src/utils/ConfigHelper.d.ts +1 -1
  42. package/dist/src/utils/Constants.d.ts +1 -0
  43. package/dist/src/utils/ContractUtils.d.ts +13 -2
  44. package/dist/src/utils/DatatokenName.d.ts +4 -0
  45. package/dist/src/utils/FetchHelper.d.ts +3 -2
  46. package/dist/src/utils/General.d.ts +4 -0
  47. package/dist/src/utils/PoolHelpers.d.ts +8 -0
  48. package/dist/src/utils/SignatureUtils.d.ts +0 -2
  49. package/dist/src/utils/TokenUtils.d.ts +69 -0
  50. package/dist/src/utils/index.d.ts +3 -0
  51. package/dist/src/utils/minAbi.d.ts +2 -0
  52. package/dist/test/TestContractHandler.d.ts +8 -36
  53. package/dist/test/config.d.ts +5 -0
  54. package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
  55. package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
  56. package/package.json +38 -34
  57. package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
  58. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  59. package/dist/src/interfaces/index.d.ts +0 -5
  60. package/dist/test/integration/config.d.ts +0 -3
  61. package/dist/test/unit/config.d.ts +0 -3
  62. package/docs/beginners_guide.md +0 -338
  63. package/docs/get-test-OCEAN.md +0 -24
  64. package/docs/overview.md +0 -394
  65. package/docs/quickstart_marketplace.md +0 -423
  66. package/docs/quickstart_simple.md +0 -272
  67. package/docs/services.md +0 -94
  68. package/docs/wallets.md +0 -98
@@ -4,6 +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 '../@types';
8
+ /**
9
+ * ERC721 ROLES
10
+ */
7
11
  interface Roles {
8
12
  manager: boolean;
9
13
  deployERC20: boolean;
@@ -11,49 +15,340 @@ interface Roles {
11
15
  store: boolean;
12
16
  }
13
17
  export declare class Nft {
14
- GASLIMIT_DEFAULT: number;
15
18
  factory721Address: string;
16
19
  factory721Abi: AbiItem | AbiItem[];
17
20
  nftAbi: AbiItem | AbiItem[];
18
21
  web3: Web3;
19
22
  startBlock: number;
20
23
  config: Config;
21
- constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
22
- estGasCreateErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number, contractInstance?: Contract): Promise<any>;
23
- createErc20(nftAddress: string, address: string, minter: string, feeManager: string, mpFeeAddress: string, feeToken: string, feeAmount: string, cap: string, name?: string, symbol?: string, templateIndex?: number): Promise<string>;
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
+ */
24
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
+ */
25
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
+ */
26
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
+ */
27
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
+ */
28
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
+ */
29
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
+ */
30
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
+ */
31
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
+ */
32
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
+ */
33
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
+ */
34
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
+ */
35
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
+ */
36
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
+ */
37
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
+ */
38
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
+ */
39
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
+ */
40
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
+ */
41
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
+ */
42
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
+ */
43
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
+ */
44
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
+ */
45
251
  safeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
46
- estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metaDataDecryptorUrl: string, metaDataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
47
- setMetadata(nftAddress: string, address: string, metadataState: number, metaDataDecryptorUrl: string, metaDataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): 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
+ */
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
+ */
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
+ */
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
+ */
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
+ */
48
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
+ */
49
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
+ */
50
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
+ */
51
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
+ */
52
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
+ */
53
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
+ */
54
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
+ */
55
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
+ */
56
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
+ */
57
352
  getTokenURI(nftAddress: string, id: number): Promise<string>;
58
353
  }
59
354
  export {};
@@ -1,6 +1,6 @@
1
1
  import Config from '../models/Config';
2
2
  export declare const configHelperNetworks: Config[];
3
3
  export declare class ConfigHelper {
4
- getAddressesFromEnv(network: string): Partial<Config>;
4
+ getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config>;
5
5
  getConfig(network: string | number, infuraProjectId?: string): Config;
6
6
  }
@@ -1 +1,2 @@
1
1
  export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
2
+ export declare const GASLIMIT_DEFAULT = 1000000;
@@ -1,9 +1,20 @@
1
1
  import Web3 from 'web3';
2
2
  import { Contract } from 'web3-eth-contract';
3
- import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../interfaces';
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 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[];
@@ -1,5 +1,6 @@
1
+ import { DownloadResponse } from '../@types/DownloadResponse';
1
2
  export declare function fetchData(url: string, opts: RequestInit): Promise<Response>;
2
- export declare function downloadFile(url: string, destination?: string, index?: number): Promise<string>;
3
+ export declare function downloadFileBrowser(url: string): Promise<void>;
4
+ export declare function downloadFile(url: string, index?: number): Promise<DownloadResponse>;
3
5
  export declare function getData(url: string): Promise<Response>;
4
6
  export declare function postData(url: string, payload: BodyInit): Promise<Response>;
5
- export declare function crossFetchGeneric(method: string, url: string, body: string, headers: any): Promise<Response>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Simple blocking sleep function
3
+ */
4
+ export declare function sleep(ms: number): Promise<unknown>;
@@ -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>;
@@ -0,0 +1,69 @@
1
+ import { Contract } from 'web3-eth-contract';
2
+ import { TransactionReceipt } from 'web3-core';
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
+ */
14
+ export declare function estApprove(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
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
+ * Estimate gas cost for transfer function
27
+ * @param {String} account
28
+ * @param {String} tokenAddress
29
+ * @param {String} recipient
30
+ * @param {String} amount
31
+ * @param {String} force
32
+ * @param {Contract} contractInstance optional contract instance
33
+ * @return {Promise<number>}
34
+ */
35
+ export declare function estTransfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string, contractInstance?: Contract): Promise<number>;
36
+ /**
37
+ * Moves amount tokens from the caller’s account to recipient.
38
+ * @param {String} account
39
+ * @param {String} tokenAddress
40
+ * @param {String} recipient
41
+ * @param {String} amount amount of ERC20 tokens (not as wei)
42
+ * @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
43
+ */
44
+ export declare function transfer(web3: Web3, account: string, tokenAddress: string, recipient: string, amount: string): Promise<TransactionReceipt | string>;
45
+ /**
46
+ * Get Allowance for any erc20
47
+ * @param {Web3} web3
48
+ * @param {String } tokenAdress
49
+ * @param {String} account
50
+ * @param {String} spender
51
+ * @param {number} tokenDecimals optional number of decimals of the token
52
+ */
53
+ export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string, tokenDecimals?: number): Promise<string>;
54
+ /**
55
+ * Get balance for any erc20
56
+ * @param {Web3} web3
57
+ * @param {String} tokenAdress
58
+ * @param {String} owner
59
+ * @param {String} spender
60
+ * @param {number} tokenDecimals optional number of decimals of the token
61
+ */
62
+ export declare function balance(web3: Web3, tokenAddress: string, account: string, tokenDecimals?: number): Promise<string>;
63
+ /**
64
+ * Get decimals for any erc20
65
+ * @param {Web3} web3
66
+ * @param {String} tokenAdress
67
+ * @return {Promise<number>} Number of decimals of the token
68
+ */
69
+ export declare function decimals(web3: Web3, tokenAddress: string): Promise<number>;
@@ -6,3 +6,6 @@ export * from './ConfigHelper';
6
6
  export * from './DdoHelpers';
7
7
  export * from './Constants';
8
8
  export * from './SignatureUtils';
9
+ export * from './TokenUtils';
10
+ export * from './General';
11
+ export * from './PoolHelpers';
@@ -0,0 +1,2 @@
1
+ import { AbiItem } from 'web3-utils/types';
2
+ export declare const minAbi: AbiItem[];
@@ -1,44 +1,16 @@
1
1
  import Web3 from 'web3';
2
- import { Contract } from 'web3-eth-contract';
3
- import { AbiItem } from 'web3-utils/types';
4
- export declare class TestContractHandler {
5
- accounts: string[];
6
- ERC721Factory: Contract;
7
- ERC20Template: Contract;
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
- poolTemplateAddress: string;
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>;
@@ -0,0 +1,5 @@
1
+ import Web3 from 'web3';
2
+ export declare const GAS_PRICE = "3000000000";
3
+ export declare const web3: Web3;
4
+ export declare const getTestConfig: (web3: Web3) => Promise<import("../src").Config>;
5
+ export declare const getAddresses: () => any;
@@ -0,0 +1 @@
1
+ export {};