@qidao/sdk 5.1.1 → 5.1.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.
Files changed (84) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.modern.mjs.map +1 -1
  4. package/dist/index.module.js +1 -1
  5. package/dist/index.module.js.map +1 -1
  6. package/dist/index.umd.js +1 -1
  7. package/dist/index.umd.js.map +1 -1
  8. package/package.json +1 -1
  9. package/dist/constants/addresses.d.ts +0 -31
  10. package/dist/constants/index.d.ts +0 -20
  11. package/dist/constants/kashi.d.ts +0 -29
  12. package/dist/constants/natives.d.ts +0 -30
  13. package/dist/constants/numbers.d.ts +0 -11
  14. package/dist/constants/tokens.d.ts +0 -5
  15. package/dist/entities/AbstractCurrency.d.ts +0 -53
  16. package/dist/entities/ConstantProductPool.d.ts +0 -43
  17. package/dist/entities/Currency.d.ts +0 -3
  18. package/dist/entities/CurrencyAmount.d.ts +0 -38
  19. package/dist/entities/Fraction.d.ts +0 -25
  20. package/dist/entities/MultiRouter.d.ts +0 -59
  21. package/dist/entities/Native/Avalanche.d.ts +0 -10
  22. package/dist/entities/Native/Binance.d.ts +0 -10
  23. package/dist/entities/Native/Celo.d.ts +0 -10
  24. package/dist/entities/Native/Ether.d.ts +0 -13
  25. package/dist/entities/Native/Fantom.d.ts +0 -10
  26. package/dist/entities/Native/Fuse.d.ts +0 -10
  27. package/dist/entities/Native/Harmony.d.ts +0 -10
  28. package/dist/entities/Native/Heco.d.ts +0 -10
  29. package/dist/entities/Native/Matic.d.ts +0 -10
  30. package/dist/entities/Native/Movr.d.ts +0 -10
  31. package/dist/entities/Native/Okex.d.ts +0 -10
  32. package/dist/entities/Native/Palm.d.ts +0 -10
  33. package/dist/entities/Native/Telos.d.ts +0 -10
  34. package/dist/entities/Native/index.d.ts +0 -14
  35. package/dist/entities/Native/xDai.d.ts +0 -10
  36. package/dist/entities/NativeCurrency.d.ts +0 -8
  37. package/dist/entities/Pair.d.ts +0 -41
  38. package/dist/entities/Percent.d.ts +0 -15
  39. package/dist/entities/Price.d.ts +0 -39
  40. package/dist/entities/Route.d.ts +0 -14
  41. package/dist/entities/Token.d.ts +0 -33
  42. package/dist/entities/Trade.d.ts +0 -107
  43. package/dist/entities/eip712.d.ts +0 -78
  44. package/dist/entities/index.d.ts +0 -14
  45. package/dist/enums/ChainId.d.ts +0 -32
  46. package/dist/enums/Fee.d.ts +0 -3
  47. package/dist/enums/KashiAction.d.ts +0 -18
  48. package/dist/enums/OrderStatus.d.ts +0 -6
  49. package/dist/enums/Rounding.d.ts +0 -5
  50. package/dist/enums/TradeType.d.ts +0 -4
  51. package/dist/enums/index.d.ts +0 -6
  52. package/dist/errors.d.ts +0 -16
  53. package/dist/functions/bentobox.d.ts +0 -3
  54. package/dist/functions/computeConstantProductPoolAddress.d.ts +0 -9
  55. package/dist/functions/computePairAddress.d.ts +0 -6
  56. package/dist/functions/computePoolInitCodeHash.d.ts +0 -5
  57. package/dist/functions/computePriceImpact.d.ts +0 -11
  58. package/dist/functions/index.d.ts +0 -8
  59. package/dist/functions/kashi.d.ts +0 -9
  60. package/dist/functions/rebase.d.ts +0 -4
  61. package/dist/functions/sortedInsert.d.ts +0 -1
  62. package/dist/functions/sqrt.d.ts +0 -7
  63. package/dist/functions/validateAndParseAddress.d.ts +0 -1
  64. package/dist/functions/validateSolidityTypeInstance.d.ts +0 -3
  65. package/dist/index.d.ts +0 -12
  66. package/dist/interfaces/AccrueInfo.d.ts +0 -6
  67. package/dist/interfaces/Rebase.d.ts +0 -5
  68. package/dist/interfaces/index.d.ts +0 -2
  69. package/dist/limitorder.d.ts +0 -115
  70. package/dist/router.d.ts +0 -68
  71. package/dist/sdk.cjs.development.js +0 -5301
  72. package/dist/sdk.cjs.development.js.map +0 -1
  73. package/dist/sdk.cjs.production.min.js +0 -2
  74. package/dist/sdk.cjs.production.min.js.map +0 -1
  75. package/dist/sdk.esm.js +0 -5162
  76. package/dist/sdk.esm.js.map +0 -1
  77. package/dist/types/AddressMap.d.ts +0 -3
  78. package/dist/types/BigIntIsh.d.ts +0 -2
  79. package/dist/types/ChainTokenMap.d.ts +0 -5
  80. package/dist/types/LimitOrderTypes.d.ts +0 -21
  81. package/dist/types/MultiRouterTypes.d.ts +0 -97
  82. package/dist/types/TokenMap.d.ts +0 -4
  83. package/dist/types/index.d.ts +0 -4
  84. package/dist/utils/MultiRouterMath.d.ts +0 -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,33 +0,0 @@
1
- import { AbstractCurrency } from './AbstractCurrency';
2
- import { ChainId } from '../enums';
3
- import { Currency } from './Currency';
4
- /**
5
- * Represents an ERC20 token with a unique address and some metadata.
6
- */
7
- export declare class Token extends AbstractCurrency {
8
- readonly chainId: ChainId;
9
- readonly address: string;
10
- readonly isNative: false;
11
- readonly isToken: true;
12
- constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string);
13
- /**
14
- * Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
15
- * @param other other token to compare
16
- */
17
- equals(other: Currency): boolean;
18
- /**
19
- * Returns true if the address of this token sorts before the address of the other token
20
- * @param other other token to compare
21
- * @throws if the tokens have the same address
22
- * @throws if the tokens are on different chains
23
- */
24
- sortsBefore(other: Token): boolean;
25
- /**
26
- * Return this token, which does not need to be wrapped
27
- */
28
- get wrapped(): Token;
29
- }
30
- /**
31
- * Compares two currencies for equality
32
- */
33
- export declare function currencyEquals(currencyA: Currency, currencyB: Currency): boolean;
@@ -1,107 +0,0 @@
1
- import { Currency } from './Currency';
2
- import { CurrencyAmount } from './CurrencyAmount';
3
- import { Pair } from './Pair';
4
- import { Percent } from './Percent';
5
- import { Price } from './Price';
6
- import { Route } from './Route';
7
- import { TradeType } from '../enums';
8
- interface InputOutput<TInput extends Currency, TOutput extends Currency> {
9
- readonly inputAmount: CurrencyAmount<TInput>;
10
- readonly outputAmount: CurrencyAmount<TOutput>;
11
- }
12
- export declare function inputOutputComparator<TInput extends Currency, TOutput extends Currency>(a: InputOutput<TInput, TOutput>, b: InputOutput<TInput, TOutput>): number;
13
- export declare function tradeComparator<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType>(a: Trade<TInput, TOutput, TTradeType>, b: Trade<TInput, TOutput, TTradeType>): number;
14
- export interface BestTradeOptions {
15
- maxNumResults?: number;
16
- maxHops?: number;
17
- }
18
- /**
19
- * Represents a trade executed against a list of pairs.
20
- * Does not account for slippage, i.e. trades that front run this trade and move the price.
21
- */
22
- export declare class Trade<TInput extends Currency, TOutput extends Currency, TTradeType extends TradeType> {
23
- /**
24
- * The route of the trade, i.e. which pairs the trade goes through and the input/output currencies.
25
- */
26
- readonly route: Route<TInput, TOutput>;
27
- /**
28
- * The type of the trade, either exact in or exact out.
29
- */
30
- readonly tradeType: TTradeType;
31
- /**
32
- * The input amount for the trade assuming no slippage.
33
- */
34
- readonly inputAmount: CurrencyAmount<TInput>;
35
- /**
36
- * The output amount for the trade assuming no slippage.
37
- */
38
- readonly outputAmount: CurrencyAmount<TOutput>;
39
- /**
40
- * The price expressed in terms of output amount/input amount.
41
- */
42
- readonly executionPrice: Price<TInput, TOutput>;
43
- /**
44
- * The percent difference between the mid price before the trade and the trade execution price.
45
- */
46
- readonly priceImpact: Percent;
47
- /**
48
- * Constructs an exact in trade with the given amount in and route
49
- * @param route route of the exact in trade
50
- * @param amountIn the amount being passed in
51
- */
52
- static exactIn<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountIn: CurrencyAmount<TInput>): Trade<TInput, TOutput, TradeType.EXACT_INPUT>;
53
- /**
54
- * Constructs an exact out trade with the given amount out and route
55
- * @param route route of the exact out trade
56
- * @param amountOut the amount returned by the trade
57
- */
58
- static exactOut<TInput extends Currency, TOutput extends Currency>(route: Route<TInput, TOutput>, amountOut: CurrencyAmount<TOutput>): Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>;
59
- constructor(route: Route<TInput, TOutput>, amount: TTradeType extends TradeType.EXACT_INPUT ? CurrencyAmount<TInput> : CurrencyAmount<TOutput>, tradeType: TTradeType);
60
- /**
61
- * Get the minimum amount that must be received from this trade for the given slippage tolerance
62
- * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade
63
- */
64
- minimumAmountOut(slippageTolerance: Percent): CurrencyAmount<TOutput>;
65
- /**
66
- * Get the maximum amount in that can be spent via this trade for the given slippage tolerance
67
- * @param slippageTolerance tolerance of unfavorable slippage from the execution price of this trade
68
- */
69
- maximumAmountIn(slippageTolerance: Percent): CurrencyAmount<TInput>;
70
- /**
71
- * Given a list of pairs, and a fixed amount in, returns the top `maxNumResults` trades that go from an input token
72
- * amount to an output token, making at most `maxHops` hops.
73
- * Note this does not consider aggregation, as routes are linear. It's possible a better route exists by splitting
74
- * the amount in among multiple routes.
75
- * @param pairs the pairs to consider in finding the best trade
76
- * @param nextAmountIn exact amount of input currency to spend
77
- * @param currencyOut the desired currency out
78
- * @param maxNumResults maximum number of results to return
79
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair
80
- * @param currentPairs used in recursion; the current list of pairs
81
- * @param currencyAmountIn used in recursion; the original value of the currencyAmountIn parameter
82
- * @param bestTrades used in recursion; the current list of best trades
83
- */
84
- static bestTradeExactIn<TInput extends Currency, TOutput extends Currency>(pairs: Pair[], currencyAmountIn: CurrencyAmount<TInput>, currencyOut: TOutput, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], nextAmountIn?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_INPUT>[]): Trade<TInput, TOutput, TradeType.EXACT_INPUT>[];
85
- /**
86
- * Return the execution price after accounting for slippage tolerance
87
- * @param slippageTolerance the allowed tolerated slippage
88
- */
89
- worstExecutionPrice(slippageTolerance: Percent): Price<TInput, TOutput>;
90
- /**
91
- * similar to the above method but instead targets a fixed output amount
92
- * given a list of pairs, and a fixed amount out, returns the top `maxNumResults` trades that go from an input token
93
- * to an output token amount, making at most `maxHops` hops
94
- * note this does not consider aggregation, as routes are linear. it's possible a better route exists by splitting
95
- * the amount in among multiple routes.
96
- * @param pairs the pairs to consider in finding the best trade
97
- * @param currencyIn the currency to spend
98
- * @param nextAmountOut the exact amount of currency out
99
- * @param maxNumResults maximum number of results to return
100
- * @param maxHops maximum number of hops a returned trade can make, e.g. 1 hop goes through a single pair
101
- * @param currentPairs used in recursion; the current list of pairs
102
- * @param currencyAmountOut used in recursion; the original value of the currencyAmountOut parameter
103
- * @param bestTrades used in recursion; the current list of best trades
104
- */
105
- static bestTradeExactOut<TInput extends Currency, TOutput extends Currency>(pairs: Pair[], currencyIn: TInput, currencyAmountOut: CurrencyAmount<TOutput>, { maxNumResults, maxHops }?: BestTradeOptions, currentPairs?: Pair[], nextAmountOut?: CurrencyAmount<Currency>, bestTrades?: Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[]): Trade<TInput, TOutput, TradeType.EXACT_OUTPUT>[];
106
- }
107
- export {};
@@ -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,14 +0,0 @@
1
- export * from './AbstractCurrency';
2
- export * from './Currency';
3
- export * from './CurrencyAmount';
4
- export * from './ConstantProductPool';
5
- export * from './Fraction';
6
- export * from './NativeCurrency';
7
- export * from './Pair';
8
- export * from './Percent';
9
- export * from './Price';
10
- export * from './Route';
11
- export * from './Token';
12
- export * from './Trade';
13
- export * from './Native';
14
- export * from './eip712';
@@ -1,32 +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
- MOONBEAM = 1284,
18
- AVALANCHE = 43114,
19
- AVALANCHE_TESTNET = 43113,
20
- HECO = 128,
21
- HECO_TESTNET = 256,
22
- HARMONY = 1666600000,
23
- HARMONY_TESTNET = 1666700000,
24
- OKEX = 66,
25
- OKEX_TESTNET = 65,
26
- CELO = 42220,
27
- PALM = 11297108109,
28
- PALM_TESTNET = 11297108099,
29
- MOONRIVER = 1285,
30
- FUSE = 122,
31
- TELOS = 40
32
- }
@@ -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';
package/dist/errors.d.ts DELETED
@@ -1,16 +0,0 @@
1
- /**
2
- * Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be
3
- * obtained by sending any amount of input.
4
- */
5
- export declare class InsufficientReservesError extends Error {
6
- readonly isInsufficientReservesError: true;
7
- constructor();
8
- }
9
- /**
10
- * Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less
11
- * than the price of a single unit of output after fees.
12
- */
13
- export declare class InsufficientInputAmountError extends Error {
14
- readonly isInsufficientInputAmountError: true;
15
- constructor();
16
- }
@@ -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;
package/dist/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import JSBI from 'jsbi';
2
- export { JSBI };
3
- export * from './constants';
4
- export * from './errors';
5
- export * from './entities';
6
- export * from './functions';
7
- export * from './router';
8
- export * from './enums';
9
- export * from './router';
10
- export * from './types';
11
- export * from './utils/MultiRouterMath';
12
- export * from './limitorder';
@@ -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
- }