@oceanprotocol/lib 3.3.0 → 3.3.1

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 (83) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +19 -16
  3. package/dist/lib.js +1 -1
  4. package/dist/lib.js.map +1 -1
  5. package/dist/lib.modern.js +1 -1
  6. package/dist/lib.modern.js.map +1 -1
  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/package.json +1 -1
  12. package/dist/src/@types/Asset.d.ts +0 -148
  13. package/dist/src/@types/Compute.d.ts +0 -71
  14. package/dist/src/@types/Contracts.d.ts +0 -26
  15. package/dist/src/@types/DDO/ConsumerParameter.d.ts +0 -37
  16. package/dist/src/@types/DDO/Credentials.d.ts +0 -8
  17. package/dist/src/@types/DDO/DDO.d.ts +0 -55
  18. package/dist/src/@types/DDO/Event.d.ts +0 -27
  19. package/dist/src/@types/DDO/Metadata.d.ts +0 -141
  20. package/dist/src/@types/DDO/Service.d.ts +0 -100
  21. package/dist/src/@types/Datatoken.d.ts +0 -38
  22. package/dist/src/@types/Dispenser.d.ts +0 -16
  23. package/dist/src/@types/DownloadResponse.d.ts +0 -4
  24. package/dist/src/@types/File.d.ts +0 -89
  25. package/dist/src/@types/FileInfo.d.ts +0 -43
  26. package/dist/src/@types/FixedPrice.d.ts +0 -51
  27. package/dist/src/@types/NFT.d.ts +0 -18
  28. package/dist/src/@types/NFTFactory.d.ts +0 -20
  29. package/dist/src/@types/Provider.d.ts +0 -33
  30. package/dist/src/@types/ReturnTypes.d.ts +0 -3
  31. package/dist/src/@types/Router.d.ts +0 -59
  32. package/dist/src/@types/index.d.ts +0 -20
  33. package/dist/src/config/Config.d.ts +0 -153
  34. package/dist/src/config/ConfigHelper.d.ts +0 -12
  35. package/dist/src/config/index.d.ts +0 -2
  36. package/dist/src/contracts/Datatoken.d.ts +0 -278
  37. package/dist/src/contracts/Dispenser.d.ts +0 -73
  38. package/dist/src/contracts/FixedRateExchange.d.ts +0 -209
  39. package/dist/src/contracts/NFT.d.ts +0 -220
  40. package/dist/src/contracts/NFTFactory.d.ts +0 -165
  41. package/dist/src/contracts/Router.d.ts +0 -107
  42. package/dist/src/contracts/SmartContract.d.ts +0 -45
  43. package/dist/src/contracts/SmartContractWithAddress.d.ts +0 -17
  44. package/dist/src/contracts/df/DfRewards.d.ts +0 -31
  45. package/dist/src/contracts/df/DfStrategyV1.d.ts +0 -21
  46. package/dist/src/contracts/index.d.ts +0 -14
  47. package/dist/src/contracts/ve/VeAllocate.d.ts +0 -38
  48. package/dist/src/contracts/ve/VeFeeDistributor.d.ts +0 -29
  49. package/dist/src/contracts/ve/VeFeeEstimate.d.ts +0 -14
  50. package/dist/src/contracts/ve/VeOcean.d.ts +0 -68
  51. package/dist/src/index.d.ts +0 -5
  52. package/dist/src/services/Aquarius.d.ts +0 -53
  53. package/dist/src/services/Provider.d.ts +0 -197
  54. package/dist/src/services/index.d.ts +0 -2
  55. package/dist/src/utils/Constants.d.ts +0 -4
  56. package/dist/src/utils/ContractUtils.d.ts +0 -46
  57. package/dist/src/utils/DatatokenName.d.ts +0 -14
  58. package/dist/src/utils/DdoHelpers.d.ts +0 -13
  59. package/dist/src/utils/FetchHelper.d.ts +0 -14
  60. package/dist/src/utils/General.d.ts +0 -5
  61. package/dist/src/utils/Logger.d.ts +0 -19
  62. package/dist/src/utils/OrderUtils.d.ts +0 -20
  63. package/dist/src/utils/ProviderErrors.d.ts +0 -1
  64. package/dist/src/utils/SignatureUtils.d.ts +0 -12
  65. package/dist/src/utils/TokenUtils.d.ts +0 -70
  66. package/dist/src/utils/index.d.ts +0 -12
  67. package/dist/src/utils/minAbi.d.ts +0 -38
  68. package/dist/test/config.d.ts +0 -19
  69. package/dist/test/integration/CodeExamples.test.d.ts +0 -1
  70. package/dist/test/integration/ComputeExamples.test.d.ts +0 -1
  71. package/dist/test/integration/ComputeFlow.test.d.ts +0 -1
  72. package/dist/test/integration/Provider.test.d.ts +0 -1
  73. package/dist/test/integration/PublishEditConsume.test.d.ts +0 -1
  74. package/dist/test/integration/PublishFlows.test.d.ts +0 -1
  75. package/dist/test/integration/helpers.d.ts +0 -7
  76. package/dist/test/unit/DFRewards.test.d.ts +0 -1
  77. package/dist/test/unit/Datatoken.test.d.ts +0 -1
  78. package/dist/test/unit/Dispenser.test.d.ts +0 -1
  79. package/dist/test/unit/FixedRateExchange.test.d.ts +0 -1
  80. package/dist/test/unit/Nft.test.d.ts +0 -1
  81. package/dist/test/unit/NftFactory.test.d.ts +0 -1
  82. package/dist/test/unit/Router.test.d.ts +0 -1
  83. package/dist/test/unit/veOcean.test.d.ts +0 -1
@@ -1,29 +0,0 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { ReceiptOrEstimate, AbiItem } from '../../@types';
3
- /**
4
- * Provides an interface for veOcean contract
5
- */
6
- export declare class VeFeeDistributor extends SmartContractWithAddress {
7
- getDefaultAbi(): AbiItem[];
8
- /**
9
- * Claim fees for `userAddress`
10
- * Each call to claim look at a maximum of 50 user veOCEAN points.
11
- For accounts with many veOCEAN related actions, this function
12
- may need to be called more than once to claim all available
13
- fees. In the `Claimed` event that fires, if `claim_epoch` is
14
- less than `max_epoch`, the account may claim again
15
- * @param {Boolean} estimateGas if True, return gas estimate
16
- * @return {Promise<ReceiptOrEstimate>}
17
- */
18
- claim<G extends boolean = false>(estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
19
- /**
20
- * Make multiple fee claims in a single call
21
- Used to claim for many accounts at once, or to make
22
- multiple claims for the same address when that address
23
- has significant veOCEAN history
24
- * @param {String} addresses array of addresses to claim
25
- * @param {Boolean} estimateGas if True, return gas estimate
26
- * @return {Promise<ReceiptOrEstimate>}
27
- */
28
- claimMany<G extends boolean = false>(addresses: string[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
29
- }
@@ -1,14 +0,0 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { AbiItem } from '../../@types';
3
- /**
4
- * Provides an interface for veOcean contract
5
- */
6
- export declare class VeFeeEstimate extends SmartContractWithAddress {
7
- getDefaultAbi(): AbiItem[];
8
- /**
9
- * estimateClaim
10
- * @param {String} userAddress user address
11
- * @return {Promise<string>}
12
- */
13
- estimateClaim(userAddress: string): Promise<string>;
14
- }
@@ -1,68 +0,0 @@
1
- import { SmartContractWithAddress } from '../SmartContractWithAddress';
2
- import { ReceiptOrEstimate, AbiItem } from '../../@types';
3
- /**
4
- * Provides an interface for veOcean contract
5
- */
6
- export declare class VeOcean extends SmartContractWithAddress {
7
- getDefaultAbi(): AbiItem[];
8
- /**
9
- * Deposit `amount` tokens for `userAddress` and lock until `unlockTime`
10
- * @param {String} amount Amount of tokens to be locked
11
- * @param {Number} unlockTime Timestamp for unlock
12
- * @param {Boolean} estimateGas if True, return gas estimate
13
- * @return {Promise<ReceiptOrEstimate>}
14
- */
15
- lockTokens<G extends boolean = false>(amount: string, unlockTime: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
16
- /**
17
- * Deposit `amount` tokens for `toAddress` and add to the existing lock
18
- * Anyone (even a smart contract) can deposit for someone else, but cannot extend their locktime and deposit for a brand new user
19
- * @param {String} toAddress user address to deposit for
20
- * @param {String} amount Amount of tokens to be locked
21
- * @param {Boolean} estimateGas if True, return gas estimate
22
- * @return {Promise<ReceiptOrEstimate>}
23
- */
24
- depositFor<G extends boolean = false>(toAddress: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
25
- /**
26
- * Deposit `amount` additional tokens for `userAddress` without modifying the unlock time
27
- * @param {String} amount Amount of tokens to be locked
28
- * @param {Boolean} estimateGas if True, return gas estimate
29
- * @return {Promise<ReceiptOrEstimate>}
30
- */
31
- increaseAmount<G extends boolean = false>(amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
32
- /**
33
- * Extend the unlock time for `userAddress` to `unlockTime`
34
- * @param {Number} unlockTime Timestamp for new unlock time
35
- * @param {Boolean} estimateGas if True, return gas estimate
36
- * @return {Promise<ReceiptOrEstimate>}
37
- */
38
- increaseUnlockTime<G extends boolean = false>(unlockTime: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
39
- /**
40
- * Withdraw all tokens for `userAddress`
41
- * @param {Boolean} estimateGas if True, return gas estimate
42
- * @return {Promise<ReceiptOrEstimate>}
43
- */
44
- withdraw<G extends boolean = false>(estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
45
- /** Get voting power for address
46
- * @param {String} userAddress user address
47
- * @return {Promise<number>}
48
- */
49
- getVotingPower(userAddress: string): Promise<number>;
50
- /** Get locked balance
51
- * @param {String} userAddress user address
52
- * @return {Promise<string>}
53
- */
54
- getLockedAmount(userAddress: string): Promise<string>;
55
- /** Get untilLock for address
56
- * @param {String} userAddress user address
57
- * @return {Promise<number>}
58
- */
59
- lockEnd(userAddress: string): Promise<number>;
60
- /** Get total supply
61
- * @return {Promise<number>}
62
- */
63
- totalSupply(): Promise<string>;
64
- /** Get token
65
- * @return {Promise<string>}
66
- */
67
- getToken(): Promise<string>;
68
- }
@@ -1,5 +0,0 @@
1
- export * from './@types';
2
- export * from './config';
3
- export * from './contracts';
4
- export * from './services';
5
- export * from './utils';
@@ -1,53 +0,0 @@
1
- import { Asset, DDO, ValidateMetadata } from '../@types';
2
- export interface SearchQuery {
3
- from?: number;
4
- size?: number;
5
- query: any;
6
- sort?: {
7
- [jsonPath: string]: string;
8
- };
9
- aggs?: any;
10
- }
11
- export declare class Aquarius {
12
- aquariusURL: string;
13
- /**
14
- * Instantiate Aquarius
15
- * @param {String} aquariusURL
16
- */
17
- constructor(aquariusURL: string);
18
- /** Resolves a DID
19
- * @param {string} did DID of the asset.
20
- * @param {AbortSignal} signal abort signal
21
- * @return {Promise<Asset>} Asset
22
- */
23
- resolve(did: string, signal?: AbortSignal): Promise<Asset>;
24
- /**
25
- * Blocks until Aqua will cache the did (or the update for that did) or timeouts
26
- * @param {string} did DID of the asset.
27
- * @param {string} txid used when the did exists and we expect an update with that txid.
28
- * @param {AbortSignal} signal abort signal
29
- * @return {Promise<Asset>} DDO of the asset.
30
- */
31
- waitForAqua(did: string, txid?: string, signal?: AbortSignal): Promise<Asset>;
32
- /**
33
- * Validate DDO content
34
- * @param {DDO} ddo DID Descriptor Object content.
35
- * @param {AbortSignal} signal abort signal
36
- * @return {Promise<ValidateMetadata>}.
37
- */
38
- validate(ddo: DDO, signal?: AbortSignal): Promise<ValidateMetadata>;
39
- /**
40
- * Search over the DDOs using a query.
41
- * @param {string} did DID of the asset
42
- * @param {AbortSignal} signal abort signal
43
- * @return {Promise<QueryResult>}
44
- */
45
- getAssetMetadata(did: string, signal?: AbortSignal): Promise<any>;
46
- /**
47
- * Search over the DDOs using a query.
48
- * @param {SearchQuery} query Query to filter the DDOs.
49
- * @param {AbortSignal} signal abort signal
50
- * @return {Promise<QueryResult>}
51
- */
52
- querySearch(query: SearchQuery, signal?: AbortSignal): Promise<any>;
53
- }
@@ -1,197 +0,0 @@
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<number>;
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 +0,0 @@
1
- export * from './Aquarius';
2
- export * from './Provider';
@@ -1,4 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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 +0,0 @@
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,19 +0,0 @@
1
- export declare enum LogLevel {
2
- None = -1,
3
- Error = 0,
4
- Warn = 1,
5
- Log = 2,
6
- Verbose = 3
7
- }
8
- export declare class Logger {
9
- private logLevel?;
10
- constructor(logLevel?: LogLevel);
11
- setLevel(logLevel: LogLevel): void;
12
- bypass(...args: any[]): void;
13
- debug(...args: any[]): void;
14
- log(...args: any[]): void;
15
- warn(...args: any[]): void;
16
- error(...args: any[]): void;
17
- private dispatch;
18
- }
19
- export declare const LoggerInstance: Logger;
@@ -1,20 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { Datatoken, Config, Asset, ConsumeMarketFee, ProviderFees } from '../index';
3
- /**
4
- * Orders an asset based on the specified pricing schema and configuration.
5
- * @param {Asset} asset - The asset to be ordered.
6
- * @param {Signer} consumerAccount - The signer account of the consumer.
7
- * @param {Config} config - The configuration settings.
8
- * @param {Datatoken} datatoken - The Datatoken instance.
9
- * @param {string} [providerUrl] - Optional the consumer address
10
- * @param {string} [consumerAccount] - Optional the consumer address
11
- * @param {ConsumeMarketFee} [consumeMarketOrderFee] - Optional consume market fee.
12
- * @param {ProviderFees} [providerFees] - Optional provider fees
13
- * @param {string} [consumeMarketFixedSwapFee='0'] - Fixed swap fee for consuming the market.
14
- * @param {number} [datatokenIndex=0] - Index of the datatoken within the asset.
15
- * @param {number} [serviceIndex=0] - Index of the service within the asset.
16
- * @param {number} [fixedRateIndex=0] - Index of the fixed rate within the pricing schema.
17
- * @returns {Promise<void>} - A promise that resolves when the asset order process is completed.
18
- * @throws {Error} If the pricing schema is not supported or if required indexes are invalid.
19
- */
20
- export declare function orderAsset(asset: Asset, consumerAccount: Signer, config: Config, datatoken: Datatoken, providerUrl?: string, consumerAddress?: string, consumeMarketOrderFee?: ConsumeMarketFee, providerFees?: ProviderFees, consumeMarketFixedSwapFee?: string, datatokenIndex?: number, serviceIndex?: number, fixedRateIndex?: number): Promise<import("@ethersproject/abstract-provider").TransactionResponse>;
@@ -1 +0,0 @@
1
- export declare function getErrorMessage(err: string): string;
@@ -1,12 +0,0 @@
1
- import { Signer } from 'ethers';
2
- /**
3
- * Signs the hash of a message using the provided signer.
4
- * @param {Signer} signer - The signer to use for signing the hash.
5
- * @param {string} message - The message to sign.
6
- * @returns {Promise<string>} - A Promise that resolves to the signature of the hash of the message.
7
- */
8
- export declare function signHash(signer: Signer, message: string): Promise<{
9
- v: string;
10
- r: string;
11
- s: string;
12
- }>;
@@ -1,70 +0,0 @@
1
- import { Signer } from 'ethers';
2
- import { Config } from '../config';
3
- import { ReceiptOrEstimate, ReceiptOrDecimal } from '../@types';
4
- /**
5
- * Approve spender to spent amount tokens
6
- * @param {Signer} signer - The signer object
7
- * @param {Config} config - The config object
8
- * @param {string} account - The address of the caller
9
- * @param {string} tokenAddress - The address of the token
10
- * @param {string} spender - The address of the spender
11
- * @param {String} amount amount of ERC20 Datatokens (always expressed as wei)
12
- * @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
13
- * @param {number} [tokenDecimals] optional number of decimals of the token
14
- * @param {boolean} [estimateGas] if true, returns the estimate gas cost for calling the method
15
- */
16
- export declare function approve<G extends boolean = false>(signer: Signer, config: Config, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrDecimal<G> | number>;
17
- /**
18
- * Approve spender to spent amount tokens
19
- * @param {Signer} signer - The signer object
20
- * @param {Config} config - The config object
21
- * @param {string} account - The address of the caller
22
- * @param {string} tokenAddress - The address of the token
23
- * @param {string} spender - The address of the spender
24
- * @param {string} amount amount of ERC20 tokens (always expressed as wei)
25
- * @param {boolean} force if true, will overwrite any previous allowence. Else, will check if allowence is enough and will not send a transaction if it's not needed
26
- * @param {boolean} [estimateGas] if true, returns the estimate gas cost for calling the method
27
- */
28
- export declare function approveWei<G extends boolean = false>(signer: Signer, config: Config, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
29
- /**
30
- * Moves amount tokens from the caller’s account to recipient.
31
- * @param {Signer} signer - The signer object
32
- * @param {Config} config - The config object
33
- * @param {string} tokenAddress - The address of the token
34
- * @param {string} recipient - The address of the tokens receiver
35
- * @param {String} amount amount of ERC20 Datatokens (not as wei)
36
- * @param {String} estimateGas if true returns the gas estimate
37
- */
38
- export declare function transfer<G extends boolean = false>(signer: Signer, config: Config, tokenAddress: string, recipient: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
39
- /**
40
- * Get Allowance for any Datatoken
41
- * @param {Signer} signer - The signer object
42
- * @param {string} tokenAddress - The address of the token
43
- * @param {string} account - The address of the caller
44
- * @param {string} spender - The address of the spender
45
- * @param {number} tokenDecimals optional number of decimals of the token
46
- */
47
- export declare function allowance(signer: Signer, tokenAddress: string, account: string, spender: string, tokenDecimals?: number): Promise<string>;
48
- /**
49
- * Get balance for any Datatoken
50
- * @param {Signer} signer - The signer object
51
- * @param {string} tokenAddress - The address of the token
52
- * @param {string} account - The address of the caller
53
- * @param {number} [tokenDecimals] optional number of decimals of the token
54
- */
55
- export declare function balance(signer: Signer, tokenAddress: string, account: string, tokenDecimals?: number): Promise<string>;
56
- /**
57
- * Get Allowance in wei for any erc20
58
- * @param {Signer} signer - The signer object
59
- * @param {string} tokenAddress - The address of the token
60
- * @param {string} account - The address of the caller
61
- * @param {string} spender - The address of the spneder
62
- */
63
- export declare function allowanceWei(signer: Signer, tokenAddress: string, account: string, spender: string): Promise<string>;
64
- /**
65
- * Get decimals for any Datatoken
66
- * @param {Signer} signer - The signer object
67
- * @param {String} tokenAddress - The address of the token
68
- * @return {Promise<number>} Number of decimals of the token
69
- */
70
- export declare function decimals(signer: Signer, tokenAddress: string): Promise<number>;
@@ -1,12 +0,0 @@
1
- export * from './Constants';
2
- export * from './ContractUtils';
3
- export * from './DatatokenName';
4
- export * from './DdoHelpers';
5
- export * from './FetchHelper';
6
- export * from './General';
7
- export * from './Logger';
8
- export * from './minAbi';
9
- export * from './SignatureUtils';
10
- export * from './TokenUtils';
11
- export * from './ProviderErrors';
12
- export * from './OrderUtils';