Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
/packages/transaction-pay-controller @MetaMask/confirmations
/packages/user-operation-controller @MetaMask/confirmations

## Transactions Team
/packages/smart-transactions-controller @MetaMask/transactions

## Delegation Team
/packages/delegation-controller @MetaMask/delegation
/packages/gator-permissions-controller @MetaMask/delegation
Expand Down Expand Up @@ -213,6 +216,8 @@
/packages/selected-network-controller/CHANGELOG.md @MetaMask/wallet-integrations @MetaMask/core-platform
/packages/signature-controller/package.json @MetaMask/confirmations @MetaMask/core-platform
/packages/signature-controller/CHANGELOG.md @MetaMask/confirmations @MetaMask/core-platform
/packages/smart-transactions-controller/package.json @MetaMask/transactions @MetaMask/core-platform
/packages/smart-transactions-controller/CHANGELOG.md @MetaMask/transactions @MetaMask/core-platform
/packages/transaction-controller/package.json @MetaMask/confirmations @MetaMask/core-platform
/packages/transaction-controller/CHANGELOG.md @MetaMask/confirmations @MetaMask/core-platform
/packages/transaction-pay-controller/package.json @MetaMask/confirmations @MetaMask/core-platform
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ yarn skills --reset # clear saved local selection
- [`@metamask/selected-network-controller`](packages/selected-network-controller)
- [`@metamask/shield-controller`](packages/shield-controller)
- [`@metamask/signature-controller`](packages/signature-controller)
- [`@metamask/smart-transactions-controller`](packages/smart-transactions-controller)
- [`@metamask/snap-account-service`](packages/snap-account-service)
- [`@metamask/social-controllers`](packages/social-controllers)
- [`@metamask/storage-service`](packages/storage-service)
Expand Down Expand Up @@ -210,6 +211,7 @@ linkStyle default opacity:0.5
selected_network_controller(["@metamask/selected-network-controller"]);
shield_controller(["@metamask/shield-controller"]);
signature_controller(["@metamask/signature-controller"]);
smart_transactions_controller(["@metamask/smart-transactions-controller"]);
snap_account_service(["@metamask/snap-account-service"]);
social_controllers(["@metamask/social-controllers"]);
storage_service(["@metamask/storage-service"]);
Expand Down Expand Up @@ -537,6 +539,16 @@ linkStyle default opacity:0.5
signature_controller --> logging_controller;
signature_controller --> messenger;
signature_controller --> network_controller;
smart_transactions_controller --> base_controller;
smart_transactions_controller --> controller_utils;
smart_transactions_controller --> eth_json_rpc_provider;
smart_transactions_controller --> messenger;
smart_transactions_controller --> network_controller;
smart_transactions_controller --> polling_controller;
smart_transactions_controller --> profile_sync_controller;
smart_transactions_controller --> remote_feature_flag_controller;
smart_transactions_controller --> transaction_controller;
smart_transactions_controller --> json_rpc_engine;
snap_account_service --> account_tree_controller;
snap_account_service --> keyring_controller;
snap_account_service --> messenger;
Expand Down
76 changes: 76 additions & 0 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,82 @@
"count": 2
}
},
"packages/smart-transactions-controller/src/SmartTransactionsController.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 12
},
"@typescript-eslint/no-explicit-any": {
"count": 3
},
"no-restricted-syntax": {
"count": 12
}
},
"packages/smart-transactions-controller/src/SmartTransactionsController.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 10
},
"@typescript-eslint/no-base-to-string": {
"count": 1
},
"@typescript-eslint/no-floating-promises": {
"count": 4
},
"@typescript-eslint/restrict-template-expressions": {
"count": 1
},
"no-restricted-syntax": {
"count": 4
}
},
"packages/smart-transactions-controller/src/featureFlags/feature-flags.ts": {
"@typescript-eslint/naming-convention": {
"count": 1
}
},
"packages/smart-transactions-controller/src/selectors.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 2
}
},
"packages/smart-transactions-controller/src/types.ts": {
"@typescript-eslint/naming-convention": {
"count": 25
},
"@typescript-eslint/no-explicit-any": {
"count": 7
},
"@typescript-eslint/prefer-enum-initializers": {
"count": 6
}
},
"packages/smart-transactions-controller/src/utils.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 7
}
},
"packages/smart-transactions-controller/src/utils.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 10
},
"@typescript-eslint/naming-convention": {
"count": 1
},
"@typescript-eslint/no-explicit-any": {
"count": 4
},
"@typescript-eslint/prefer-nullish-coalescing": {
"count": 1
},
"jsdoc/require-param-description": {
"count": 1
}
},
"packages/smart-transactions-controller/tests/helpers.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 2
}
},
"packages/snap-account-service/src/SnapAccountService.test.ts": {
"no-restricted-syntax": {
"count": 2
Expand Down
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const config = createConfig([
'**/coverage/**',
'**/dist/**',
'**/docs/**',
'.skills-cache/**',
'.yarn/**',
'merged-packages/**',
'scripts/create-package/package-template/**',
Expand Down
2 changes: 0 additions & 2 deletions merged-packages/smart-transactions-controller/setupJest.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- This package was migrated to the core monorepo from [`MetaMask/smart-transactions-controller`](https://github.com/MetaMask/smart-transactions-controller). For the changelog up to and including v24.2.1 (the last release from the original repo), see the [historical changelog](https://github.com/MetaMask/smart-transactions-controller/blob/v24.2.1/CHANGELOG.md).
### Changed

- This package was migrated to the core monorepo from [`MetaMask/smart-transactions-controller`](https://github.com/MetaMask/smart-transactions-controller). For the changelog up to and including v24.2.1 (the last release from the original repo), see the [historical changelog](https://github.com/MetaMask/smart-transactions-controller/blob/v24.2.1/CHANGELOG.md) ([#9139](https://github.com/MetaMask/core/pull/9139)).

[Unreleased]: https://github.com/MetaMask/core/
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ module.exports = merge(baseConfig, {
statements: 91.89,
},
},

setupFiles: ['./setupJest.js'],

testTimeout: 2500,
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@metamask/smart-transactions-controller",
"version": "24.2.1",
"description": "Improves success rates for swaps by trialing transactions privately and finding minimum fees.",
"description": "Improves success rates for swaps by trialing transactions privately and finding minimum fees",
"keywords": [
"Ethereum",
"MetaMask"
Expand All @@ -15,7 +15,12 @@
"type": "git",
"url": "https://github.com/MetaMask/core.git"
},
"files": [
"dist/"
],
"sideEffects": false,
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"exports": {
".": {
"import": {
Expand All @@ -29,11 +34,10 @@
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.cts",
"files": [
"dist/"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"scripts": {
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
"build:all": "ts-bridge --project tsconfig.build.json --verbose --clean",
Expand All @@ -50,8 +54,6 @@
},
"dependencies": {
"@babel/runtime": "^7.23.9",
"@ethereumjs/tx": "^5.4.0",
"@ethereumjs/util": "^9.1.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/keccak256": "^5.8.0",
"@ethersproject/transactions": "^5.7.0",
Expand All @@ -68,28 +70,22 @@
"@metamask/transaction-controller": "^68.0.0",
"@metamask/utils": "^11.11.0",
"bignumber.js": "^9.1.2",
"fast-json-patch": "^3.1.1",
"lodash": "^4.17.21",
"reselect": "^5.1.1"
},
"devDependencies": {
"@metamask/auto-changelog": "^6.1.0",
"@metamask/gas-fee-controller": "^26.2.2",
"@metamask/json-rpc-engine": "^10.5.0",
"@ts-bridge/cli": "^0.6.4",
"deepmerge": "^4.2.2",
"jest": "^29.7.0",
"nock": "^14.0.0-beta.7",
"nock": "^13.3.1",
"ts-jest": "^29.2.5",
"tsx": "^4.20.5",
"typedoc": "^0.25.13",
"typedoc-plugin-missing-exports": "^2.0.0",
"typescript": "~5.3.3"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"engines": {
"node": "^18.18 || >=20"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type { Hex } from '@metamask/utils';
import nock from 'nock';

import packageJson from '../package.json';
import { advanceTime, flushPromises, getFakeProvider } from '../tests/helpers';
import {
API_BASE_URL,
SENTINEL_API_BASE_URL_MAP,
Expand All @@ -40,7 +41,6 @@ import type { SmartTransactionsControllerMessenger } from './SmartTransactionsCo
import type { SmartTransaction, UnsignedTransaction } from './types';
import { SmartTransactionStatuses, ClientId } from './types';
import * as utils from './utils';
import { advanceTime, flushPromises, getFakeProvider } from '../tests/helpers';

type AllActions = MessengerActions<SmartTransactionsControllerMessenger>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export enum MetaMetricsEventName {

export enum MetaMetricsEventCategory {
Transactions = 'Transactions',
// eslint-disable-next-line @typescript-eslint/no-shadow
Navigation = 'Navigation',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const calculateStatus = (stxStatus: SmartTransactionsStatus) => {

/**
* Returns processing time for an STX in seconds.
*
* @param smartTransactionSubmittedtime
* @returns Processing time in seconds.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const flushPromises = async () => {
* promises or other asynchronous operations that may get enqueued during the timer's duration.
* By advancing time in incremental steps and flushing promises between each step,
* this function ensures that both timers and promises are comprehensively processed.
*
* @param options - The options object.
* @param options.duration - The total amount of time (in milliseconds) to advance the timer by.
* @param options.stepSize - The incremental step size (in milliseconds) by which the timer is advanced in each iteration. Default is 1/4 of the duration.
Expand Down
3 changes: 2 additions & 1 deletion teams.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@
"metamask/config-registry-controller": "team-networks",
"metamask/money-account-controller": "team-accounts-framework",
"metamask/money-account-upgrade-controller": "team-earn",
"metamask/snap-account-service": "team-accounts-framework"
"metamask/snap-account-service": "team-accounts-framework",
"metamask/smart-transactions-controller": "team-transactions"
}
3 changes: 3 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@
{
"path": "./packages/signature-controller/tsconfig.build.json"
},
{
"path": "./packages/smart-transactions-controller/tsconfig.build.json"
},
{
"path": "./packages/snap-account-service/tsconfig.build.json"
},
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@
{
"path": "./packages/signature-controller"
},
{
"path": "./packages/smart-transactions-controller"
},
{
"path": "./packages/snap-account-service"
},
Expand Down
1 change: 1 addition & 0 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ async function expectWorkspaceLicense(workspace) {
'@metamask/permission-log-controller',
'@metamask/eth-json-rpc-middleware',
'@metamask/eth-json-rpc-provider',
'@metamask/smart-transactions-controller',
].includes(workspace.manifest.name)
) {
expectWorkspaceField(workspace, 'license');
Expand Down
37 changes: 37 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8338,6 +8338,43 @@ __metadata:
languageName: node
linkType: hard

"@metamask/smart-transactions-controller@workspace:packages/smart-transactions-controller":
version: 0.0.0-use.local
resolution: "@metamask/smart-transactions-controller@workspace:packages/smart-transactions-controller"
dependencies:
"@babel/runtime": "npm:^7.23.9"
"@ethersproject/bytes": "npm:^5.7.0"
"@ethersproject/keccak256": "npm:^5.8.0"
"@ethersproject/transactions": "npm:^5.7.0"
"@metamask/auto-changelog": "npm:^6.1.0"
"@metamask/base-controller": "npm:^9.1.0"
"@metamask/controller-utils": "npm:^12.2.0"
"@metamask/eth-json-rpc-provider": "npm:^6.0.1"
"@metamask/eth-query": "npm:^4.0.0"
"@metamask/json-rpc-engine": "npm:^10.5.0"
"@metamask/messenger": "npm:^1.2.0"
"@metamask/network-controller": "npm:^32.0.0"
"@metamask/polling-controller": "npm:^16.0.6"
"@metamask/profile-sync-controller": "npm:^28.2.0"
"@metamask/remote-feature-flag-controller": "npm:^4.2.2"
"@metamask/superstruct": "npm:^3.1.0"
"@metamask/transaction-controller": "npm:^68.0.0"
"@metamask/utils": "npm:^11.11.0"
"@ts-bridge/cli": "npm:^0.6.4"
bignumber.js: "npm:^9.1.2"
deepmerge: "npm:^4.2.2"
jest: "npm:^29.7.0"
lodash: "npm:^4.17.21"
nock: "npm:^13.3.1"
reselect: "npm:^5.1.1"
ts-jest: "npm:^29.2.5"
tsx: "npm:^4.20.5"
typedoc: "npm:^0.25.13"
typedoc-plugin-missing-exports: "npm:^2.0.0"
typescript: "npm:~5.3.3"
languageName: unknown
linkType: soft

"@metamask/snap-account-service@npm:^0.3.1, @metamask/snap-account-service@workspace:packages/snap-account-service":
version: 0.0.0-use.local
resolution: "@metamask/snap-account-service@workspace:packages/snap-account-service"
Expand Down
Loading