@oceanprotocol/lib 1.0.0-next.1 → 1.0.0-next.13
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 +111 -1
- 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 +119 -0
- package/dist/src/{src/@types → @types}/Compute.d.ts +17 -0
- package/dist/src/{src/@types → @types}/DDO/Credentials.d.ts +0 -0
- package/dist/src/@types/DDO/DDO.d.ts +58 -0
- package/dist/src/@types/DDO/Event.d.ts +27 -0
- package/dist/src/@types/DDO/Metadata.d.ts +126 -0
- package/dist/src/@types/DDO/Service.d.ts +124 -0
- package/dist/src/{src/interfaces/DispenserInterface.d.ts → @types/Dispenser.d.ts} +0 -0
- package/dist/src/@types/DownloadResponse.d.ts +4 -0
- package/dist/src/{src/interfaces/Erc20Interface.d.ts → @types/Erc20.d.ts} +0 -0
- package/dist/src/@types/Erc721.d.ts +12 -0
- package/dist/src/@types/FileMetadata.d.ts +38 -0
- package/dist/src/{src/interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +1 -1
- package/dist/src/{src/interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +4 -4
- package/dist/src/{src/@types → @types}/Provider.d.ts +3 -2
- package/dist/src/@types/Router.d.ts +59 -0
- package/dist/src/{src/@types → @types}/index.d.ts +6 -0
- package/dist/src/aquarius/Aquarius.d.ts +32 -0
- package/dist/src/{src/aquarius → aquarius}/index.d.ts +0 -0
- package/dist/src/factories/NFTFactory.d.ts +273 -0
- package/dist/src/{src/factories → factories}/index.d.ts +0 -0
- package/dist/src/{src/index.d.ts → index.d.ts} +0 -1
- package/dist/src/models/Config.d.ts +166 -0
- package/dist/src/{src/models → models}/index.d.ts +0 -0
- package/dist/src/pools/Router.d.ts +229 -0
- package/dist/src/pools/balancer/Pool.d.ts +365 -0
- package/dist/src/{src/pools → pools}/balancer/index.d.ts +0 -0
- package/dist/src/pools/dispenser/Dispenser.d.ts +146 -0
- package/dist/src/{src/pools → pools}/dispenser/index.d.ts +0 -0
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +375 -0
- package/dist/src/{src/pools → pools}/fixedRate/index.d.ts +0 -0
- package/dist/src/{src/pools → pools}/index.d.ts +0 -0
- package/dist/src/pools/ssContracts/SideStaking.d.ts +132 -0
- package/dist/src/{src/pools → pools}/ssContracts/index.d.ts +0 -0
- package/dist/src/provider/Provider.d.ts +147 -0
- package/dist/src/{src/provider → provider}/index.d.ts +0 -0
- package/dist/src/tokens/Datatoken.d.ts +362 -0
- package/dist/src/tokens/NFT.d.ts +355 -0
- package/dist/src/{src/tokens → tokens}/index.d.ts +0 -0
- package/dist/src/{src/utils → utils}/ConfigHelper.d.ts +1 -1
- package/dist/src/{src/utils → utils}/Constants.d.ts +1 -0
- package/dist/src/utils/ContractUtils.d.ts +11 -0
- package/dist/src/{src/utils → utils}/ConversionTypeHelper.d.ts +0 -0
- package/dist/src/utils/DatatokenName.d.ts +11 -0
- package/dist/src/{src/utils → utils}/DdoHelpers.d.ts +0 -0
- package/dist/src/{src/utils → utils}/FetchHelper.d.ts +3 -2
- package/dist/src/utils/General.d.ts +4 -0
- package/dist/src/{src/utils → utils}/Logger.d.ts +0 -0
- package/dist/src/{src/utils → utils}/SignatureUtils.d.ts +0 -0
- package/dist/src/utils/TokenUtils.d.ts +39 -0
- package/dist/src/{src/utils → utils}/index.d.ts +3 -2
- package/dist/src/utils/minAbi.d.ts +2 -0
- package/dist/{src/test → test}/TestContractHandler.d.ts +0 -0
- package/dist/{src/test → test}/integration/ComputeFlow.test.d.ts +0 -0
- package/dist/{src/test → test}/integration/Provider.test.d.ts +0 -0
- package/dist/{src/test → test}/integration/PublishFlows.test.d.ts +0 -0
- package/dist/{src/test → test}/integration/SimplePublishConsumeFlow.test.d.ts +0 -0
- package/dist/{src/test → test}/integration/config.d.ts +0 -0
- package/dist/{src/test → test}/unit/NftFactory.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/config.d.ts +0 -0
- package/dist/{src/test → test}/unit/pools/Router.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/pools/balancer/Pool.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/pools/dispenser/Dispenser.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/pools/fixedRate/FixedRateExchange.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/pools/ssContracts/SideStaking.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/tokens/Datatoken.test.d.ts +0 -0
- package/dist/{src/test → test}/unit/tokens/Nft.test.d.ts +0 -0
- package/docs/beginners_guide.md +4 -4
- package/docs/overview.md +100 -9
- package/docs/quickstart_marketplace.md +34 -33
- package/docs/quickstart_simple.md +18 -16
- package/package.json +23 -22
- package/dist/src/src/@types/Asset.d.ts +0 -36
- package/dist/src/src/@types/DDO/DDO.d.ts +0 -15
- package/dist/src/src/@types/DDO/Event.d.ts +0 -7
- package/dist/src/src/@types/DDO/Metadata.d.ts +0 -38
- package/dist/src/src/@types/DDO/Service.d.ts +0 -28
- package/dist/src/src/@types/FileMetadata.d.ts +0 -8
- package/dist/src/src/aquarius/Aquarius.d.ts +0 -10
- package/dist/src/src/factories/NFTFactory.d.ts +0 -70
- package/dist/src/src/interfaces/RouterInterface.d.ts +0 -12
- package/dist/src/src/interfaces/index.d.ts +0 -5
- package/dist/src/src/models/Config.d.ts +0 -34
- package/dist/src/src/pools/Router.d.ts +0 -46
- package/dist/src/src/pools/balancer/Pool.d.ts +0 -73
- package/dist/src/src/pools/dispenser/Dispenser.d.ts +0 -37
- package/dist/src/src/pools/fixedRate/FixedRateExchange.d.ts +0 -95
- package/dist/src/src/pools/ssContracts/SideStaking.d.ts +0 -28
- package/dist/src/src/provider/Provider.d.ts +0 -31
- package/dist/src/src/tokens/Datatoken.d.ts +0 -77
- package/dist/src/src/tokens/NFT.d.ts +0 -57
- package/dist/src/src/utils/ContractParams.d.ts +0 -4
- package/dist/src/src/utils/DatatokenName.d.ts +0 -7
- package/dist/src/src/utils/GasUtils.d.ts +0 -2
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { AbiItem } from 'web3-utils';
|
|
3
|
+
import { TransactionReceipt } from 'web3-eth';
|
|
4
|
+
import { Contract } from 'web3-eth-contract';
|
|
5
|
+
import { MetadataProof } from '../../src/@types';
|
|
6
|
+
import { Config } from '../models/index.js';
|
|
7
|
+
import { MetadataAndTokenURI } from '../@types';
|
|
8
|
+
/**
|
|
9
|
+
* ERC721 ROLES
|
|
10
|
+
*/
|
|
11
|
+
interface Roles {
|
|
12
|
+
manager: boolean;
|
|
13
|
+
deployERC20: boolean;
|
|
14
|
+
updateMetadata: boolean;
|
|
15
|
+
store: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class Nft {
|
|
18
|
+
GASLIMIT_DEFAULT: number;
|
|
19
|
+
factory721Address: string;
|
|
20
|
+
factory721Abi: AbiItem | AbiItem[];
|
|
21
|
+
nftAbi: AbiItem | AbiItem[];
|
|
22
|
+
web3: Web3;
|
|
23
|
+
startBlock: number;
|
|
24
|
+
config: Config;
|
|
25
|
+
constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
26
|
+
/**
|
|
27
|
+
* Estimate gas cost for createERC20 token creation
|
|
28
|
+
* @param {String} nftAddress ERC721 addreess
|
|
29
|
+
* @param {String} address User address
|
|
30
|
+
* @param {String} minter User set as initial minter for the ERC20
|
|
31
|
+
* @param {String} feeManager initial feeManager for this DT
|
|
32
|
+
* @param {String} mpFeeAddress Consume marketplace fee address
|
|
33
|
+
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
|
34
|
+
* @param {String} feeAmount amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI
|
|
35
|
+
* @param {String} cap Maximum cap (Number) - will be converted to wei
|
|
36
|
+
* @param {String} name Token name
|
|
37
|
+
* @param {String} symbol Token symbol
|
|
38
|
+
* @param {Number} templateIndex NFT template index
|
|
39
|
+
* @param {Contract} nftContract optional contract instance
|
|
40
|
+
* @return {Promise<any>}
|
|
41
|
+
*/
|
|
42
|
+
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>;
|
|
43
|
+
/**
|
|
44
|
+
* Create new ERC20 datatoken - only user with ERC20Deployer permission can succeed
|
|
45
|
+
* @param {String} nftAddress ERC721 addreess
|
|
46
|
+
* @param {String} address User address
|
|
47
|
+
* @param {String} minter User set as initial minter for the ERC20
|
|
48
|
+
* @param {String} feeManager initial feeManager for this DT
|
|
49
|
+
* @param {String} mpFeeAddress Consume marketplace fee address
|
|
50
|
+
* @param {String} feeToken address of the token marketplace wants to add fee on top
|
|
51
|
+
* @param {String} feeAmount amount of feeToken to be transferred to mpFeeAddress on top, will be converted to WEI
|
|
52
|
+
* @param {String} cap Maximum cap (Number) - will be converted to wei
|
|
53
|
+
* @param {String} name Token name
|
|
54
|
+
* @param {String} symbol Token symbol
|
|
55
|
+
* @param {Number} templateIndex NFT template index
|
|
56
|
+
* @return {Promise<string>} ERC20 datatoken address
|
|
57
|
+
*/
|
|
58
|
+
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>;
|
|
59
|
+
/**
|
|
60
|
+
* Estimate gas cost for add manager call
|
|
61
|
+
* @param {String} nftAddress erc721 contract adress
|
|
62
|
+
* @param {String} address NFT Owner adress
|
|
63
|
+
* @param {String} manager User adress which is going to be assing manager
|
|
64
|
+
* @param {Contract} nftContract optional contract instance
|
|
65
|
+
* @return {Promise<any>}
|
|
66
|
+
*/
|
|
67
|
+
estGasAddManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
|
|
68
|
+
/**
|
|
69
|
+
* Add Manager for NFT Contract (only NFT Owner can succeed)
|
|
70
|
+
* @param {String} nftAddress erc721 contract adress
|
|
71
|
+
* @param {String} address NFT Owner adress
|
|
72
|
+
* @param {String} manager User adress which is going to be assing manager
|
|
73
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
74
|
+
*/
|
|
75
|
+
addManager(nftAddress: string, address: string, manager: string): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* Estimate gas cost for removeManager method
|
|
78
|
+
* @param {String} nftAddress erc721 contract adress
|
|
79
|
+
* @param {String} address NFT Owner adress
|
|
80
|
+
* @param {String} manager User adress which is going to be removed as manager
|
|
81
|
+
* @param {Contract} nftContract optional contract instance
|
|
82
|
+
* @return {Promise<any>}
|
|
83
|
+
*/
|
|
84
|
+
estGasRemoveManager(nftAddress: string, address: string, manager: string, contractInstance?: Contract): Promise<any>;
|
|
85
|
+
/**
|
|
86
|
+
* Removes a specific manager for NFT Contract (only NFT Owner can succeed)
|
|
87
|
+
* @param {String} nftAddress erc721 contract adress
|
|
88
|
+
* @param {String} address NFT Owner adress
|
|
89
|
+
* @param {String} manager User adress which is going to be removed as manager
|
|
90
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
91
|
+
*/
|
|
92
|
+
removeManager(nftAddress: string, address: string, manager: string): Promise<any>;
|
|
93
|
+
/**
|
|
94
|
+
* Estimate gas cost for addToCreateERC20List method
|
|
95
|
+
* @param {String} nftAddress erc721 contract adress
|
|
96
|
+
* @param {String} address NFT Manager adress
|
|
97
|
+
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
|
98
|
+
* @param {Contract} nftContract optional contract instance
|
|
99
|
+
* @return {Promise<any>}
|
|
100
|
+
*/
|
|
101
|
+
estGasAddErc20Deployer(nftAddress: string, address: string, erc20Deployer: string, contractInstance?: Contract): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Add ERC20Deployer permission - only Manager can succeed
|
|
104
|
+
* @param {String} nftAddress erc721 contract adress
|
|
105
|
+
* @param {String} address NFT Manager adress
|
|
106
|
+
* @param {String} erc20Deployer User adress which is going to have erc20Deployer permission
|
|
107
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
108
|
+
*/
|
|
109
|
+
addErc20Deployer(nftAddress: string, address: string, erc20Deployer: string): Promise<TransactionReceipt>;
|
|
110
|
+
/**
|
|
111
|
+
* Estimate gas cost for removeFromCreateERC20List method
|
|
112
|
+
* @param {String} nftAddress erc721 contract adress
|
|
113
|
+
* @param {String} address NFT Manager adress
|
|
114
|
+
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
|
115
|
+
* @param {Contract} nftContract optional contract instance
|
|
116
|
+
* @return {Promise<any>}
|
|
117
|
+
*/
|
|
118
|
+
estGasRemoveErc20Deployer(nftAddress: string, address: string, erc20Deployer: string, contractInstance?: Contract): Promise<any>;
|
|
119
|
+
/**
|
|
120
|
+
* Remove ERC20Deployer permission - only Manager can succeed
|
|
121
|
+
* @param {String} nftAddress erc721 contract adress
|
|
122
|
+
* @param {String} address NFT Manager adress
|
|
123
|
+
* @param {String} erc20Deployer Address of the user to be revoked ERC20Deployer Permission
|
|
124
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
125
|
+
*/
|
|
126
|
+
removeErc20Deployer(nftAddress: string, address: string, erc20Deployer: string): Promise<TransactionReceipt>;
|
|
127
|
+
/**
|
|
128
|
+
* Estimate gas cost for addToMetadataList method
|
|
129
|
+
* @param {String} nftAddress erc721 contract adress
|
|
130
|
+
* @param {String} address NFT Manager adress
|
|
131
|
+
* @param {String} metadataUpdater User adress which is going to have Metadata Updater permission
|
|
132
|
+
* @param {Contract} nftContract optional contract instance
|
|
133
|
+
* @return {Promise<any>}
|
|
134
|
+
*/
|
|
135
|
+
estGasAddMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
136
|
+
/**
|
|
137
|
+
* Add Metadata Updater permission - only Manager can succeed
|
|
138
|
+
* @param {String} nftAddress erc721 contract adress
|
|
139
|
+
* @param {String} address NFT Manager adress
|
|
140
|
+
* @param {String} metadataUpdater User adress which is going to have Metadata Updater permission
|
|
141
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
142
|
+
*/
|
|
143
|
+
addMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string): Promise<TransactionReceipt>;
|
|
144
|
+
/**
|
|
145
|
+
* Estimate gas cost for removeFromMetadataList method
|
|
146
|
+
* @param {String} nftAddress erc721 contract adress
|
|
147
|
+
* @param {String} address NFT Manager adress
|
|
148
|
+
* @param {String} metadataUpdater Address of the user to be revoked Metadata updater Permission
|
|
149
|
+
* @param {Contract} nftContract optional contract instance
|
|
150
|
+
* @return {Promise<any>}
|
|
151
|
+
*/
|
|
152
|
+
esGasRemoveMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Remove Metadata Updater permission - only Manager can succeed
|
|
155
|
+
* @param {String} nftAddress erc721 contract adress
|
|
156
|
+
* @param {String} address NFT Manager adress
|
|
157
|
+
* @param {String} metadataUpdater Address of the user to be revoked Metadata updater Permission
|
|
158
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
159
|
+
*/
|
|
160
|
+
removeMetadataUpdater(nftAddress: string, address: string, metadataUpdater: string): Promise<TransactionReceipt>;
|
|
161
|
+
/**
|
|
162
|
+
* Estimate gas cost for addTo725StoreList method
|
|
163
|
+
* @param {String} nftAddress erc721 contract adress
|
|
164
|
+
* @param {String} address NFT Manager adress
|
|
165
|
+
* @param {String} storeUpdater User adress which is going to have Store Updater permission
|
|
166
|
+
* @param {Contract} nftContract optional contract instance
|
|
167
|
+
* @return {Promise<any>}
|
|
168
|
+
*/
|
|
169
|
+
estGasAddStoreUpdater(nftAddress: string, address: string, storeUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
170
|
+
/**
|
|
171
|
+
* Add Store Updater permission - only Manager can succeed
|
|
172
|
+
* @param {String} nftAddress erc721 contract adress
|
|
173
|
+
* @param {String} address NFT Manager adress
|
|
174
|
+
* @param {String} storeUpdater User adress which is going to have Store Updater permission
|
|
175
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
176
|
+
*/
|
|
177
|
+
addStoreUpdater(nftAddress: string, address: string, storeUpdater: string): Promise<TransactionReceipt>;
|
|
178
|
+
/**
|
|
179
|
+
* Estimate gas cost for removeFrom725StoreList method
|
|
180
|
+
* @param {String} nftAddress erc721 contract adress
|
|
181
|
+
* @param {String} address NFT Manager adress
|
|
182
|
+
* @param {String} storeUpdater Address of the user to be revoked Store Updater Permission
|
|
183
|
+
* @param {Contract} nftContract optional contract instance
|
|
184
|
+
* @return {Promise<any>}
|
|
185
|
+
*/
|
|
186
|
+
estGasRemoveStoreUpdater(nftAddress: string, address: string, storeUpdater: string, contractInstance?: Contract): Promise<any>;
|
|
187
|
+
/**
|
|
188
|
+
* Remove Store Updater permission - only Manager can succeed
|
|
189
|
+
* @param {String} nftAddress erc721 contract adress
|
|
190
|
+
* @param {String} address NFT Manager adress
|
|
191
|
+
* @param {String} storeUpdater Address of the user to be revoked Store Updater Permission
|
|
192
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
193
|
+
*/
|
|
194
|
+
removeStoreUpdater(nftAddress: string, address: string, storeUpdater: string): Promise<TransactionReceipt>;
|
|
195
|
+
/**
|
|
196
|
+
* Estimate gas cost for cleanPermissions method
|
|
197
|
+
* @param {String} nftAddress erc721 contract adress
|
|
198
|
+
* @param {String} address NFT Owner adress
|
|
199
|
+
* @param {Contract} nftContract optional contract instance
|
|
200
|
+
* @return {Promise<any>}
|
|
201
|
+
*/
|
|
202
|
+
estGasCleanPermissions(nftAddress: string, address: string, contractInstance?: Contract): Promise<any>;
|
|
203
|
+
/**
|
|
204
|
+
* This function allows to remove all ROLES at erc721 level: Managers, ERC20Deployer, MetadataUpdater, StoreUpdater
|
|
205
|
+
* Even NFT Owner has to readd himself as Manager
|
|
206
|
+
* Permissions at erc20 level stay.
|
|
207
|
+
* Only NFT Owner can call it.
|
|
208
|
+
* @param {String} nftAddress erc721 contract adress
|
|
209
|
+
* @param {String} address NFT Owner adress
|
|
210
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
211
|
+
*/
|
|
212
|
+
cleanPermissions(nftAddress: string, address: string): Promise<TransactionReceipt>;
|
|
213
|
+
/**
|
|
214
|
+
* Estimate gas cost for transfer NFT method
|
|
215
|
+
* @param {String} nftAddress erc721 contract adress
|
|
216
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
217
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
218
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
219
|
+
* @param {Contract} nftContract optional contract instance
|
|
220
|
+
* @return {Promise<any>}
|
|
221
|
+
*/
|
|
222
|
+
estGasTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
|
|
223
|
+
/**
|
|
224
|
+
* Transfers the NFT
|
|
225
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
226
|
+
* @param {String} nftAddress erc721 contract adress
|
|
227
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
228
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
229
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
230
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
231
|
+
*/
|
|
232
|
+
transferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
233
|
+
/**
|
|
234
|
+
* Estimate gas cost for safeTransfer NFT method
|
|
235
|
+
* @param {String} nftAddress erc721 contract adress
|
|
236
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
237
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
238
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
239
|
+
* @param {Contract} nftContract optional contract instance
|
|
240
|
+
* @return {Promise<any>}
|
|
241
|
+
*/
|
|
242
|
+
estGasSafeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
|
|
243
|
+
/**
|
|
244
|
+
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
|
245
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
246
|
+
* @param {String} nftAddress erc721 contract adress
|
|
247
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
248
|
+
* @param {String} nftReceiver User which will receive the NFT, will also be set as Manager
|
|
249
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
250
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
251
|
+
*/
|
|
252
|
+
safeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
253
|
+
/**
|
|
254
|
+
* Estimate gas cost for setMetadata method
|
|
255
|
+
* @param {String} nftAddress erc721 contract adress
|
|
256
|
+
* @param {String} metadataUpdater metadataUpdater address
|
|
257
|
+
* @param {Number} metadataState User which will receive the NFT, will also be set as Manager
|
|
258
|
+
* @param {String} metadataDecryptorUrl
|
|
259
|
+
* @param {Number} tokenId The id of the token to be transfered
|
|
260
|
+
* @param {Contract} nftContract optional contract instance
|
|
261
|
+
* @return {Promise<any>}
|
|
262
|
+
*/
|
|
263
|
+
estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
|
|
264
|
+
/**
|
|
265
|
+
* safeTransferNFT Used for transferring the NFT, can be used by an approved relayer
|
|
266
|
+
* will clean all permissions both on erc721 and erc20 level.
|
|
267
|
+
* @param {String} nftAddress erc721 contract adress
|
|
268
|
+
* @param {String} address Caller address NFT Owner adress
|
|
269
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
270
|
+
*/
|
|
271
|
+
setMetadata(nftAddress: string, address: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): Promise<TransactionReceipt>;
|
|
272
|
+
/**
|
|
273
|
+
* Estimate gas cost for setMetadata method
|
|
274
|
+
* @param {String} nftAddress erc721 contract adress
|
|
275
|
+
* @param {String} metadataUpdater metadataUpdater address
|
|
276
|
+
* @param {MetaDataAndTokenURI} metadataAndTokenURI metaDataAndTokenURI object
|
|
277
|
+
* @param {Contract} nftContract optional contract instance
|
|
278
|
+
* @return {Promise<any>}
|
|
279
|
+
*/
|
|
280
|
+
estGasSetMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI, contractInstance?: Contract): Promise<any>;
|
|
281
|
+
/**
|
|
282
|
+
* Helper function to improve UX sets both MetaData & TokenURI in one tx
|
|
283
|
+
* @param {String} nftAddress erc721 contract adress
|
|
284
|
+
* @param {String} address Caller address
|
|
285
|
+
* @param {MetadataAndTokenURI} metadataAndTokenURI metaDataAndTokenURI object
|
|
286
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
287
|
+
*/
|
|
288
|
+
setMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI): Promise<TransactionReceipt>;
|
|
289
|
+
/**
|
|
290
|
+
* Estimate gas cost for setMetadataState method
|
|
291
|
+
* @param {String} nftAddress erc721 contract adress
|
|
292
|
+
* @param {String} nftOwner Current NFT Owner adress
|
|
293
|
+
* @param {Number} metadataState new metadata state
|
|
294
|
+
* @param {Contract} nftContract optional contract instance
|
|
295
|
+
* @return {Promise<any>}
|
|
296
|
+
*/
|
|
297
|
+
estGasSetMetadataState(nftAddress: string, metadataUpdater: string, metadataState: number, contractInstance?: Contract): Promise<any>;
|
|
298
|
+
/**
|
|
299
|
+
* setMetadataState Used for updating the metadata State
|
|
300
|
+
* @param {String} nftAddress erc721 contract adress
|
|
301
|
+
* @param {String} address Caller address => metadata updater
|
|
302
|
+
* @param {Number} metadataState new metadata state
|
|
303
|
+
* @return {Promise<TransactionReceipt>} trxReceipt
|
|
304
|
+
*/
|
|
305
|
+
setMetadataState(nftAddress: string, address: string, metadataState: number): Promise<TransactionReceipt>;
|
|
306
|
+
/** Estimate gas cost for setTokenURI method
|
|
307
|
+
* @param nftAddress erc721 contract adress
|
|
308
|
+
* @param address user adress
|
|
309
|
+
* @param data input data for TokenURI
|
|
310
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
311
|
+
*/
|
|
312
|
+
estSetTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
|
|
313
|
+
/** set TokenURI on an nft
|
|
314
|
+
* @param nftAddress erc721 contract adress
|
|
315
|
+
* @param address user adress
|
|
316
|
+
* @param data input data for TokenURI
|
|
317
|
+
* @return {Promise<TransactionReceipt>} transaction receipt
|
|
318
|
+
*/
|
|
319
|
+
setTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
|
|
320
|
+
/** Get Owner
|
|
321
|
+
* @param {String} nftAddress erc721 contract adress
|
|
322
|
+
* @return {Promise<string>} string
|
|
323
|
+
*/
|
|
324
|
+
getNftOwner(nftAddress: string): Promise<string>;
|
|
325
|
+
/** Get users NFT Permissions
|
|
326
|
+
* @param {String} nftAddress erc721 contract adress
|
|
327
|
+
* @param {String} address user adress
|
|
328
|
+
* @return {Promise<Roles>}
|
|
329
|
+
*/
|
|
330
|
+
getNftPermissions(nftAddress: string, address: string): Promise<Roles>;
|
|
331
|
+
/** Get users Metadata, return Metadata details
|
|
332
|
+
* @param {String} nftAddress erc721 contract adress
|
|
333
|
+
* @return {Promise<Objecta>}
|
|
334
|
+
*/
|
|
335
|
+
getMetadata(nftAddress: string): Promise<Object>;
|
|
336
|
+
/** Get users ERC20Deployer role
|
|
337
|
+
* @param {String} nftAddress erc721 contract adress
|
|
338
|
+
* @param {String} address user adress
|
|
339
|
+
* @return {Promise<Roles>}
|
|
340
|
+
*/
|
|
341
|
+
isErc20Deployer(nftAddress: string, address: string): Promise<boolean>;
|
|
342
|
+
/** Gets data at a given `key`
|
|
343
|
+
* @param {String} nftAddress erc721 contract adress
|
|
344
|
+
* @param {String} key the key which value to retrieve
|
|
345
|
+
* @return {Promise<string>} The data stored at the key
|
|
346
|
+
*/
|
|
347
|
+
getData(nftAddress: string, key: string): Promise<string>;
|
|
348
|
+
/** Gets data at a given `key`
|
|
349
|
+
* @param {String} nftAddress erc721 contract adress
|
|
350
|
+
* @param {String} id
|
|
351
|
+
* @return {Promise<string>} The data stored at the key
|
|
352
|
+
*/
|
|
353
|
+
getTokenURI(nftAddress: string, id: number): Promise<string>;
|
|
354
|
+
}
|
|
355
|
+
export {};
|
|
File without changes
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Web3 from 'web3';
|
|
2
|
+
import { Contract } from 'web3-eth-contract';
|
|
3
|
+
import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../@types';
|
|
4
|
+
import { Config } from '../models';
|
|
5
|
+
export declare function setContractDefaults(contract: Contract, config: Config): Contract;
|
|
6
|
+
export declare function getFairGasPrice(web3: Web3, config: Config): Promise<string>;
|
|
7
|
+
export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
|
|
8
|
+
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>;
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
*/
|
|
5
|
+
export declare function generateDtName(wordList?: {
|
|
6
|
+
nouns: string[];
|
|
7
|
+
adjectives: string[];
|
|
8
|
+
}): {
|
|
9
|
+
name: string;
|
|
10
|
+
symbol: string;
|
|
11
|
+
};
|
|
File without changes
|
|
@@ -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
|
|
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>;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
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 (always expressed as wei)
|
|
21
|
+
* @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
|
|
22
|
+
*/
|
|
23
|
+
export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
24
|
+
/**
|
|
25
|
+
* Get Allowance for any erc20
|
|
26
|
+
* @param {Web3} web3
|
|
27
|
+
* @param {String } tokenAdress
|
|
28
|
+
* @param {String} account
|
|
29
|
+
* @param {String} spender
|
|
30
|
+
*/
|
|
31
|
+
export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Get balance for any erc20
|
|
34
|
+
* @param {Web3} web3
|
|
35
|
+
* @param {String} tokenAdress
|
|
36
|
+
* @param {String} owner
|
|
37
|
+
* @param {String} spender
|
|
38
|
+
*/
|
|
39
|
+
export declare function balance(web3: Web3, tokenAddress: string, account: string): Promise<string>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from './Logger';
|
|
2
|
-
export * from './GasUtils';
|
|
3
2
|
export * from './DatatokenName';
|
|
4
|
-
export * from './
|
|
3
|
+
export * from './ContractUtils';
|
|
5
4
|
export * from './FetchHelper';
|
|
6
5
|
export * from './ConfigHelper';
|
|
7
6
|
export * from './DdoHelpers';
|
|
8
7
|
export * from './Constants';
|
|
9
8
|
export * from './SignatureUtils';
|
|
9
|
+
export * from './TokenUtils';
|
|
10
|
+
export * from './General';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/docs/beginners_guide.md
CHANGED
|
@@ -166,10 +166,10 @@ The process of creating and deploying the ERC20 datatokens has been automated by
|
|
|
166
166
|
|
|
167
167
|
```Javascript
|
|
168
168
|
const Web3 = require("web3");
|
|
169
|
-
const { Ocean,
|
|
169
|
+
const { Ocean, Datatokens } = require("@oceanprotocol/lib");
|
|
170
170
|
|
|
171
|
-
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/DTFactory.json");
|
|
172
|
-
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/
|
|
171
|
+
const { factoryABI } = require("@oceanprotocol/contracts/artifacts/contracts/DTFactory.json");
|
|
172
|
+
const { datatokensABI } = require("@oceanprotocol/contracts/artifacts/contracts/DatatokenTemplate.json");
|
|
173
173
|
const { config, contracts, urls } = require("./config");
|
|
174
174
|
|
|
175
175
|
const init = async () => {
|
|
@@ -180,7 +180,7 @@ const init = async () => {
|
|
|
180
180
|
const alice = accounts[0].id;
|
|
181
181
|
console.log('Alice account address:', alice)
|
|
182
182
|
|
|
183
|
-
const datatoken = new
|
|
183
|
+
const datatoken = new Datatokens(
|
|
184
184
|
contracts.DTFactory,
|
|
185
185
|
factoryABI,
|
|
186
186
|
datatokensABI,
|