@oceanprotocol/lib 3.0.4 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- 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 +148 -148
- package/dist/src/@types/Compute.d.ts +71 -71
- package/dist/src/@types/Contracts.d.ts +26 -26
- package/dist/src/@types/DDO/ConsumerParameter.d.ts +37 -37
- package/dist/src/@types/DDO/Credentials.d.ts +8 -8
- package/dist/src/@types/DDO/DDO.d.ts +55 -55
- package/dist/src/@types/DDO/Event.d.ts +27 -27
- package/dist/src/@types/DDO/Metadata.d.ts +141 -141
- package/dist/src/@types/DDO/Service.d.ts +100 -100
- package/dist/src/@types/Datatoken.d.ts +38 -38
- package/dist/src/@types/Dispenser.d.ts +16 -16
- package/dist/src/@types/DownloadResponse.d.ts +4 -4
- package/dist/src/@types/File.d.ts +89 -89
- package/dist/src/@types/FileInfo.d.ts +43 -43
- package/dist/src/@types/FixedPrice.d.ts +51 -51
- package/dist/src/@types/NFT.d.ts +18 -18
- package/dist/src/@types/NFTFactory.d.ts +20 -20
- package/dist/src/@types/Provider.d.ts +33 -33
- package/dist/src/@types/ReturnTypes.d.ts +3 -3
- package/dist/src/@types/Router.d.ts +59 -59
- package/dist/src/@types/index.d.ts +20 -20
- package/dist/src/config/Config.d.ts +153 -153
- package/dist/src/config/ConfigHelper.d.ts +12 -12
- package/dist/src/config/index.d.ts +2 -2
- package/dist/src/contracts/Datatoken.d.ts +278 -260
- package/dist/src/contracts/Dispenser.d.ts +73 -73
- package/dist/src/contracts/FixedRateExchange.d.ts +209 -209
- package/dist/src/contracts/NFT.d.ts +220 -220
- package/dist/src/contracts/NFTFactory.d.ts +165 -165
- package/dist/src/contracts/Router.d.ts +107 -107
- package/dist/src/contracts/SmartContract.d.ts +45 -45
- package/dist/src/contracts/SmartContractWithAddress.d.ts +17 -17
- package/dist/src/contracts/df/DfRewards.d.ts +31 -31
- package/dist/src/contracts/df/DfStrategyV1.d.ts +21 -21
- package/dist/src/contracts/index.d.ts +14 -14
- package/dist/src/contracts/ve/VeAllocate.d.ts +38 -38
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +29 -29
- package/dist/src/contracts/ve/VeFeeEstimate.d.ts +14 -14
- package/dist/src/contracts/ve/VeOcean.d.ts +68 -68
- package/dist/src/index.d.ts +5 -5
- package/dist/src/services/Aquarius.d.ts +53 -53
- package/dist/src/services/Provider.d.ts +197 -197
- package/dist/src/services/index.d.ts +2 -2
- package/dist/src/utils/Constants.d.ts +4 -4
- package/dist/src/utils/ContractUtils.d.ts +46 -46
- package/dist/src/utils/DatatokenName.d.ts +14 -14
- package/dist/src/utils/DdoHelpers.d.ts +13 -13
- package/dist/src/utils/FetchHelper.d.ts +14 -14
- package/dist/src/utils/General.d.ts +5 -5
- package/dist/src/utils/Logger.d.ts +19 -19
- package/dist/src/utils/OrderUtils.d.ts +17 -0
- package/dist/src/utils/ProviderErrors.d.ts +1 -1
- package/dist/src/utils/SignatureUtils.d.ts +12 -12
- package/dist/src/utils/TokenUtils.d.ts +70 -70
- package/dist/src/utils/index.d.ts +12 -11
- package/dist/src/utils/minAbi.d.ts +38 -38
- package/dist/test/config.d.ts +19 -19
- package/dist/test/integration/CodeExamples.test.d.ts +1 -1
- package/dist/test/integration/ComputeExamples.test.d.ts +1 -1
- package/dist/test/integration/ComputeFlow.test.d.ts +1 -1
- package/dist/test/integration/Provider.test.d.ts +1 -1
- package/dist/test/integration/PublishEditConsume.test.d.ts +1 -1
- package/dist/test/integration/PublishFlows.test.d.ts +1 -1
- package/dist/test/integration/helpers.d.ts +7 -7
- package/dist/test/unit/DFRewards.test.d.ts +1 -1
- package/dist/test/unit/Datatoken.test.d.ts +1 -1
- package/dist/test/unit/Dispenser.test.d.ts +1 -1
- package/dist/test/unit/FixedRateExchange.test.d.ts +1 -1
- package/dist/test/unit/Nft.test.d.ts +1 -1
- package/dist/test/unit/NftFactory.test.d.ts +1 -1
- package/dist/test/unit/Router.test.d.ts +1 -1
- package/dist/test/unit/veOcean.test.d.ts +1 -1
- package/package.json +5 -5
|
@@ -1,197 +1,197 @@
|
|
|
1
|
-
import { Signer } from 'ethers';
|
|
2
|
-
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, Smartcontract, GraphqlQuery } from '../@types';
|
|
3
|
-
export declare class Provider {
|
|
4
|
-
/**
|
|
5
|
-
* Returns the provider endpoints
|
|
6
|
-
* @param {string} providerUri - the provider url
|
|
7
|
-
* @return {Promise<any>}
|
|
8
|
-
*/
|
|
9
|
-
getEndpoints(providerUri: string): Promise<any>;
|
|
10
|
-
/**
|
|
11
|
-
* This function returns the endpoint URL for a given service name.
|
|
12
|
-
* @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
|
|
13
|
-
* @param {string} serviceName - The name of the service
|
|
14
|
-
* @returns {ServiceEndpoint} The endpoint URL for the given service name
|
|
15
|
-
*/
|
|
16
|
-
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
17
|
-
/**
|
|
18
|
-
* This function returns an array of service endpoints for a given provider endpoint.
|
|
19
|
-
* @param {string} providerEndpoint - The provider endpoint
|
|
20
|
-
* @param {any} endpoints - The endpoints object
|
|
21
|
-
* @returns {ServiceEndpoint[]} An array of service endpoints
|
|
22
|
-
*/
|
|
23
|
-
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Get current nonce from the provider.
|
|
26
|
-
* @param {string} providerUri provider uri address
|
|
27
|
-
* @param {string} consumerAddress Publisher address
|
|
28
|
-
* @param {AbortSignal} signal abort signal
|
|
29
|
-
* @param {string} providerEndpoints Identifier of the asset to be registered in ocean
|
|
30
|
-
* @param {string} serviceEndpoints document description object (DDO)=
|
|
31
|
-
* @return {Promise<string>} urlDetails
|
|
32
|
-
*/
|
|
33
|
-
getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
|
|
34
|
-
/**
|
|
35
|
-
* Sign a provider request with a signer.
|
|
36
|
-
* @param {Signer} signer - The signer to use.
|
|
37
|
-
* @param {string} message - The message to sign.
|
|
38
|
-
* @returns {Promise<string>} A promise that resolves with the signature.
|
|
39
|
-
*/
|
|
40
|
-
signProviderRequest(signer: Signer, message: string): Promise<string>;
|
|
41
|
-
/**
|
|
42
|
-
* Encrypt data using the Provider's own symmetric key
|
|
43
|
-
* @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
|
|
44
|
-
* @param {number} chainId network's id so provider can choose the corresponding Signer object
|
|
45
|
-
* @param {string} providerUri provider uri address
|
|
46
|
-
* @param {AbortSignal} signal abort signal
|
|
47
|
-
* @return {Promise<string>} urlDetails
|
|
48
|
-
*/
|
|
49
|
-
encrypt(data: any, chainId: number, providerUri: string, signal?: AbortSignal): Promise<string>;
|
|
50
|
-
/**
|
|
51
|
-
* Get file details for a given DID and service ID.
|
|
52
|
-
* @param {string} did - The DID to check.
|
|
53
|
-
* @param {string} serviceId - The service ID to check.
|
|
54
|
-
* @param {string} providerUri - The URI of the provider.
|
|
55
|
-
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
56
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
57
|
-
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
58
|
-
*/
|
|
59
|
-
checkDidFiles(did: string, serviceId: string, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Get File details (if possible)
|
|
62
|
-
* @param {UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract} file one of the supported file structures
|
|
63
|
-
* @param {string} providerUri uri of the provider that will be used to check the file
|
|
64
|
-
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
65
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
66
|
-
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
67
|
-
*/
|
|
68
|
-
getFileInfo(file: UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Returns compute environments from a provider.
|
|
71
|
-
* @param {string} providerUri - The URI of the provider.
|
|
72
|
-
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
73
|
-
* @returns {Promise<{[chainId: number]: ComputeEnvironment[]}>} A promise that resolves with an object containing compute environments for each chain ID.
|
|
74
|
-
*/
|
|
75
|
-
getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<{
|
|
76
|
-
[chainId: number]: ComputeEnvironment[];
|
|
77
|
-
}>;
|
|
78
|
-
/**
|
|
79
|
-
* Initializes the provider for a service request.
|
|
80
|
-
* @param {string} did - The asset DID .
|
|
81
|
-
* @param {string} serviceId - The asset service ID.
|
|
82
|
-
* @param {number} fileIndex - The file index.
|
|
83
|
-
* @param {string} consumerAddress - The consumer address.
|
|
84
|
-
* @param {string} providerUri - The URI of the provider.
|
|
85
|
-
* @param {AbortSignal} [signal] - The abort signal if any.
|
|
86
|
-
* @param {UserCustomParameters} [userCustomParameters] - The custom parameters if any.
|
|
87
|
-
* @param {string} [computeEnv] - The compute environment if any.
|
|
88
|
-
* @param {number} [validUntil] - The validity time if any.
|
|
89
|
-
* @returns {Promise<ProviderInitialize>} A promise that resolves with ProviderInitialize response.
|
|
90
|
-
*/
|
|
91
|
-
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
92
|
-
/** Initializes the provider for a compute request.
|
|
93
|
-
* @param {ComputeAsset[]} assets The datasets array to initialize compute request.
|
|
94
|
-
* @param {ComputeAlgorithmber} algorithm The algorithm to use.
|
|
95
|
-
* @param {string} computeEnv The compute environment.
|
|
96
|
-
* @param {number} validUntil The job expiration date.
|
|
97
|
-
* @param {string} providerUri The provider URI.
|
|
98
|
-
* @param {string} accountId caller address
|
|
99
|
-
* @param {AbortSignal} signal abort signal
|
|
100
|
-
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
101
|
-
*/
|
|
102
|
-
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
103
|
-
/**
|
|
104
|
-
* Gets the download URL.
|
|
105
|
-
* @param {string} did - The DID.
|
|
106
|
-
* @param {string} serviceId - The service ID.
|
|
107
|
-
* @param {number} fileIndex - The file index.
|
|
108
|
-
* @param {string} transferTxId - The transfer transaction ID.
|
|
109
|
-
* @param {string} providerUri - The provider URI.
|
|
110
|
-
* @param {Signer} signer - The signer.
|
|
111
|
-
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
112
|
-
* @returns {Promise<any>} The download URL.
|
|
113
|
-
*/
|
|
114
|
-
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signer: Signer, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
115
|
-
/** Instruct the provider to start a compute job
|
|
116
|
-
* @param {string} providerUri The provider URI.
|
|
117
|
-
* @param {Signer} signer The consumer signer object.
|
|
118
|
-
* @param {string} computeEnv The compute environment.
|
|
119
|
-
* @param {ComputeAsset} dataset The dataset to start compute on
|
|
120
|
-
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
121
|
-
* @param {AbortSignal} signal abort signal
|
|
122
|
-
* @param {ComputeAsset[]} additionalDatasets The additional datasets if that is the case.
|
|
123
|
-
* @param {ComputeOutput} output The compute job output settings.
|
|
124
|
-
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
125
|
-
*/
|
|
126
|
-
computeStart(providerUri: string, consumer: Signer, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
|
|
127
|
-
/** Instruct the provider to Stop the execution of a to stop a compute job.
|
|
128
|
-
* @param {string} did the asset did
|
|
129
|
-
* @param {string} consumerAddress The consumer address.
|
|
130
|
-
* @param {string} jobId the compute job id
|
|
131
|
-
* @param {string} providerUri The provider URI.
|
|
132
|
-
* @param {Signer} signer The consumer signer object.
|
|
133
|
-
* @param {AbortSignal} signal abort signal
|
|
134
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
135
|
-
*/
|
|
136
|
-
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, signer: Signer, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
137
|
-
/** Get compute status for a specific jobId/documentId/owner.
|
|
138
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
139
|
-
* @param {string} consumerAddress The consumer ethereum address
|
|
140
|
-
* @param {string} jobId The ID of a compute job.
|
|
141
|
-
* @param {string} did The ID of the asset
|
|
142
|
-
* @param {AbortSignal} signal abort signal
|
|
143
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
144
|
-
*/
|
|
145
|
-
computeStatus(providerUri: string, consumerAddress: string, jobId?: string, did?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
146
|
-
/** Get compute result url
|
|
147
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
148
|
-
* @param {Signer} consumer consumer Signer wallet object
|
|
149
|
-
* @param {string} jobId The ID of a compute job.
|
|
150
|
-
* @param {number} index Result index
|
|
151
|
-
* @return {Promise<string>}
|
|
152
|
-
*/
|
|
153
|
-
getComputeResultUrl(providerUri: string, consumer: Signer, jobId: string, index: number): Promise<string>;
|
|
154
|
-
/** Deletes a compute job.
|
|
155
|
-
* @param {string} did asset did
|
|
156
|
-
* @param {Signer} consumer consumer Signer wallet object
|
|
157
|
-
* @param {string} jobId the compute job ID
|
|
158
|
-
* @param {string} providerUri The URI of the provider we want to query
|
|
159
|
-
* @param {AbortSignal} signal abort signal
|
|
160
|
-
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
161
|
-
*/
|
|
162
|
-
computeDelete(did: string, consumer: Signer, jobId: string, providerUri: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
163
|
-
/** Check for a valid provider at URL
|
|
164
|
-
* @param {String} url provider uri address
|
|
165
|
-
* @param {AbortSignal} signal abort signal
|
|
166
|
-
* @return {Promise<boolean>} valid or not
|
|
167
|
-
*/
|
|
168
|
-
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
169
|
-
/**
|
|
170
|
-
* Private method that removes the leading 0x from a string.
|
|
171
|
-
* @param {string} input - The input string.
|
|
172
|
-
* @returns The transformed string.
|
|
173
|
-
*/
|
|
174
|
-
private noZeroX;
|
|
175
|
-
/**
|
|
176
|
-
* Private method that removes the leading 0x from a string.
|
|
177
|
-
* @param {string} input - The input string.
|
|
178
|
-
* @param {boolean} zeroOutput - Whether to include 0x in the output if the input is valid and zeroOutput is true.
|
|
179
|
-
* @returns The transformed string.
|
|
180
|
-
*/
|
|
181
|
-
private zeroXTransformer;
|
|
182
|
-
/**
|
|
183
|
-
* Private method that matches an input string against a regular expression and returns the first capture group.
|
|
184
|
-
* @param {string} input - The input string to match.
|
|
185
|
-
* @param {RegExp} regexp - The regular expression to match against.
|
|
186
|
-
* @param {string} conversorName - The name of the method calling this function.
|
|
187
|
-
* @returns An object with two properties: `valid` (a boolean indicating whether the input matched the regular expression) and `output` (the first capture group of the match, or the original input if there was no match).
|
|
188
|
-
*/
|
|
189
|
-
private inputMatch;
|
|
190
|
-
/**
|
|
191
|
-
* Private method that fetches data from a URL using the GET method.
|
|
192
|
-
* @param {string} url - The URL to fetch data from.
|
|
193
|
-
* @returns A Promise that resolves to a Response object.
|
|
194
|
-
*/
|
|
195
|
-
private getData;
|
|
196
|
-
}
|
|
197
|
-
export declare const ProviderInstance: Provider;
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { Arweave, FileInfo, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ComputeEnvironment, ProviderInitialize, ProviderComputeInitializeResults, ServiceEndpoint, UrlFile, UserCustomParameters, Ipfs, Smartcontract, GraphqlQuery } from '../@types';
|
|
3
|
+
export declare class Provider {
|
|
4
|
+
/**
|
|
5
|
+
* Returns the provider endpoints
|
|
6
|
+
* @param {string} providerUri - the provider url
|
|
7
|
+
* @return {Promise<any>}
|
|
8
|
+
*/
|
|
9
|
+
getEndpoints(providerUri: string): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* This function returns the endpoint URL for a given service name.
|
|
12
|
+
* @param {ServiceEndpoint[]} servicesEndpoints - The array of service endpoints
|
|
13
|
+
* @param {string} serviceName - The name of the service
|
|
14
|
+
* @returns {ServiceEndpoint} The endpoint URL for the given service name
|
|
15
|
+
*/
|
|
16
|
+
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
17
|
+
/**
|
|
18
|
+
* This function returns an array of service endpoints for a given provider endpoint.
|
|
19
|
+
* @param {string} providerEndpoint - The provider endpoint
|
|
20
|
+
* @param {any} endpoints - The endpoints object
|
|
21
|
+
* @returns {ServiceEndpoint[]} An array of service endpoints
|
|
22
|
+
*/
|
|
23
|
+
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Get current nonce from the provider.
|
|
26
|
+
* @param {string} providerUri provider uri address
|
|
27
|
+
* @param {string} consumerAddress Publisher address
|
|
28
|
+
* @param {AbortSignal} signal abort signal
|
|
29
|
+
* @param {string} providerEndpoints Identifier of the asset to be registered in ocean
|
|
30
|
+
* @param {string} serviceEndpoints document description object (DDO)=
|
|
31
|
+
* @return {Promise<string>} urlDetails
|
|
32
|
+
*/
|
|
33
|
+
getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Sign a provider request with a signer.
|
|
36
|
+
* @param {Signer} signer - The signer to use.
|
|
37
|
+
* @param {string} message - The message to sign.
|
|
38
|
+
* @returns {Promise<string>} A promise that resolves with the signature.
|
|
39
|
+
*/
|
|
40
|
+
signProviderRequest(signer: Signer, message: string): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Encrypt data using the Provider's own symmetric key
|
|
43
|
+
* @param {string} data data in json format that needs to be sent , it can either be a DDO or a File array
|
|
44
|
+
* @param {number} chainId network's id so provider can choose the corresponding Signer object
|
|
45
|
+
* @param {string} providerUri provider uri address
|
|
46
|
+
* @param {AbortSignal} signal abort signal
|
|
47
|
+
* @return {Promise<string>} urlDetails
|
|
48
|
+
*/
|
|
49
|
+
encrypt(data: any, chainId: number, providerUri: string, signal?: AbortSignal): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Get file details for a given DID and service ID.
|
|
52
|
+
* @param {string} did - The DID to check.
|
|
53
|
+
* @param {string} serviceId - The service ID to check.
|
|
54
|
+
* @param {string} providerUri - The URI of the provider.
|
|
55
|
+
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
56
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
57
|
+
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
58
|
+
*/
|
|
59
|
+
checkDidFiles(did: string, serviceId: string, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Get File details (if possible)
|
|
62
|
+
* @param {UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract} file one of the supported file structures
|
|
63
|
+
* @param {string} providerUri uri of the provider that will be used to check the file
|
|
64
|
+
* @param {boolean} [withChecksum=false] - Whether or not to include a checksum.
|
|
65
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
66
|
+
* @returns {Promise<FileInfo[]>} A promise that resolves with an array of file info objects.
|
|
67
|
+
*/
|
|
68
|
+
getFileInfo(file: UrlFile | Arweave | Ipfs | GraphqlQuery | Smartcontract, providerUri: string, withChecksum?: boolean, signal?: AbortSignal): Promise<FileInfo[]>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns compute environments from a provider.
|
|
71
|
+
* @param {string} providerUri - The URI of the provider.
|
|
72
|
+
* @param {AbortSignal} [signal] - An optional abort signal.
|
|
73
|
+
* @returns {Promise<{[chainId: number]: ComputeEnvironment[]}>} A promise that resolves with an object containing compute environments for each chain ID.
|
|
74
|
+
*/
|
|
75
|
+
getComputeEnvironments(providerUri: string, signal?: AbortSignal): Promise<{
|
|
76
|
+
[chainId: number]: ComputeEnvironment[];
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Initializes the provider for a service request.
|
|
80
|
+
* @param {string} did - The asset DID .
|
|
81
|
+
* @param {string} serviceId - The asset service ID.
|
|
82
|
+
* @param {number} fileIndex - The file index.
|
|
83
|
+
* @param {string} consumerAddress - The consumer address.
|
|
84
|
+
* @param {string} providerUri - The URI of the provider.
|
|
85
|
+
* @param {AbortSignal} [signal] - The abort signal if any.
|
|
86
|
+
* @param {UserCustomParameters} [userCustomParameters] - The custom parameters if any.
|
|
87
|
+
* @param {string} [computeEnv] - The compute environment if any.
|
|
88
|
+
* @param {number} [validUntil] - The validity time if any.
|
|
89
|
+
* @returns {Promise<ProviderInitialize>} A promise that resolves with ProviderInitialize response.
|
|
90
|
+
*/
|
|
91
|
+
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
92
|
+
/** Initializes the provider for a compute request.
|
|
93
|
+
* @param {ComputeAsset[]} assets The datasets array to initialize compute request.
|
|
94
|
+
* @param {ComputeAlgorithmber} algorithm The algorithm to use.
|
|
95
|
+
* @param {string} computeEnv The compute environment.
|
|
96
|
+
* @param {number} validUntil The job expiration date.
|
|
97
|
+
* @param {string} providerUri The provider URI.
|
|
98
|
+
* @param {string} accountId caller address
|
|
99
|
+
* @param {AbortSignal} signal abort signal
|
|
100
|
+
* @return {Promise<ProviderComputeInitialize>} ProviderComputeInitialize data
|
|
101
|
+
*/
|
|
102
|
+
initializeCompute(assets: ComputeAsset[], algorithm: ComputeAlgorithm, computeEnv: string, validUntil: number, providerUri: string, accountId: string, signal?: AbortSignal): Promise<ProviderComputeInitializeResults>;
|
|
103
|
+
/**
|
|
104
|
+
* Gets the download URL.
|
|
105
|
+
* @param {string} did - The DID.
|
|
106
|
+
* @param {string} serviceId - The service ID.
|
|
107
|
+
* @param {number} fileIndex - The file index.
|
|
108
|
+
* @param {string} transferTxId - The transfer transaction ID.
|
|
109
|
+
* @param {string} providerUri - The provider URI.
|
|
110
|
+
* @param {Signer} signer - The signer.
|
|
111
|
+
* @param {UserCustomParameters} userCustomParameters - The user custom parameters.
|
|
112
|
+
* @returns {Promise<any>} The download URL.
|
|
113
|
+
*/
|
|
114
|
+
getDownloadUrl(did: string, serviceId: string, fileIndex: number, transferTxId: string, providerUri: string, signer: Signer, userCustomParameters?: UserCustomParameters): Promise<any>;
|
|
115
|
+
/** Instruct the provider to start a compute job
|
|
116
|
+
* @param {string} providerUri The provider URI.
|
|
117
|
+
* @param {Signer} signer The consumer signer object.
|
|
118
|
+
* @param {string} computeEnv The compute environment.
|
|
119
|
+
* @param {ComputeAsset} dataset The dataset to start compute on
|
|
120
|
+
* @param {ComputeAlgorithm} algorithm The algorithm to start compute with.
|
|
121
|
+
* @param {AbortSignal} signal abort signal
|
|
122
|
+
* @param {ComputeAsset[]} additionalDatasets The additional datasets if that is the case.
|
|
123
|
+
* @param {ComputeOutput} output The compute job output settings.
|
|
124
|
+
* @return {Promise<ComputeJob | ComputeJob[]>} The compute job or jobs.
|
|
125
|
+
*/
|
|
126
|
+
computeStart(providerUri: string, consumer: Signer, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
|
|
127
|
+
/** Instruct the provider to Stop the execution of a to stop a compute job.
|
|
128
|
+
* @param {string} did the asset did
|
|
129
|
+
* @param {string} consumerAddress The consumer address.
|
|
130
|
+
* @param {string} jobId the compute job id
|
|
131
|
+
* @param {string} providerUri The provider URI.
|
|
132
|
+
* @param {Signer} signer The consumer signer object.
|
|
133
|
+
* @param {AbortSignal} signal abort signal
|
|
134
|
+
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
135
|
+
*/
|
|
136
|
+
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, signer: Signer, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
137
|
+
/** Get compute status for a specific jobId/documentId/owner.
|
|
138
|
+
* @param {string} providerUri The URI of the provider we want to query
|
|
139
|
+
* @param {string} consumerAddress The consumer ethereum address
|
|
140
|
+
* @param {string} jobId The ID of a compute job.
|
|
141
|
+
* @param {string} did The ID of the asset
|
|
142
|
+
* @param {AbortSignal} signal abort signal
|
|
143
|
+
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
144
|
+
*/
|
|
145
|
+
computeStatus(providerUri: string, consumerAddress: string, jobId?: string, did?: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
146
|
+
/** Get compute result url
|
|
147
|
+
* @param {string} providerUri The URI of the provider we want to query
|
|
148
|
+
* @param {Signer} consumer consumer Signer wallet object
|
|
149
|
+
* @param {string} jobId The ID of a compute job.
|
|
150
|
+
* @param {number} index Result index
|
|
151
|
+
* @return {Promise<string>}
|
|
152
|
+
*/
|
|
153
|
+
getComputeResultUrl(providerUri: string, consumer: Signer, jobId: string, index: number): Promise<string>;
|
|
154
|
+
/** Deletes a compute job.
|
|
155
|
+
* @param {string} did asset did
|
|
156
|
+
* @param {Signer} consumer consumer Signer wallet object
|
|
157
|
+
* @param {string} jobId the compute job ID
|
|
158
|
+
* @param {string} providerUri The URI of the provider we want to query
|
|
159
|
+
* @param {AbortSignal} signal abort signal
|
|
160
|
+
* @return {Promise<ComputeJob | ComputeJob[]>}
|
|
161
|
+
*/
|
|
162
|
+
computeDelete(did: string, consumer: Signer, jobId: string, providerUri: string, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
163
|
+
/** Check for a valid provider at URL
|
|
164
|
+
* @param {String} url provider uri address
|
|
165
|
+
* @param {AbortSignal} signal abort signal
|
|
166
|
+
* @return {Promise<boolean>} valid or not
|
|
167
|
+
*/
|
|
168
|
+
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
169
|
+
/**
|
|
170
|
+
* Private method that removes the leading 0x from a string.
|
|
171
|
+
* @param {string} input - The input string.
|
|
172
|
+
* @returns The transformed string.
|
|
173
|
+
*/
|
|
174
|
+
private noZeroX;
|
|
175
|
+
/**
|
|
176
|
+
* Private method that removes the leading 0x from a string.
|
|
177
|
+
* @param {string} input - The input string.
|
|
178
|
+
* @param {boolean} zeroOutput - Whether to include 0x in the output if the input is valid and zeroOutput is true.
|
|
179
|
+
* @returns The transformed string.
|
|
180
|
+
*/
|
|
181
|
+
private zeroXTransformer;
|
|
182
|
+
/**
|
|
183
|
+
* Private method that matches an input string against a regular expression and returns the first capture group.
|
|
184
|
+
* @param {string} input - The input string to match.
|
|
185
|
+
* @param {RegExp} regexp - The regular expression to match against.
|
|
186
|
+
* @param {string} conversorName - The name of the method calling this function.
|
|
187
|
+
* @returns An object with two properties: `valid` (a boolean indicating whether the input matched the regular expression) and `output` (the first capture group of the match, or the original input if there was no match).
|
|
188
|
+
*/
|
|
189
|
+
private inputMatch;
|
|
190
|
+
/**
|
|
191
|
+
* Private method that fetches data from a URL using the GET method.
|
|
192
|
+
* @param {string} url - The URL to fetch data from.
|
|
193
|
+
* @returns A Promise that resolves to a Response object.
|
|
194
|
+
*/
|
|
195
|
+
private getData;
|
|
196
|
+
}
|
|
197
|
+
export declare const ProviderInstance: Provider;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './Aquarius';
|
|
2
|
-
export * from './Provider';
|
|
1
|
+
export * from './Aquarius';
|
|
2
|
+
export * from './Provider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2
|
-
export declare const GASLIMIT_DEFAULT = 1000000;
|
|
3
|
-
export declare const MAX_UINT_256 = "115792089237316195423570985008687907853269984665640564039457584007913129639934";
|
|
4
|
-
export declare const FEE_HISTORY_NOT_SUPPORTED = "Returned error: Method eth_feeHistory not supported.";
|
|
1
|
+
export declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
2
|
+
export declare const GASLIMIT_DEFAULT = 1000000;
|
|
3
|
+
export declare const MAX_UINT_256 = "115792089237316195423570985008687907853269984665640564039457584007913129639934";
|
|
4
|
+
export declare const FEE_HISTORY_NOT_SUPPORTED = "Returned error: Method eth_feeHistory not supported.";
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers';
|
|
2
|
-
import { Config } from '../config';
|
|
3
|
-
export declare function setContractDefaults(contract: Contract, config: Config): Contract;
|
|
4
|
-
/**
|
|
5
|
-
* Asynchronous function that returns a fair gas price based on the current gas price and a multiplier.
|
|
6
|
-
* @param {Signer} signer - The signer object to use for fetching the current gas price.
|
|
7
|
-
* @param {number} gasFeeMultiplier - The multiplier to apply to the current gas price. If not provided, the current gas price is returned as a string.
|
|
8
|
-
* @returns A Promise that resolves to a string representation of the fair gas price.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getFairGasPrice(signer: Signer, gasFeeMultiplier: number): Promise<string>;
|
|
11
|
-
/**
|
|
12
|
-
* Asynchronous function that returns the number of decimal places for a given token.
|
|
13
|
-
* @param {Signer} signer - The signer object to use for fetching the token decimals.
|
|
14
|
-
* @param {string} token - The address of the token contract.
|
|
15
|
-
* @returns A Promise that resolves to the number of decimal places for the token.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getTokenDecimals(signer: Signer, token: string): Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* Converts an amount of units to tokens
|
|
20
|
-
* @param {Signer} signer - The signer object to use.
|
|
21
|
-
* @param {string} token - The token to convert
|
|
22
|
-
* @param {string} amount - The amount of units to convert
|
|
23
|
-
* @param {number} [tokenDecimals] - The number of decimals in the token
|
|
24
|
-
* @returns {Promise<string>} - The converted amount in tokens
|
|
25
|
-
*/
|
|
26
|
-
export declare function unitsToAmount(signer: Signer, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
27
|
-
/**
|
|
28
|
-
* Converts an amount of tokens to units
|
|
29
|
-
* @param {Signer} signer - The signer object to use.
|
|
30
|
-
* @param {string} token - The token to convert
|
|
31
|
-
* @param {string} amount - The amount of tokens to convert
|
|
32
|
-
* @param {number} [tokenDecimals] - The number of decimals of the token
|
|
33
|
-
* @returns {Promise<string>} - The converted amount in units
|
|
34
|
-
*/
|
|
35
|
-
export declare function amountToUnits(signer: Signer, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
36
|
-
export declare function getEventFromTx(txReceipt: any, eventName: any): any;
|
|
37
|
-
/**
|
|
38
|
-
* Send the transation on chain
|
|
39
|
-
* @param {BigNumber} estGas estimated gas for the transaction
|
|
40
|
-
* @param {Signer} signer signer object
|
|
41
|
-
* @param {number} gasFeeMultiplier number represinting the multiplier we apply to gas fees
|
|
42
|
-
* @param {Function} functionToSend function that we need to send
|
|
43
|
-
* @param {...any[]} args arguments of the function
|
|
44
|
-
* @return {Promise<any>} transaction receipt
|
|
45
|
-
*/
|
|
46
|
-
export declare function sendTx(estGas: BigNumber, signer: Signer, gasFeeMultiplier: number, functionToSend: ContractFunction, ...args: any[]): Promise<providers.TransactionResponse>;
|
|
1
|
+
import { Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers';
|
|
2
|
+
import { Config } from '../config';
|
|
3
|
+
export declare function setContractDefaults(contract: Contract, config: Config): Contract;
|
|
4
|
+
/**
|
|
5
|
+
* Asynchronous function that returns a fair gas price based on the current gas price and a multiplier.
|
|
6
|
+
* @param {Signer} signer - The signer object to use for fetching the current gas price.
|
|
7
|
+
* @param {number} gasFeeMultiplier - The multiplier to apply to the current gas price. If not provided, the current gas price is returned as a string.
|
|
8
|
+
* @returns A Promise that resolves to a string representation of the fair gas price.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getFairGasPrice(signer: Signer, gasFeeMultiplier: number): Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Asynchronous function that returns the number of decimal places for a given token.
|
|
13
|
+
* @param {Signer} signer - The signer object to use for fetching the token decimals.
|
|
14
|
+
* @param {string} token - The address of the token contract.
|
|
15
|
+
* @returns A Promise that resolves to the number of decimal places for the token.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTokenDecimals(signer: Signer, token: string): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* Converts an amount of units to tokens
|
|
20
|
+
* @param {Signer} signer - The signer object to use.
|
|
21
|
+
* @param {string} token - The token to convert
|
|
22
|
+
* @param {string} amount - The amount of units to convert
|
|
23
|
+
* @param {number} [tokenDecimals] - The number of decimals in the token
|
|
24
|
+
* @returns {Promise<string>} - The converted amount in tokens
|
|
25
|
+
*/
|
|
26
|
+
export declare function unitsToAmount(signer: Signer, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Converts an amount of tokens to units
|
|
29
|
+
* @param {Signer} signer - The signer object to use.
|
|
30
|
+
* @param {string} token - The token to convert
|
|
31
|
+
* @param {string} amount - The amount of tokens to convert
|
|
32
|
+
* @param {number} [tokenDecimals] - The number of decimals of the token
|
|
33
|
+
* @returns {Promise<string>} - The converted amount in units
|
|
34
|
+
*/
|
|
35
|
+
export declare function amountToUnits(signer: Signer, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
36
|
+
export declare function getEventFromTx(txReceipt: any, eventName: any): any;
|
|
37
|
+
/**
|
|
38
|
+
* Send the transation on chain
|
|
39
|
+
* @param {BigNumber} estGas estimated gas for the transaction
|
|
40
|
+
* @param {Signer} signer signer object
|
|
41
|
+
* @param {number} gasFeeMultiplier number represinting the multiplier we apply to gas fees
|
|
42
|
+
* @param {Function} functionToSend function that we need to send
|
|
43
|
+
* @param {...any[]} args arguments of the function
|
|
44
|
+
* @return {Promise<any>} transaction receipt
|
|
45
|
+
*/
|
|
46
|
+
export declare function sendTx(estGas: BigNumber, signer: Signer, gasFeeMultiplier: number, functionToSend: ContractFunction, ...args: any[]): Promise<providers.TransactionResponse>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function generates a datatoken name and symbol from a given word list.
|
|
3
|
-
* @param {Object} [wordList] - An object containing an array of nouns and adjectives.
|
|
4
|
-
* @param {string[]} [wordList.nouns] - An array of nouns.
|
|
5
|
-
* @param {string[]} [wordList.adjectives] - An array of adjectives.
|
|
6
|
-
* @returns {Object} Returns an object containing the generated name and symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
|
|
7
|
-
*/
|
|
8
|
-
export declare function generateDtName(wordList?: {
|
|
9
|
-
nouns: string[];
|
|
10
|
-
adjectives: string[];
|
|
11
|
-
}): {
|
|
12
|
-
name: string;
|
|
13
|
-
symbol: string;
|
|
14
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* This function generates a datatoken name and symbol from a given word list.
|
|
3
|
+
* @param {Object} [wordList] - An object containing an array of nouns and adjectives.
|
|
4
|
+
* @param {string[]} [wordList.nouns] - An array of nouns.
|
|
5
|
+
* @param {string[]} [wordList.adjectives] - An array of adjectives.
|
|
6
|
+
* @returns {Object} Returns an object containing the generated name and symbol. Produces e.g. "Endemic Jellyfish Token" & "ENDJEL-45"
|
|
7
|
+
*/
|
|
8
|
+
export declare function generateDtName(wordList?: {
|
|
9
|
+
nouns: string[];
|
|
10
|
+
adjectives: string[];
|
|
11
|
+
}): {
|
|
12
|
+
name: string;
|
|
13
|
+
symbol: string;
|
|
14
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a valid DID
|
|
3
|
-
* @param {string} nftAddress - The NFT address
|
|
4
|
-
* @param {number} chainId - The chain ID
|
|
5
|
-
* @returns {string} - The DID
|
|
6
|
-
*/
|
|
7
|
-
export declare function generateDid(nftAddress: string, chainId: number): string;
|
|
8
|
-
/**
|
|
9
|
-
* Returns the SHA256 hash of the input data
|
|
10
|
-
* @param {any} data - The input data
|
|
11
|
-
* @returns {string} - The SHA256 hash of the input data
|
|
12
|
-
*/
|
|
13
|
-
export declare function getHash(data: any): string;
|
|
1
|
+
/**
|
|
2
|
+
* Generates a valid DID
|
|
3
|
+
* @param {string} nftAddress - The NFT address
|
|
4
|
+
* @param {number} chainId - The chain ID
|
|
5
|
+
* @returns {string} - The DID
|
|
6
|
+
*/
|
|
7
|
+
export declare function generateDid(nftAddress: string, chainId: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns the SHA256 hash of the input data
|
|
10
|
+
* @param {any} data - The input data
|
|
11
|
+
* @returns {string} - The SHA256 hash of the input data
|
|
12
|
+
*/
|
|
13
|
+
export declare function getHash(data: any): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { DownloadResponse } from '../@types';
|
|
2
|
-
/**
|
|
3
|
-
* Triggers a file download from the specified URL when called from a browser context.
|
|
4
|
-
* @param {string} url - The URL of the file to download
|
|
5
|
-
* @returns {Promise<void>} - A Promise that resolves when the file has been downloaded
|
|
6
|
-
*/
|
|
7
|
-
export declare function downloadFileBrowser(url: string): void;
|
|
8
|
-
/**
|
|
9
|
-
* Triggers a file download from the specified URL when called from a browser context.
|
|
10
|
-
* @param {string} url - The URL of the file to download
|
|
11
|
-
* @param {number} [index] - The file index
|
|
12
|
-
* @returns {Promise<void>} - A Promise that resolves when the file has been downloaded
|
|
13
|
-
*/
|
|
14
|
-
export declare function downloadFile(url: string, index?: number): Promise<DownloadResponse>;
|
|
1
|
+
import { DownloadResponse } from '../@types';
|
|
2
|
+
/**
|
|
3
|
+
* Triggers a file download from the specified URL when called from a browser context.
|
|
4
|
+
* @param {string} url - The URL of the file to download
|
|
5
|
+
* @returns {Promise<void>} - A Promise that resolves when the file has been downloaded
|
|
6
|
+
*/
|
|
7
|
+
export declare function downloadFileBrowser(url: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Triggers a file download from the specified URL when called from a browser context.
|
|
10
|
+
* @param {string} url - The URL of the file to download
|
|
11
|
+
* @param {number} [index] - The file index
|
|
12
|
+
* @returns {Promise<void>} - A Promise that resolves when the file has been downloaded
|
|
13
|
+
*/
|
|
14
|
+
export declare function downloadFile(url: string, index?: number): Promise<DownloadResponse>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple blocking sleep function
|
|
3
|
-
* @param {number} ms - Number of miliseconds to wait
|
|
4
|
-
*/
|
|
5
|
-
export declare function sleep(ms: number): Promise<unknown>;
|
|
1
|
+
/**
|
|
2
|
+
* Simple blocking sleep function
|
|
3
|
+
* @param {number} ms - Number of miliseconds to wait
|
|
4
|
+
*/
|
|
5
|
+
export declare function sleep(ms: number): Promise<unknown>;
|