@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.
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -0
- package/dist/index.modern.mjs +2 -0
- package/dist/index.modern.mjs.map +1 -0
- package/dist/index.module.js +2 -0
- package/dist/index.module.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/src/src/constants.d.ts +69 -0
- package/dist/src/src/contracts/CrosschainNativeQiStablecoin.d.ts +978 -0
- package/dist/src/src/contracts/CrosschainQiStablecoin.d.ts +974 -0
- package/dist/src/src/contracts/CrosschainQiStablecoinSlim.d.ts +942 -0
- package/dist/src/src/contracts/CrosschainQiStablecoinSlimV2.d.ts +950 -0
- package/dist/src/src/contracts/CrosschainQiStablecoinV2.d.ts +910 -0
- package/dist/src/src/contracts/CrosschainQiStablecoinwbtc.d.ts +958 -0
- package/dist/src/src/contracts/Erc20QiStablecoincamwbtc.d.ts +986 -0
- package/dist/src/src/contracts/Erc20QiStablecoinwbtc.d.ts +994 -0
- package/dist/src/src/contracts/Erc20Stablecoin.d.ts +938 -0
- package/dist/src/src/contracts/StableQiVault.d.ts +1522 -0
- package/dist/src/src/contracts/common.d.ts +22 -0
- package/dist/src/src/contracts/factories/CrosschainNativeQiStablecoin__factory.d.ts +61 -0
- package/dist/src/src/contracts/factories/CrosschainQiStablecoinSlimV2__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/CrosschainQiStablecoinSlim__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/CrosschainQiStablecoinV2__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/CrosschainQiStablecoin__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/CrosschainQiStablecoinwbtc__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/Erc20QiStablecoincamwbtc__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/Erc20QiStablecoinwbtc__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/Erc20Stablecoin__factory.d.ts +52 -0
- package/dist/src/src/contracts/factories/StableQiVault__factory.d.ts +46 -0
- package/dist/src/src/contracts/factories/index.d.ts +10 -0
- package/dist/src/src/contracts/index.d.ts +21 -0
- package/dist/src/src/entities/currency.d.ts +83 -0
- package/dist/src/src/entities/fractions/currencyAmount.d.ts +19 -0
- package/dist/{entities/Fraction.d.ts → src/src/entities/fractions/fraction.d.ts} +1 -7
- package/dist/src/src/entities/fractions/index.d.ts +5 -0
- package/dist/src/src/entities/fractions/percent.d.ts +6 -0
- package/dist/src/src/entities/fractions/price.d.ts +17 -0
- package/dist/src/src/entities/fractions/tokenAmount.d.ts +9 -0
- package/dist/src/src/entities/index.d.ts +3 -0
- package/dist/{entities/Token.d.ts → src/src/entities/token.d.ts} +40 -11
- package/dist/{errors.d.ts → src/src/errors.d.ts} +0 -0
- package/dist/src/src/index.d.ts +7 -0
- package/dist/src/src/utils.d.ts +7 -0
- package/dist/src/src/vaultInfo.d.ts +27 -0
- package/dist/src/test/fraction.test.d.ts +1 -0
- package/dist/src/test/token.test.d.ts +1 -0
- package/package.json +47 -66
- package/dist/constants/addresses.d.ts +0 -31
- package/dist/constants/index.d.ts +0 -20
- package/dist/constants/kashi.d.ts +0 -29
- package/dist/constants/natives.d.ts +0 -30
- package/dist/constants/numbers.d.ts +0 -11
- package/dist/constants/tokens.d.ts +0 -5
- package/dist/entities/AbstractCurrency.d.ts +0 -53
- package/dist/entities/ConstantProductPool.d.ts +0 -43
- package/dist/entities/Currency.d.ts +0 -3
- package/dist/entities/CurrencyAmount.d.ts +0 -38
- package/dist/entities/MultiRouter.d.ts +0 -59
- package/dist/entities/Native/Avalanche.d.ts +0 -10
- package/dist/entities/Native/Binance.d.ts +0 -10
- package/dist/entities/Native/Celo.d.ts +0 -10
- package/dist/entities/Native/Ether.d.ts +0 -13
- package/dist/entities/Native/Fantom.d.ts +0 -10
- package/dist/entities/Native/Fuse.d.ts +0 -10
- package/dist/entities/Native/Harmony.d.ts +0 -10
- package/dist/entities/Native/Heco.d.ts +0 -10
- package/dist/entities/Native/Matic.d.ts +0 -10
- package/dist/entities/Native/Movr.d.ts +0 -10
- package/dist/entities/Native/Okex.d.ts +0 -10
- package/dist/entities/Native/Palm.d.ts +0 -10
- package/dist/entities/Native/Telos.d.ts +0 -10
- package/dist/entities/Native/index.d.ts +0 -14
- package/dist/entities/Native/xDai.d.ts +0 -10
- package/dist/entities/NativeCurrency.d.ts +0 -8
- package/dist/entities/Pair.d.ts +0 -41
- package/dist/entities/Percent.d.ts +0 -15
- package/dist/entities/Price.d.ts +0 -39
- package/dist/entities/Route.d.ts +0 -14
- package/dist/entities/Trade.d.ts +0 -107
- package/dist/entities/eip712.d.ts +0 -78
- package/dist/entities/index.d.ts +0 -14
- package/dist/enums/ChainId.d.ts +0 -32
- package/dist/enums/Fee.d.ts +0 -3
- package/dist/enums/KashiAction.d.ts +0 -18
- package/dist/enums/OrderStatus.d.ts +0 -6
- package/dist/enums/Rounding.d.ts +0 -5
- package/dist/enums/TradeType.d.ts +0 -4
- package/dist/enums/index.d.ts +0 -6
- package/dist/functions/bentobox.d.ts +0 -3
- package/dist/functions/computeConstantProductPoolAddress.d.ts +0 -9
- package/dist/functions/computePairAddress.d.ts +0 -6
- package/dist/functions/computePoolInitCodeHash.d.ts +0 -5
- package/dist/functions/computePriceImpact.d.ts +0 -11
- package/dist/functions/index.d.ts +0 -8
- package/dist/functions/kashi.d.ts +0 -9
- package/dist/functions/rebase.d.ts +0 -4
- package/dist/functions/sortedInsert.d.ts +0 -1
- package/dist/functions/sqrt.d.ts +0 -7
- package/dist/functions/validateAndParseAddress.d.ts +0 -1
- package/dist/functions/validateSolidityTypeInstance.d.ts +0 -3
- package/dist/index.d.ts +0 -12
- package/dist/interfaces/AccrueInfo.d.ts +0 -6
- package/dist/interfaces/Rebase.d.ts +0 -5
- package/dist/interfaces/index.d.ts +0 -2
- package/dist/limitorder.d.ts +0 -115
- package/dist/router.d.ts +0 -68
- package/dist/sdk.cjs.development.js +0 -5301
- 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 -5162
- package/dist/sdk.esm.js.map +0 -1
- package/dist/types/AddressMap.d.ts +0 -3
- package/dist/types/BigIntIsh.d.ts +0 -2
- package/dist/types/ChainTokenMap.d.ts +0 -5
- package/dist/types/LimitOrderTypes.d.ts +0 -21
- package/dist/types/MultiRouterTypes.d.ts +0 -97
- package/dist/types/TokenMap.d.ts +0 -4
- package/dist/types/index.d.ts +0 -4
- 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,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;
|
package/dist/functions/sqrt.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function validateAndParseAddress(address: string): string;
|
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';
|
package/dist/limitorder.d.ts
DELETED
|
@@ -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
|
-
}
|