-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (54 loc) · 1.9 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* -------------------------------- PACKAGES -------------------------------- */
const fs = require("fs");
const Joi = require("joi");
const cors = require('cors');
const path = require('path');
const axios = require("axios");
const helmet = require("helmet")
const moment = require("moment");
const express = require('express');
const momentTz = require('moment-timezone');
const app = express();
/* --------------------------------- app.use -------------------------------- */
app.use(cors({
origin: true,
}));
// app.use(express.json({ limit: '1mb' }));
/* ---- Helmet helps secure Express apps by setting HTTP response headers --- */
app.use(helmet());
/* ----------------------------- MODULE IMPORTS ----------------------------- */
const { uniswapFee } = require("./modules/uniswap/constants");
const { uniswapGetDirectQuote, uniswapExecuteTrade, uniswapExecuteSmartRoute } = require("./modules/uniswap/swaps");
const PRIVATE_KEY= process.env.PRIVATE_KEY
// uniswapGetDirectQuote({
// from: 'USDT',
// to: 'WETH',
// chain: "optimism",
// fromAmount: '4000',
// requestFee: uniswapFee.low
// }).then(res => console.log(res))
// uniswapGetDirectQuote({
// from: 'USDT',
// to: 'WETH',
// chain: "arb",
// fromAmount: '4000',
// requestFee: uniswapFee.low
// }).then(res => console.log(res))
// getPool("0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", 3000)
// uniswapExecuteTrade({
// privateKey: PRIVATE_KEY,
// from: 'USDT',
// to: 'WMATIC',
// // chain: "sepolia",
// chain: "polygon",
// fromAmount: '1',
// requestFee: uniswapFee.high
// }).then(res => console.log(res))
// .catch(err => console.log(err))
// uniswapExecuteSmartRoute({
// privateKey: PRIVATE_KEY,
// from: 'WETH',
// to: 'USDT',
// chain: "sepolia",
// fromAmount: '0.01'
// }).then(res => console.log(res))