Skip to content

Commit 72a75a5

Browse files
chore: remove keyring-api dependency from transaction controller (#4955)
1 parent 71e8dfc commit 72a75a5

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

packages/transaction-controller/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
"@metamask/eth-json-rpc-provider": "^4.1.6",
7676
"@metamask/ethjs-provider-http": "^0.3.0",
7777
"@metamask/gas-fee-controller": "^22.0.1",
78-
"@metamask/keyring-api": "^10.1.0",
7978
"@metamask/network-controller": "^22.0.2",
8079
"@types/bn.js": "^5.1.5",
8180
"@types/jest": "^27.4.1",

packages/transaction-controller/src/TransactionController.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ import {
1717
import type { SafeEventEmitterProvider } from '@metamask/eth-json-rpc-provider';
1818
import EthQuery from '@metamask/eth-query';
1919
import HttpProvider from '@metamask/ethjs-provider-http';
20-
import type { InternalAccount } from '@metamask/keyring-api';
21-
import { EthAccountType } from '@metamask/keyring-api';
2220
import type {
2321
BlockTracker,
2422
NetworkClientConfiguration,
@@ -71,6 +69,7 @@ import type {
7169
GasFeeFlow,
7270
GasFeeFlowResponse,
7371
SubmitHistoryEntry,
72+
InternalAccount,
7473
} from './types';
7574
import {
7675
GasFeeEstimateType,
@@ -399,10 +398,11 @@ const MOCK_LINEA_GOERLI_NETWORK: MockNetwork = {
399398
};
400399

401400
const ACCOUNT_MOCK = '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207';
402-
const INTERNAL_ACCOUNT_MOCK = {
401+
402+
const INTERNAL_ACCOUNT_MOCK: InternalAccount = {
403403
id: '58def058-d35f-49a1-a7ab-e2580565f6f5',
404404
address: ACCOUNT_MOCK,
405-
type: EthAccountType.Eoa,
405+
type: 'eip155:eoa',
406406
options: {},
407407
methods: [],
408408
metadata: {

packages/transaction-controller/src/TransactionControllerIntegration.test.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import {
1313
InfuraNetworkType,
1414
NetworkType,
1515
} from '@metamask/controller-utils';
16-
import type { InternalAccount } from '@metamask/keyring-api';
17-
import { EthAccountType, EthMethod } from '@metamask/keyring-api';
1816
import {
1917
NetworkController,
2018
NetworkClientType,
@@ -61,7 +59,7 @@ import type {
6159
TransactionControllerOptions,
6260
} from './TransactionController';
6361
import { TransactionController } from './TransactionController';
64-
import type { TransactionMeta } from './types';
62+
import type { InternalAccount, TransactionMeta } from './types';
6563
import { TransactionStatus, TransactionType } from './types';
6664
import { getEtherscanApiHost } from './utils/etherscan';
6765
import * as etherscanUtils from './utils/etherscan';
@@ -104,22 +102,15 @@ const createMockInternalAccount = ({
104102
id,
105103
address,
106104
options: {},
107-
methods: [
108-
EthMethod.PersonalSign,
109-
EthMethod.Sign,
110-
EthMethod.SignTransaction,
111-
EthMethod.SignTypedDataV1,
112-
EthMethod.SignTypedDataV3,
113-
EthMethod.SignTypedDataV4,
114-
],
115-
type: EthAccountType.Eoa,
105+
methods: [],
106+
type: 'eip155:eoa',
116107
metadata: {
117108
name,
118109
keyring: { type: 'HD Key Tree' },
119110
importTime,
120111
lastSelected,
121112
},
122-
} as InternalAccount;
113+
};
123114
};
124115

125116
const ACCOUNT_MOCK = '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207';

packages/transaction-controller/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { AccessList } from '@ethereumjs/tx';
2+
import type { AccountsController } from '@metamask/accounts-controller';
23
import type EthQuery from '@metamask/eth-query';
34
import type { GasFeeState } from '@metamask/gas-fee-controller';
45
import type { NetworkClientId, Provider } from '@metamask/network-controller';
@@ -1344,3 +1345,7 @@ export type SubmitHistoryEntry = {
13441345
/** The transaction parameters that were submitted. */
13451346
transaction: TransactionParams;
13461347
};
1348+
1349+
export type InternalAccount = ReturnType<
1350+
AccountsController['getSelectedAccount']
1351+
>;

yarn.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3684,7 +3684,6 @@ __metadata:
36843684
"@metamask/eth-query": "npm:^4.0.0"
36853685
"@metamask/ethjs-provider-http": "npm:^0.3.0"
36863686
"@metamask/gas-fee-controller": "npm:^22.0.1"
3687-
"@metamask/keyring-api": "npm:^10.1.0"
36883687
"@metamask/metamask-eth-abis": "npm:^3.1.1"
36893688
"@metamask/network-controller": "npm:^22.0.2"
36903689
"@metamask/nonce-tracker": "npm:^6.0.0"

0 commit comments

Comments
 (0)