@qidao/sdk 5.0.0-canary.117 → 5.0.3

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.
Files changed (97) hide show
  1. package/dist/constants.d.ts +77 -0
  2. package/dist/entities/currency.d.ts +61 -0
  3. package/dist/entities/fractions/currencyAmount.d.ts +19 -0
  4. package/dist/entities/{Fraction.d.ts → fractions/fraction.d.ts} +1 -7
  5. package/dist/entities/fractions/index.d.ts +5 -0
  6. package/dist/entities/fractions/percent.d.ts +6 -0
  7. package/dist/entities/fractions/price.d.ts +19 -0
  8. package/dist/entities/fractions/tokenAmount.d.ts +9 -0
  9. package/dist/entities/index.d.ts +6 -14
  10. package/dist/entities/pair.d.ts +41 -0
  11. package/dist/entities/route.d.ts +14 -0
  12. package/dist/entities/{Token.d.ts → token.d.ts} +29 -11
  13. package/dist/entities/{Trade.d.ts → trade.d.ts} +34 -35
  14. package/dist/fetcher.d.ts +28 -0
  15. package/dist/index.d.ts +2 -7
  16. package/dist/router.d.ts +2 -7
  17. package/dist/sdk.cjs.development.js +1050 -4663
  18. package/dist/sdk.cjs.development.js.map +1 -1
  19. package/dist/sdk.cjs.production.min.js +1 -1
  20. package/dist/sdk.cjs.production.min.js.map +1 -1
  21. package/dist/sdk.esm.js +1045 -4547
  22. package/dist/sdk.esm.js.map +1 -1
  23. package/dist/test/constants.test.d.ts +1 -0
  24. package/dist/test/data.test.d.ts +1 -0
  25. package/dist/test/entities.test.d.ts +1 -0
  26. package/dist/test/fraction.test.d.ts +1 -0
  27. package/dist/test/miscellaneous.test.d.ts +1 -0
  28. package/dist/test/pair.test.d.ts +1 -0
  29. package/dist/test/route.test.d.ts +1 -0
  30. package/dist/test/router.test.d.ts +1 -0
  31. package/dist/test/token.test.d.ts +1 -0
  32. package/dist/test/trade.test.d.ts +1 -0
  33. package/dist/utils.d.ts +7 -0
  34. package/package.json +31 -45
  35. package/dist/constants/addresses.d.ts +0 -31
  36. package/dist/constants/index.d.ts +0 -20
  37. package/dist/constants/kashi.d.ts +0 -29
  38. package/dist/constants/natives.d.ts +0 -30
  39. package/dist/constants/numbers.d.ts +0 -11
  40. package/dist/constants/tokens.d.ts +0 -5
  41. package/dist/entities/AbstractCurrency.d.ts +0 -53
  42. package/dist/entities/ConstantProductPool.d.ts +0 -43
  43. package/dist/entities/Currency.d.ts +0 -3
  44. package/dist/entities/CurrencyAmount.d.ts +0 -38
  45. package/dist/entities/MultiRouter.d.ts +0 -59
  46. package/dist/entities/Native/Avalanche.d.ts +0 -10
  47. package/dist/entities/Native/Binance.d.ts +0 -10
  48. package/dist/entities/Native/Celo.d.ts +0 -10
  49. package/dist/entities/Native/Ether.d.ts +0 -13
  50. package/dist/entities/Native/Fantom.d.ts +0 -10
  51. package/dist/entities/Native/Fuse.d.ts +0 -10
  52. package/dist/entities/Native/Harmony.d.ts +0 -10
  53. package/dist/entities/Native/Heco.d.ts +0 -10
  54. package/dist/entities/Native/Matic.d.ts +0 -10
  55. package/dist/entities/Native/Movr.d.ts +0 -10
  56. package/dist/entities/Native/Okex.d.ts +0 -10
  57. package/dist/entities/Native/Palm.d.ts +0 -10
  58. package/dist/entities/Native/Telos.d.ts +0 -10
  59. package/dist/entities/Native/index.d.ts +0 -14
  60. package/dist/entities/Native/xDai.d.ts +0 -10
  61. package/dist/entities/NativeCurrency.d.ts +0 -8
  62. package/dist/entities/Pair.d.ts +0 -41
  63. package/dist/entities/Percent.d.ts +0 -15
  64. package/dist/entities/Price.d.ts +0 -39
  65. package/dist/entities/Route.d.ts +0 -14
  66. package/dist/entities/eip712.d.ts +0 -78
  67. package/dist/enums/ChainId.d.ts +0 -31
  68. package/dist/enums/Fee.d.ts +0 -3
  69. package/dist/enums/KashiAction.d.ts +0 -18
  70. package/dist/enums/OrderStatus.d.ts +0 -6
  71. package/dist/enums/Rounding.d.ts +0 -5
  72. package/dist/enums/TradeType.d.ts +0 -4
  73. package/dist/enums/index.d.ts +0 -6
  74. package/dist/functions/bentobox.d.ts +0 -3
  75. package/dist/functions/computeConstantProductPoolAddress.d.ts +0 -9
  76. package/dist/functions/computePairAddress.d.ts +0 -6
  77. package/dist/functions/computePoolInitCodeHash.d.ts +0 -5
  78. package/dist/functions/computePriceImpact.d.ts +0 -11
  79. package/dist/functions/index.d.ts +0 -8
  80. package/dist/functions/kashi.d.ts +0 -9
  81. package/dist/functions/rebase.d.ts +0 -4
  82. package/dist/functions/sortedInsert.d.ts +0 -1
  83. package/dist/functions/sqrt.d.ts +0 -7
  84. package/dist/functions/validateAndParseAddress.d.ts +0 -1
  85. package/dist/functions/validateSolidityTypeInstance.d.ts +0 -3
  86. package/dist/interfaces/AccrueInfo.d.ts +0 -6
  87. package/dist/interfaces/Rebase.d.ts +0 -5
  88. package/dist/interfaces/index.d.ts +0 -2
  89. package/dist/limitorder.d.ts +0 -115
  90. package/dist/types/AddressMap.d.ts +0 -3
  91. package/dist/types/BigIntIsh.d.ts +0 -2
  92. package/dist/types/ChainTokenMap.d.ts +0 -5
  93. package/dist/types/LimitOrderTypes.d.ts +0 -21
  94. package/dist/types/MultiRouterTypes.d.ts +0 -97
  95. package/dist/types/TokenMap.d.ts +0 -4
  96. package/dist/types/index.d.ts +0 -4
  97. package/dist/utils/MultiRouterMath.d.ts +0 -15
@@ -1,10 +0,0 @@
1
- import { Currency } from '../Currency';
2
- import { NativeCurrency } from '../NativeCurrency';
3
- import { Token } from '../Token';
4
- export declare class xDai extends NativeCurrency {
5
- protected constructor(chainId: number);
6
- get wrapped(): Token;
7
- private static _cache;
8
- static onChain(chainId: number): xDai;
9
- equals(other: Currency): boolean;
10
- }
@@ -1,8 +0,0 @@
1
- import { AbstractCurrency } from './AbstractCurrency';
2
- /**
3
- * Represents the native currency of the chain on which it resides, e.g.
4
- */
5
- export declare abstract class NativeCurrency extends AbstractCurrency {
6
- readonly isNative: true;
7
- readonly isToken: false;
8
- }
@@ -1,41 +0,0 @@
1
- import { BigintIsh } from '../types';
2
- import { CurrencyAmount } from './CurrencyAmount';
3
- import { Price } from './Price';
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(currencyAmountA: CurrencyAmount<Token>, currencyAmountB: CurrencyAmount<Token>);
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<Token, Token>;
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<Token, Token>;
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<Token, Token>;
28
- /**
29
- * Returns the chain ID of the tokens in the pair.
30
- */
31
- get chainId(): number;
32
- get token0(): Token;
33
- get token1(): Token;
34
- get reserve0(): CurrencyAmount<Token>;
35
- get reserve1(): CurrencyAmount<Token>;
36
- reserveOf(token: Token): CurrencyAmount<Token>;
37
- getOutputAmount(inputAmount: CurrencyAmount<Token>): [CurrencyAmount<Token>, Pair];
38
- getInputAmount(outputAmount: CurrencyAmount<Token>): [CurrencyAmount<Token>, Pair];
39
- getLiquidityMinted(totalSupply: CurrencyAmount<Token>, tokenAmountA: CurrencyAmount<Token>, tokenAmountB: CurrencyAmount<Token>): CurrencyAmount<Token>;
40
- getLiquidityValue(token: Token, totalSupply: CurrencyAmount<Token>, liquidity: CurrencyAmount<Token>, feeOn?: boolean, kLast?: BigintIsh): CurrencyAmount<Token>;
41
- }
@@ -1,15 +0,0 @@
1
- import { BigintIsh } from '../types';
2
- import { Fraction } from './Fraction';
3
- import { Rounding } from '../enums';
4
- export declare class Percent extends Fraction {
5
- /**
6
- * This boolean prevents a fraction from being interpreted as a Percent
7
- */
8
- readonly isPercent: true;
9
- add(other: Fraction | BigintIsh): Percent;
10
- subtract(other: Fraction | BigintIsh): Percent;
11
- multiply(other: Fraction | BigintIsh): Percent;
12
- divide(other: Fraction | BigintIsh): Percent;
13
- toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
14
- toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
15
- }
@@ -1,39 +0,0 @@
1
- import { BigintIsh } from '../types';
2
- import { Currency } from './Currency';
3
- import { CurrencyAmount } from './CurrencyAmount';
4
- import { Fraction } from './Fraction';
5
- import { Rounding } from '../enums';
6
- export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
7
- readonly baseCurrency: TBase;
8
- readonly quoteCurrency: TQuote;
9
- readonly scalar: Fraction;
10
- /**
11
- * Construct a price, either with the base and quote currency amount, or the
12
- * @param args
13
- */
14
- constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [{
15
- baseAmount: CurrencyAmount<TBase>;
16
- quoteAmount: CurrencyAmount<TQuote>;
17
- }]);
18
- /**
19
- * Flip the price, switching the base and quote currency
20
- */
21
- invert(): Price<TQuote, TBase>;
22
- /**
23
- * Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
24
- * @param other the other price
25
- */
26
- multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
27
- /**
28
- * Return the amount of quote currency corresponding to a given amount of the base currency
29
- * @param currencyAmount the amount of base currency to quote against the price
30
- */
31
- quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
32
- /**
33
- * Get the value scaled by decimals for formatting
34
- * @private
35
- */
36
- private get adjustedForDecimals();
37
- toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
38
- toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
39
- }
@@ -1,14 +0,0 @@
1
- import { Currency } from './Currency';
2
- import { Pair } from './Pair';
3
- import { Price } from './Price';
4
- import { Token } from './Token';
5
- export declare class Route<TInput extends Currency, TOutput extends Currency> {
6
- readonly pairs: Pair[];
7
- readonly path: Token[];
8
- readonly input: TInput;
9
- readonly output: TOutput;
10
- constructor(pairs: Pair[], input: TInput, output: TOutput);
11
- private _midPrice;
12
- get midPrice(): Price<TInput, TOutput>;
13
- get chainId(): number;
14
- }
@@ -1,78 +0,0 @@
1
- import { ChainId } from '../enums';
2
- import { Web3Provider } from '@ethersproject/providers';
3
- export interface Domain {
4
- name: string;
5
- chainId: ChainId;
6
- verifyingContract: string;
7
- }
8
- export interface Message {
9
- maker: string;
10
- tokenIn: string;
11
- tokenOut: string;
12
- amountIn: string;
13
- amountOut: string;
14
- recipient: string;
15
- startTime: string;
16
- endTime: string;
17
- stopPrice: string;
18
- oracleAddress: string;
19
- oracleData: string;
20
- }
21
- export interface BentoApprovalMessage {
22
- warning: string;
23
- user: string;
24
- masterContract: string;
25
- approved: boolean;
26
- nonce: number;
27
- }
28
- export declare const getSignature: (message: Message, chainId: ChainId, privateKey: string) => {
29
- v: number;
30
- r: string;
31
- s: string;
32
- };
33
- export declare const getTypedData: (message: Message, chainId: ChainId) => {
34
- types: {
35
- EIP712Domain: {
36
- name: string;
37
- type: string;
38
- }[];
39
- LimitOrder: {
40
- name: string;
41
- type: string;
42
- }[];
43
- };
44
- primaryType: string;
45
- domain: Domain;
46
- message: Message;
47
- };
48
- export declare const getTypedDataBento: (message: BentoApprovalMessage, chainId: ChainId) => {
49
- types: {
50
- EIP712Domain: {
51
- name: string;
52
- type: string;
53
- }[];
54
- SetMasterContractApproval: {
55
- name: string;
56
- type: string;
57
- }[];
58
- };
59
- primaryType: string;
60
- domain: Domain;
61
- message: BentoApprovalMessage;
62
- };
63
- export declare const getTypeHash: (typedData: any) => string;
64
- export declare const getSignatureWithProvider: (message: Message, chainId: ChainId, provider: Web3Provider) => Promise<{
65
- v: number;
66
- r: string;
67
- s: string;
68
- }>;
69
- export declare const getSignatureWithProviderBentobox: (message: BentoApprovalMessage, chainId: ChainId, provider: Web3Provider) => Promise<{
70
- v: number;
71
- r: string;
72
- s: string;
73
- }>;
74
- export declare const getSignatureBento: (bentoApproval: BentoApprovalMessage, chainId: ChainId, privateKey: string) => Promise<{
75
- v: number;
76
- r: string;
77
- s: string;
78
- }>;
@@ -1,31 +0,0 @@
1
- export declare enum ChainId {
2
- MAINNET = 1,
3
- ROPSTEN = 3,
4
- RINKEBY = 4,
5
- GÖRLI = 5,
6
- KOVAN = 42,
7
- MATIC = 137,
8
- MATIC_TESTNET = 80001,
9
- FANTOM = 250,
10
- FANTOM_TESTNET = 4002,
11
- XDAI = 100,
12
- BSC = 56,
13
- BSC_TESTNET = 97,
14
- ARBITRUM = 42161,
15
- ARBITRUM_TESTNET = 79377087078960,
16
- MOONBEAM_TESTNET = 1287,
17
- AVALANCHE = 43114,
18
- AVALANCHE_TESTNET = 43113,
19
- HECO = 128,
20
- HECO_TESTNET = 256,
21
- HARMONY = 1666600000,
22
- HARMONY_TESTNET = 1666700000,
23
- OKEX = 66,
24
- OKEX_TESTNET = 65,
25
- CELO = 42220,
26
- PALM = 11297108109,
27
- PALM_TESTNET = 11297108099,
28
- MOONRIVER = 1285,
29
- FUSE = 122,
30
- TELOS = 40
31
- }
@@ -1,3 +0,0 @@
1
- export declare enum Fee {
2
- DEFAULT = 30
3
- }
@@ -1,18 +0,0 @@
1
- export declare enum KashiAction {
2
- ADD_ASSET = 1,
3
- REPAY = 2,
4
- REMOVE_ASSET = 3,
5
- REMOVE_COLLATERAL = 4,
6
- BORROW = 5,
7
- GET_REPAY_SHARE = 6,
8
- GET_REPAY_PART = 7,
9
- ACCRUE = 8,
10
- ADD_COLLATERAL = 10,
11
- UPDATE_EXCHANGE_RATE = 11,
12
- BENTO_DEPOSIT = 20,
13
- BENTO_WITHDRAW = 21,
14
- BENTO_TRANSFER = 22,
15
- BENTO_TRANSFER_MULTIPLE = 23,
16
- BENTO_SETAPPROVAL = 24,
17
- CALL = 30
18
- }
@@ -1,6 +0,0 @@
1
- export declare enum OrderStatus {
2
- FILLED = "FILLED",
3
- CANCELLED = "CANCELLED",
4
- EXPIRED = "EXPIRED",
5
- PENDING = "PENDING"
6
- }
@@ -1,5 +0,0 @@
1
- export declare enum Rounding {
2
- ROUND_DOWN = 0,
3
- ROUND_HALF_UP = 1,
4
- ROUND_UP = 2
5
- }
@@ -1,4 +0,0 @@
1
- export declare enum TradeType {
2
- EXACT_INPUT = 0,
3
- EXACT_OUTPUT = 1
4
- }
@@ -1,6 +0,0 @@
1
- export { ChainId } from './ChainId';
2
- export { Rounding } from './Rounding';
3
- export { TradeType } from './TradeType';
4
- export { KashiAction } from './KashiAction';
5
- export { Fee } from './Fee';
6
- export { OrderStatus } from './OrderStatus';
@@ -1,3 +0,0 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- export declare function toAmount(token: any, shares: BigNumber): BigNumber;
3
- export declare function toShare(token: any, amount: BigNumber): BigNumber;
@@ -1,9 +0,0 @@
1
- import { Fee } from '../enums';
2
- import { Token } from '../entities';
3
- export declare const computeConstantProductPoolAddress: ({ factoryAddress, tokenA, tokenB, fee, twap }: {
4
- factoryAddress: string;
5
- tokenA: Token;
6
- tokenB: Token;
7
- fee: Fee;
8
- twap: boolean;
9
- }) => string;
@@ -1,6 +0,0 @@
1
- import { Token } from '../entities';
2
- export declare const computePairAddress: ({ factoryAddress, tokenA, tokenB }: {
3
- factoryAddress: string;
4
- tokenA: Token;
5
- tokenB: Token;
6
- }) => string;
@@ -1,5 +0,0 @@
1
- export declare const computePoolInitCodeHash: ({ creationCode, deployData, masterDeployerAddress }: {
2
- creationCode: string;
3
- deployData: string;
4
- masterDeployerAddress: string;
5
- }) => string;
@@ -1,11 +0,0 @@
1
- import { Currency } from '../entities/Currency';
2
- import { CurrencyAmount } from '../entities/CurrencyAmount';
3
- import { Percent } from '../entities/Percent';
4
- import { Price } from '../entities/Price';
5
- /**
6
- * Returns the percent difference between the mid price and the execution price, i.e. price impact.
7
- * @param midPrice mid price before the trade
8
- * @param inputAmount the input amount of the trade
9
- * @param outputAmount the output amount of the trade
10
- */
11
- export declare function computePriceImpact<TBase extends Currency, TQuote extends Currency>(midPrice: Price<TBase, TQuote>, inputAmount: CurrencyAmount<TBase>, outputAmount: CurrencyAmount<TQuote>): Percent;
@@ -1,8 +0,0 @@
1
- export { computePairAddress } from './computePairAddress';
2
- export { computePriceImpact } from './computePriceImpact';
3
- export { computeConstantProductPoolAddress } from './computeConstantProductPoolAddress';
4
- export { computePoolInitCodeHash } from './computePoolInitCodeHash';
5
- export { sortedInsert } from './sortedInsert';
6
- export { sqrt } from './sqrt';
7
- export { validateAndParseAddress } from './validateAndParseAddress';
8
- export { validateSolidityTypeInstance } from './validateSolidityTypeInstance';
@@ -1,9 +0,0 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- export declare function accrue(pair: any, amount: BigNumber, includePrincipal?: boolean): BigNumber;
3
- export declare function accrueTotalAssetWithFee(pair: any): {
4
- elastic: BigNumber;
5
- base: BigNumber;
6
- };
7
- export declare function interestAccrue(pair: any, interest: BigNumber): BigNumber;
8
- export declare function takeFee(amount: BigNumber): BigNumber;
9
- export declare function addBorrowFee(amount: BigNumber): BigNumber;
@@ -1,4 +0,0 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- import { Rebase } from '../interfaces';
3
- export declare function rebase(value: BigNumber, from: BigNumber, to: BigNumber): BigNumber;
4
- export declare function toElastic(total: Rebase, base: BigNumber, roundUp: boolean): BigNumber;
@@ -1 +0,0 @@
1
- export declare function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null;
@@ -1,7 +0,0 @@
1
- import JSBI from 'jsbi';
2
- export declare const MAX_SAFE_INTEGER: JSBI;
3
- /**
4
- * Computes floor(sqrt(value))
5
- * @param value the value for which to compute the square root, rounded down
6
- */
7
- export declare function sqrt(value: JSBI): JSBI;
@@ -1 +0,0 @@
1
- export declare function validateAndParseAddress(address: string): string;
@@ -1,3 +0,0 @@
1
- import { SolidityType } from '../constants';
2
- import JSBI from 'jsbi';
3
- export declare function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void;
@@ -1,6 +0,0 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- export interface AccrueInfo {
3
- interestPerSecond: BigNumber;
4
- lastAccrued: BigNumber;
5
- feesEarnedFraction: BigNumber;
6
- }
@@ -1,5 +0,0 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- export interface Rebase {
3
- base: BigNumber;
4
- elastic: BigNumber;
5
- }
@@ -1,2 +0,0 @@
1
- export { AccrueInfo } from './AccrueInfo';
2
- export { Rebase } from './Rebase';
@@ -1,115 +0,0 @@
1
- import { CurrencyAmount, Price, Token } from './entities';
2
- import { Message } from './entities';
3
- import { BigNumber } from '@ethersproject/bignumber';
4
- import { ChainId } from './enums';
5
- import { NonceManager } from '@ethersproject/experimental';
6
- import { Signer } from '@ethersproject/abstract-signer';
7
- import { Transaction } from '@ethersproject/transactions';
8
- import { Web3Provider } from '@ethersproject/providers';
9
- export interface ILimitOrderData {
10
- maker: string;
11
- tokenIn: string;
12
- tokenOut: string;
13
- tokenInDecimals: number;
14
- tokenOutDecimals: number;
15
- tokenInSymbol: string;
16
- tokenOutSymbol: string;
17
- amountIn: string;
18
- amountOut: string;
19
- recipient: string;
20
- startTime: string | number;
21
- endTime: string | number;
22
- stopPrice?: string;
23
- oracleAddress?: string;
24
- oracleData?: string;
25
- v: number;
26
- r: string;
27
- s: string;
28
- chainId: ChainId;
29
- orderTypeHash?: string;
30
- }
31
- export declare class LimitOrder {
32
- readonly maker: string;
33
- readonly amountIn: CurrencyAmount<Token>;
34
- readonly amountOut: CurrencyAmount<Token>;
35
- readonly recipient: string;
36
- readonly startTime: string;
37
- readonly endTime: string;
38
- readonly stopPrice: string;
39
- readonly oracleAddress: string;
40
- readonly oracleData: string;
41
- v: number;
42
- r: string;
43
- s: string;
44
- static getLimitOrder(data: ILimitOrderData): LimitOrder;
45
- constructor(maker: string, amountIn: CurrencyAmount<Token>, amountOut: CurrencyAmount<Token>, recipient: string, startTime: string | number, endTime: string | number, stopPrice?: string, oracleAddress?: string, oracleData?: string, v?: number, r?: string, s?: string);
46
- get amountInRaw(): string;
47
- get amountOutRaw(): string;
48
- get tokenInAddress(): string;
49
- get tokenOutAddress(): string;
50
- get tokenInDecimals(): number;
51
- get tokenOutDecimals(): number;
52
- get tokenInSymbol(): string;
53
- get tokenOutSymbol(): string;
54
- get chainId(): ChainId;
55
- usePrice(price: Price<Token, Token>): LimitOrder;
56
- signdOrderWithPrivatekey(chainId: ChainId, privateKey: string): {
57
- v: number;
58
- r: string;
59
- s: string;
60
- };
61
- signOrderWithProvider(chainId: ChainId, provider: Web3Provider): Promise<{
62
- v: number;
63
- r: string;
64
- s: string;
65
- }>;
66
- getTypedData(): {
67
- types: {
68
- EIP712Domain: {
69
- name: string;
70
- type: string;
71
- }[];
72
- LimitOrder: {
73
- name: string;
74
- type: string;
75
- }[];
76
- };
77
- primaryType: string;
78
- domain: import("./entities").Domain;
79
- message: Message;
80
- };
81
- getTypeHash(): string;
82
- send(): Promise<any>;
83
- }
84
- export declare class FillLimitOrder {
85
- readonly order: LimitOrder;
86
- readonly path: string[];
87
- readonly amountExternal: BigNumber;
88
- readonly amountToFill: BigNumber;
89
- readonly limitOrderReceiver: string;
90
- readonly to: string;
91
- readonly tokenIn: string;
92
- readonly tokenOut: string;
93
- readonly limitOrderReceiverData: string;
94
- constructor(order: LimitOrder, path: string[], amountExternal: BigNumber, amountToFill: BigNumber, limitOrderReceiver: string, to: string, keepTokenIn?: boolean);
95
- fillOrderOpen(signer: Signer, extra: {
96
- forceExecution?: boolean;
97
- gasPrice?: BigNumber;
98
- nonce?: number;
99
- debug?: boolean;
100
- open?: boolean;
101
- }): Promise<{
102
- executed: boolean;
103
- transaction?: Transaction | undefined;
104
- }>;
105
- fillOrder(signer: Signer | NonceManager, extra: {
106
- debug?: boolean;
107
- forceExecution?: boolean;
108
- gasPrice?: BigNumber;
109
- open?: boolean;
110
- nonce?: number;
111
- }): Promise<{
112
- executed: boolean;
113
- transaction?: Transaction;
114
- }>;
115
- }
@@ -1,3 +0,0 @@
1
- export declare type AddressMap = {
2
- [chainId: number]: string;
3
- };
@@ -1,2 +0,0 @@
1
- import JSBI from 'jsbi';
2
- export declare type BigintIsh = JSBI | number | string;
@@ -1,5 +0,0 @@
1
- import { ChainId } from 'enums';
2
- import { Token } from 'entities';
3
- export declare type ChainTokenMap = {
4
- readonly [chainId in ChainId]?: Token;
5
- };
@@ -1,21 +0,0 @@
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";
@@ -1,97 +0,0 @@
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 {};
@@ -1,4 +0,0 @@
1
- import { Token } from '../entities';
2
- export declare type TokenMap = {
3
- [chainId: number]: Token;
4
- };