@oceanprotocol/lib 1.0.0-next.4 → 1.0.0-next.40

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