Skip to content

Commit

Permalink
Merge branch 'main' into sanitize-amount
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoda committed Feb 13, 2024
2 parents 7ed45eb + 94362ca commit 0271de1
Show file tree
Hide file tree
Showing 17 changed files with 413 additions and 295 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
run-linters:
name: lint
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up node
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run linters
run: yarn lint
4 changes: 2 additions & 2 deletions lib/entities/QuoteRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ export class QuoteRequest {
...(this.quoteId && { quoteId: this.quoteId }),
};
}

public toOpposingRequest(): QuoteRequest {
const opposingJSON = this.toOpposingCleanJSON();
return new QuoteRequest({
...opposingJSON,
amount: BigNumber.from(opposingJSON.amount),
type: TradeType[opposingJSON.type as keyof typeof TradeType],
});
}
}

public get requestId(): string {
return this.data.requestId;
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/quote/injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
FADE_RATE_BUCKET,
FADE_RATE_S3_KEY,
INTEGRATION_S3_KEY,
PRODUCTION_S3_KEY,
PROD_COMPLIANCE_S3_KEY,
PRODUCTION_S3_KEY,
WEBHOOK_CONFIG_BUCKET,
} from '../../constants';
import {
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/analytics/firehose.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { FirehoseClient, PutRecordCommand } from '@aws-sdk/client-firehose';
import { default as Logger } from 'bunyan';

import { IAnalyticsLogger } from '.';
import { AnalyticsEvent } from '../../entities/analytics-events';
import { IAnalyticsLogger } from '.';

export class FirehoseLogger implements IAnalyticsLogger {
private log: Logger;
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/compliance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface FillerComplianceConfiguration {

export interface FillerComplianceConfigurationProvider {
getConfigs(): Promise<FillerComplianceConfiguration[]>;
// getExcludedAddrToEndpointsMap(): Promise<Map<string, Set<string>>>;
// getExcludedAddrToEndpointsMap(): Promise<Map<string, Set<string>>>;
getEndpointToExcludedAddrsMap(): Promise<Map<string, Set<string>>>;
}

Expand Down
7 changes: 3 additions & 4 deletions lib/providers/compliance/mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class MockFillerComplianceConfigurationProvider implements FillerComplian
async getConfigs(): Promise<FillerComplianceConfiguration[]> {
return this.configs;
}

async getEndpointToExcludedAddrsMap(): Promise<Map<string, Set<string>>> {
const map = new Map<string, Set<string>>();
this.configs.forEach((config) => {
Expand All @@ -18,8 +18,7 @@ export class MockFillerComplianceConfigurationProvider implements FillerComplian
map.get(endpoint)?.add(address);
});
});
})
});
return map;
}

}
}
10 changes: 3 additions & 7 deletions lib/providers/compliance/s3.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3';
import { default as Logger } from 'bunyan';

import { checkDefined } from '../../preconditions/preconditions';
import { FillerComplianceConfiguration, FillerComplianceConfigurationProvider } from '.';


export class S3FillerComplianceConfigurationProvider implements FillerComplianceConfigurationProvider {
private log: Logger;
private configs: FillerComplianceConfiguration[];
Expand All @@ -32,14 +30,12 @@ export class S3FillerComplianceConfigurationProvider implements FillerCompliance
this.endpointToExcludedAddrsMap.get(endpoint)?.add(address);
});
});
})
});
return this.endpointToExcludedAddrsMap;
}

async getConfigs(): Promise<FillerComplianceConfiguration[]> {
if (
this.configs.length === 0
) {
if (this.configs.length === 0) {
await this.fetchConfigs();
}
return this.configs;
Expand All @@ -57,4 +53,4 @@ export class S3FillerComplianceConfigurationProvider implements FillerCompliance
this.configs = JSON.parse(await s3Body.transformToString()) as FillerComplianceConfiguration[];
this.log.info({ configsLength: this.configs.map((c) => c.addresses.length) }, `Fetched configs`);
}
}
}
2 changes: 1 addition & 1 deletion lib/quoters/MockQuoter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Logger from 'bunyan';
import { BigNumber } from 'ethers';

import { Quoter, QuoterType } from '.';
import { QuoteRequest, QuoteResponse } from '../entities';
import { Quoter, QuoterType } from '.';

export const MOCK_FILLER_ADDRESS = '0x0000000000000000000000000000000000000001';

Expand Down
2 changes: 1 addition & 1 deletion test/entities/QuoteRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('QuoteRequest', () => {
numOutputs: 1,
});
});

it('toOpposingRequest', async () => {
const opposingRequest = request.toOpposingRequest();
expect(opposingRequest.toCleanJSON()).toEqual({
Expand Down
Loading

0 comments on commit 0271de1

Please sign in to comment.