@qidao/sdk 5.0.10 → 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 (121) hide show
  1. package/dist/index.js +2 -8
  2. package/dist/index.js.map +1 -0
  3. package/dist/index.modern.mjs +2 -0
  4. package/dist/index.modern.mjs.map +1 -0
  5. package/dist/index.module.js +2 -0
  6. package/dist/index.module.js.map +1 -0
  7. package/dist/index.umd.js +2 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/src/src/constants.d.ts +69 -0
  10. package/dist/src/src/contracts/CrosschainNativeQiStablecoin.d.ts +978 -0
  11. package/dist/src/src/contracts/CrosschainQiStablecoin.d.ts +974 -0
  12. package/dist/src/src/contracts/CrosschainQiStablecoinSlim.d.ts +942 -0
  13. package/dist/src/src/contracts/CrosschainQiStablecoinSlimV2.d.ts +950 -0
  14. package/dist/src/src/contracts/CrosschainQiStablecoinV2.d.ts +910 -0
  15. package/dist/src/src/contracts/CrosschainQiStablecoinwbtc.d.ts +958 -0
  16. package/dist/src/src/contracts/Erc20QiStablecoincamwbtc.d.ts +986 -0
  17. package/dist/src/src/contracts/Erc20QiStablecoinwbtc.d.ts +994 -0
  18. package/dist/src/src/contracts/Erc20Stablecoin.d.ts +938 -0
  19. package/dist/src/src/contracts/StableQiVault.d.ts +1522 -0
  20. package/dist/src/src/contracts/common.d.ts +22 -0
  21. package/dist/src/src/contracts/factories/CrosschainNativeQiStablecoin__factory.d.ts +61 -0
  22. package/dist/src/src/contracts/factories/CrosschainQiStablecoinSlimV2__factory.d.ts +52 -0
  23. package/dist/src/src/contracts/factories/CrosschainQiStablecoinSlim__factory.d.ts +52 -0
  24. package/dist/src/src/contracts/factories/CrosschainQiStablecoinV2__factory.d.ts +52 -0
  25. package/dist/src/src/contracts/factories/CrosschainQiStablecoin__factory.d.ts +52 -0
  26. package/dist/src/src/contracts/factories/CrosschainQiStablecoinwbtc__factory.d.ts +52 -0
  27. package/dist/src/src/contracts/factories/Erc20QiStablecoincamwbtc__factory.d.ts +52 -0
  28. package/dist/src/src/contracts/factories/Erc20QiStablecoinwbtc__factory.d.ts +52 -0
  29. package/dist/src/src/contracts/factories/Erc20Stablecoin__factory.d.ts +52 -0
  30. package/dist/src/src/contracts/factories/StableQiVault__factory.d.ts +46 -0
  31. package/dist/src/src/contracts/factories/index.d.ts +10 -0
  32. package/dist/src/src/contracts/index.d.ts +21 -0
  33. package/dist/src/src/entities/currency.d.ts +83 -0
  34. package/dist/src/src/entities/fractions/currencyAmount.d.ts +19 -0
  35. package/dist/{entities/Fraction.d.ts → src/src/entities/fractions/fraction.d.ts} +1 -7
  36. package/dist/src/src/entities/fractions/index.d.ts +5 -0
  37. package/dist/src/src/entities/fractions/percent.d.ts +6 -0
  38. package/dist/src/src/entities/fractions/price.d.ts +17 -0
  39. package/dist/src/src/entities/fractions/tokenAmount.d.ts +9 -0
  40. package/dist/src/src/entities/index.d.ts +3 -0
  41. package/dist/{entities/Token.d.ts → src/src/entities/token.d.ts} +40 -11
  42. package/dist/{errors.d.ts → src/src/errors.d.ts} +0 -0
  43. package/dist/src/src/index.d.ts +7 -0
  44. package/dist/src/src/utils.d.ts +7 -0
  45. package/dist/src/src/vaultInfo.d.ts +27 -0
  46. package/dist/src/test/fraction.test.d.ts +1 -0
  47. package/dist/src/test/token.test.d.ts +1 -0
  48. package/package.json +47 -66
  49. package/dist/constants/addresses.d.ts +0 -31
  50. package/dist/constants/index.d.ts +0 -20
  51. package/dist/constants/kashi.d.ts +0 -29
  52. package/dist/constants/natives.d.ts +0 -30
  53. package/dist/constants/numbers.d.ts +0 -11
  54. package/dist/constants/tokens.d.ts +0 -5
  55. package/dist/entities/AbstractCurrency.d.ts +0 -53
  56. package/dist/entities/ConstantProductPool.d.ts +0 -43
  57. package/dist/entities/Currency.d.ts +0 -3
  58. package/dist/entities/CurrencyAmount.d.ts +0 -38
  59. package/dist/entities/MultiRouter.d.ts +0 -59
  60. package/dist/entities/Native/Avalanche.d.ts +0 -10
  61. package/dist/entities/Native/Binance.d.ts +0 -10
  62. package/dist/entities/Native/Celo.d.ts +0 -10
  63. package/dist/entities/Native/Ether.d.ts +0 -13
  64. package/dist/entities/Native/Fantom.d.ts +0 -10
  65. package/dist/entities/Native/Fuse.d.ts +0 -10
  66. package/dist/entities/Native/Harmony.d.ts +0 -10
  67. package/dist/entities/Native/Heco.d.ts +0 -10
  68. package/dist/entities/Native/Matic.d.ts +0 -10
  69. package/dist/entities/Native/Movr.d.ts +0 -10
  70. package/dist/entities/Native/Okex.d.ts +0 -10
  71. package/dist/entities/Native/Palm.d.ts +0 -10
  72. package/dist/entities/Native/Telos.d.ts +0 -10
  73. package/dist/entities/Native/index.d.ts +0 -14
  74. package/dist/entities/Native/xDai.d.ts +0 -10
  75. package/dist/entities/NativeCurrency.d.ts +0 -8
  76. package/dist/entities/Pair.d.ts +0 -41
  77. package/dist/entities/Percent.d.ts +0 -15
  78. package/dist/entities/Price.d.ts +0 -39
  79. package/dist/entities/Route.d.ts +0 -14
  80. package/dist/entities/Trade.d.ts +0 -107
  81. package/dist/entities/eip712.d.ts +0 -78
  82. package/dist/entities/index.d.ts +0 -14
  83. package/dist/enums/ChainId.d.ts +0 -32
  84. package/dist/enums/Fee.d.ts +0 -3
  85. package/dist/enums/KashiAction.d.ts +0 -18
  86. package/dist/enums/OrderStatus.d.ts +0 -6
  87. package/dist/enums/Rounding.d.ts +0 -5
  88. package/dist/enums/TradeType.d.ts +0 -4
  89. package/dist/enums/index.d.ts +0 -6
  90. package/dist/functions/bentobox.d.ts +0 -3
  91. package/dist/functions/computeConstantProductPoolAddress.d.ts +0 -9
  92. package/dist/functions/computePairAddress.d.ts +0 -6
  93. package/dist/functions/computePoolInitCodeHash.d.ts +0 -5
  94. package/dist/functions/computePriceImpact.d.ts +0 -11
  95. package/dist/functions/index.d.ts +0 -8
  96. package/dist/functions/kashi.d.ts +0 -9
  97. package/dist/functions/rebase.d.ts +0 -4
  98. package/dist/functions/sortedInsert.d.ts +0 -1
  99. package/dist/functions/sqrt.d.ts +0 -7
  100. package/dist/functions/validateAndParseAddress.d.ts +0 -1
  101. package/dist/functions/validateSolidityTypeInstance.d.ts +0 -3
  102. package/dist/index.d.ts +0 -12
  103. package/dist/interfaces/AccrueInfo.d.ts +0 -6
  104. package/dist/interfaces/Rebase.d.ts +0 -5
  105. package/dist/interfaces/index.d.ts +0 -2
  106. package/dist/limitorder.d.ts +0 -115
  107. package/dist/router.d.ts +0 -68
  108. package/dist/sdk.cjs.development.js +0 -5301
  109. package/dist/sdk.cjs.development.js.map +0 -1
  110. package/dist/sdk.cjs.production.min.js +0 -2
  111. package/dist/sdk.cjs.production.min.js.map +0 -1
  112. package/dist/sdk.esm.js +0 -5162
  113. package/dist/sdk.esm.js.map +0 -1
  114. package/dist/types/AddressMap.d.ts +0 -3
  115. package/dist/types/BigIntIsh.d.ts +0 -2
  116. package/dist/types/ChainTokenMap.d.ts +0 -5
  117. package/dist/types/LimitOrderTypes.d.ts +0 -21
  118. package/dist/types/MultiRouterTypes.d.ts +0 -97
  119. package/dist/types/TokenMap.d.ts +0 -4
  120. package/dist/types/index.d.ts +0 -4
  121. package/dist/utils/MultiRouterMath.d.ts +0 -15
@@ -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
- }
package/dist/router.d.ts DELETED
@@ -1,68 +0,0 @@
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';
6
- /**
7
- * Options for producing the arguments to send call to the router.
8
- */
9
- export interface TradeOptions {
10
- /**
11
- * How much the execution price is allowed to move unfavorably from the trade execution price.
12
- */
13
- allowedSlippage: Percent;
14
- /**
15
- * How long the swap is valid until it expires, in seconds.
16
- * This will be used to produce a `deadline` parameter which is computed from when the swap call parameters
17
- * are generated.
18
- */
19
- ttl: number;
20
- /**
21
- * The account that should receive the output of the swap.
22
- */
23
- recipient: string;
24
- /**
25
- * Whether any of the tokens in the path are fee on transfer tokens, which should be handled with special methods
26
- */
27
- feeOnTransfer?: boolean;
28
- }
29
- export interface TradeOptionsDeadline extends Omit<TradeOptions, 'ttl'> {
30
- /**
31
- * When the transaction expires.
32
- * This is an atlernate to specifying the ttl, for when you do not want to use local time.
33
- */
34
- deadline: number;
35
- }
36
- /**
37
- * The parameters to use in the call to the Uniswap V2 Router to execute a trade.
38
- */
39
- export interface SwapParameters {
40
- /**
41
- * The method to call on the Uniswap V2 Router.
42
- */
43
- methodName: string;
44
- /**
45
- * The arguments to pass to the method, all hex encoded.
46
- */
47
- args: (string | string[])[];
48
- /**
49
- * The amount of wei to send in hex.
50
- */
51
- value: string;
52
- }
53
- export declare function toHex(currencyAmount: CurrencyAmount<Currency>): string;
54
- /**
55
- * Represents the Uniswap V2 Router, and has static methods for helping execute trades.
56
- */
57
- export declare abstract class Router {
58
- /**
59
- * Cannot be constructed.
60
- */
61
- private constructor();
62
- /**
63
- * Produces the on-chain method name to call and the hex encoded parameters to pass as arguments for a given trade.
64
- * @param trade to produce call parameters for
65
- * @param options options for the call parameters
66
- */
67
- static swapCallParameters(trade: Trade<Currency, Currency, TradeType>, options: TradeOptions | TradeOptionsDeadline): SwapParameters;
68
- }