@orbs-network/twap 1.5.0 → 1.5.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/src/configs.d.ts +2 -0
- package/dist/src/configs.js +16 -25
- package/dist/src/lib.d.ts +2 -0
- package/dist/src/lib.js +5 -3
- package/dist/src/paraswap.d.ts +3 -1
- package/dist/src/paraswap.js +2 -0
- package/package.json +1 -1
package/dist/src/configs.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface Config {
|
|
|
14
14
|
minChunkSizeUsd: number;
|
|
15
15
|
wToken: TokenData;
|
|
16
16
|
}
|
|
17
|
+
export declare const UniswapV2Config: Config;
|
|
18
|
+
export declare const SushiSwapConfig: Config;
|
|
17
19
|
export declare const QuickSwapConfig: Config;
|
|
18
20
|
export declare const SpiritSwapConfig: Config;
|
|
19
21
|
export declare const SpookySwapConfig: Config;
|
package/dist/src/configs.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nativeTokenAddresses = exports.SpookySwapConfig = exports.SpiritSwapConfig = exports.QuickSwapConfig = void 0;
|
|
3
|
+
exports.nativeTokenAddresses = exports.SpookySwapConfig = exports.SpiritSwapConfig = exports.QuickSwapConfig = exports.SushiSwapConfig = exports.UniswapV2Config = void 0;
|
|
4
4
|
const web3_candies_1 = require("@defi.org/web3-candies");
|
|
5
5
|
const ChainConfigs = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
eth: {
|
|
7
|
+
chainId: 1,
|
|
8
|
+
twapAddress: "",
|
|
9
|
+
lensAddress: "",
|
|
10
|
+
bidDelaySeconds: 60,
|
|
11
|
+
minChunkSizeUsd: 100,
|
|
12
|
+
wToken: {
|
|
13
|
+
address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
14
|
+
decimals: 18,
|
|
15
|
+
symbol: "WETH",
|
|
16
|
+
logoUrl: "https://tokens.1inch.io/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee.png",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
19
|
ftm: {
|
|
20
20
|
chainId: 250,
|
|
21
21
|
twapAddress: "0xdE2ed02ef21895B97a937E82068F28390fF464aC",
|
|
@@ -43,17 +43,8 @@ const ChainConfigs = {
|
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// partner: "UniswapV2",
|
|
49
|
-
// exchangeAddress: "0xE83df5BfA9F14a84e550c38c4ec505cB22C6A0d7",
|
|
50
|
-
// };
|
|
51
|
-
//
|
|
52
|
-
// export const SushiSwapConfig: Config = {
|
|
53
|
-
// ...ChainConfigs.eth,
|
|
54
|
-
// partner: "SushiSwap",
|
|
55
|
-
// exchangeAddress: "0x72a18A408e329E7052d08aA0746243Dc30Ad2530",
|
|
56
|
-
// };
|
|
46
|
+
exports.UniswapV2Config = Object.assign(Object.assign({}, ChainConfigs.eth), { partner: "UniswapV2", exchangeAddress: "0xE83df5BfA9F14a84e550c38c4ec505cB22C6A0d7" });
|
|
47
|
+
exports.SushiSwapConfig = Object.assign(Object.assign({}, ChainConfigs.eth), { partner: "SushiSwap", exchangeAddress: "0x72a18A408e329E7052d08aA0746243Dc30Ad2530" });
|
|
57
48
|
exports.QuickSwapConfig = Object.assign(Object.assign({}, ChainConfigs.poly), { partner: "QuickSwap", exchangeAddress: "0xeFE1B6096838949156e5130604434A2a13c68C68" });
|
|
58
49
|
exports.SpiritSwapConfig = Object.assign(Object.assign({}, ChainConfigs.ftm), { partner: "SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404" });
|
|
59
50
|
exports.SpookySwapConfig = Object.assign(Object.assign({}, ChainConfigs.ftm), { partner: "SpookySwap", exchangeAddress: "0x37F427DA0D12Fe2C80aCa09EE08e7e92A1B2B114" });
|
package/dist/src/lib.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { Config, TokenData } from "./configs";
|
|
|
2
2
|
import BN from "bignumber.js";
|
|
3
3
|
import type { TWAP } from "../typechain-hardhat/contracts";
|
|
4
4
|
import type { Lens } from "../typechain-hardhat/contracts/periphery";
|
|
5
|
+
export declare const twapAbi: any;
|
|
6
|
+
export declare const lensAbi: any;
|
|
5
7
|
export declare class TWAPLib {
|
|
6
8
|
config: Config;
|
|
7
9
|
provider: any;
|
package/dist/src/lib.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.OrderInputValidation = exports.Status = exports.TWAPLib = void 0;
|
|
15
|
+
exports.OrderInputValidation = exports.Status = exports.TWAPLib = exports.lensAbi = exports.twapAbi = void 0;
|
|
16
16
|
const configs_1 = require("./configs");
|
|
17
17
|
const web3_1 = __importDefault(require("web3"));
|
|
18
18
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
@@ -20,6 +20,8 @@ const web3_candies_1 = require("@defi.org/web3-candies");
|
|
|
20
20
|
const TWAP_json_1 = __importDefault(require("../artifacts/contracts/TWAP.sol/TWAP.json"));
|
|
21
21
|
const Lens_json_1 = __importDefault(require("../artifacts/contracts/periphery/Lens.sol/Lens.json"));
|
|
22
22
|
const lodash_1 = __importDefault(require("lodash"));
|
|
23
|
+
exports.twapAbi = TWAP_json_1.default.abi;
|
|
24
|
+
exports.lensAbi = Lens_json_1.default.abi;
|
|
23
25
|
class TWAPLib {
|
|
24
26
|
constructor(config, provider, maker) {
|
|
25
27
|
this.config = config;
|
|
@@ -51,8 +53,8 @@ class TWAPLib {
|
|
|
51
53
|
? Status.Completed
|
|
52
54
|
: Status.Expired;
|
|
53
55
|
(0, web3_candies_1.setWeb3Instance)(new web3_1.default(provider));
|
|
54
|
-
this.twap = (0, web3_candies_1.contract)(
|
|
55
|
-
this.lens = (0, web3_candies_1.contract)(
|
|
56
|
+
this.twap = (0, web3_candies_1.contract)(exports.twapAbi, this.config.twapAddress);
|
|
57
|
+
this.lens = (0, web3_candies_1.contract)(exports.lensAbi, this.config.lensAddress);
|
|
56
58
|
}
|
|
57
59
|
makerBalance(token) {
|
|
58
60
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/src/paraswap.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { TokenData } from "./configs";
|
|
|
3
3
|
export declare namespace Paraswap {
|
|
4
4
|
enum OnlyDex {
|
|
5
5
|
SpiritSwap = "SpiritSwap,SpiritSwapV2",
|
|
6
|
-
SpookySwap = "SpookySwap"
|
|
6
|
+
SpookySwap = "SpookySwap",
|
|
7
|
+
Quickswap = "Quickswap",
|
|
8
|
+
Sushiswap = "Sushiswap"
|
|
7
9
|
}
|
|
8
10
|
interface ParaswapRoute {
|
|
9
11
|
blockNumber: number;
|
package/dist/src/paraswap.js
CHANGED
|
@@ -23,6 +23,8 @@ var Paraswap;
|
|
|
23
23
|
(function (OnlyDex) {
|
|
24
24
|
OnlyDex["SpiritSwap"] = "SpiritSwap,SpiritSwapV2";
|
|
25
25
|
OnlyDex["SpookySwap"] = "SpookySwap";
|
|
26
|
+
OnlyDex["Quickswap"] = "Quickswap";
|
|
27
|
+
OnlyDex["Sushiswap"] = "Sushiswap";
|
|
26
28
|
})(OnlyDex = Paraswap.OnlyDex || (Paraswap.OnlyDex = {}));
|
|
27
29
|
function priceUsd(chainId, token) {
|
|
28
30
|
return __awaiter(this, void 0, void 0, function* () {
|