@oceanprotocol/lib 2.0.0-next.3 → 2.0.2
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 +47 -4
- package/CodeExamples.md +44 -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/src/@types/File.d.ts +18 -1
- package/dist/src/contracts/index.d.ts +1 -0
- package/dist/src/contracts/ve/VeFeeEstimate.d.ts +14 -0
- package/dist/src/utils/TokenUtils.d.ts +7 -1
- package/package.json +2 -2
|
@@ -16,8 +16,25 @@ export interface UrlFile {
|
|
|
16
16
|
*/
|
|
17
17
|
method: string;
|
|
18
18
|
}
|
|
19
|
+
export interface GraphqlQuery {
|
|
20
|
+
type: 'graphql';
|
|
21
|
+
/**
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
index?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Endpoint URL
|
|
27
|
+
* @type {string}
|
|
28
|
+
*/
|
|
29
|
+
url: string;
|
|
30
|
+
/**
|
|
31
|
+
* query
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
query: string;
|
|
35
|
+
}
|
|
19
36
|
export interface Files {
|
|
20
37
|
nftAddress: string;
|
|
21
38
|
datatokenAddress: string;
|
|
22
|
-
files: UrlFile[];
|
|
39
|
+
files: UrlFile[] | GraphqlQuery[];
|
|
23
40
|
}
|
|
@@ -8,6 +8,7 @@ export * from './NFT';
|
|
|
8
8
|
export * from './NFTFactory';
|
|
9
9
|
export * from './ve/VeOcean';
|
|
10
10
|
export * from './ve/VeFeeDistributor';
|
|
11
|
+
export * from './ve/VeFeeEstimate';
|
|
11
12
|
export * from './ve/VeAllocate';
|
|
12
13
|
export * from './df/DfRewards';
|
|
13
14
|
export * from './df/DfStrategyV1';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
+
/**
|
|
4
|
+
* Provides an interface for veOcean contract
|
|
5
|
+
*/
|
|
6
|
+
export declare class VeFeeEstimate extends SmartContractWithAddress {
|
|
7
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
8
|
+
/**
|
|
9
|
+
* estimateClaim
|
|
10
|
+
* @param {String} userAddress user address
|
|
11
|
+
* @return {Promise<string>}
|
|
12
|
+
*/
|
|
13
|
+
estimateClaim(userAddress: string): Promise<string>;
|
|
14
|
+
}
|
|
@@ -3,21 +3,27 @@ import { Config } from '../config';
|
|
|
3
3
|
import { ReceiptOrEstimate } from '../@types';
|
|
4
4
|
/**
|
|
5
5
|
* Approve spender to spent amount tokens
|
|
6
|
+
* @param {Web3} web3
|
|
7
|
+
* @param {Config} config
|
|
6
8
|
* @param {String} account
|
|
7
9
|
* @param {String} tokenAddress
|
|
8
10
|
* @param {String} spender
|
|
9
11
|
* @param {String} amount amount of ERC20 Datatokens (always expressed as wei)
|
|
10
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
|
|
11
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
|
|
12
15
|
*/
|
|
13
16
|
export declare function approve<G extends boolean = false>(web3: Web3, config: Config, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, tokenDecimals?: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
14
17
|
/**
|
|
15
18
|
* Approve spender to spent amount tokens
|
|
19
|
+
* @param {Web3} web3
|
|
20
|
+
* @param {Config} config
|
|
16
21
|
* @param {String} account
|
|
17
22
|
* @param {String} tokenAddress
|
|
18
23
|
* @param {String} spender
|
|
19
24
|
* @param {String} amount amount of ERC20 tokens (always expressed as wei)
|
|
20
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
|
|
21
27
|
*/
|
|
22
28
|
export declare function approveWei<G extends boolean = false>(web3: Web3, config: Config, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
23
29
|
/**
|
|
@@ -54,7 +60,7 @@ export declare function balance(web3: Web3, tokenAddress: string, account: strin
|
|
|
54
60
|
* @param {String} account
|
|
55
61
|
* @param {String} spender
|
|
56
62
|
*/
|
|
57
|
-
export declare function allowanceWei(web3: Web3, tokenAddress: string, account: string, spender: string
|
|
63
|
+
export declare function allowanceWei(web3: Web3, tokenAddress: string, account: string, spender: string): Promise<string>;
|
|
58
64
|
/**
|
|
59
65
|
* Get decimals for any Datatoken
|
|
60
66
|
* @param {Web3} web3
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oceanprotocol/lib",
|
|
3
3
|
"source": "./src/index.ts",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"web3": "^1.7.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@oceanprotocol/contracts": "^1.1.
|
|
52
|
+
"@oceanprotocol/contracts": "^1.1.4",
|
|
53
53
|
"bignumber.js": "^9.0.2",
|
|
54
54
|
"cross-fetch": "^3.1.5",
|
|
55
55
|
"crypto-js": "^4.1.1",
|