Linter standard (#49)

* Impl

* Fix

* Fix

* Bump

* Bump

* Fix

* Bump
This commit is contained in:
Aleksandr Kraiz
2023-02-14 00:34:37 +04:00
committed by GitHub
parent 7040df6142
commit c12a4e8e7a
48 changed files with 964 additions and 594 deletions

View File

@@ -1,4 +1,4 @@
import { SupportedChainId } from '../types';
import { type SupportedChainId } from '../types';
import eip712DomainData from '../config/eip712DomainData.json';
import eip712DomainSchema from '../config/schemas/eip712DomainSchema';

View File

@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { CFDOrder } from '../types';
import { type CFDOrder } from '../types';
const hashCFDOrder = (order: CFDOrder) => ethers.utils.solidityKeccak256(
[
@@ -24,7 +24,7 @@ const hashCFDOrder = (order: CFDOrder) => ethers.utils.solidityKeccak256(
order.matcherFee,
order.nonce,
order.expiration,
order.buySide ? '0x01' : '0x00',
order.buySide === 1 ? '0x01' : '0x00',
],
);

View File

@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { Order } from '../types';
import { type Order } from '../types';
const hashOrder = (order: Order) => ethers.utils.solidityKeccak256(
[
@@ -28,7 +28,7 @@ const hashOrder = (order: Order) => ethers.utils.solidityKeccak256(
order.matcherFee,
order.nonce,
order.expiration,
order.buySide ? '0x01' : '0x00',
order.buySide === 1 ? '0x01' : '0x00',
],
);

View File

@@ -1,10 +1,9 @@
/* eslint-disable no-underscore-dangle */
import { TypedDataSigner } from '@ethersproject/abstract-signer';
import { type TypedDataSigner } from '@ethersproject/abstract-signer';
import BigNumber from 'bignumber.js';
import { ethers } from 'ethers';
import { type ethers } from 'ethers';
import { joinSignature, splitSignature } from 'ethers/lib/utils';
import { INTERNAL_ORION_PRECISION } from '../constants';
import { CFDOrder, SignedCFDOrder, SupportedChainId } from '../types';
import { type CFDOrder, type SignedCFDOrder, type SupportedChainId } from '../types';
import normalizeNumber from '../utils/normalizeNumber';
import getDomainData from './getDomainData';
import signCFDOrderPersonal from './signCFDOrderPersonal';
@@ -69,7 +68,7 @@ export const signCFDOrder = async (
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = joinSignature(splitSignature(signature));
if (!fixedSignature) throw new Error("Can't sign order");
// if (!fixedSignature) throw new Error("Can't sign order");
const signedOrder: SignedCFDOrder = {
...order,

View File

@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { CFDOrder } from '../types';
import { type CFDOrder } from '../types';
const { arrayify, joinSignature, splitSignature } = ethers.utils;

View File

@@ -1,9 +1,8 @@
/* eslint-disable no-underscore-dangle */
import { TypedDataSigner } from '@ethersproject/abstract-signer';
import { ethers } from 'ethers';
import { type TypedDataSigner } from '@ethersproject/abstract-signer';
import { type ethers } from 'ethers';
import { joinSignature, splitSignature } from 'ethers/lib/utils';
import CANCEL_ORDER_TYPES from '../constants/cancelOrderTypes';
import { CancelOrderRequest, SignedCancelOrderRequest, SupportedChainId } from '../types';
import { type CancelOrderRequest, type SignedCancelOrderRequest, type SupportedChainId } from '../types';
import getDomainData from './getDomainData';
import signCancelOrderPersonal from './signCancelOrderPersonal';
@@ -37,7 +36,7 @@ const signCancelOrder = async (
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = joinSignature(splitSignature(signature));
if (!fixedSignature) throw new Error("Can't sign order cancel");
// if (!fixedSignature) throw new Error("Can't sign order cancel");
const signedCancelOrderReqeust: SignedCancelOrderRequest = {
...cancelOrderRequest,

View File

@@ -1,6 +1,6 @@
import { ethers } from 'ethers';
import { arrayify, joinSignature, splitSignature } from 'ethers/lib/utils';
import { CancelOrderRequest } from '../types';
import { type CancelOrderRequest } from '../types';
const signCancelOrderPersonal = async (
cancelOrderRequest: CancelOrderRequest,

View File

@@ -1,11 +1,10 @@
/* eslint-disable no-underscore-dangle */
import { TypedDataSigner } from '@ethersproject/abstract-signer';
import { type TypedDataSigner } from '@ethersproject/abstract-signer';
import BigNumber from 'bignumber.js';
import { ethers } from 'ethers';
import { type ethers } from 'ethers';
import { joinSignature, splitSignature } from 'ethers/lib/utils';
import { INTERNAL_ORION_PRECISION } from '../constants';
import ORDER_TYPES from '../constants/orderTypes';
import { Order, SignedOrder, SupportedChainId } from '../types';
import { type Order, type SignedOrder, type SupportedChainId } from '../types';
import normalizeNumber from '../utils/normalizeNumber';
import getDomainData from './getDomainData';
import hashOrder from './hashOrder';
@@ -74,7 +73,7 @@ export const signOrder = async (
// "Signature's v was always send as 27 or 28, but from Ledger was 0 or 1"
const fixedSignature = joinSignature(splitSignature(signature));
if (!fixedSignature) throw new Error("Can't sign order");
// if (!fixedSignature) throw new Error("Can't sign order");
const signedOrder: SignedOrder = {
...order,

View File

@@ -1,5 +1,5 @@
import { ethers } from 'ethers';
import { Order } from '../types';
import { type Order } from '../types';
const { arrayify, joinSignature, splitSignature } = ethers.utils;