Skip to content

Commit 18b93af

Browse files
feat(keyring-internal-api): add TRON account support (#312)
1 parent 36391d9 commit 18b93af

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

  • packages/keyring-internal-api/src

packages/keyring-internal-api/src/types.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {
1515
EthEoaAccountStruct,
1616
EthErc4337AccountStruct,
1717
SolDataAccountStruct,
18+
TrxAccountType,
19+
TrxEoaAccountStruct,
1820
} from '@metamask/keyring-api';
1921
import { exactOptional, object } from '@metamask/keyring-utils';
2022
import type { Infer, Struct } from '@metamask/superstruct';
@@ -23,7 +25,8 @@ import { boolean, string, number } from '@metamask/superstruct';
2325
export type InternalAccountType =
2426
| EthAccountType
2527
| BtcAccountType
26-
| SolAccountType;
28+
| SolAccountType
29+
| TrxAccountType;
2730

2831
export const InternalAccountMetadataStruct = object({
2932
metadata: object({
@@ -79,6 +82,11 @@ export const InternalSolDataAccountStruct = object({
7982
...InternalAccountMetadataStruct.schema,
8083
});
8184

85+
export const InternalTrxEoaAccountStruct = object({
86+
...TrxEoaAccountStruct.schema,
87+
...InternalAccountMetadataStruct.schema,
88+
});
89+
8290
export type InternalEthEoaAccount = Infer<typeof InternalEthEoaAccountStruct>;
8391

8492
export type InternalEthErc4337Account = Infer<
@@ -99,6 +107,8 @@ export type InternalBtcP2trAccount = Infer<typeof InternalBtcP2trAccountStruct>;
99107

100108
export type InternalSolDataAccount = Infer<typeof InternalSolDataAccountStruct>;
101109

110+
export type InternalTrxEoaAccount = Infer<typeof InternalTrxEoaAccountStruct>;
111+
102112
export const InternalAccountStructs: Record<
103113
string,
104114
| Struct<InternalEthEoaAccount>
@@ -108,6 +118,7 @@ export const InternalAccountStructs: Record<
108118
| Struct<InternalBtcP2wpkhAccount>
109119
| Struct<InternalBtcP2trAccount>
110120
| Struct<InternalSolDataAccount>
121+
| Struct<InternalTrxEoaAccount>
111122
> = {
112123
[`${EthAccountType.Eoa}`]: InternalEthEoaAccountStruct,
113124
[`${EthAccountType.Erc4337}`]: InternalEthErc4337AccountStruct,
@@ -116,6 +127,7 @@ export const InternalAccountStructs: Record<
116127
[`${BtcAccountType.P2wpkh}`]: InternalBtcP2wpkhAccountStruct,
117128
[`${BtcAccountType.P2tr}`]: InternalBtcP2trAccountStruct,
118129
[`${SolAccountType.DataAccount}`]: InternalSolDataAccountStruct,
130+
[`${TrxAccountType.Eoa}`]: InternalTrxEoaAccountStruct,
119131
};
120132

121133
export type InternalAccountTypes =
@@ -125,7 +137,8 @@ export type InternalAccountTypes =
125137
| InternalBtcP2shAccount
126138
| InternalBtcP2wpkhAccount
127139
| InternalBtcP2trAccount
128-
| InternalSolDataAccount;
140+
| InternalSolDataAccount
141+
| InternalTrxEoaAccount;
129142

130143
export const InternalAccountStruct = object({
131144
...KeyringAccountStruct.schema,

0 commit comments

Comments
 (0)