@oceanprotocol/lib 1.0.0-next.7 → 1.0.0-next.8
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 +8 -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/DownloadResponse.d.ts +4 -0
- package/dist/src/aquarius/Aquarius.d.ts +3 -3
- package/dist/src/interfaces/Erc721Interface.d.ts +12 -0
- package/dist/src/pools/balancer/Pool.d.ts +0 -5
- package/dist/src/provider/Provider.d.ts +15 -11
- package/dist/src/tokens/NFT.d.ts +5 -2
- package/dist/src/utils/ConfigHelper.d.ts +1 -1
- package/dist/src/utils/Constants.d.ts +1 -0
- package/dist/src/utils/ContractUtils.d.ts +2 -0
- package/dist/src/utils/FetchHelper.d.ts +3 -2
- package/dist/src/utils/TokenUtils.d.ts +7 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/minAbi.d.ts +2 -0
- package/package.json +3 -4
|
@@ -2,9 +2,9 @@ import { Asset, DDO, ValidateMetadata } from '../@types/';
|
|
|
2
2
|
export declare class Aquarius {
|
|
3
3
|
aquariusURL: any;
|
|
4
4
|
constructor(aquariusURL: string);
|
|
5
|
-
resolve(did: string,
|
|
5
|
+
resolve(did: string, signal?: AbortSignal): Promise<Asset>;
|
|
6
6
|
sleep(ms: number): Promise<unknown>;
|
|
7
|
-
waitForAqua(did: string, txid?: string,
|
|
8
|
-
validate(ddo: DDO,
|
|
7
|
+
waitForAqua(did: string, txid?: string, signal?: AbortSignal): Promise<Asset>;
|
|
8
|
+
validate(ddo: DDO, signal?: AbortSignal): Promise<ValidateMetadata>;
|
|
9
9
|
}
|
|
10
10
|
export default Aquarius;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MetadataProof } from '../@types';
|
|
2
|
+
export interface MetadataAndTokenURI {
|
|
3
|
+
metaDataState: number;
|
|
4
|
+
metaDataDecryptorUrl: string;
|
|
5
|
+
metaDataDecryptorAddress: string;
|
|
6
|
+
flags: string;
|
|
7
|
+
data: string;
|
|
8
|
+
metaDataHash: string;
|
|
9
|
+
tokenId: number;
|
|
10
|
+
tokenURI: string;
|
|
11
|
+
metadataProofs: MetadataProof[];
|
|
12
|
+
}
|
|
@@ -12,9 +12,6 @@ export declare class Pool {
|
|
|
12
12
|
private logger;
|
|
13
13
|
private config;
|
|
14
14
|
constructor(web3: Web3, logger: Logger, poolAbi?: AbiItem | AbiItem[], config?: Config);
|
|
15
|
-
estApprove(account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
16
|
-
allowance(tokenAddress: string, owner: string, spender: string): Promise<string>;
|
|
17
|
-
approve(account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
18
15
|
sharesBalance(account: string, poolAddress: string): Promise<string>;
|
|
19
16
|
estSetSwapFee(account: string, poolAddress: string, fee: string, contractInstance?: Contract): Promise<number>;
|
|
20
17
|
setSwapFee(account: string, poolAddress: string, fee: string): Promise<TransactionReceipt>;
|
|
@@ -44,8 +41,6 @@ export declare class Pool {
|
|
|
44
41
|
collectMarketFee(address: string, poolAddress: string): Promise<TransactionReceipt>;
|
|
45
42
|
estUpdateMarketFeeCollector(address: string, poolAddress: string, newCollector: string, contractInstance?: Contract): Promise<number>;
|
|
46
43
|
updateMarketFeeCollector(address: string, poolAddress: string, newCollector: string): Promise<TransactionReceipt>;
|
|
47
|
-
amountToUnits(token: string, amount: string): Promise<string>;
|
|
48
|
-
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
49
44
|
estSwapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee, contractInstance?: Contract): Promise<number>;
|
|
50
45
|
swapExactAmountIn(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsInMaxFee): Promise<TransactionReceipt>;
|
|
51
46
|
estSwapExactAmountOut(address: string, poolAddress: string, tokenInOutMarket: TokenInOutMarket, amountsInOutMaxFee: AmountsOutMaxFee, contractInstance?: Contract): Promise<number>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
2
|
import { FileMetadata, ComputeJob, ComputeOutput, ComputeAlgorithm, ComputeAsset, ProviderInitialize } from '../@types/';
|
|
3
|
+
import { DownloadResponse } from '../@types/DownloadResponse';
|
|
4
|
+
export interface HttpCallback {
|
|
5
|
+
(httpMethod: string, url: string, body: string, header: any): Promise<any>;
|
|
6
|
+
}
|
|
3
7
|
export interface ServiceEndpoint {
|
|
4
8
|
serviceName: string;
|
|
5
9
|
method: string;
|
|
@@ -12,20 +16,20 @@ export declare class Provider {
|
|
|
12
16
|
getEndpoints(providerUri: string): Promise<any>;
|
|
13
17
|
getEndpointURL(servicesEndpoints: ServiceEndpoint[], serviceName: string): ServiceEndpoint;
|
|
14
18
|
getServiceEndpoints(providerEndpoint: string, endpoints: any): Promise<ServiceEndpoint[]>;
|
|
15
|
-
getNonce(providerUri: string, consumerAddress: string,
|
|
19
|
+
getNonce(providerUri: string, consumerAddress: string, signal?: AbortSignal, providerEndpoints?: any, serviceEndpoints?: ServiceEndpoint[]): Promise<string>;
|
|
16
20
|
createSignature(web3: Web3, accountId: string, agreementId: string): Promise<string>;
|
|
17
21
|
createHashSignature(web3: Web3, accountId: string, message: string): Promise<string>;
|
|
18
|
-
encrypt(data: any, providerUri: string,
|
|
19
|
-
checkDidFiles(did: string, serviceId: number, providerUri: string,
|
|
20
|
-
checkFileUrl(url: string, providerUri: string,
|
|
21
|
-
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string,
|
|
22
|
+
encrypt(data: any, providerUri: string, signal?: AbortSignal): Promise<string>;
|
|
23
|
+
checkDidFiles(did: string, serviceId: number, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
|
|
24
|
+
checkFileUrl(url: string, providerUri: string, signal?: AbortSignal): Promise<FileMetadata[]>;
|
|
25
|
+
initialize(did: string, serviceId: string, fileIndex: number, consumerAddress: string, providerUri: string, signal?: AbortSignal, userCustomParameters?: UserCustomParameters, computeEnv?: string, validUntil?: number): Promise<ProviderInitialize>;
|
|
22
26
|
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, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm,
|
|
24
|
-
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3,
|
|
25
|
-
computeStatus(providerUri: string,
|
|
26
|
-
computeResult(jobId: string, index: number,
|
|
27
|
-
computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3,
|
|
28
|
-
isValidProvider(url: string,
|
|
27
|
+
computeStart(providerUri: string, web3: Web3, consumerAddress: string, computeEnv: string, dataset: ComputeAsset, algorithm: ComputeAlgorithm, signal?: AbortSignal, additionalDatasets?: ComputeAsset[], output?: ComputeOutput): Promise<ComputeJob | ComputeJob[]>;
|
|
28
|
+
computeStop(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
29
|
+
computeStatus(providerUri: string, signal?: AbortSignal, jobId?: string, did?: string, consumerAddress?: string): Promise<ComputeJob | ComputeJob[]>;
|
|
30
|
+
computeResult(jobId: string, index: number, accountId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<DownloadResponse | void>;
|
|
31
|
+
computeDelete(did: string, consumerAddress: string, jobId: string, providerUri: string, web3: Web3, signal?: AbortSignal): Promise<ComputeJob | ComputeJob[]>;
|
|
32
|
+
isValidProvider(url: string, signal?: AbortSignal): Promise<boolean>;
|
|
29
33
|
}
|
|
30
34
|
export declare const ProviderInstance: Provider;
|
|
31
35
|
export default ProviderInstance;
|
package/dist/src/tokens/NFT.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { TransactionReceipt } from 'web3-eth';
|
|
|
4
4
|
import { Contract } from 'web3-eth-contract';
|
|
5
5
|
import { MetadataProof } from '../../src/@types';
|
|
6
6
|
import { Config } from '../models/index.js';
|
|
7
|
+
import { MetadataAndTokenURI } from '../interfaces/Erc721Interface';
|
|
7
8
|
interface Roles {
|
|
8
9
|
manager: boolean;
|
|
9
10
|
deployERC20: boolean;
|
|
@@ -43,8 +44,10 @@ export declare class Nft {
|
|
|
43
44
|
transferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
44
45
|
estGasSafeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId: number, contractInstance?: Contract): Promise<any>;
|
|
45
46
|
safeTransferNft(nftAddress: string, nftOwner: string, nftReceiver: string, tokenId?: number): Promise<TransactionReceipt>;
|
|
46
|
-
estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number,
|
|
47
|
-
setMetadata(nftAddress: string, address: string, metadataState: number,
|
|
47
|
+
estGasSetMetadata(nftAddress: string, metadataUpdater: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[], contractInstance?: Contract): Promise<any>;
|
|
48
|
+
setMetadata(nftAddress: string, address: string, metadataState: number, metadataDecryptorUrl: string, metadataDecryptorAddress: string, flags: string, data: string, metadataHash: string, metadataProofs?: MetadataProof[]): Promise<TransactionReceipt>;
|
|
49
|
+
estGasSetMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI, contractInstance?: Contract): Promise<any>;
|
|
50
|
+
setMetadataAndTokenURI(nftAddress: string, metadataUpdater: string, metadataAndTokenURI: MetadataAndTokenURI): Promise<TransactionReceipt>;
|
|
48
51
|
estGasSetMetadataState(nftAddress: string, metadataUpdater: string, metadataState: number, contractInstance?: Contract): Promise<any>;
|
|
49
52
|
setMetadataState(nftAddress: string, address: string, metadataState: number): Promise<TransactionReceipt>;
|
|
50
53
|
estSetTokenURI(nftAddress: string, address: string, data: string): Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Config from '../models/Config';
|
|
2
2
|
export declare const configHelperNetworks: Config[];
|
|
3
3
|
export declare class ConfigHelper {
|
|
4
|
-
getAddressesFromEnv(network: string): Partial<Config>;
|
|
4
|
+
getAddressesFromEnv(network: string, customAddresses?: any): Partial<Config>;
|
|
5
5
|
getConfig(network: string | number, infuraProjectId?: string): Config;
|
|
6
6
|
}
|
|
@@ -7,3 +7,5 @@ export declare function getFairGasPrice(web3: Web3, config: Config): Promise<str
|
|
|
7
7
|
export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
|
|
8
8
|
export declare function getFreCreationParams(freParams: FreCreationParams): any;
|
|
9
9
|
export declare function getPoolCreationParams(poolParams: PoolCreationParams): any;
|
|
10
|
+
export declare function unitsToAmount(web3: Web3, token: string, amount: string): Promise<string>;
|
|
11
|
+
export declare function amountToUnits(web3: Web3, token: string, amount: string): Promise<string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DownloadResponse } from '../@types/DownloadResponse';
|
|
1
2
|
export declare function fetchData(url: string, opts: RequestInit): Promise<Response>;
|
|
2
|
-
export declare function
|
|
3
|
+
export declare function downloadFileBrowser(url: string): Promise<void>;
|
|
4
|
+
export declare function downloadFile(url: string, index?: number): Promise<DownloadResponse>;
|
|
3
5
|
export declare function getData(url: string): Promise<Response>;
|
|
4
6
|
export declare function postData(url: string, payload: BodyInit): Promise<Response>;
|
|
5
|
-
export declare function crossFetchGeneric(method: string, url: string, body: string, headers: any): Promise<Response>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Contract } from 'web3-eth-contract';
|
|
2
|
+
import { TransactionReceipt } from 'web3-core';
|
|
3
|
+
import Web3 from 'web3';
|
|
4
|
+
export declare function estApprove(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, contractInstance?: Contract): Promise<number>;
|
|
5
|
+
export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
6
|
+
export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string): Promise<string>;
|
|
7
|
+
export declare function balance(web3: Web3, tokenAddress: string, account: string): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "1.0.0-next.
|
|
4
|
+
"version": "1.0.0-next.8",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test:pool": "npm run mocha -- 'test/unit/pools/balancer/Pool.test.ts'",
|
|
33
33
|
"test:dispenser": "npm run mocha -- 'test/unit/pools/dispenser/Dispenser.test.ts'",
|
|
34
34
|
"test:dt": "npm run mocha -- 'test/unit/tokens/Datatoken.test.ts'",
|
|
35
|
-
"test:nftDt": "npm run mocha -- 'test/unit/Nft.test.ts'",
|
|
35
|
+
"test:nftDt": "npm run mocha -- 'test/unit/tokens/Nft.test.ts'",
|
|
36
36
|
"test:factory": "npm run mocha -- 'test/unit/NftFactory.test.ts'",
|
|
37
37
|
"test:router": "npm run mocha -- 'test/unit/pools/Router.test.ts'",
|
|
38
38
|
"test:publishAll": "npm run mocha -- 'test/integration/PublishFlows.test.ts'",
|
|
@@ -62,8 +62,6 @@
|
|
|
62
62
|
"cross-fetch": "^3.1.4",
|
|
63
63
|
"crypto-js": "^4.0.0",
|
|
64
64
|
"decimal.js": "^10.2.1",
|
|
65
|
-
"fs": "0.0.1-security",
|
|
66
|
-
"save-file": "^2.3.1",
|
|
67
65
|
"web3": ">=1.3.5",
|
|
68
66
|
"web3-core": "^1.6.1",
|
|
69
67
|
"web3-eth-contract": "^1.6.1"
|
|
@@ -83,6 +81,7 @@
|
|
|
83
81
|
"chai-spies": "^1.0.0",
|
|
84
82
|
"cross-env": "^7.0.3",
|
|
85
83
|
"eslint": "^7.17.0",
|
|
84
|
+
"fs": "0.0.1-security",
|
|
86
85
|
"eslint-config-oceanprotocol": "^1.5.0",
|
|
87
86
|
"eslint-config-prettier": "^8.3.0",
|
|
88
87
|
"eslint-plugin-prettier": "^4.0.0",
|