@qidao/sdk 5.0.6 → 5.0.9
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/dist/constants/addresses.d.ts +31 -0
- package/dist/constants/index.d.ts +20 -0
- package/dist/constants/kashi.d.ts +29 -0
- package/dist/constants/natives.d.ts +30 -0
- package/dist/constants/numbers.d.ts +11 -0
- package/dist/constants/tokens.d.ts +5 -0
- package/dist/entities/AbstractCurrency.d.ts +53 -0
- package/dist/entities/ConstantProductPool.d.ts +43 -0
- package/dist/entities/Currency.d.ts +3 -0
- package/dist/entities/CurrencyAmount.d.ts +38 -0
- package/dist/entities/{fractions/fraction.d.ts → Fraction.d.ts} +7 -1
- package/dist/entities/MultiRouter.d.ts +59 -0
- package/dist/entities/Native/Avalanche.d.ts +10 -0
- package/dist/entities/Native/Binance.d.ts +10 -0
- package/dist/entities/Native/Celo.d.ts +10 -0
- package/dist/entities/Native/Ether.d.ts +13 -0
- package/dist/entities/Native/Fantom.d.ts +10 -0
- package/dist/entities/Native/Fuse.d.ts +10 -0
- package/dist/entities/Native/Harmony.d.ts +10 -0
- package/dist/entities/Native/Heco.d.ts +10 -0
- package/dist/entities/Native/Matic.d.ts +10 -0
- package/dist/entities/Native/Movr.d.ts +10 -0
- package/dist/entities/Native/Okex.d.ts +10 -0
- package/dist/entities/Native/Palm.d.ts +10 -0
- package/dist/entities/Native/Telos.d.ts +10 -0
- package/dist/entities/Native/index.d.ts +14 -0
- package/dist/entities/Native/xDai.d.ts +10 -0
- package/dist/entities/NativeCurrency.d.ts +8 -0
- package/dist/entities/Pair.d.ts +41 -0
- package/dist/entities/Percent.d.ts +15 -0
- package/dist/entities/Price.d.ts +39 -0
- package/dist/entities/Route.d.ts +14 -0
- package/dist/entities/{token.d.ts → Token.d.ts} +11 -39
- package/dist/entities/{trade.d.ts → Trade.d.ts} +35 -34
- package/dist/entities/eip712.d.ts +78 -0
- package/dist/entities/index.d.ts +14 -6
- package/dist/enums/ChainId.d.ts +32 -0
- package/dist/enums/Fee.d.ts +3 -0
- package/dist/enums/KashiAction.d.ts +18 -0
- package/dist/enums/OrderStatus.d.ts +6 -0
- package/dist/enums/Rounding.d.ts +5 -0
- package/dist/enums/TradeType.d.ts +4 -0
- package/dist/enums/index.d.ts +6 -0
- package/dist/functions/bentobox.d.ts +3 -0
- package/dist/functions/computeConstantProductPoolAddress.d.ts +9 -0
- package/dist/functions/computePairAddress.d.ts +6 -0
- package/dist/functions/computePoolInitCodeHash.d.ts +5 -0
- package/dist/functions/computePriceImpact.d.ts +11 -0
- package/dist/functions/index.d.ts +8 -0
- package/dist/functions/kashi.d.ts +9 -0
- package/dist/functions/rebase.d.ts +4 -0
- package/dist/functions/sortedInsert.d.ts +1 -0
- package/dist/functions/sqrt.d.ts +7 -0
- package/dist/functions/validateAndParseAddress.d.ts +1 -0
- package/dist/functions/validateSolidityTypeInstance.d.ts +3 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.js +2 -2
- package/dist/interfaces/AccrueInfo.d.ts +6 -0
- package/dist/interfaces/Rebase.d.ts +5 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/limitorder.d.ts +115 -0
- package/dist/qidao-sdk.cjs.development.js +5301 -0
- package/dist/qidao-sdk.cjs.development.js.map +1 -0
- package/dist/qidao-sdk.cjs.production.min.js +2 -0
- package/dist/qidao-sdk.cjs.production.min.js.map +1 -0
- package/dist/qidao-sdk.esm.js +5162 -0
- package/dist/qidao-sdk.esm.js.map +1 -0
- package/dist/router.d.ts +7 -2
- package/dist/types/AddressMap.d.ts +3 -0
- package/dist/types/BigIntIsh.d.ts +2 -0
- package/dist/types/ChainTokenMap.d.ts +5 -0
- package/dist/types/LimitOrderTypes.d.ts +21 -0
- package/dist/types/MultiRouterTypes.d.ts +97 -0
- package/dist/types/TokenMap.d.ts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/utils/MultiRouterMath.d.ts +15 -0
- package/package.json +57 -31
- package/dist/constants.d.ts +0 -86
- package/dist/entities/currency.d.ts +0 -81
- package/dist/entities/fractions/currencyAmount.d.ts +0 -19
- package/dist/entities/fractions/index.d.ts +0 -5
- package/dist/entities/fractions/percent.d.ts +0 -6
- package/dist/entities/fractions/price.d.ts +0 -19
- package/dist/entities/fractions/tokenAmount.d.ts +0 -9
- package/dist/entities/pair.d.ts +0 -41
- package/dist/entities/route.d.ts +0 -14
- package/dist/fetcher.d.ts +0 -28
- package/dist/sdk.cjs.development.js +0 -1708
- package/dist/sdk.cjs.development.js.map +0 -1
- package/dist/sdk.cjs.production.min.js +0 -2
- package/dist/sdk.cjs.production.min.js.map +0 -1
- package/dist/sdk.esm.js +0 -1680
- package/dist/sdk.esm.js.map +0 -1
- package/dist/test/constants.test.d.ts +0 -1
- package/dist/test/data.test.d.ts +0 -1
- package/dist/test/entities.test.d.ts +0 -1
- package/dist/test/fraction.test.d.ts +0 -1
- package/dist/test/miscellaneous.test.d.ts +0 -1
- package/dist/test/pair.test.d.ts +0 -1
- package/dist/test/route.test.d.ts +0 -1
- package/dist/test/router.test.d.ts +0 -1
- package/dist/test/token.test.d.ts +0 -1
- package/dist/test/trade.test.d.ts +0 -1
- package/dist/utils.d.ts +0 -7
package/dist/router.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Currency } from './entities/Currency';
|
|
2
|
+
import { CurrencyAmount } from './entities/CurrencyAmount';
|
|
3
|
+
import { Percent } from './entities/Percent';
|
|
4
|
+
import { Trade } from './entities/Trade';
|
|
5
|
+
import { TradeType } from './enums/TradeType';
|
|
2
6
|
/**
|
|
3
7
|
* Options for producing the arguments to send call to the router.
|
|
4
8
|
*/
|
|
@@ -46,6 +50,7 @@ export interface SwapParameters {
|
|
|
46
50
|
*/
|
|
47
51
|
value: string;
|
|
48
52
|
}
|
|
53
|
+
export declare function toHex(currencyAmount: CurrencyAmount<Currency>): string;
|
|
49
54
|
/**
|
|
50
55
|
* Represents the Uniswap V2 Router, and has static methods for helping execute trades.
|
|
51
56
|
*/
|
|
@@ -59,5 +64,5 @@ export declare abstract class Router {
|
|
|
59
64
|
* @param trade to produce call parameters for
|
|
60
65
|
* @param options options for the call parameters
|
|
61
66
|
*/
|
|
62
|
-
static swapCallParameters(trade: Trade, options: TradeOptions | TradeOptionsDeadline): SwapParameters;
|
|
67
|
+
static swapCallParameters(trade: Trade<Currency, Currency, TradeType>, options: TradeOptions | TradeOptionsDeadline): SwapParameters;
|
|
63
68
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const types: {
|
|
2
|
+
EIP712Domain: {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}[];
|
|
6
|
+
LimitOrder: {
|
|
7
|
+
name: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}[];
|
|
10
|
+
};
|
|
11
|
+
export declare const bentoTypes: {
|
|
12
|
+
EIP712Domain: {
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
SetMasterContractApproval: {
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}[];
|
|
20
|
+
};
|
|
21
|
+
export declare const name = "LimitOrder";
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
export interface RToken {
|
|
3
|
+
name: string;
|
|
4
|
+
address: string;
|
|
5
|
+
}
|
|
6
|
+
export declare enum PoolType {
|
|
7
|
+
ConstantProduct = "ConstantProduct",
|
|
8
|
+
Weighted = "Weighted",
|
|
9
|
+
Hybrid = "Hybrid",
|
|
10
|
+
ConcentratedLiquidity = "ConcentratedLiquidity"
|
|
11
|
+
}
|
|
12
|
+
export interface PoolInfo {
|
|
13
|
+
address: string;
|
|
14
|
+
token0: RToken;
|
|
15
|
+
token1: RToken;
|
|
16
|
+
type: PoolType;
|
|
17
|
+
reserve0: BigNumber;
|
|
18
|
+
reserve1: BigNumber;
|
|
19
|
+
fee: number;
|
|
20
|
+
minLiquidity: number;
|
|
21
|
+
swapGasCost: number;
|
|
22
|
+
}
|
|
23
|
+
declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
24
|
+
declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
25
|
+
declare type PoolInfoWithDefaults = PartialBy<PoolInfo, 'minLiquidity' | 'swapGasCost'>;
|
|
26
|
+
export declare class Pool {
|
|
27
|
+
address: string;
|
|
28
|
+
token0: RToken;
|
|
29
|
+
token1: RToken;
|
|
30
|
+
type: PoolType;
|
|
31
|
+
reserve0: BigNumber;
|
|
32
|
+
reserve1: BigNumber;
|
|
33
|
+
fee: number;
|
|
34
|
+
minLiquidity: number;
|
|
35
|
+
swapGasCost: number;
|
|
36
|
+
constructor(_info: PoolInfoWithDefaults);
|
|
37
|
+
}
|
|
38
|
+
declare type PoolInfoNoType = Omit<PoolInfoWithDefaults, 'type'>;
|
|
39
|
+
export declare class RConstantProductPool extends Pool {
|
|
40
|
+
constructor(info: PoolInfoNoType);
|
|
41
|
+
}
|
|
42
|
+
declare type HybridPoolInfo = PoolInfoNoType & {
|
|
43
|
+
A: number;
|
|
44
|
+
};
|
|
45
|
+
export declare class RHybridPool extends Pool {
|
|
46
|
+
A: number;
|
|
47
|
+
constructor(info: HybridPoolInfo);
|
|
48
|
+
}
|
|
49
|
+
declare type WeightedPoolInfo = PoolInfoNoType & {
|
|
50
|
+
weight0: number;
|
|
51
|
+
weight1: number;
|
|
52
|
+
};
|
|
53
|
+
export declare class RWeightedPool extends Pool {
|
|
54
|
+
weight0: number;
|
|
55
|
+
weight1: number;
|
|
56
|
+
constructor(info: WeightedPoolInfo);
|
|
57
|
+
}
|
|
58
|
+
export declare const CL_MIN_TICK = -887272;
|
|
59
|
+
export declare const CL_MAX_TICK: number;
|
|
60
|
+
interface CLTick {
|
|
61
|
+
index: number;
|
|
62
|
+
DLiquidity: number;
|
|
63
|
+
}
|
|
64
|
+
interface CLSpecific {
|
|
65
|
+
liquidity: number;
|
|
66
|
+
sqrtPrice: number;
|
|
67
|
+
nearestTick: number;
|
|
68
|
+
ticks: CLTick[];
|
|
69
|
+
}
|
|
70
|
+
declare type CLPoolInfo = Omit<PoolInfoNoType, 'reserve0' | 'reserve1'> & CLSpecific;
|
|
71
|
+
export declare class RConcentratedLiquidityPool extends Pool {
|
|
72
|
+
liquidity: number;
|
|
73
|
+
sqrtPrice: number;
|
|
74
|
+
nearestTick: number;
|
|
75
|
+
ticks: CLTick[];
|
|
76
|
+
constructor(info: CLPoolInfo);
|
|
77
|
+
}
|
|
78
|
+
export interface RouteLeg {
|
|
79
|
+
address: string;
|
|
80
|
+
token: RToken;
|
|
81
|
+
swapPortion: number;
|
|
82
|
+
absolutePortion: number;
|
|
83
|
+
}
|
|
84
|
+
export declare enum RouteStatus {
|
|
85
|
+
Success = "Success",
|
|
86
|
+
NoWay = "NoWay",
|
|
87
|
+
Partial = "Partial"
|
|
88
|
+
}
|
|
89
|
+
export interface MultiRoute {
|
|
90
|
+
status: RouteStatus;
|
|
91
|
+
amountIn: number;
|
|
92
|
+
amountOut: number;
|
|
93
|
+
legs: RouteLeg[];
|
|
94
|
+
gasSpent: number;
|
|
95
|
+
totalAmountOut: number;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import { Pool, RHybridPool } from '../types/MultiRouterTypes';
|
|
3
|
+
export declare function HybridComputeLiquidity(pool: RHybridPool): BigNumber;
|
|
4
|
+
export declare function HybridgetY(pool: RHybridPool, x: BigNumber): BigNumber;
|
|
5
|
+
export declare function calcOutByIn(pool: Pool, amountIn: number, direction?: boolean): number;
|
|
6
|
+
export declare class OutOfLiquidity extends Error {
|
|
7
|
+
}
|
|
8
|
+
export declare function calcInByOut(pool: Pool, amountOut: number, direction: boolean): number;
|
|
9
|
+
export declare function calcPrice(pool: Pool, amountIn: number, takeFeeIntoAccount?: boolean): number;
|
|
10
|
+
export declare function calcInputByPrice(pool: Pool, priceEffective: number, hint?: number): number;
|
|
11
|
+
export declare function ASSERT(f: () => boolean, t?: string): void;
|
|
12
|
+
export declare function closeValues(a: number, b: number, accuracy: number): boolean;
|
|
13
|
+
export declare function calcSquareEquation(a: number, b: number, c: number): [number, number];
|
|
14
|
+
export declare function revertPositive(f: (x: number) => number, out: number, hint?: number): number;
|
|
15
|
+
export declare function getBigNumber(valueBN: BigNumber | undefined, value: number): BigNumber;
|
package/package.json
CHANGED
|
@@ -1,56 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qidao/sdk",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.9",
|
|
5
5
|
"description": "🛠 An SDK for building applications on top of QiDao Protocol.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
|
-
"repository":
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/publu/qidao-sdk.git"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"qidao",
|
|
17
|
+
"mai",
|
|
18
|
+
"polygon",
|
|
19
|
+
"sdk"
|
|
20
|
+
],
|
|
21
|
+
"module": "dist/sdk.esm.js",
|
|
14
22
|
"scripts": {
|
|
15
23
|
"lint": "tsdx lint src test",
|
|
16
24
|
"build": "tsdx build",
|
|
17
|
-
"
|
|
25
|
+
"watch": "tsdx watch",
|
|
18
26
|
"test": "tsdx test",
|
|
19
|
-
"
|
|
27
|
+
"prepublish": "tsdx build",
|
|
28
|
+
"prepare": "husky install",
|
|
29
|
+
"prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'"
|
|
30
|
+
},
|
|
31
|
+
"lint-staged": {
|
|
32
|
+
"*.{js,jsx,ts,tsx}": [
|
|
33
|
+
"yarn lint",
|
|
34
|
+
"yarn test --bail --passWithNoTests --findRelatedTests",
|
|
35
|
+
"prettier --write"
|
|
36
|
+
],
|
|
37
|
+
"*.md": "prettier --write"
|
|
20
38
|
},
|
|
21
39
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"
|
|
40
|
+
"@ethersproject/abi": "^5.4.0",
|
|
41
|
+
"@ethersproject/abstract-signer": "^5.4.0",
|
|
42
|
+
"@ethersproject/address": "^5.4.0",
|
|
43
|
+
"@ethersproject/bignumber": "^5.4.0",
|
|
44
|
+
"@ethersproject/bytes": "^5.4.0",
|
|
45
|
+
"@ethersproject/contracts": "^5.4.0",
|
|
46
|
+
"@ethersproject/experimental": "^5.4.0",
|
|
47
|
+
"@ethersproject/networks": "^5.4.0",
|
|
48
|
+
"@ethersproject/providers": "^5.4.0",
|
|
49
|
+
"@ethersproject/signing-key": "^5.4.0",
|
|
50
|
+
"@ethersproject/solidity": "^5.4.0",
|
|
51
|
+
"@ethersproject/transactions": "^5.4.0",
|
|
52
|
+
"@sushiswap/core": "^2.0.0-canary.1",
|
|
53
|
+
"big.js": "^6.1.0",
|
|
24
54
|
"decimal.js-light": "^2.5.0",
|
|
25
|
-
"
|
|
55
|
+
"eip-712": "^0.4.3",
|
|
56
|
+
"isomorphic-unfetch": "^3.1.0",
|
|
57
|
+
"jsbi": "^4.1.0",
|
|
26
58
|
"tiny-invariant": "^1.1.0",
|
|
27
59
|
"tiny-warning": "^1.0.3",
|
|
28
60
|
"toformat": "^2.0.0"
|
|
29
61
|
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"@ethersproject/address": "^5.0.0-beta",
|
|
32
|
-
"@ethersproject/contracts": "^5.0.0-beta",
|
|
33
|
-
"@ethersproject/networks": "^5.0.0-beta",
|
|
34
|
-
"@ethersproject/providers": "^5.0.0-beta",
|
|
35
|
-
"@ethersproject/solidity": "^5.0.0-beta"
|
|
36
|
-
},
|
|
37
62
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"babel-plugin-transform-jsbi-to-bigint": "^1.3.1",
|
|
46
|
-
"tsdx": "^0.12.3"
|
|
63
|
+
"@sushiswap/prettier-config": "^0.1.0",
|
|
64
|
+
"@types/big.js": "^6.1.0",
|
|
65
|
+
"babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
|
|
66
|
+
"husky": "^7.0.0",
|
|
67
|
+
"lint-staged": "^11.1.2",
|
|
68
|
+
"prettier": "^2.4.1",
|
|
69
|
+
"tsdx": "^0.14.1"
|
|
47
70
|
},
|
|
48
71
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
72
|
+
"node": ">=14"
|
|
73
|
+
},
|
|
74
|
+
"bugs": {
|
|
75
|
+
"url": "https://github.com/publu/qidao-sdk/issues"
|
|
76
|
+
},
|
|
77
|
+
"homepage": "https://github.com/publu/qidao-sdk#readme",
|
|
78
|
+
"directories": {
|
|
79
|
+
"test": "test"
|
|
50
80
|
},
|
|
51
|
-
"
|
|
52
|
-
"printWidth": 120,
|
|
53
|
-
"semi": false,
|
|
54
|
-
"singleQuote": true
|
|
55
|
-
}
|
|
81
|
+
"author": "Pablo"
|
|
56
82
|
}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import JSBI from 'jsbi';
|
|
2
|
-
export declare type BigintIsh = JSBI | bigint | string;
|
|
3
|
-
export declare enum ChainId {
|
|
4
|
-
MAINNET = 1,
|
|
5
|
-
ROPSTEN = 3,
|
|
6
|
-
RINKEBY = 4,
|
|
7
|
-
GÖRLI = 5,
|
|
8
|
-
KOVAN = 42,
|
|
9
|
-
MATIC = 137,
|
|
10
|
-
MATIC_TESTNET = 80001,
|
|
11
|
-
FANTOM = 250,
|
|
12
|
-
FANTOM_TESTNET = 4002,
|
|
13
|
-
XDAI = 100,
|
|
14
|
-
BSC = 56,
|
|
15
|
-
BSC_TESTNET = 97,
|
|
16
|
-
ARBITRUM = 42161,
|
|
17
|
-
MOONBASE = 1287,
|
|
18
|
-
AVALANCHE = 43114,
|
|
19
|
-
FUJI = 43113,
|
|
20
|
-
HECO = 128,
|
|
21
|
-
HECO_TESTNET = 256,
|
|
22
|
-
HARMONY = 1666600000,
|
|
23
|
-
HARMONY_TESTNET = 1666700000,
|
|
24
|
-
MOONRIVER = 1285,
|
|
25
|
-
CRONOS = 25,
|
|
26
|
-
OPTIMISM = 10,
|
|
27
|
-
SYSCOIN = 57,
|
|
28
|
-
METIS = 1088,
|
|
29
|
-
MOONBEAM = 1284,
|
|
30
|
-
MILKOMEDA = 2001,
|
|
31
|
-
KAVA = 2222,
|
|
32
|
-
IOTEX = 4689,
|
|
33
|
-
KLAYTN = 8217,
|
|
34
|
-
CELO = 42220,
|
|
35
|
-
AURORA = 1313161554,
|
|
36
|
-
BOBA = 288
|
|
37
|
-
}
|
|
38
|
-
export declare enum TradeType {
|
|
39
|
-
EXACT_INPUT = 0,
|
|
40
|
-
EXACT_OUTPUT = 1
|
|
41
|
-
}
|
|
42
|
-
export declare enum Rounding {
|
|
43
|
-
ROUND_DOWN = 0,
|
|
44
|
-
ROUND_HALF_UP = 1,
|
|
45
|
-
ROUND_UP = 2
|
|
46
|
-
}
|
|
47
|
-
export declare const INIT_CODE_HASH: string;
|
|
48
|
-
export declare const FACTORY_ADDRESS: {
|
|
49
|
-
[chainId in ChainId]: string;
|
|
50
|
-
};
|
|
51
|
-
export declare const ROUTER_ADDRESS: {
|
|
52
|
-
[chainId in ChainId]: string;
|
|
53
|
-
};
|
|
54
|
-
export declare const SUSHI_ADDRESS: {
|
|
55
|
-
[chainId in ChainId]: string;
|
|
56
|
-
};
|
|
57
|
-
export declare const MASTERCHEF_ADDRESS: {
|
|
58
|
-
[chainId in ChainId]: string;
|
|
59
|
-
};
|
|
60
|
-
export declare const BAR_ADDRESS: {
|
|
61
|
-
[chainId in ChainId]: string;
|
|
62
|
-
};
|
|
63
|
-
export declare const MAKER_ADDRESS: {
|
|
64
|
-
[chainId in ChainId]: string;
|
|
65
|
-
};
|
|
66
|
-
export declare const TIMELOCK_ADDRESS: {
|
|
67
|
-
[chainId in ChainId]: string;
|
|
68
|
-
};
|
|
69
|
-
export declare const MINIMUM_LIQUIDITY: JSBI;
|
|
70
|
-
export declare const ZERO: JSBI;
|
|
71
|
-
export declare const ONE: JSBI;
|
|
72
|
-
export declare const TWO: JSBI;
|
|
73
|
-
export declare const THREE: JSBI;
|
|
74
|
-
export declare const FIVE: JSBI;
|
|
75
|
-
export declare const TEN: JSBI;
|
|
76
|
-
export declare const _100: JSBI;
|
|
77
|
-
export declare const _997: JSBI;
|
|
78
|
-
export declare const _1000: JSBI;
|
|
79
|
-
export declare enum SolidityType {
|
|
80
|
-
uint8 = "uint8",
|
|
81
|
-
uint256 = "uint256"
|
|
82
|
-
}
|
|
83
|
-
export declare const SOLIDITY_TYPE_MAXIMA: {
|
|
84
|
-
uint8: JSBI;
|
|
85
|
-
uint256: JSBI;
|
|
86
|
-
};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { ChainId } from '../constants';
|
|
2
|
-
/**
|
|
3
|
-
* A currency is any fungible financial instrument on Ethereum, including Ether and all ERC20 tokens.
|
|
4
|
-
*
|
|
5
|
-
* The only instance of the base class `Currency` is Ether.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Currency {
|
|
8
|
-
readonly decimals: number;
|
|
9
|
-
readonly symbol?: string;
|
|
10
|
-
readonly name?: string;
|
|
11
|
-
static readonly ETHER: Currency;
|
|
12
|
-
static readonly BNB: Currency;
|
|
13
|
-
static readonly FTM: Currency;
|
|
14
|
-
static readonly MATIC: Currency;
|
|
15
|
-
static readonly XDAI: Currency;
|
|
16
|
-
static readonly GLMR: Currency;
|
|
17
|
-
static readonly AVAX: Currency;
|
|
18
|
-
static readonly HT: Currency;
|
|
19
|
-
static readonly ONE: Currency;
|
|
20
|
-
static readonly MOVR: Currency;
|
|
21
|
-
static readonly CRO: Currency;
|
|
22
|
-
static readonly SYSCOIN: Currency;
|
|
23
|
-
static readonly METIS: Currency;
|
|
24
|
-
static readonly MOONBEAM: Currency;
|
|
25
|
-
static readonly MILKOMEDA: Currency;
|
|
26
|
-
static readonly KAVA: Currency;
|
|
27
|
-
static readonly IOTEX: Currency;
|
|
28
|
-
static readonly KLAYTN: Currency;
|
|
29
|
-
static readonly CELO: Currency;
|
|
30
|
-
static readonly AURORA: Currency;
|
|
31
|
-
static readonly BOBA: Currency;
|
|
32
|
-
static readonly NATIVE: {
|
|
33
|
-
1: Currency;
|
|
34
|
-
3: Currency;
|
|
35
|
-
4: Currency;
|
|
36
|
-
5: Currency;
|
|
37
|
-
42: Currency;
|
|
38
|
-
250: Currency;
|
|
39
|
-
4002: Currency;
|
|
40
|
-
137: Currency;
|
|
41
|
-
80001: Currency;
|
|
42
|
-
100: Currency;
|
|
43
|
-
56: Currency;
|
|
44
|
-
97: Currency;
|
|
45
|
-
42161: Currency;
|
|
46
|
-
1287: Currency;
|
|
47
|
-
43114: Currency;
|
|
48
|
-
43113: Currency;
|
|
49
|
-
128: Currency;
|
|
50
|
-
256: Currency;
|
|
51
|
-
1666600000: Currency;
|
|
52
|
-
1666700000: Currency;
|
|
53
|
-
25: Currency;
|
|
54
|
-
1285: Currency;
|
|
55
|
-
10: Currency;
|
|
56
|
-
57: Currency;
|
|
57
|
-
1088: Currency;
|
|
58
|
-
1284: Currency;
|
|
59
|
-
2001: Currency;
|
|
60
|
-
2222: Currency;
|
|
61
|
-
4689: Currency;
|
|
62
|
-
8217: Currency;
|
|
63
|
-
42220: Currency;
|
|
64
|
-
1313161554: Currency;
|
|
65
|
-
288: Currency;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Constructs an instance of the base class `Currency`. The only instance of the base class `Currency` is `Currency.ETHER`.
|
|
69
|
-
* @param decimals decimals of the currency
|
|
70
|
-
* @param symbol symbol of the currency
|
|
71
|
-
* @param name of the currency
|
|
72
|
-
*/
|
|
73
|
-
protected constructor(decimals: number, symbol?: string, name?: string);
|
|
74
|
-
static getNativeCurrency(chainId?: ChainId): Currency;
|
|
75
|
-
static getNativeCurrencySymbol(chainId?: ChainId): string | undefined;
|
|
76
|
-
static getNativeCurrencyName(chainId?: ChainId): string | undefined;
|
|
77
|
-
getSymbol(chainId?: ChainId): string | undefined;
|
|
78
|
-
getName(chainId?: ChainId): string | undefined;
|
|
79
|
-
}
|
|
80
|
-
declare const ETHER: Currency;
|
|
81
|
-
export { ETHER };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Currency } from '../currency';
|
|
2
|
-
import JSBI from 'jsbi';
|
|
3
|
-
import { BigintIsh, Rounding } from '../../constants';
|
|
4
|
-
import { Fraction } from './fraction';
|
|
5
|
-
export declare class CurrencyAmount extends Fraction {
|
|
6
|
-
readonly currency: Currency;
|
|
7
|
-
/**
|
|
8
|
-
* Helper that calls the constructor with the ETHER currency
|
|
9
|
-
* @param amount ether amount in wei
|
|
10
|
-
*/
|
|
11
|
-
static ether(amount: BigintIsh): CurrencyAmount;
|
|
12
|
-
protected constructor(currency: Currency, amount: BigintIsh);
|
|
13
|
-
get raw(): JSBI;
|
|
14
|
-
add(other: CurrencyAmount): CurrencyAmount;
|
|
15
|
-
subtract(other: CurrencyAmount): CurrencyAmount;
|
|
16
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
17
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
18
|
-
toExact(format?: object): string;
|
|
19
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Rounding } from '../../constants';
|
|
2
|
-
import { Fraction } from './fraction';
|
|
3
|
-
export declare class Percent extends Fraction {
|
|
4
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
5
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
6
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BigintIsh, Rounding } from '../../constants';
|
|
2
|
-
import { Currency } from '../currency';
|
|
3
|
-
import { Route } from '../route';
|
|
4
|
-
import { Fraction } from './fraction';
|
|
5
|
-
import { CurrencyAmount } from './currencyAmount';
|
|
6
|
-
export declare class Price extends Fraction {
|
|
7
|
-
readonly baseCurrency: Currency;
|
|
8
|
-
readonly quoteCurrency: Currency;
|
|
9
|
-
readonly scalar: Fraction;
|
|
10
|
-
static fromRoute(route: Route): Price;
|
|
11
|
-
constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh);
|
|
12
|
-
get raw(): Fraction;
|
|
13
|
-
get adjusted(): Fraction;
|
|
14
|
-
invert(): Price;
|
|
15
|
-
multiply(other: Price): Price;
|
|
16
|
-
quote(currencyAmount: CurrencyAmount): CurrencyAmount;
|
|
17
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
18
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CurrencyAmount } from './currencyAmount';
|
|
2
|
-
import { Token } from '../token';
|
|
3
|
-
import { BigintIsh } from '../../constants';
|
|
4
|
-
export declare class TokenAmount extends CurrencyAmount {
|
|
5
|
-
readonly token: Token;
|
|
6
|
-
constructor(token: Token, amount: BigintIsh);
|
|
7
|
-
add(other: TokenAmount): TokenAmount;
|
|
8
|
-
subtract(other: TokenAmount): TokenAmount;
|
|
9
|
-
}
|
package/dist/entities/pair.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Price } from './fractions/price';
|
|
2
|
-
import { TokenAmount } from './fractions/tokenAmount';
|
|
3
|
-
import { BigintIsh, ChainId } from '../constants';
|
|
4
|
-
import { Token } from './token';
|
|
5
|
-
export declare class Pair {
|
|
6
|
-
readonly liquidityToken: Token;
|
|
7
|
-
private readonly tokenAmounts;
|
|
8
|
-
static getAddress(tokenA: Token, tokenB: Token): string;
|
|
9
|
-
constructor(tokenAmountA: TokenAmount, tokenAmountB: TokenAmount);
|
|
10
|
-
/**
|
|
11
|
-
* Returns true if the token is either token0 or token1
|
|
12
|
-
* @param token to check
|
|
13
|
-
*/
|
|
14
|
-
involvesToken(token: Token): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Returns the current mid price of the pair in terms of token0, i.e. the ratio of reserve1 to reserve0
|
|
17
|
-
*/
|
|
18
|
-
get token0Price(): Price;
|
|
19
|
-
/**
|
|
20
|
-
* Returns the current mid price of the pair in terms of token1, i.e. the ratio of reserve0 to reserve1
|
|
21
|
-
*/
|
|
22
|
-
get token1Price(): Price;
|
|
23
|
-
/**
|
|
24
|
-
* Return the price of the given token in terms of the other token in the pair.
|
|
25
|
-
* @param token token to return price of
|
|
26
|
-
*/
|
|
27
|
-
priceOf(token: Token): Price;
|
|
28
|
-
/**
|
|
29
|
-
* Returns the chain ID of the tokens in the pair.
|
|
30
|
-
*/
|
|
31
|
-
get chainId(): ChainId;
|
|
32
|
-
get token0(): Token;
|
|
33
|
-
get token1(): Token;
|
|
34
|
-
get reserve0(): TokenAmount;
|
|
35
|
-
get reserve1(): TokenAmount;
|
|
36
|
-
reserveOf(token: Token): TokenAmount;
|
|
37
|
-
getOutputAmount(inputAmount: TokenAmount): [TokenAmount, Pair];
|
|
38
|
-
getInputAmount(outputAmount: TokenAmount): [TokenAmount, Pair];
|
|
39
|
-
getLiquidityMinted(totalSupply: TokenAmount, tokenAmountA: TokenAmount, tokenAmountB: TokenAmount): TokenAmount;
|
|
40
|
-
getLiquidityValue(token: Token, totalSupply: TokenAmount, liquidity: TokenAmount, feeOn?: boolean, kLast?: BigintIsh): TokenAmount;
|
|
41
|
-
}
|
package/dist/entities/route.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ChainId } from '../constants';
|
|
2
|
-
import { Currency } from './currency';
|
|
3
|
-
import { Token } from './token';
|
|
4
|
-
import { Pair } from './pair';
|
|
5
|
-
import { Price } from './fractions/price';
|
|
6
|
-
export declare class Route {
|
|
7
|
-
readonly pairs: Pair[];
|
|
8
|
-
readonly path: Token[];
|
|
9
|
-
readonly input: Currency;
|
|
10
|
-
readonly output: Currency;
|
|
11
|
-
readonly midPrice: Price;
|
|
12
|
-
constructor(pairs: Pair[], input: Currency, output?: Currency);
|
|
13
|
-
get chainId(): ChainId;
|
|
14
|
-
}
|
package/dist/fetcher.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Pair } from './entities/pair';
|
|
2
|
-
import { ChainId } from './constants';
|
|
3
|
-
import { Token } from './entities/token';
|
|
4
|
-
/**
|
|
5
|
-
* Contains methods for constructing instances of pairs and tokens from on-chain data.
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class Fetcher {
|
|
8
|
-
/**
|
|
9
|
-
* Cannot be constructed.
|
|
10
|
-
*/
|
|
11
|
-
private constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Fetch information for a given token on the given chain, using the given ethers provider.
|
|
14
|
-
* @param chainId chain of the token
|
|
15
|
-
* @param address address of the token on the chain
|
|
16
|
-
* @param provider provider used to fetch the token
|
|
17
|
-
* @param symbol optional symbol of the token
|
|
18
|
-
* @param name optional name of the token
|
|
19
|
-
*/
|
|
20
|
-
static fetchTokenData(chainId: ChainId, address: string, provider?: import("@ethersproject/providers").BaseProvider, symbol?: string, name?: string): Promise<Token>;
|
|
21
|
-
/**
|
|
22
|
-
* Fetches information about a pair and constructs a pair from the given two tokens.
|
|
23
|
-
* @param tokenA first token
|
|
24
|
-
* @param tokenB second token
|
|
25
|
-
* @param provider the provider to use to fetch the data
|
|
26
|
-
*/
|
|
27
|
-
static fetchPairData(tokenA: Token, tokenB: Token, provider?: import("@ethersproject/providers").BaseProvider): Promise<Pair>;
|
|
28
|
-
}
|