@oceanprotocol/lib 1.0.0-next.13 → 1.0.0-next.17

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.
@@ -6,7 +6,7 @@ export interface FreCreationParams {
6
6
  baseTokenDecimals: number;
7
7
  datatokenDecimals: number;
8
8
  fixedRate: string;
9
- marketFee: number;
9
+ marketFee: string;
10
10
  withMint?: boolean;
11
11
  allowedConsumer?: string;
12
12
  }
@@ -17,3 +17,9 @@ export interface FreOrderParams {
17
17
  swapMarketFee: string;
18
18
  marketFeeAddress: string;
19
19
  }
20
+ export interface PriceAndFees {
21
+ baseTokenAmount: string;
22
+ baseTokenAmountBeforeFee: string;
23
+ oceanFeeAmount: string;
24
+ marketFeeAmount: string;
25
+ }
@@ -10,8 +10,8 @@ export interface PoolCreationParams {
10
10
  vestingAmount: string;
11
11
  vestedBlocks: number;
12
12
  initialBaseTokenLiquidity: string;
13
- swapFeeLiquidityProvider: number;
14
- swapFeeMarketRunner: number;
13
+ swapFeeLiquidityProvider: string;
14
+ swapFeeMarketRunner: string;
15
15
  }
16
16
  export interface CurrentFees {
17
17
  tokens: string[];
@@ -1,3 +1,4 @@
1
+ export * from './aquarius';
1
2
  export * from './pools';
2
3
  export * from './tokens';
3
4
  export * from './factories';
@@ -3,6 +3,7 @@ import { Contract } from 'web3-eth-contract';
3
3
  import { AbiItem } from 'web3-utils/types';
4
4
  import Web3 from 'web3';
5
5
  import { Config } from '../../models/index.js';
6
+ import { PriceAndFees } from '../..';
6
7
  export interface FixedPriceExchange {
7
8
  active: boolean;
8
9
  exchangeOwner: string;
@@ -195,12 +196,12 @@ export declare class FixedRateExchange {
195
196
  */
196
197
  getAllowedSwapper(exchangeId: string): Promise<string>;
197
198
  /**
198
- * getBTNeeded - returns amount in baseToken that user will pay for datatokenAmount
199
+ * calcBaseInGivenOutDT - Calculates how many base tokens are needed to get specified amount of datatokens
199
200
  * @param {String} exchangeId ExchangeId
200
- * @param {Number} datatokenAmount Amount of datatokens user wants to buy
201
- * @return {Promise<string>} Amount of baseToken needed for buying
201
+ * @param {string} datatokenAmount Amount of datatokens user wants to buy
202
+ * @return {Promise<PriceAndFees>} how many base tokens are needed and fees
202
203
  */
203
- getAmountBTIn(exchangeId: string, datatokenAmount: string): Promise<string>;
204
+ calcBaseInGivenOutDT(exchangeId: string, datatokenAmount: string): Promise<PriceAndFees>;
204
205
  /**
205
206
  * getBTOut - returns amount in baseToken that user will receive for datatokenAmount sold
206
207
  * @param {String} exchangeId ExchangeId
@@ -1,10 +1,11 @@
1
1
  import Web3 from 'web3';
2
2
  import { Contract } from 'web3-eth-contract';
3
- import { Erc20CreateParams, FreCreationParams, PoolCreationParams } from '../@types';
3
+ import { Erc20CreateParams, FreCreationParams, FreOrderParams, PoolCreationParams } from '../@types';
4
4
  import { Config } from '../models';
5
5
  export declare function setContractDefaults(contract: Contract, config: Config): Contract;
6
6
  export declare function getFairGasPrice(web3: Web3, config: Config): Promise<string>;
7
7
  export declare function getErcCreationParams(ercParams: Erc20CreateParams): any;
8
+ export declare function getFreOrderParams(freParams: FreOrderParams): any;
8
9
  export declare function getFreCreationParams(freParams: FreCreationParams): any;
9
10
  export declare function getPoolCreationParams(poolParams: PoolCreationParams): any;
10
11
  export declare function unitsToAmount(web3: Web3, token: string, amount: 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.13",
4
+ "version": "1.0.0-next.17",
5
5
  "description": "JavaScript client library for Ocean Protocol",
6
6
  "main": "./dist/lib.js",
7
7
  "umd:main": "dist/lib.umd.js",
@@ -70,14 +70,14 @@
70
70
  "@truffle/hdwallet-provider": "^2.0.3",
71
71
  "@types/chai": "^4.2.19",
72
72
  "@types/chai-spies": "^1.0.3",
73
- "@types/crypto-js": "^4.0.1",
73
+ "@types/crypto-js": "^4.1.0",
74
74
  "@types/mocha": "^9.1.0",
75
- "@types/node": "^17.0.16",
75
+ "@types/node": "^17.0.17",
76
76
  "@types/node-fetch": "^3.0.3",
77
77
  "@typescript-eslint/eslint-plugin": "^4.33.0",
78
78
  "@typescript-eslint/parser": "^4.33.0",
79
79
  "auto-changelog": "^2.4.0",
80
- "chai": "^4.3.4",
80
+ "chai": "^4.3.6",
81
81
  "chai-spies": "^1.0.0",
82
82
  "cross-env": "^7.0.3",
83
83
  "eslint": "^7.17.0",