@qidao/sdk 5.0.9 → 5.1.1
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/{qidao-sdk.cjs.development.js → sdk.cjs.development.js} +1 -1
- package/dist/sdk.cjs.development.js.map +1 -0
- package/dist/{qidao-sdk.cjs.production.min.js → sdk.cjs.production.min.js} +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -0
- package/dist/{qidao-sdk.esm.js → sdk.esm.js} +1 -1
- package/dist/sdk.esm.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/src/src/entities/fractions/fraction.d.ts +19 -0
- 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/src/src/entities/token.d.ts +62 -0
- package/dist/src/src/errors.d.ts +16 -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/qidao-sdk.cjs.development.js.map +0 -1
- package/dist/qidao-sdk.cjs.production.min.js.map +0 -1
- package/dist/qidao-sdk.esm.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
3
|
+
export declare class Fraction {
|
|
4
|
+
readonly numerator: JSBI;
|
|
5
|
+
readonly denominator: JSBI;
|
|
6
|
+
constructor(numerator: BigintIsh, denominator?: BigintIsh);
|
|
7
|
+
get quotient(): JSBI;
|
|
8
|
+
get remainder(): Fraction;
|
|
9
|
+
invert(): Fraction;
|
|
10
|
+
add(other: Fraction | BigintIsh): Fraction;
|
|
11
|
+
subtract(other: Fraction | BigintIsh): Fraction;
|
|
12
|
+
lessThan(other: Fraction | BigintIsh): boolean;
|
|
13
|
+
equalTo(other: Fraction | BigintIsh): boolean;
|
|
14
|
+
greaterThan(other: Fraction | BigintIsh): boolean;
|
|
15
|
+
multiply(other: Fraction | BigintIsh): Fraction;
|
|
16
|
+
divide(other: Fraction | BigintIsh): Fraction;
|
|
17
|
+
toSignificant(significantDigits: number, format?: object, rounding?: Rounding): string;
|
|
18
|
+
toFixed(decimalPlaces: number, format?: object, rounding?: Rounding): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
2
|
+
import { Currency } from '../currency';
|
|
3
|
+
import { Fraction } from './fraction';
|
|
4
|
+
import { CurrencyAmount } from './currencyAmount';
|
|
5
|
+
export declare class Price extends Fraction {
|
|
6
|
+
readonly baseCurrency: Currency;
|
|
7
|
+
readonly quoteCurrency: Currency;
|
|
8
|
+
readonly scalar: Fraction;
|
|
9
|
+
constructor(baseCurrency: Currency, quoteCurrency: Currency, denominator: BigintIsh, numerator: BigintIsh);
|
|
10
|
+
get raw(): Fraction;
|
|
11
|
+
get adjusted(): Fraction;
|
|
12
|
+
invert(): Price;
|
|
13
|
+
multiply(other: Price): Price;
|
|
14
|
+
quote(currencyAmount: CurrencyAmount): CurrencyAmount;
|
|
15
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
16
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ChainId } from '../constants';
|
|
2
|
+
import { Currency } from './currency';
|
|
3
|
+
/**
|
|
4
|
+
* Represents an ERC20 token with a unique address and some metadata.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Token extends Currency {
|
|
7
|
+
readonly chainId: ChainId;
|
|
8
|
+
readonly address: string;
|
|
9
|
+
constructor(chainId: ChainId, address: string, decimals: number, symbol?: string, name?: string);
|
|
10
|
+
/**
|
|
11
|
+
* Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
|
|
12
|
+
* @param other other token to compare
|
|
13
|
+
*/
|
|
14
|
+
equals(other: Token): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true if the address of this token sorts before the address of the other token
|
|
17
|
+
* @param other other token to compare
|
|
18
|
+
* @throws if the tokens have the same address
|
|
19
|
+
* @throws if the tokens are on different chains
|
|
20
|
+
*/
|
|
21
|
+
sortsBefore(other: Token): boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Compares two currencies for equality
|
|
25
|
+
*/
|
|
26
|
+
export declare function currencyEquals(currencyA: Currency, currencyB: Currency): boolean;
|
|
27
|
+
export declare const WETH: {
|
|
28
|
+
1: Token;
|
|
29
|
+
3: Token;
|
|
30
|
+
4: Token;
|
|
31
|
+
5: Token;
|
|
32
|
+
42: Token;
|
|
33
|
+
250: Token;
|
|
34
|
+
4002: Token;
|
|
35
|
+
137: Token;
|
|
36
|
+
80001: Token;
|
|
37
|
+
100: Token;
|
|
38
|
+
56: Token;
|
|
39
|
+
97: Token;
|
|
40
|
+
42161: Token;
|
|
41
|
+
1287: Token;
|
|
42
|
+
43114: Token;
|
|
43
|
+
43113: Token;
|
|
44
|
+
128: Token;
|
|
45
|
+
256: Token;
|
|
46
|
+
1666600000: Token;
|
|
47
|
+
1666700000: Token;
|
|
48
|
+
1285: Token;
|
|
49
|
+
25: Token;
|
|
50
|
+
10: Token;
|
|
51
|
+
57: Token;
|
|
52
|
+
1088: Token;
|
|
53
|
+
1284: Token;
|
|
54
|
+
2001: Token;
|
|
55
|
+
2222: Token;
|
|
56
|
+
4689: Token;
|
|
57
|
+
8217: Token;
|
|
58
|
+
42220: Token;
|
|
59
|
+
1313161554: Token;
|
|
60
|
+
288: Token;
|
|
61
|
+
1818: Token;
|
|
62
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
export { JSBI };
|
|
3
|
+
export { BigintIsh, ChainId, TradeType, Rounding, INIT_CODE_HASH, MINIMUM_LIQUIDITY } from './constants';
|
|
4
|
+
export * from './errors';
|
|
5
|
+
export * from './entities';
|
|
6
|
+
export * from './vaultInfo';
|
|
7
|
+
export * from './contracts';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
import { BigintIsh, SolidityType } from './constants';
|
|
3
|
+
export declare function validateSolidityTypeInstance(value: JSBI, solidityType: SolidityType): void;
|
|
4
|
+
export declare function validateAndParseAddress(address: string): string;
|
|
5
|
+
export declare function parseBigintIsh(bigintIsh: BigintIsh): JSBI;
|
|
6
|
+
export declare function sqrt(y: JSBI): JSBI;
|
|
7
|
+
export declare function sortedInsert<T>(items: T[], add: T, maxSize: number, comparator: (a: T, b: T) => number): T | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Provider } from "@ethersproject/providers";
|
|
2
|
+
import { Signer } from 'ethers';
|
|
3
|
+
import { CrosschainNativeQiStablecoin, CrosschainQiStablecoin, CrosschainQiStablecoinSlim, CrosschainQiStablecoinSlimV2, CrosschainQiStablecoinV2, CrosschainQiStablecoinwbtc, Erc20QiStablecoincamwbtc, Erc20QiStablecoinwbtc, Erc20Stablecoin, StableQiVault } from "./contracts";
|
|
4
|
+
import { Token } from './entities';
|
|
5
|
+
import ERC20_STABLECOIN from './abis/toGenerate/erc20Stablecoin.json';
|
|
6
|
+
import STABLE_QI_VAULT from './abis/toGenerate/stableQiVault.json';
|
|
7
|
+
import { ChainId } from "./constants";
|
|
8
|
+
export declare type VaultContractAbi = typeof ERC20_STABLECOIN | typeof STABLE_QI_VAULT;
|
|
9
|
+
export default interface COLLATERAL {
|
|
10
|
+
aaveId?: string;
|
|
11
|
+
connect(address: string, signerOrProvider: Signer | Provider): Erc20Stablecoin | Erc20QiStablecoinwbtc | Erc20QiStablecoincamwbtc | StableQiVault | CrosschainQiStablecoin | CrosschainNativeQiStablecoin | CrosschainQiStablecoinV2 | CrosschainQiStablecoinSlim | CrosschainQiStablecoinSlimV2 | CrosschainQiStablecoinwbtc;
|
|
12
|
+
chainId: ChainId;
|
|
13
|
+
depreciated?: boolean;
|
|
14
|
+
infoUrl?: string;
|
|
15
|
+
minimumCDR: number;
|
|
16
|
+
native?: boolean;
|
|
17
|
+
subgraph?: string;
|
|
18
|
+
token: Token;
|
|
19
|
+
vaultAddress: string;
|
|
20
|
+
}
|
|
21
|
+
export interface COLLATERAL_V2 extends COLLATERAL {
|
|
22
|
+
contractAbi: VaultContractAbi;
|
|
23
|
+
}
|
|
24
|
+
export declare function isV2QiVault(collateral: COLLATERAL | COLLATERAL_V2): collateral is COLLATERAL_V2;
|
|
25
|
+
export declare const COLLATERALS: {
|
|
26
|
+
[chainId in ChainId]?: (COLLATERAL | COLLATERAL_V2)[];
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,82 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qidao/sdk",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"description": "🛠 An SDK for building applications on top of QiDao Protocol.",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"umd:main": "dist/index.umd.js",
|
|
8
|
+
"source": "./src/index.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"default": "./dist/index.modern.js"
|
|
12
|
+
},
|
|
13
|
+
"module": "./dist/index.module.js",
|
|
14
|
+
"unpkg": "./dist/index.umd.js",
|
|
15
|
+
"types": "./dist/src/index.d.ts",
|
|
8
16
|
"files": [
|
|
9
17
|
"dist"
|
|
10
18
|
],
|
|
11
|
-
"repository":
|
|
12
|
-
|
|
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",
|
|
19
|
+
"repository": "https://github.com/royalaid/sushiswap-sdk",
|
|
20
|
+
"keywords": [],
|
|
22
21
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"test": "tsdx test",
|
|
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"
|
|
22
|
+
"build": "microbundle",
|
|
23
|
+
"start": "microbundle watch",
|
|
24
|
+
"prepublishOnly": "typechain --discriminate-types --target ethers-v5 --out-dir src/contracts \"src/abis/toGenerate/**/*.json\" && microbundle"
|
|
38
25
|
},
|
|
39
26
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"@ethersproject/
|
|
50
|
-
"@ethersproject/
|
|
51
|
-
"@ethersproject/
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"decimal.js-light": "^2.5.0",
|
|
55
|
-
"eip-712": "^0.4.3",
|
|
56
|
-
"isomorphic-unfetch": "^3.1.0",
|
|
57
|
-
"jsbi": "^4.1.0",
|
|
58
|
-
"tiny-invariant": "^1.1.0",
|
|
59
|
-
"tiny-warning": "^1.0.3",
|
|
60
|
-
"toformat": "^2.0.0"
|
|
27
|
+
"big.js": "5.2.2",
|
|
28
|
+
"decimal.js-light": "2.5.1",
|
|
29
|
+
"ethers": "5.6.9",
|
|
30
|
+
"jsbi": "3.2.5",
|
|
31
|
+
"tiny-invariant": "1.2.0",
|
|
32
|
+
"tiny-warning": "1.0.3",
|
|
33
|
+
"toformat": "2.0.0"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@ethersproject/address": "5.6.1",
|
|
37
|
+
"@ethersproject/contracts": "5.6.2",
|
|
38
|
+
"@ethersproject/networks": "5.6.4",
|
|
39
|
+
"@ethersproject/providers": "5.6.8",
|
|
40
|
+
"@ethersproject/solidity": "5.6.1"
|
|
61
41
|
},
|
|
62
42
|
"devDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
43
|
+
"@ethersproject/address": "5.6.1",
|
|
44
|
+
"@ethersproject/contracts": "5.6.2",
|
|
45
|
+
"@ethersproject/networks": "5.6.4",
|
|
46
|
+
"@ethersproject/providers": "5.6.8",
|
|
47
|
+
"@ethersproject/solidity": "5.6.1",
|
|
48
|
+
"@typechain/ethers-v5": "10.1.0",
|
|
49
|
+
"@types/big.js": "4.0.5",
|
|
50
|
+
"@types/jest": "28.1.6",
|
|
51
|
+
"microbundle": "0.15.1",
|
|
52
|
+
"typechain": "8.1.0",
|
|
53
|
+
"typescript": "4.7.4"
|
|
70
54
|
},
|
|
71
55
|
"engines": {
|
|
72
|
-
"node": ">=
|
|
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"
|
|
56
|
+
"node": ">= 16"
|
|
80
57
|
},
|
|
81
|
-
"
|
|
58
|
+
"prettier": {
|
|
59
|
+
"printWidth": 120,
|
|
60
|
+
"semi": false,
|
|
61
|
+
"singleQuote": true
|
|
62
|
+
}
|
|
82
63
|
}
|