Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into allow-returning-tx-ha…
Browse files Browse the repository at this point in the history
…sh-asap

# Conflicts:
#	package.json
#	yarn.lock
  • Loading branch information
dan437 committed Nov 27, 2024
2 parents af2d5e6 + 42e161c commit 5e3c7fb
Show file tree
Hide file tree
Showing 11 changed files with 627 additions and 491 deletions.
4 changes: 0 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ module.exports = {

{
files: ['*.test.ts', '*.test.js'],
parserOptions: {
project: ['./tsconfig.test.json'],
tsconfigRootDir: __dirname,
},
extends: ['@metamask/eslint-config-jest'],
},
],
Expand Down
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module.exports = {
global: {
branches: 75.52,
functions: 92.5,
lines: 92.64,
statements: 92.65,
lines: 92.52,
statements: 92.51,
},
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node'],
Expand Down
29 changes: 21 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dist/"
],
"scripts": {
"build": "tsc --project .",
"build": "tsc --project tsconfig.build.json",
"build:clean": "rm -rf dist && yarn build",
"build:link": "yarn build && cd dist && yarn link && rm -rf node_modules && cd ..",
"lint": "yarn lint:eslint && yarn lint:misc --check",
Expand All @@ -31,25 +31,26 @@
"@ethersproject/bytes": "^5.7.0",
"@metamask/base-controller": "^7.0.1",
"@metamask/controller-utils": "^11.0.0",
"@metamask/eth-json-rpc-provider": "^4.1.0",
"@metamask/eth-json-rpc-provider": "^4.1.6",
"@metamask/eth-query": "^4.0.0",
"@metamask/network-controller": "^22.0.0",
"@metamask/polling-controller": "^11.0.0",
"@metamask/transaction-controller": "^37.3.0",
"@metamask/polling-controller": "^12.0.0",
"bignumber.js": "^9.0.1",
"events": "^3.3.0",
"fast-json-patch": "^3.1.0",
"lodash": "^4.17.21"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^3.2.1",
"@lavamoat/preinstall-always-fail": "^2.1.0",
"@metamask/auto-changelog": "^3.1.0",
"@metamask/eslint-config": "^12.2.0",
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
"@metamask/eslint-config-typescript": "^12.1.0",
"@metamask/gas-fee-controller": "^21.0.0",
"@metamask/json-rpc-engine": "^9.0.0",
"@metamask/gas-fee-controller": "^22.0.0",
"@metamask/json-rpc-engine": "^10.0.1",
"@metamask/network-controller": "^22.0.0",
"@metamask/transaction-controller": "^38.0.0",
"@types/jest": "^26.0.24",
"@types/lodash": "^4.14.194",
"@types/node": "^18.19.17",
Expand All @@ -58,7 +59,7 @@
"@typescript-eslint/parser": "^5.33.0",
"eslint": "^8.48.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import": "~2.26.0",
"eslint-plugin-jest": "^27.1.5",
"eslint-plugin-jsdoc": "^39.2.9",
"eslint-plugin-n": "^15.7.0",
Expand All @@ -73,6 +74,18 @@
"ts-jest": "^29.1.4",
"typescript": "~4.8.4"
},
"peerDependencies": {
"@metamask/network-controller": "^22.0.0",
"@metamask/transaction-controller": "^38.0.0"
},
"peerDependenciesMeta": {
"@metamask/accounts-controller": {
"optional": true
},
"@metamask/approval-controller": {
"optional": true
}
},
"packageManager": "[email protected]",
"engines": {
"node": "^18.18 || >=20"
Expand Down
6 changes: 2 additions & 4 deletions src/SmartTransactionsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import {
import nock from 'nock';
import * as sinon from 'sinon';

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import packageJson from '../package.json';
import { advanceTime, flushPromises, getFakeProvider } from '../tests/helpers';
import { API_BASE_URL, SENTINEL_API_BASE_URL_MAP } from './constants';
import SmartTransactionsController, {
DEFAULT_INTERVAL,
Expand All @@ -30,11 +30,9 @@ import type {
SmartTransactionsControllerActions,
SmartTransactionsControllerEvents,
} from './SmartTransactionsController';
import { advanceTime, flushPromises, getFakeProvider } from './test-helpers';
import type { SmartTransaction, UnsignedTransaction, Hex } from './types';
import { SmartTransactionStatuses, ClientId } from './types';
import * as utils from './utils';
import packageJson from '../package.json';

jest.mock('@ethersproject/bytes', () => ({
...jest.requireActual('@ethersproject/bytes'),
Expand Down
4 changes: 1 addition & 3 deletions src/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ChainId } from '@metamask/controller-utils';

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import packageJson from '../package.json';
import { API_BASE_URL, SENTINEL_API_BASE_URL_MAP } from './constants';
import {
SmartTransactionMinedTx,
Expand All @@ -11,7 +10,6 @@ import {
ClientId,
} from './types';
import * as utils from './utils';
import packageJson from '../package.json';

const createSignedTransaction = () => {
return '0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a02b79f322a625d623a2bb2911e0c6b3e7eaf741a7c7c5d2e8c67ef3ff4acf146ca01ae168fea63dc3391b75b586c8a7c0cb55cdf3b8e2e4d8e097957a3a56c6f2c5';
Expand Down
7 changes: 4 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { BigNumber } from 'bignumber.js';
import jsonDiffer from 'fast-json-patch';
import _ from 'lodash';

// Ignoring TypeScript errors here because this import is disallowed for production builds, because
// the `package.json` file is above the root directory.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import packageJson from '../package.json';
import { API_BASE_URL, SENTINEL_API_BASE_URL_MAP } from './constants';
import type {
SmartTransaction,
Expand All @@ -20,9 +24,6 @@ import {
cancellationReasonToStatusMap,
ClientId,
} from './types';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import packageJson from '../package.json';

export function isSmartTransactionPending(smartTransaction: SmartTransaction) {
return smartTransaction.status === SmartTransactionStatuses.PENDING;
Expand Down
File renamed without changes.
22 changes: 22 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"inlineSources": true,
"noEmit": false,
"outDir": "dist",
"rootDir": "src",
"sourceMap": true
},
"include": ["./src/**/*.ts"],
"exclude": [
"./src/**/__fixtures__/**/*",
"./src/**/__mocks__/**/*",
"./src/**/__test__/**/*",
"./src/**/__tests__/**/*",
"./src/**/__snapshots__/**/*",
"./src/**/*.test.ts",
"./src/**/*.test-d.ts",
"./src/**/*.test.*.ts"
]
}
17 changes: 6 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"inlineSources": true,
"lib": ["DOM", "ES2020"],
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"strict": true,
"target": "ES2017",
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"resolveJsonModule": true
"strict": true,
"target": "es2017"
},
"exclude": ["./src/**/*.test.ts"],
"include": ["./src/**/*.ts"]
"exclude": ["./dist", "**/node_modules"]
}
5 changes: 0 additions & 5 deletions tsconfig.test.json

This file was deleted.

Loading

0 comments on commit 5e3c7fb

Please sign in to comment.