@oceanprotocol/lib 1.0.0-next.9 → 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 (63) hide show
  1. package/CHANGELOG.md +390 -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/Erc20.d.ts +21 -0
  20. package/dist/src/{interfaces/Erc721Interface.d.ts → @types/Erc721.d.ts} +2 -2
  21. package/dist/src/@types/FileMetadata.d.ts +29 -0
  22. package/dist/src/{interfaces/FixedRateInterface.d.ts → @types/FixedPrice.d.ts} +7 -1
  23. package/dist/src/{interfaces/PoolInterface.d.ts → @types/Pool.d.ts} +11 -2
  24. package/dist/src/@types/Provider.d.ts +9 -0
  25. package/dist/src/@types/Router.d.ts +59 -0
  26. package/dist/src/@types/index.d.ts +6 -0
  27. package/dist/src/aquarius/Aquarius.d.ts +23 -1
  28. package/dist/src/factories/NFTFactory.d.ts +222 -14
  29. package/dist/src/index.d.ts +1 -1
  30. package/dist/src/models/Config.d.ts +128 -0
  31. package/dist/src/pools/Router.d.ts +189 -8
  32. package/dist/src/pools/balancer/Pool.d.ts +354 -29
  33. package/dist/src/pools/dispenser/Dispenser.d.ts +109 -2
  34. package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +309 -17
  35. package/dist/src/pools/index.d.ts +2 -0
  36. package/dist/src/pools/ssContracts/SideStaking.d.ts +110 -7
  37. package/dist/src/provider/Provider.d.ts +125 -6
  38. package/dist/src/tokens/Datatoken.d.ts +347 -8
  39. package/dist/src/tokens/NFT.d.ts +297 -5
  40. package/dist/src/utils/ContractUtils.d.ts +13 -4
  41. package/dist/src/utils/DatatokenName.d.ts +4 -0
  42. package/dist/src/utils/General.d.ts +4 -0
  43. package/dist/src/utils/PoolHelpers.d.ts +8 -0
  44. package/dist/src/utils/SignatureUtils.d.ts +0 -2
  45. package/dist/src/utils/TokenUtils.d.ts +65 -3
  46. package/dist/src/utils/index.d.ts +2 -0
  47. package/dist/test/TestContractHandler.d.ts +8 -36
  48. package/dist/test/config.d.ts +5 -0
  49. package/dist/test/{unit/NftFactory.test.d.ts → integration/CodeExamples.test.d.ts} +0 -0
  50. package/dist/test/unit/factories/NftFactory.test.d.ts +1 -0
  51. package/package.json +37 -32
  52. package/dist/src/interfaces/Erc20Interface.d.ts +0 -11
  53. package/dist/src/interfaces/RouterInterface.d.ts +0 -12
  54. package/dist/src/interfaces/index.d.ts +0 -5
  55. package/dist/test/integration/config.d.ts +0 -3
  56. package/dist/test/unit/config.d.ts +0 -3
  57. package/docs/beginners_guide.md +0 -338
  58. package/docs/get-test-OCEAN.md +0 -24
  59. package/docs/overview.md +0 -394
  60. package/docs/quickstart_marketplace.md +0 -423
  61. package/docs/quickstart_simple.md +0 -272
  62. package/docs/services.md +0 -94
  63. package/docs/wallets.md +0 -98
@@ -1,6 +1,5 @@
1
1
  import Web3 from 'web3';
2
- import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ProviderInitialize } from '../@types/';
3
- import { DownloadResponse } from '../@types/DownloadResponse';
2
+ import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults } from '../@types/';
4
3
  export interface HttpCallback {
5
4
  (httpMethod: string, url: string, body: string, header: any): Promise<any>;
6
5
  }
@@ -13,22 +12,142 @@ export interface UserCustomParameters {
13
12
  [key: string]: any;
14
13
  }
15
14
  export declare class Provider {
15
+ /**
16
+ * Returns the provider endpoints
17
+ * @return {Promise<ServiceEndpoint[]>}
18
+ */
16
19
  getEndpoints(providerUri: string): Promise<any>;
17
20
  getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
21
+ /**
22
+ * Returns the service endpoints that exist in provider.
23
+ * @param {any} endpoints
24
+ * @return {Promise<ServiceEndpoint[]>}
25
+ */
18
26
  getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
27
+ /** Gets current nonce
28
+ * @param {string} providerUri provider uri address
29
+ * @param {string} consumerAddress Publisher address
30
+ * @param {AbortSignal} signal abort signal
31
+ * @param {string} providerEndpoints Identifier of the asset to be registered in ocean
32
+ * @param {string} serviceEndpoints document description object (DDO)=
33
+ * @return {Promise<string>} urlDetails
34
+ */
19
35
  getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
20
- createSignature(web3: Web3, accountId: string, agreementId: string): Promise<string>;
21
- createHashSignature(web3: Web3, accountId: string, message: string): Promise<string>;
36
+ signProviderRequest(web3: Web3, accountId: string, message: string, password?: string): Promise<string>;
37
+ /** Encrypt data using the Provider's own symmetric key
38
+ * @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
39
+ * @param {string} providerUri provider uri address
40
+ * @param {AbortSignal} signal abort signal
41
+ * @return {Promise<string>} urlDetails
42
+ */
22
43
  encrypt(data: any, providerUri: string, signal?: AbortSignal): Promise<string>;
44
+ /** Get DDO File details (if possible)
45
+ * @param {string} did did
46
+ * @param {number} serviceId the id of the service for which to check the files
47
+ * @param {string} providerUri uri of the provider that will be used to check the file
48
+ * @param {AbortSignal} signal abort signal
49
+ * @return {Promise<FileMetadata[]>} urlDetails
50
+ */
23
51
  checkDidFiles(did: string, serviceId: number, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
52
+ /** Get URL details (if possible)
53
+ * @param {string} url or did
54
+ * @param {string} providerUri uri of the provider that will be used to check the file
55
+ * @param {AbortSignal} signal abort signal
56
+ * @return {Promise<FileMetadata[]>} urlDetails
57
+ */
24
58
  checkFileUrl(url: string, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
59
+ /** Get Compute Environments
60
+ * @return {Promise<ComputeEnvironment[]>} urlDetails
61
+ */
62
+ getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<ComputeEnvironment[]>;
63
+ /** Initialize a service request.
64
+ * @param {DDO | string} asset
65
+ * @param {number} serviceIndex
66
+ * @param {string} serviceType
67
+ * @param {string} consumerAddress
68
+ * @param {UserCustomParameters} userCustomParameters
69
+ * @param {string} providerUri Identifier of the asset to be registered in ocean
70
+ * @param {AbortSignal} signal abort signal
71
+ * @return {Promise<ProviderInitialize>} ProviderInitialize data
72
+ */
25
73
  initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
74
+ /** Initialize a compute request.
75
+ * @param {ComputeAsset} assets
76
+ * @param {ComputeAlgorithmber} algorithm
77
+ * @param {string} computeEnv
78
+ * @param {number} validUntil
79
+ * @param {string} providerUri Identifier of the asset to be registered in ocean
80
+ * @param {string} accountId
81
+ * @param {AbortSignal} signal abort signal
82
+ * @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
83
+ */
84
+ initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
85
+ /** Gets fully signed URL for download
86
+ * @param {string} did
87
+ * @param {string} accountId
88
+ * @param {string} serviceId
89
+ * @param {number} fileIndex
90
+ * @param {string} providerUri
91
+ * @param {Web3} web3
92
+ * @param {UserCustomParameters} userCustomParameters
93
+ * @return {Promise<string>}
94
+ */
26
95
  getDownloadUrl(did: string, accountId: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, web3: Web3, userCustomParameters?: UserCustomParameters): Promise<any>;
96
+ /** Instruct the provider to start a compute job
97
+ * @param {string} did
98
+ * @param {string} consumerAddress
99
+ * @param {string} computeEnv
100
+ * @param {ComputeAlgorithm} algorithm
101
+ * @param {string} providerUri
102
+ * @param {Web3} web3
103
+ * @param {AbortSignal} signal abort signal
104
+ * @param {ComputeOutput} output
105
+ * @return {Promise<ComputeJob | ComputeJob[]>}
106
+ */
27
107
  computeStart(providerUri: string, web3: Web3, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
108
+ /** Instruct the provider to Stop the execution of a to stop a compute job.
109
+ * @param {string} did
110
+ * @param {string} consumerAddress
111
+ * @param {string} jobId
112
+ * @param {string} providerUri
113
+ * @param {Web3} web3
114
+ * @param {AbortSignal} signal abort signal
115
+ * @return {Promise<ComputeJob | ComputeJob[]>}
116
+ */
28
117
  computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
29
- computeStatus(providerUri: string, signal?: AbortSignal, jobId?: string, did?: string, consumerAddress?: string): Promise<ComputeJob | ComputeJob[]>;
30
- computeResult(jobId: string, index: number, accountId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<DownloadResponse | void>;
118
+ /** Get compute status for a specific jobId/documentId/owner.
119
+ * @param {string} providerUri The URI of the provider we want to query
120
+ * @param {string} consumerAddress The consumer ethereum address
121
+ * @param {string} jobId The ID of a compute job.
122
+ * @param {string} did The ID of the asset
123
+ * @param {AbortSignal} signal abort signal
124
+ * @return {Promise<ComputeJob | ComputeJob[]>}
125
+ */
126
+ computeStatus(providerUri: string, consumerAddress: string, jobId?: string, did?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
127
+ /** Get compute result url
128
+ * @param {string} providerUri The URI of the provider we want to query
129
+ * @param {Web3} web3 Web3 instance
130
+ * @param {string} consumerAddress The consumer ethereum address
131
+ * @param {string} jobId The ID of a compute job.
132
+ * @param {number} index Result index
133
+ * @return {Promise<string>}
134
+ */
135
+ getComputeResultUrl(providerUri: string, web3: Web3, consumerAddress: string, jobId: string, index: number): Promise<string>;
136
+ /** Deletes a compute job.
137
+ * @param {string} did
138
+ * @param {string} consumerAddress
139
+ * @param {string} jobId
140
+ * @param {string} providerUri
141
+ * @param {Web3} web3
142
+ * @param {AbortSignal} signal abort signal
143
+ * @return {Promise<ComputeJob | ComputeJob[]>}
144
+ */
31
145
  computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
146
+ /** Check for a valid provider at URL
147
+ * @param {String} url provider uri address
148
+ * @param {AbortSignal} signal abort signal
149
+ * @return {Promise<boolean>} string
150
+ */
32
151
  isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
33
152
  }
34
153
  export declare const ProviderInstance: Provider;
@@ -2,10 +2,12 @@ import Web3 from 'web3';
2
2
  import { AbiItem } from 'web3-utils';
3
3
  import { TransactionReceipt } from 'web3-eth';
4
4
  import { Contract } from 'web3-eth-contract';
5
- import { FreOrderParams, FreCreationParams } from '../interfaces';
5
+ import { ConsumeMarketFee, FreOrderParams, FreCreationParams, ProviderFees, PublishingMarketFee } from '../@types';
6
6
  import { Nft } from './NFT';
7
7
  import { Config } from '../models/index.js';
8
- import { ProviderFees } from '../@types/Provider.js';
8
+ /**
9
+ * ERC20 ROLES
10
+ */
9
11
  interface Roles {
10
12
  minter: boolean;
11
13
  paymentManager: boolean;
@@ -13,8 +15,8 @@ interface Roles {
13
15
  export interface OrderParams {
14
16
  consumer: string;
15
17
  serviceIndex: number;
16
- ammount: string;
17
- _providerFees: ProviderFees;
18
+ _providerFee: ProviderFees;
19
+ _consumeMarketFee: ConsumeMarketFee;
18
20
  }
19
21
  export interface DispenserParams {
20
22
  maxTokens: string;
@@ -23,7 +25,6 @@ export interface DispenserParams {
23
25
  allowedSwapper?: string;
24
26
  }
25
27
  export declare class Datatoken {
26
- GASLIMIT_DEFAULT: number;
27
28
  factoryAddress: string;
28
29
  factoryABI: AbiItem | AbiItem[];
29
30
  datatokensAbi: AbiItem | AbiItem[];
@@ -31,44 +32,382 @@ export declare class Datatoken {
31
32
  web3: Web3;
32
33
  config: Config;
33
34
  nft: Nft;
34
- constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
35
+ /**
36
+ * Instantiate ERC20 Datatokens
37
+ * @param {AbiItem | AbiItem[]} datatokensAbi
38
+ * @param {Web3} web3
39
+ */
40
+ constructor(web3: Web3, network?: string | number, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
41
+ /**
42
+ * Estimate gas cost for mint method
43
+ * @param {String} dtAddress Datatoken address
44
+ * @param {String} spender Spender address
45
+ * @param {string} amount Number of datatokens, as number. Will be converted to wei
46
+ * @param {String} address User adress
47
+ * @param {Contract} contractInstance optional contract instance
48
+ * @return {Promise<any>}
49
+ */
35
50
  estGasApprove(dtAddress: string, spender: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
51
+ /**
52
+ * Approve
53
+ * @param {String} dtAddress Datatoken address
54
+ * @param {String} spender Spender address
55
+ * @param {string} amount Number of datatokens, as number. Will be converted to wei
56
+ * @param {String} address User adress
57
+ * @return {Promise<TransactionReceipt>} trxReceipt
58
+ */
36
59
  approve(dtAddress: string, spender: string, amount: string, address: string): Promise<TransactionReceipt>;
60
+ /**
61
+ * Estimate gas cost for mint method
62
+ * @param {String} dtAddress Datatoken address
63
+ * @param {String} address Minter address
64
+ * @param {String} amount Number of datatokens, as number. Will be converted to wei
65
+ * @param {String} toAddress only if toAddress is different from the minter
66
+ * @param {Contract} contractInstance optional contract instance
67
+ * @return {Promise<any>}
68
+ */
37
69
  estGasMint(dtAddress: string, address: string, amount: string, toAddress?: string, contractInstance?: Contract): Promise<any>;
70
+ /**
71
+ * Estimate gas cost for createFixedRate method
72
+ * @param {String} dtAddress Datatoken address
73
+ * @param {String} address Caller address
74
+ * @param {String} fixedPriceAddress
75
+ * @param {FixedRateParams} fixedRateParams
76
+ * @param {Contract} contractInstance optional contract instance
77
+ * @return {Promise<any>}
78
+ */
38
79
  estGasCreateFixedRate(dtAddress: string, address: string, fixedRateParams: FreCreationParams, contractInstance?: Contract): Promise<any>;
80
+ /**
81
+ * Creates a new FixedRateExchange setup.
82
+ * @param {String} dtAddress Datatoken address
83
+ * @param {String} address Caller address
84
+ * @param {String} fixedPriceAddress
85
+ * @param {FixedRateParams} fixedRateParams
86
+ * @return {Promise<TransactionReceipt>} transactionId
87
+ */
39
88
  createFixedRate(dtAddress: string, address: string, fixedRateParams: FreCreationParams): Promise<TransactionReceipt>;
89
+ /**
90
+ * Estimate gas cost for createDispenser method
91
+ * @param {String} dtAddress Datatoken address
92
+ * @param {String} address Caller address
93
+ * @param {String} dispenserAddress ispenser contract address
94
+ * @param {String} dispenserParams
95
+ * @param {Contract} contractInstance optional contract instance
96
+ * @return {Promise<any>}
97
+ */
40
98
  estGasCreateDispenser(dtAddress: string, address: string, dispenserAddress: string, dispenserParams: DispenserParams, contractInstance?: Contract): Promise<any>;
99
+ /**
100
+ * Creates a new Dispenser
101
+ * @param {String} dtAddress Datatoken address
102
+ * @param {String} address Caller address
103
+ * @param {String} dispenserAddress ispenser contract address
104
+ * @param {String} dispenserParams
105
+ * @return {Promise<TransactionReceipt>} transactionId
106
+ */
41
107
  createDispenser(dtAddress: string, address: string, dispenserAddress: string, dispenserParams: DispenserParams): Promise<TransactionReceipt>;
108
+ /**
109
+ * Mint
110
+ * @param {String} dtAddress Datatoken address
111
+ * @param {String} address Minter address
112
+ * @param {String} amount Number of datatokens, as number. Will be converted to wei
113
+ * @param {String} toAddress only if toAddress is different from the minter
114
+ * @return {Promise<TransactionReceipt>} transactionId
115
+ */
42
116
  mint(dtAddress: string, address: string, amount: string, toAddress?: string): Promise<TransactionReceipt>;
117
+ /**
118
+ * Estimate gas cost for addMinter method
119
+ * @param {String} dtAddress Datatoken address
120
+ * @param {String} address User address
121
+ * @param {String} minter User which is going to be a Minter
122
+ * @param {Contract} contractInstance optional contract instance
123
+ * @return {Promise<any>}
124
+ */
43
125
  estGasAddMinter(dtAddress: string, address: string, minter: string, contractInstance?: Contract): Promise<any>;
126
+ /**
127
+ * Add Minter for an ERC20 datatoken
128
+ * only ERC20Deployer can succeed
129
+ * @param {String} dtAddress Datatoken address
130
+ * @param {String} address User address
131
+ * @param {String} minter User which is going to be a Minter
132
+ * @return {Promise<TransactionReceipt>} transactionId
133
+ */
44
134
  addMinter(dtAddress: string, address: string, minter: string): Promise<TransactionReceipt>;
135
+ /**
136
+ * Estimate gas for removeMinter method
137
+ * @param {String} dtAddress Datatoken address
138
+ * @param {String} address User address
139
+ * @param {String} minter User which will be removed from Minter permission
140
+ * @param {Contract} contractInstance optional contract instance
141
+ * @return {Promise<any>}
142
+ */
45
143
  estGasRemoveMinter(dtAddress: string, address: string, minter: string, contractInstance?: Contract): Promise<any>;
144
+ /**
145
+ * Revoke Minter permission for an ERC20 datatoken
146
+ * only ERC20Deployer can succeed
147
+ * @param {String} dtAddress Datatoken address
148
+ * @param {String} address User address
149
+ * @param {String} minter User which will be removed from Minter permission
150
+ * @param {Contract} contractInstance optional contract instance
151
+ * @return {Promise<any>}
152
+ */
46
153
  removeMinter(dtAddress: string, address: string, minter: string): Promise<TransactionReceipt>;
154
+ /**
155
+ * Estimate gas for addPaymentManager method
156
+ * @param {String} dtAddress Datatoken address
157
+ * @param {String} address User address
158
+ * @param {String} paymentManager User which is going to be a Minter
159
+ * @param {Contract} contractInstance optional contract instance
160
+ * @return {Promise<any>}
161
+ */
47
162
  estGasAddPaymentManager(dtAddress: string, address: string, paymentManager: string, contractInstance?: Contract): Promise<any>;
163
+ /**
164
+ * Add addPaymentManager (can set who's going to collect fee when consuming orders)
165
+ * only ERC20Deployer can succeed
166
+ * @param {String} dtAddress Datatoken address
167
+ * @param {String} address User address
168
+ * @param {String} paymentManager User which is going to be a Minter
169
+ * @return {Promise<TransactionReceipt>} transactionId
170
+ */
48
171
  addPaymentManager(dtAddress: string, address: string, paymentManager: string): Promise<TransactionReceipt>;
172
+ /**
173
+ * Estimate gas for removePaymentManager method
174
+ * @param {String} dtAddress Datatoken address
175
+ * @param {String} address User address
176
+ * @param {String} paymentManager User which will be removed from paymentManager permission
177
+ * @param {Contract} contractInstance optional contract instance
178
+ * @return {Promise<any>}
179
+ */
49
180
  estGasRemovePaymentManager(dtAddress: string, address: string, paymentManager: string, contractInstance?: Contract): Promise<any>;
181
+ /**
182
+ * Revoke paymentManager permission for an ERC20 datatoken
183
+ * only ERC20Deployer can succeed
184
+ * @param {String} dtAddress Datatoken address
185
+ * @param {String} address User address
186
+ * @param {String} paymentManager User which will be removed from paymentManager permission
187
+ * @return {Promise<TransactionReceipt>} trxReceipt
188
+ */
50
189
  removePaymentManager(dtAddress: string, address: string, paymentManager: string): Promise<TransactionReceipt>;
190
+ /**
191
+ * Estimate gas for setPaymentCollector method
192
+ * @param dtAddress datatoken address
193
+ * @param address Caller address
194
+ * @param paymentCollector User to be set as new payment collector
195
+ * @param {Contract} contractInstance optional contract instance
196
+ * @return {Promise<any>}
197
+ */
51
198
  estGasSetPaymentCollector(dtAddress: string, address: string, paymentCollector: string, contractInstance?: Contract): Promise<any>;
199
+ /**
200
+ * This function allows to set a new PaymentCollector (receives DT when consuming)
201
+ * If not set the paymentCollector is the NFT Owner
202
+ * only NFT owner can call
203
+ * @param dtAddress datatoken address
204
+ * @param address Caller address
205
+ * @param paymentCollector User to be set as new payment collector
206
+ * @return {Promise<TransactionReceipt>} trxReceipt
207
+ */
52
208
  setPaymentCollector(dtAddress: string, address: string, paymentCollector: string): Promise<TransactionReceipt>;
209
+ /** getPaymentCollector - It returns the current paymentCollector
210
+ * @param dtAddress datatoken address
211
+ * @return {Promise<string>}
212
+ */
53
213
  getPaymentCollector(dtAddress: string): Promise<string>;
214
+ /**
215
+ * Transfer as number from address to toAddress
216
+ * @param {String} dtAddress Datatoken address
217
+ * @param {String} toAddress Receiver address
218
+ * @param {String} amount Number of datatokens, as number. To be converted to wei.
219
+ * @param {String} address User adress
220
+ * @return {Promise<TransactionReceipt>} transactionId
221
+ */
54
222
  transfer(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
223
+ /**
224
+ * Estimate gas for transfer method
225
+ * @param {String} dtAddress Datatoken address
226
+ * @param {String} toAddress Receiver address
227
+ * @param {String} amount Number of datatokens, as number. Expressed as wei
228
+ * @param {String} address User adress
229
+ * @param {Contract} contractInstance optional contract instance
230
+ * @return {Promise<any>}
231
+ */
55
232
  estGasTransfer(dtAddress: string, toAddress: string, amount: string, address: string, contractInstance?: Contract): Promise<any>;
233
+ /**
234
+ * Transfer in wei from address to toAddress
235
+ * @param {String} dtAddress Datatoken address
236
+ * @param {String} toAddress Receiver address
237
+ * @param {String} amount Number of datatokens, as number. Expressed as wei
238
+ * @param {String} address User adress
239
+ * @return {Promise<TransactionReceipt>} transactionId
240
+ */
56
241
  transferWei(dtAddress: string, toAddress: string, amount: string, address: string): Promise<TransactionReceipt>;
57
- estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
58
- startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees): Promise<TransactionReceipt>;
242
+ /** Estimate gas cost for startOrder method
243
+ * @param {String} dtAddress Datatoken address
244
+ * @param {String} address User address which calls
245
+ * @param {String} consumer Consumer Address
246
+ * @param {Number} serviceIndex Service index in the metadata
247
+ * @param {providerFees} providerFees provider fees
248
+ * @param {consumeMarketFee} ConsumeMarketFee consume market fees
249
+ * @param {Contract} contractInstance optional contract instance
250
+ * @return {Promise<any>}
251
+ */
252
+ estGasStartOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee, contractInstance?: Contract): Promise<any>;
253
+ /** Start Order: called by payer or consumer prior ordering a service consume on a marketplace.
254
+ * @param {String} dtAddress Datatoken address
255
+ * @param {String} address User address which calls
256
+ * @param {String} consumer Consumer Address
257
+ * @param {Number} serviceIndex Service index in the metadata
258
+ * @param {providerFees} providerFees provider fees
259
+ * @param {consumeMarketFee} ConsumeMarketFee consume market fees
260
+ * @return {Promise<TransactionReceipt>} string
261
+ */
262
+ startOrder(dtAddress: string, address: string, consumer: string, serviceIndex: number, providerFees: ProviderFees, consumeMarketFee?: ConsumeMarketFee): Promise<TransactionReceipt>;
263
+ /** Estimate gas cost for reuseOrder method
264
+ * @param {String} dtAddress Datatoken address
265
+ * @param {String} address User address which calls
266
+ * @param {String} orderTxId previous valid order
267
+ * @param {providerFees} providerFees provider fees
268
+ * @param {Contract} contractInstance optional contract instance
269
+ * @return {Promise<any>}
270
+ */
271
+ estGasReuseOrder(dtAddress: string, address: string, orderTxId: string, providerFees: ProviderFees, contractInstance?: Contract): Promise<any>;
272
+ /** Reuse Order: called by payer or consumer having a valid order, but with expired provider access.
273
+ * Pays the provider fee again, but it will not require a new datatoken payment
274
+ * Requires previous approval of provider fee.
275
+ * @param {String} dtAddress Datatoken address
276
+ * @param {String} address User address which calls
277
+ * @param {String} orderTxId previous valid order
278
+ * @param {providerFees} providerFees provider fees
279
+ * @return {Promise<TransactionReceipt>} string
280
+ */
281
+ reuseOrder(dtAddress: string, address: string, orderTxId: string, providerFees: ProviderFees): Promise<TransactionReceipt>;
282
+ /** Estimate gas cost for buyFromFreAndOrder method
283
+ * @param {String} dtAddress Datatoken address
284
+ * @param {String} address User address which calls
285
+ * @param {OrderParams} orderParams Consumer Address
286
+ * @param {FreParams} freParams Amount of tokens that is going to be transfered
287
+ * @param {Contract} contractInstance optional contract instance
288
+ * @return {Promise<any>}
289
+ */
59
290
  estGasBuyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams, contractInstance?: Contract): Promise<any>;
291
+ /** Buys 1 DT from the FRE and then startsOrder, while burning that DT
292
+ * @param {String} dtAddress Datatoken address
293
+ * @param {String} address User address which calls
294
+ * @param {OrderParams} orderParams Consumer Address
295
+ * @param {FreParams} freParams Amount of tokens that is going to be transfered
296
+ * @return {Promise<TransactionReceipt>}
297
+ */
60
298
  buyFromFreAndOrder(dtAddress: string, address: string, orderParams: OrderParams, freParams: FreOrderParams): Promise<TransactionReceipt>;
299
+ /** Estimate gas cost for buyFromFreAndOrder method
300
+ * @param {String} dtAddress Datatoken address
301
+ * @param {String} address User address which calls
302
+ * @param {OrderParams} orderParams
303
+ * @param {String} dispenserContract
304
+ * @param {Contract} contractInstance optional contract instance
305
+ * @return {Promise<any>}
306
+ */
61
307
  estGasBuyFromDispenserAndOrder(dtAddress: string, address: string, orderParams: OrderParams, dispenserContract: string, contractInstance?: Contract): Promise<any>;
308
+ /** Gets DT from dispenser and then startsOrder, while burning that DT
309
+ * @param {String} dtAddress Datatoken address
310
+ * @param {String} address User address which calls
311
+ * @param {OrderParams} orderParams
312
+ * @param {String} dispenserContract
313
+ * @return {Promise<TransactionReceipt>}
314
+ */
62
315
  buyFromDispenserAndOrder(dtAddress: string, address: string, orderParams: OrderParams, dispenserContract: string): Promise<TransactionReceipt>;
316
+ /** Estimate gas for setData method
317
+ * @param {String} dtAddress Datatoken address
318
+ * @param {String} address User address
319
+ * @param {String} value Data to be stored into 725Y standard
320
+ * @param {Contract} contractInstance optional contract instance
321
+ * @return {Promise<any>}
322
+ */
63
323
  estGasSetData(dtAddress: string, address: string, value: string, contractInstance?: Contract): Promise<any>;
324
+ /** setData
325
+ * This function allows to store data with a preset key (keccak256(ERC20Address)) into NFT 725 Store
326
+ * only ERC20Deployer can succeed
327
+ * @param {String} dtAddress Datatoken address
328
+ * @param {String} address User address
329
+ * @param {String} value Data to be stored into 725Y standard
330
+ * @return {Promise<TransactionReceipt>} transactionId
331
+ */
64
332
  setData(dtAddress: string, address: string, value: string): Promise<TransactionReceipt>;
333
+ /** Estimate gas for cleanPermissions method
334
+ * @param dtAddress Datatoken address where we want to clean permissions
335
+ * @param address User adress
336
+ * @param {Contract} contractInstance optional contract instance
337
+ * @return {Promise<any>}
338
+ */
65
339
  estGasCleanPermissions(dtAddress: string, address: string, contractInstance?: Contract): Promise<any>;
340
+ /**
341
+ * Clean erc20level Permissions (minters, paymentManager and reset the paymentCollector) for an ERC20 datatoken
342
+ * Only NFT Owner (at 721 level) can call it.
343
+ * @param dtAddress Datatoken address where we want to clean permissions
344
+ * @param address User adress
345
+ * @return {Promise<TransactionReceipt>} transactionId
346
+ */
66
347
  cleanPermissions(dtAddress: string, address: string): Promise<TransactionReceipt>;
348
+ /** Returns ERC20 user's permissions for a datatoken
349
+ * @param {String} dtAddress Datatoken adress
350
+ * @param {String} address user adress
351
+ * @return {Promise<Roles>}
352
+ */
67
353
  getDTPermissions(dtAddress: string, address: string): Promise<Roles>;
354
+ /** Returns the Datatoken capital
355
+ * @param {String} dtAddress Datatoken adress
356
+ * @return {Promise<string>}
357
+ */
68
358
  getCap(dtAddress: string): Promise<string>;
359
+ /** It returns the token decimals, how many supported decimal points
360
+ * @param {String} dtAddress Datatoken adress
361
+ * @return {Promise<number>}
362
+ */
69
363
  getDecimals(dtAddress: string): Promise<string>;
364
+ /** It returns the token decimals, how many supported decimal points
365
+ * @param {String} dtAddress Datatoken adress
366
+ * @return {Promise<number>}
367
+ */
70
368
  getNFTAddress(dtAddress: string): Promise<string>;
369
+ /** Returns true if address has deployERC20 role
370
+ * @param {String} dtAddress Datatoken adress
371
+ * @param {String} dtAddress Datatoken adress
372
+ * @return {Promise<boolean>}
373
+ */
71
374
  isERC20Deployer(dtAddress: string, address: string): Promise<boolean>;
375
+ /**
376
+ * Get Address Balance for datatoken
377
+ * @param {String} dtAddress Datatoken adress
378
+ * @param {String} address user adress
379
+ * @return {Promise<String>} balance Number of datatokens. Will be converted from wei
380
+ */
72
381
  balance(datatokenAddress: string, address: string): Promise<string>;
382
+ /**
383
+ * @dev estGasSetPublishingMarketFee
384
+ * Estimating gas for publishMarketFeeAddress method
385
+ * @param {string} datatokenAddress Datatoken adress
386
+ * @param {string} publishMarketFeeAddress new publish Market Fee Address
387
+ * @param {string} publishMarketFeeToken new publish Market Fee Token
388
+ * @param {string} publishMarketFeeAmount new fee amount
389
+ * @param {String} address user adress
390
+ */
391
+ estGasSetPublishingMarketFee(datatokenAddress: string, publishMarketFeeAddress: string, publishMarketFeeToken: string, publishMarketFeeAmount: string, address: string): Promise<number>;
392
+ /**
393
+ * @dev setPublishingMarketFee
394
+ * Only publishMarketFeeAddress can call it
395
+ * This function allows to set the fee required by the publisherMarket
396
+ * @param {string} datatokenAddress Datatoken adress
397
+ * @param {string} publishMarketFeeAddress new publish Market Fee Address
398
+ * @param {string} publishMarketFeeToken new publish Market Fee Token
399
+ * @param {string} publishMarketFeeAmount new fee amount
400
+ * @param {String} address user adress
401
+ */
402
+ setPublishingMarketFee(datatokenAddress: string, publishMarketFeeAddress: string, publishMarketFeeToken: string, publishMarketFeeAmount: string, address: string): Promise<void>;
403
+ /**
404
+ * @dev getPublishingMarketFee
405
+ * Get publishingMarket Fee
406
+ * This function allows to get the current fee set by the publishing market
407
+ * @param {String} datatokenAddress Datatoken adress
408
+ * @param {String} address user adress
409
+ * @return {Promise<PublishingMarketFee>} Current fee set by the publishing market
410
+ */
411
+ getPublishingMarketFee(datatokenAddress: string, address: string): Promise<PublishingMarketFee>;
73
412
  }
74
413
  export {};