@oceanprotocol/lib 2.0.0-next.0 → 2.0.0-next.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 +13 -1
- 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/contracts/index.d.ts +3 -0
- package/dist/src/contracts/ve/VeAllocate.d.ts +41 -0
- package/dist/src/contracts/ve/VeFeeDistributor.d.ts +30 -0
- package/dist/src/contracts/ve/VeOcean.d.ts +69 -0
- package/dist/test/unit/veOcean.test.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
+
import { ReceiptOrEstimate } from '../../@types';
|
|
4
|
+
/**
|
|
5
|
+
* Provides an interface for veOcean contract
|
|
6
|
+
*/
|
|
7
|
+
export declare class VeAllocate extends SmartContractWithAddress {
|
|
8
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
9
|
+
/**
|
|
10
|
+
* set a specific percentage of veOcean to a specific nft
|
|
11
|
+
* Maximum allocated percentage is 10000, so 1% is specified as 100
|
|
12
|
+
* @param {String} userAddress user address
|
|
13
|
+
* @param {String} amount Percentage used
|
|
14
|
+
* @param {String} nft NFT address to allocate to
|
|
15
|
+
* @param {String} chainId chainId of NFT
|
|
16
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
17
|
+
*/
|
|
18
|
+
setAllocation<G extends boolean = false>(userAddress: string, amount: string, nft: string, chainId: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
19
|
+
/**
|
|
20
|
+
* set specific percetage of veOcean to multiple nfts
|
|
21
|
+
* Maximum allocated percentage is 10000, so 1% is specified as 100
|
|
22
|
+
* @param {String} userAddress user address
|
|
23
|
+
* @param {String[]} amount Array of percentages used
|
|
24
|
+
* @param {String[]} nft Array of NFT addresses
|
|
25
|
+
* @param {String[]} chainId Array of chainIds
|
|
26
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
27
|
+
*/
|
|
28
|
+
setBatchAllocation<G extends boolean = false>(userAddress: string, amount: string[], nft: string[], chainId: number[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
29
|
+
/** Get totalAllocation for address
|
|
30
|
+
* @param {String} userAddress user address
|
|
31
|
+
* @return {Promise<number>}
|
|
32
|
+
*/
|
|
33
|
+
getTotalAllocation(userAddress: string): Promise<number>;
|
|
34
|
+
/** Get getveAllocation for address, nft, chainId
|
|
35
|
+
* @param {String} userAddress user address
|
|
36
|
+
* @param {String} nft NFT address to allocate to
|
|
37
|
+
* @param {String} chainId chainId of NFT
|
|
38
|
+
* @return {Promise<number>}
|
|
39
|
+
*/
|
|
40
|
+
getVeAllocation(userAddress: string, nft: string, chainId: string): Promise<number>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
+
import { ReceiptOrEstimate } from '../../@types';
|
|
4
|
+
/**
|
|
5
|
+
* Provides an interface for veOcean contract
|
|
6
|
+
*/
|
|
7
|
+
export declare class VeFeeDistributor extends SmartContractWithAddress {
|
|
8
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Claim fees for `userAddress`
|
|
11
|
+
* Each call to claim look at a maximum of 50 user veOCEAN points.
|
|
12
|
+
For accounts with many veOCEAN related actions, this function
|
|
13
|
+
may need to be called more than once to claim all available
|
|
14
|
+
fees. In the `Claimed` event that fires, if `claim_epoch` is
|
|
15
|
+
less than `max_epoch`, the account may claim again
|
|
16
|
+
* @param {String} userAddress user address
|
|
17
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
18
|
+
*/
|
|
19
|
+
claim<G extends boolean = false>(userAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
20
|
+
/**
|
|
21
|
+
* Make multiple fee claims in a single call
|
|
22
|
+
Used to claim for many accounts at once, or to make
|
|
23
|
+
multiple claims for the same address when that address
|
|
24
|
+
has significant veOCEAN history
|
|
25
|
+
* @param {String} fromUserAddress user address that sends the tx
|
|
26
|
+
* @param {String} addresses array of addresses to claim
|
|
27
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
28
|
+
*/
|
|
29
|
+
claimMany<G extends boolean = false>(fromUserAddress: string, addresses: string[], estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AbiItem } from 'web3-utils';
|
|
2
|
+
import { SmartContractWithAddress } from '../SmartContractWithAddress';
|
|
3
|
+
import { ReceiptOrEstimate } from '../../@types';
|
|
4
|
+
/**
|
|
5
|
+
* Provides an interface for veOcean contract
|
|
6
|
+
*/
|
|
7
|
+
export declare class VeOcean extends SmartContractWithAddress {
|
|
8
|
+
getDefaultAbi(): AbiItem | AbiItem[];
|
|
9
|
+
/**
|
|
10
|
+
* Deposit `amount` tokens for `userAddress` and lock until `unlockTime`
|
|
11
|
+
* @param {String} userAddress user address
|
|
12
|
+
* @param {String} amount Amount of tokens to be locked
|
|
13
|
+
* @param {Number} unlockTime Timestamp for unlock
|
|
14
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
15
|
+
*/
|
|
16
|
+
lockTokens<G extends boolean = false>(userAddress: string, amount: string, unlockTime: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
17
|
+
/**
|
|
18
|
+
* Deposit `amount` tokens for `toAddress` and add to the existing lock
|
|
19
|
+
* Anyone (even a smart contract) can deposit for someone else, but cannot extend their locktime and deposit for a brand new user
|
|
20
|
+
* @param {String} fromUserAddress user address that sends the tx
|
|
21
|
+
* @param {String} toAddress user address to deposit for
|
|
22
|
+
* @param {String} amount Amount of tokens to be locked
|
|
23
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
24
|
+
*/
|
|
25
|
+
depositFor<G extends boolean = false>(fromUserAddress: string, toAddress: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
26
|
+
/**
|
|
27
|
+
* Deposit `amount` additional tokens for `userAddress` without modifying the unlock time
|
|
28
|
+
* @param {String} userAddress user address that sends the tx
|
|
29
|
+
* @param {String} amount Amount of tokens to be locked
|
|
30
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
31
|
+
*/
|
|
32
|
+
increaseAmount<G extends boolean = false>(userAddress: string, amount: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
33
|
+
/**
|
|
34
|
+
* Extend the unlock time for `userAddress` to `unlockTime`
|
|
35
|
+
* @param {String} userAddress user address that sends the tx
|
|
36
|
+
* @param {Number} unlockTime Timestamp for new unlock time
|
|
37
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
38
|
+
*/
|
|
39
|
+
increaseUnlockTime<G extends boolean = false>(userAddress: string, unlockTime: number, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
40
|
+
/**
|
|
41
|
+
* Withdraw all tokens for `userAddress`
|
|
42
|
+
* @param {String} userAddress user address that sends the tx
|
|
43
|
+
* @return {Promise<ReceiptOrEstimate>}
|
|
44
|
+
*/
|
|
45
|
+
withdraw<G extends boolean = false>(userAddress: string, estimateGas?: G): Promise<ReceiptOrEstimate<G>>;
|
|
46
|
+
/** Get voting power for address
|
|
47
|
+
* @param {String} userAddress user address
|
|
48
|
+
* @return {Promise<number>}
|
|
49
|
+
*/
|
|
50
|
+
getVotingPower(userAddress: string): Promise<number>;
|
|
51
|
+
/** Get locked balance
|
|
52
|
+
* @param {String} userAddress user address
|
|
53
|
+
* @return {Promise<string>}
|
|
54
|
+
*/
|
|
55
|
+
getLockedAmount(userAddress: string): Promise<string>;
|
|
56
|
+
/** Get untilLock for address
|
|
57
|
+
* @param {String} userAddress user address
|
|
58
|
+
* @return {Promise<number>}
|
|
59
|
+
*/
|
|
60
|
+
lockEnd(userAddress: string): Promise<number>;
|
|
61
|
+
/** Get total supply
|
|
62
|
+
* @return {Promise<number>}
|
|
63
|
+
*/
|
|
64
|
+
totalSupply(): Promise<string>;
|
|
65
|
+
/** Get token
|
|
66
|
+
* @return {Promise<string>}
|
|
67
|
+
*/
|
|
68
|
+
getToken(): Promise<string>;
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
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.0-next.
|
|
4
|
+
"version": "2.0.0-next.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.
|
|
52
|
+
"@oceanprotocol/contracts": "^1.1.3",
|
|
53
53
|
"bignumber.js": "^9.0.2",
|
|
54
54
|
"cross-fetch": "^3.1.5",
|
|
55
55
|
"crypto-js": "^4.1.1",
|