Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 2 additions & 0 deletions packages/keyring-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `EthKeyringWrapper` abstract class for Ethereum-based `KeyringV2` implementations ([#404](https://github.com/MetaMask/accounts/pull/404))
- Provides common Ethereum signing method routing (`submitRequest`) for all Ethereum-based keyrings.
- Add `KeyringWrapper` base class to adapt legacy keyrings to `KeyringV2` ([#398](https://github.com/MetaMask/accounts/pull/398))

## [21.3.0]
Expand Down
2 changes: 2 additions & 0 deletions packages/keyring-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
"test:watch": "jest --watch"
},
"dependencies": {
"@ethereumjs/tx": "^5.4.0",
"@metamask/eth-sig-util": "^8.2.0",
"@metamask/keyring-utils": "workspace:^",
"@metamask/superstruct": "^3.1.0",
"@metamask/utils": "^11.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/keyring-api/src/eth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './erc4337';
export * from './rpc';
export * from './types';
export * from './utils';
export * from './v2';
15 changes: 15 additions & 0 deletions packages/keyring-api/src/eth/rpc/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ export type EthEip7702Authorization = Infer<
typeof EthEip7702AuthorizationStruct
>;

/**
* A struct for getEncryptionPublicKey options.
*/
export const EthGetEncryptionPublicKeyOptionsStruct = optional(
record(string(), unknown()),
);

// ============================================================================
// RPC Method Parameter Structs
// ============================================================================
Expand Down Expand Up @@ -214,3 +221,11 @@ export const EthSignEip7702AuthorizationParamsStruct = tuple([
export type EthSignEip7702AuthorizationParams = Infer<
typeof EthSignEip7702AuthorizationParamsStruct
>;

/**
* Parameters for `eth_getEncryptionPublicKey`.
*/
export const EthGetEncryptionPublicKeyParamsStruct = tuple([
EthAddressStruct, // address
EthGetEncryptionPublicKeyOptionsStruct, // options
]);
4 changes: 2 additions & 2 deletions packages/keyring-api/src/eth/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { object } from '@metamask/keyring-utils';
import type { Infer } from '@metamask/superstruct';
import { nonempty, array, enums, literal } from '@metamask/superstruct';
import { definePattern } from '@metamask/utils';
import { definePattern, type Hex } from '@metamask/utils';

import { EthScope } from '.';
import {
Expand All @@ -12,7 +12,7 @@ import {

export const EthBytesStruct = definePattern('EthBytes', /^0x[0-9a-f]*$/iu);

export const EthAddressStruct = definePattern(
export const EthAddressStruct = definePattern<Hex>(
'EthAddress',
/^0x[0-9a-f]{40}$/iu,
);
Expand Down
Loading
Loading