Skip to content

Commit

Permalink
chore: ban ethers (#82)
Browse files Browse the repository at this point in the history
* fix: auto lint

* fix: ban ethers imports

* Fix code style issues with Prettier

* fix: use ethers for typings

Co-authored-by: Lint Action <[email protected]>
  • Loading branch information
zzmp and lint-action committed Mar 28, 2022
1 parent 6f230bf commit b1e311f
Show file tree
Hide file tree
Showing 37 changed files with 997 additions and 1,047 deletions.
11 changes: 11 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
"sort-imports": [
"error",
{ "ignoreDeclarationSort": true, "ignoreCase": true }
],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "ethers",
"message": "Please import from '@ethersproject/module' directly to support tree-shaking."
}
]
}
]
}
}
8 changes: 3 additions & 5 deletions cli/base-command.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/// <reference types="./types/bunyan-debug-stream" />
import { BigNumber } from '@ethersproject/bignumber';
import { JsonRpcProvider } from '@ethersproject/providers';
import { Command, flags } from '@oclif/command';
import { ParserOutput } from '@oclif/parser/lib/parse';
import DEFAULT_TOKEN_LIST from '@uniswap/default-token-list';
import { Currency, CurrencyAmount, Token } from '@uniswap/sdk-core';
import { MethodParameters } from '@uniswap/v3-sdk';
import bunyan, { default as Logger } from 'bunyan';
import bunyanDebugStream from 'bunyan-debug-stream';
import { BigNumber, ethers } from 'ethers';
import _ from 'lodash';
import NodeCache from 'node-cache';
import {
Expand Down Expand Up @@ -212,10 +213,7 @@ export abstract class BaseCommand extends Command {
const chainId = ID_TO_CHAIN_ID(chainIdNumb);
const chainProvider = ID_TO_PROVIDER(chainId);

const provider = new ethers.providers.JsonRpcProvider(
chainProvider,
chainId
);
const provider = new JsonRpcProvider(chainProvider, chainId);
this._blockNumber = await provider.getBlockNumber();

const tokenCache = new NodeJSCache<Token>(
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/quote-to-ratio.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Logger } from '@ethersproject/logger';
import { flags } from '@oclif/command';
import { Currency, Ether, Fraction, Percent } from '@uniswap/sdk-core';
import { Position } from '@uniswap/v3-sdk';
import dotenv from 'dotenv';
import { ethers } from 'ethers';
import {
ID_TO_CHAIN_ID,
parseAmount,
Expand All @@ -13,8 +13,8 @@ import { BaseCommand } from '../base-command';

dotenv.config();

ethers.utils.Logger.globalLogger();
ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.DEBUG);
Logger.globalLogger();
Logger.setLogLevel(Logger.levels.DEBUG);

export class QuoteToRatio extends BaseCommand {
static description = 'Uniswap Smart Order Router CLI';
Expand Down
6 changes: 3 additions & 3 deletions cli/commands/quote.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Logger } from '@ethersproject/logger';
import { flags } from '@oclif/command';
import { Protocol } from '@uniswap/router-sdk';
import { Currency, Percent, TradeType } from '@uniswap/sdk-core';
import dotenv from 'dotenv';
import { ethers } from 'ethers';
import _ from 'lodash';
import {
ID_TO_CHAIN_ID,
Expand All @@ -16,8 +16,8 @@ import { BaseCommand } from '../base-command';

dotenv.config();

ethers.utils.Logger.globalLogger();
ethers.utils.Logger.setLogLevel(ethers.utils.Logger.levels.DEBUG);
Logger.globalLogger();
Logger.setLogLevel(Logger.levels.DEBUG);

export class Quote extends BaseCommand {
static description = 'Uniswap Smart Order Router CLI';
Expand Down
Loading

0 comments on commit b1e311f

Please sign in to comment.