@metamask-previews/keyring-controller 19.0.7-preview-12ba192 → 19.0.7-preview-df91d059

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,7 +59,6 @@ var KeyringTypes;
59
59
  KeyringTypes["hd"] = "HD Key Tree";
60
60
  KeyringTypes["qr"] = "QR Hardware Wallet Device";
61
61
  KeyringTypes["trezor"] = "Trezor Hardware";
62
- KeyringTypes["oneKey"] = "OneKey Hardware";
63
62
  KeyringTypes["ledger"] = "Ledger Hardware";
64
63
  KeyringTypes["lattice"] = "Lattice Hardware";
65
64
  KeyringTypes["snap"] = "Snap Keyring";
@@ -666,6 +665,27 @@ class KeyringController extends base_controller_1.BaseController {
666
665
  }
667
666
  return await keyring.signMessage(address, messageParams.data);
668
667
  }
668
+ /**
669
+ * Signs EIP-7702 Authorization message by calling down into a specific keyring.
670
+ *
671
+ * @param messageParams - EIP7702AuthorizationMessageParams object to sign.
672
+ * @returns Promise resolving to an EIP-7702 Authorization signature.
673
+ * @throws Will throw UnsupportedSignEIP7702Authorization if the keyring does not support signing EIP-7702 Authorization messages.
674
+ */
675
+ async signEip7702Authorization(messageParams) {
676
+ const from = (0, eth_sig_util_1.normalize)(messageParams.from);
677
+ const keyring = (await this.getKeyringForAccount(from));
678
+ if (!keyring.signEip7702Authorization) {
679
+ throw new Error(constants_1.KeyringControllerError.UnsupportedSignEip7702Authorization);
680
+ }
681
+ const { chainId, nonce } = messageParams;
682
+ const contractAddress = (0, eth_sig_util_1.normalize)(messageParams.contractAddress);
683
+ return await keyring.signEip7702Authorization(from, [
684
+ chainId,
685
+ contractAddress,
686
+ nonce,
687
+ ]);
688
+ }
669
689
  /**
670
690
  * Signs personal message by calling down into a specific keyring.
671
691
  *
@@ -1075,6 +1095,7 @@ class KeyringController extends base_controller_1.BaseController {
1075
1095
  exports.KeyringController = KeyringController;
1076
1096
  _KeyringController_controllerOperationMutex = new WeakMap(), _KeyringController_vaultOperationMutex = new WeakMap(), _KeyringController_keyringBuilders = new WeakMap(), _KeyringController_unsupportedKeyrings = new WeakMap(), _KeyringController_encryptor = new WeakMap(), _KeyringController_cacheEncryptionKey = new WeakMap(), _KeyringController_keyrings = new WeakMap(), _KeyringController_password = new WeakMap(), _KeyringController_qrKeyringStateListener = new WeakMap(), _KeyringController_instances = new WeakSet(), _KeyringController_registerMessageHandlers = function _KeyringController_registerMessageHandlers() {
1077
1097
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1098
+ this.messagingSystem.registerActionHandler(`${name}:signEip7702AuthorizationMessage`, this.signEip7702Authorization.bind(this));
1078
1099
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
1079
1100
  this.messagingSystem.registerActionHandler(`${name}:signTypedMessage`, this.signTypedMessage.bind(this));
1080
1101
  this.messagingSystem.registerActionHandler(`${name}:decryptMessage`, this.decryptMessage.bind(this));