@oceanprotocol/lib 1.0.0-next.38 → 1.0.0-next.39
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 +14 -0
- package/dist/lib.js +1 -1
- package/dist/lib.js.map +1 -1
- package/dist/lib.modern.mjs +1 -1
- package/dist/lib.modern.mjs.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/Pool.d.ts +2 -0
- package/dist/src/factories/NFTFactory.d.ts +1 -1
- package/dist/src/pools/Router.d.ts +1 -1
- package/dist/src/pools/balancer/Pool.d.ts +29 -12
- package/dist/src/pools/dispenser/Dispenser.d.ts +1 -1
- package/dist/src/pools/fixedRate/FixedRateExchange.d.ts +3 -3
- package/dist/src/pools/ssContracts/SideStaking.d.ts +8 -6
- package/dist/src/tokens/Datatoken.d.ts +1 -1
- package/dist/src/tokens/NFT.d.ts +1 -1
- package/dist/src/utils/ContractUtils.d.ts +2 -2
- package/dist/src/utils/TokenUtils.d.ts +7 -4
- package/package.json +4 -4
|
@@ -39,7 +39,7 @@ export declare class NftFactory {
|
|
|
39
39
|
* @param {AbiItem | AbiItem[]} factory721ABI
|
|
40
40
|
* @param {Web3} web3
|
|
41
41
|
*/
|
|
42
|
-
constructor(factory721Address: string, web3: Web3, factory721Abi?: AbiItem | AbiItem[], config?: Config);
|
|
42
|
+
constructor(factory721Address: string, web3: Web3, network?: string | number, factory721Abi?: AbiItem | AbiItem[], config?: Config);
|
|
43
43
|
/**
|
|
44
44
|
* Get estimated gas cost for deployERC721Contract value
|
|
45
45
|
* @param {String} address
|
|
@@ -20,7 +20,7 @@ export declare class Router {
|
|
|
20
20
|
* @param {AbiItem | AbiItem[]} Router
|
|
21
21
|
* @param {Web3} web3
|
|
22
22
|
*/
|
|
23
|
-
constructor(routerAddress: string, web3: Web3, RouterAbi?: AbiItem | AbiItem[], config?: Config);
|
|
23
|
+
constructor(routerAddress: string, web3: Web3, network?: string | number, RouterAbi?: AbiItem | AbiItem[], config?: Config);
|
|
24
24
|
/**
|
|
25
25
|
* Estimate gas cost for buyDTBatch method
|
|
26
26
|
* @param {String} address
|
|
@@ -12,7 +12,9 @@ export declare class Pool {
|
|
|
12
12
|
web3: Web3;
|
|
13
13
|
GASLIMIT_DEFAULT: number;
|
|
14
14
|
private config;
|
|
15
|
-
constructor(web3: Web3, poolAbi?: AbiItem | AbiItem[], config?: Config);
|
|
15
|
+
constructor(web3: Web3, network?: string | number, poolAbi?: AbiItem | AbiItem[], config?: Config);
|
|
16
|
+
amountToUnits(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
17
|
+
unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
16
18
|
/**
|
|
17
19
|
* Get user shares of pool tokens
|
|
18
20
|
* @param {String} account
|
|
@@ -112,9 +114,10 @@ export declare class Pool {
|
|
|
112
114
|
* Returns the current token reserve amount
|
|
113
115
|
* @param {String} poolAddress
|
|
114
116
|
* @param {String} token Address of the token to be checked
|
|
117
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
115
118
|
* @return {String}
|
|
116
119
|
*/
|
|
117
|
-
getReserve(poolAddress: string, token: string): Promise<string>;
|
|
120
|
+
getReserve(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
118
121
|
/**
|
|
119
122
|
* Get if a pool is finalized
|
|
120
123
|
* Returns true if pool is finalized
|
|
@@ -156,9 +159,10 @@ export declare class Pool {
|
|
|
156
159
|
* Get Market Fees available to be collected for a specific token
|
|
157
160
|
* @param {String} poolAddress
|
|
158
161
|
* @param {String} token token we want to check fees
|
|
162
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
159
163
|
* @return {String}
|
|
160
164
|
*/
|
|
161
|
-
getMarketFees(poolAddress: string, token: string): Promise<string>;
|
|
165
|
+
getMarketFees(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
162
166
|
/**
|
|
163
167
|
* Get Community Get the current amount of fees which can be withdrawned by the Market
|
|
164
168
|
* @return {CurrentFees}
|
|
@@ -173,9 +177,10 @@ export declare class Pool {
|
|
|
173
177
|
* Get Community Fees available to be collected for a specific token
|
|
174
178
|
* @param {String} poolAddress
|
|
175
179
|
* @param {String} token token we want to check fees
|
|
180
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
176
181
|
* @return {String}
|
|
177
182
|
*/
|
|
178
|
-
getCommunityFees(poolAddress: string, token: string): Promise<string>;
|
|
183
|
+
getCommunityFees(poolAddress: string, token: string, tokenDecimals?: number): Promise<string>;
|
|
179
184
|
/**
|
|
180
185
|
* Estimate gas cost for collectOPF
|
|
181
186
|
* @param {String} address
|
|
@@ -330,41 +335,53 @@ export declare class Pool {
|
|
|
330
335
|
* @param tokenOut token to get
|
|
331
336
|
* @param tokenAmountOut exact amount of tokenOut
|
|
332
337
|
* @param swapMarketFee consume market swap fee
|
|
338
|
+
* @param {number} tokenInDecimals optional number of decimals of the token to be swaped
|
|
339
|
+
* @param {number} tokenOutDecimals optional number of decimals of the token to get
|
|
333
340
|
*/
|
|
334
|
-
getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string): Promise<PoolPriceAndFees>;
|
|
341
|
+
getAmountInExactOut(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountOut: string, swapMarketFee: string, tokenInDecimals?: number, tokenOutDecimals?: number): Promise<PoolPriceAndFees>;
|
|
335
342
|
/**
|
|
336
343
|
* How many tokensOut you will get for a exact tokenAmountIn
|
|
337
344
|
* Returns: tokenAmountOut, LPFee, opcFee , publishMarketSwapFee, consumeMarketSwapFee
|
|
338
345
|
* @param tokenIn token to be swaped
|
|
339
346
|
* @param tokenOut token to get
|
|
340
|
-
* @param
|
|
341
|
-
* @param
|
|
347
|
+
* @param tokenAmountIn exact amount of tokenIn
|
|
348
|
+
* @param swapMarketFee
|
|
349
|
+
* @param {number} tokenInDecimals optional number of decimals of the token to be swaped
|
|
350
|
+
* @param {number} tokenOutDecimals optional number of decimals of the token to get
|
|
342
351
|
*/
|
|
343
|
-
getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string): Promise<PoolPriceAndFees>;
|
|
352
|
+
getAmountOutExactIn(poolAddress: string, tokenIn: string, tokenOut: string, tokenAmountIn: string, swapMarketFee: string, tokenInDecimals?: number, tokenOutDecimals?: number): Promise<PoolPriceAndFees>;
|
|
344
353
|
/**
|
|
345
354
|
* Returns number of poolshares obtain by staking exact tokenAmountIn tokens
|
|
346
355
|
* @param tokenIn tokenIn
|
|
347
356
|
* @param tokenAmountIn exact number of tokens staked
|
|
357
|
+
* @param {number} poolDecimals optional number of decimals of the poool
|
|
358
|
+
* @param {number} tokenInDecimals optional number of decimals of the token
|
|
348
359
|
*/
|
|
349
|
-
calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string): Promise<string>;
|
|
360
|
+
calcPoolOutGivenSingleIn(poolAddress: string, tokenIn: string, tokenAmountIn: string, poolDecimals?: number, tokenInDecimals?: number): Promise<string>;
|
|
350
361
|
/**
|
|
351
362
|
* Returns number of tokens to be staked to the pool in order to get an exact number of poolshares
|
|
352
363
|
* @param tokenIn tokenIn
|
|
353
364
|
* @param poolAmountOut expected amount of pool shares
|
|
365
|
+
* @param {number} poolDecimals optional number of decimals of the pool
|
|
366
|
+
* @param {number} tokenInDecimals optional number of decimals of the token
|
|
354
367
|
*/
|
|
355
|
-
calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string): Promise<string>;
|
|
368
|
+
calcSingleInGivenPoolOut(poolAddress: string, tokenIn: string, poolAmountOut: string, poolDecimals?: number, tokenInDecimals?: number): Promise<string>;
|
|
356
369
|
/**
|
|
357
370
|
* Returns expected amount of tokenOut for removing exact poolAmountIn pool shares from the pool
|
|
358
371
|
* @param tokenOut tokenOut
|
|
359
372
|
* @param poolAmountIn amount of shares spent
|
|
373
|
+
* @param {number} poolDecimals optional number of decimals of the pool
|
|
374
|
+
* @param {number} tokenOutDecimals optional number of decimals of the token
|
|
360
375
|
*/
|
|
361
|
-
calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string): Promise<string>;
|
|
376
|
+
calcSingleOutGivenPoolIn(poolAddress: string, tokenOut: string, poolAmountIn: string, poolDecimals?: number, tokenOutDecimals?: number): Promise<string>;
|
|
362
377
|
/**
|
|
363
378
|
* Returns number of poolshares needed to withdraw exact tokenAmountOut tokens
|
|
364
379
|
* @param tokenOut tokenOut
|
|
365
380
|
* @param tokenAmountOut expected amount of tokensOut
|
|
381
|
+
* @param {number} poolDecimals optional number of decimals of the pool
|
|
382
|
+
* @param {number} tokenOutDecimals optional number of decimals of the token
|
|
366
383
|
*/
|
|
367
|
-
calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string): Promise<string>;
|
|
384
|
+
calcPoolInGivenSingleOut(poolAddress: string, tokenOut: string, tokenAmountOut: string, poolDecimals?: number, tokenOutDecimals?: number): Promise<string>;
|
|
368
385
|
/**
|
|
369
386
|
* Get LOG_SWAP encoded topic
|
|
370
387
|
* @return {String}
|
|
@@ -26,7 +26,7 @@ export declare class Dispenser {
|
|
|
26
26
|
* @param {String} dispenserAddress
|
|
27
27
|
* @param {any} dispenserABI
|
|
28
28
|
*/
|
|
29
|
-
constructor(web3: Web3, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
|
|
29
|
+
constructor(web3: Web3, network?: string | number, dispenserAddress?: string, dispenserAbi?: AbiItem | AbiItem[], config?: Config);
|
|
30
30
|
/**
|
|
31
31
|
* Get information about a datatoken dispenser
|
|
32
32
|
* @param {String} dtAddress
|
|
@@ -54,9 +54,9 @@ export declare class FixedRateExchange {
|
|
|
54
54
|
* @param {any} web3
|
|
55
55
|
* @param {any} fixedRateExchangeAbi
|
|
56
56
|
*/
|
|
57
|
-
constructor(web3: Web3, fixedRateAddress: string, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
|
|
58
|
-
amountToUnits(token: string, amount: string): Promise<string>;
|
|
59
|
-
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
57
|
+
constructor(web3: Web3, fixedRateAddress: string, network?: string | number, fixedRateExchangeAbi?: AbiItem | AbiItem[], oceanAddress?: string, config?: Config);
|
|
58
|
+
amountToUnits(token: string, amount: string, tokenDecimals: number): Promise<string>;
|
|
59
|
+
unitsToAmount(token: string, amount: string, tokenDecimals: number): Promise<string>;
|
|
60
60
|
/**
|
|
61
61
|
* Creates unique exchange identifier.
|
|
62
62
|
* @param {String} baseToken baseToken contract address
|
|
@@ -8,9 +8,8 @@ export declare class SideStaking {
|
|
|
8
8
|
web3: Web3;
|
|
9
9
|
GASLIMIT_DEFAULT: number;
|
|
10
10
|
config: Config;
|
|
11
|
-
constructor(web3: Web3, ssAbi?: AbiItem | AbiItem[], config?: Config);
|
|
12
|
-
|
|
13
|
-
unitsToAmount(token: string, amount: string): Promise<string>;
|
|
11
|
+
constructor(web3: Web3, network?: string | number, ssAbi?: AbiItem | AbiItem[], config?: Config);
|
|
12
|
+
unitsToAmount(token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
14
13
|
/**
|
|
15
14
|
* Get (total vesting amount + token released from the contract when adding liquidity)
|
|
16
15
|
* @param {String} ssAddress side staking contract address
|
|
@@ -58,9 +57,10 @@ export declare class SideStaking {
|
|
|
58
57
|
* Get dt balance in the staking contract available for being added as liquidity
|
|
59
58
|
* @param {String} ssAddress side staking contract address
|
|
60
59
|
* @param {String} datatokenAddress datatokenAddress
|
|
60
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
61
61
|
* @return {String}
|
|
62
62
|
*/
|
|
63
|
-
getDatatokenBalance(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
63
|
+
getDatatokenBalance(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
64
64
|
/**
|
|
65
65
|
* Get block when vesting ends
|
|
66
66
|
* @param {String} ssAddress side staking contract address
|
|
@@ -72,9 +72,10 @@ export declare class SideStaking {
|
|
|
72
72
|
* Get total amount vesting
|
|
73
73
|
* @param {String} ssAddress side staking contract address
|
|
74
74
|
* @param {String} datatokenAddress datatokenAddress
|
|
75
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
75
76
|
* @return {String}
|
|
76
77
|
*/
|
|
77
|
-
getvestingAmount(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
78
|
+
getvestingAmount(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
78
79
|
/**
|
|
79
80
|
* Get last block publisher got some vested tokens
|
|
80
81
|
* @param {String} ssAddress side staking contract address
|
|
@@ -86,9 +87,10 @@ export declare class SideStaking {
|
|
|
86
87
|
* Get how much has been taken from the vesting amount
|
|
87
88
|
* @param {String} ssAddress side staking contract address
|
|
88
89
|
* @param {String} datatokenAddress datatokenAddress
|
|
90
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
89
91
|
* @return {String}
|
|
90
92
|
*/
|
|
91
|
-
getvestingAmountSoFar(ssAddress: string, datatokenAddress: string): Promise<string>;
|
|
93
|
+
getvestingAmountSoFar(ssAddress: string, datatokenAddress: string, tokenDecimals?: number): Promise<string>;
|
|
92
94
|
/**
|
|
93
95
|
* Estimate gas cost for getVesting
|
|
94
96
|
* @param {String} account
|
|
@@ -38,7 +38,7 @@ export declare class Datatoken {
|
|
|
38
38
|
* @param {AbiItem | AbiItem[]} datatokensAbi
|
|
39
39
|
* @param {Web3} web3
|
|
40
40
|
*/
|
|
41
|
-
constructor(web3: Web3, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
|
|
41
|
+
constructor(web3: Web3, network?: string | number, datatokensAbi?: AbiItem | AbiItem[], datatokensEnterpriseAbi?: AbiItem | AbiItem[], config?: Config);
|
|
42
42
|
/**
|
|
43
43
|
* Estimate gas cost for mint method
|
|
44
44
|
* @param {String} dtAddress Datatoken address
|
package/dist/src/tokens/NFT.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export declare class Nft {
|
|
|
22
22
|
web3: Web3;
|
|
23
23
|
startBlock: number;
|
|
24
24
|
config: Config;
|
|
25
|
-
constructor(web3: Web3, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
25
|
+
constructor(web3: Web3, network?: string | number, nftAbi?: AbiItem | AbiItem[], config?: Config);
|
|
26
26
|
/**
|
|
27
27
|
* Estimate gas cost for createERC20 token creation
|
|
28
28
|
* @param {String} nftAddress ERC721 addreess
|
|
@@ -8,5 +8,5 @@ export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
|
|
|
8
8
|
export declare function getFreOrderParams(freParams: FreOrderParams): any;
|
|
9
9
|
export declare function getFreCreationParams(freParams: FreCreationParams): any;
|
|
10
10
|
export declare function getPoolCreationParams(web3: Web3, poolParams: PoolCreationParams): Promise<any>;
|
|
11
|
-
export declare function unitsToAmount(web3: Web3, token: string, amount: string): Promise<string>;
|
|
12
|
-
export declare function amountToUnits(web3: Web3, token: string, amount: string): Promise<string>;
|
|
11
|
+
export declare function unitsToAmount(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
12
|
+
export declare function amountToUnits(web3: Web3, token: string, amount: string, tokenDecimals?: number): Promise<string>;
|
|
@@ -18,22 +18,25 @@ export declare function estApprove(web3: Web3, account: string, tokenAddress: st
|
|
|
18
18
|
* @param {String} tokenAddress
|
|
19
19
|
* @param {String} spender
|
|
20
20
|
* @param {String} amount (always expressed as wei)
|
|
21
|
-
* @param {
|
|
21
|
+
* @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
|
|
22
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
22
23
|
*/
|
|
23
|
-
export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean): Promise<TransactionReceipt | string>;
|
|
24
|
+
export declare function approve(web3: Web3, account: string, tokenAddress: string, spender: string, amount: string, force?: boolean, tokenDecimals?: number): Promise<TransactionReceipt | string>;
|
|
24
25
|
/**
|
|
25
26
|
* Get Allowance for any erc20
|
|
26
27
|
* @param {Web3} web3
|
|
27
28
|
* @param {String } tokenAdress
|
|
28
29
|
* @param {String} account
|
|
29
30
|
* @param {String} spender
|
|
31
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
30
32
|
*/
|
|
31
|
-
export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string): Promise<string>;
|
|
33
|
+
export declare function allowance(web3: Web3, tokenAddress: string, account: string, spender: string, tokenDecimals?: number): Promise<string>;
|
|
32
34
|
/**
|
|
33
35
|
* Get balance for any erc20
|
|
34
36
|
* @param {Web3} web3
|
|
35
37
|
* @param {String} tokenAdress
|
|
36
38
|
* @param {String} owner
|
|
37
39
|
* @param {String} spender
|
|
40
|
+
* @param {number} tokenDecimals optional number of decimals of the token
|
|
38
41
|
*/
|
|
39
|
-
export declare function balance(web3: Web3, tokenAddress: string, account: string): Promise<string>;
|
|
42
|
+
export declare function balance(web3: Web3, tokenAddress: string, account: string, tokenDecimals?: number): 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.39",
|
|
5
5
|
"description": "JavaScript client library for Ocean Protocol",
|
|
6
6
|
"main": "./dist/lib.js",
|
|
7
7
|
"umd:main": "dist/lib.umd.js",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@types/chai-spies": "^1.0.3",
|
|
74
74
|
"@types/crypto-js": "^4.1.1",
|
|
75
75
|
"@types/mocha": "^9.1.1",
|
|
76
|
-
"@types/node": "^17.0.
|
|
76
|
+
"@types/node": "^17.0.31",
|
|
77
77
|
"@types/node-fetch": "^3.0.3",
|
|
78
78
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
79
79
|
"@typescript-eslint/parser": "^4.33.0",
|
|
@@ -87,12 +87,12 @@
|
|
|
87
87
|
"eslint-plugin-prettier": "^4.0.0",
|
|
88
88
|
"fs": "0.0.1-security",
|
|
89
89
|
"microbundle": "^0.15.0",
|
|
90
|
-
"mocha": "^
|
|
90
|
+
"mocha": "^10.0.0",
|
|
91
91
|
"mock-local-storage": "^1.1.21",
|
|
92
92
|
"nyc": "^15.1.0",
|
|
93
93
|
"ora": "5.4.1",
|
|
94
94
|
"prettier": "^2.6.2",
|
|
95
|
-
"release-it": "^
|
|
95
|
+
"release-it": "^15.0.0",
|
|
96
96
|
"source-map-support": "^0.5.19",
|
|
97
97
|
"ts-node": "^10.7.0",
|
|
98
98
|
"ts-node-register": "^1.0.0",
|