@oceanprotocol/lib 3.4.2 → 3.4.4
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 +30 -0
- package/CodeExamples.md +1 -1
- package/ComputeExamples.md +2 -2
- 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/types/@types/Asset.d.ts +148 -0
- package/dist/types/@types/Compute.d.ts +71 -0
- package/dist/types/@types/Contracts.d.ts +26 -0
- package/dist/types/@types/DDO/ConsumerParameter.d.ts +37 -0
- package/dist/types/@types/DDO/Credentials.d.ts +8 -0
- package/dist/types/@types/DDO/DDO.d.ts +55 -0
- package/dist/types/@types/DDO/Event.d.ts +27 -0
- package/dist/types/@types/DDO/Metadata.d.ts +141 -0
- package/dist/types/@types/DDO/Service.d.ts +106 -0
- package/dist/types/@types/Datatoken.d.ts +42 -0
- package/dist/types/@types/Dispenser.d.ts +16 -0
- package/dist/types/@types/DownloadResponse.d.ts +4 -0
- package/dist/types/@types/File.d.ts +89 -0
- package/dist/types/@types/FileInfo.d.ts +43 -0
- package/dist/types/@types/FixedPrice.d.ts +51 -0
- package/dist/types/@types/NFT.d.ts +18 -0
- package/dist/types/@types/NFTFactory.d.ts +20 -0
- package/dist/types/@types/Provider.d.ts +33 -0
- package/dist/types/@types/ReturnTypes.d.ts +3 -0
- package/dist/types/@types/Router.d.ts +59 -0
- package/dist/types/@types/index.d.ts +20 -0
- package/dist/types/config/Config.d.ts +162 -0
- package/dist/types/config/ConfigHelper.d.ts +13 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/contracts/AccessList.d.ts +85 -0
- package/dist/types/contracts/AccessListFactory.d.ts +56 -0
- package/dist/types/contracts/Datatoken.d.ts +278 -0
- package/dist/types/contracts/Datatoken4.d.ts +72 -0
- package/dist/types/contracts/Dispenser.d.ts +73 -0
- package/dist/types/contracts/FixedRateExchange.d.ts +209 -0
- package/dist/types/contracts/NFT.d.ts +227 -0
- package/dist/types/contracts/NFTFactory.d.ts +165 -0
- package/dist/types/contracts/Router.d.ts +107 -0
- package/dist/types/contracts/SmartContract.d.ts +46 -0
- package/dist/types/contracts/SmartContractWithAddress.d.ts +17 -0
- package/dist/types/contracts/df/DfRewards.d.ts +31 -0
- package/dist/types/contracts/df/DfStrategyV1.d.ts +21 -0
- package/dist/types/contracts/index.d.ts +20 -0
- package/dist/types/contracts/ve/VeAllocate.d.ts +38 -0
- package/dist/types/contracts/ve/VeFeeDistributor.d.ts +29 -0
- package/dist/types/contracts/ve/VeFeeEstimate.d.ts +14 -0
- package/dist/types/contracts/ve/VeOcean.d.ts +68 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/services/Aquarius.d.ts +53 -0
- package/dist/types/services/Provider.d.ts +197 -0
- package/dist/types/services/index.d.ts +2 -0
- package/dist/types/utils/Assets.d.ts +56 -0
- package/dist/types/utils/Constants.d.ts +4 -0
- package/dist/types/utils/ContractUtils.d.ts +46 -0
- package/dist/types/utils/DatatokenName.d.ts +14 -0
- package/dist/types/utils/DdoHelpers.d.ts +13 -0
- package/dist/types/utils/FetchHelper.d.ts +14 -0
- package/dist/types/utils/General.d.ts +5 -0
- package/dist/types/utils/Logger.d.ts +19 -0
- package/dist/types/utils/OrderUtils.d.ts +20 -0
- package/dist/types/utils/ProviderErrors.d.ts +1 -0
- package/dist/types/utils/SignatureUtils.d.ts +12 -0
- package/dist/types/utils/TokenUtils.d.ts +70 -0
- package/dist/types/utils/index.d.ts +13 -0
- package/dist/types/utils/minAbi.d.ts +38 -0
- package/package.json +2 -2
|
@@ -0,0 +1,70 @@
|
|
|
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>;
|
|
@@ -0,0 +1,13 @@
|
|
|
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';
|
|
13
|
+
export * from './Assets';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const minAbi: ({
|
|
2
|
+
constant: boolean;
|
|
3
|
+
inputs: {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
}[];
|
|
7
|
+
name: string;
|
|
8
|
+
outputs: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
}[];
|
|
12
|
+
payable: boolean;
|
|
13
|
+
stateMutability: string;
|
|
14
|
+
type: string;
|
|
15
|
+
anonymous?: undefined;
|
|
16
|
+
} | {
|
|
17
|
+
payable: boolean;
|
|
18
|
+
stateMutability: string;
|
|
19
|
+
type: string;
|
|
20
|
+
constant?: undefined;
|
|
21
|
+
inputs?: undefined;
|
|
22
|
+
name?: undefined;
|
|
23
|
+
outputs?: undefined;
|
|
24
|
+
anonymous?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
anonymous: boolean;
|
|
27
|
+
inputs: {
|
|
28
|
+
indexed: boolean;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}[];
|
|
32
|
+
name: string;
|
|
33
|
+
type: string;
|
|
34
|
+
constant?: undefined;
|
|
35
|
+
outputs?: undefined;
|
|
36
|
+
payable?: undefined;
|
|
37
|
+
stateMutability?: undefined;
|
|
38
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.4",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"require": "./dist/lib.js",
|
|
11
11
|
"default": "./dist/lib.modern.js"
|
|
12
12
|
},
|
|
13
|
-
"types": "./dist/
|
|
13
|
+
"types": "./dist/types/index.d.ts",
|
|
14
14
|
"scripts": {
|
|
15
15
|
"start": "npm run clean && npm run build:metadata && tsc -w",
|
|
16
16
|
"build": "npm run clean && npm run build:metadata && microbundle build --format modern,esm,cjs,umd --compress --tsconfig tsconfig.json",
|