@metamask-previews/keyring-controller 19.0.7-preview-ee98fad1 → 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.
@@ -665,6 +665,27 @@ class KeyringController extends base_controller_1.BaseController {
665
665
  }
666
666
  return await keyring.signMessage(address, messageParams.data);
667
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
+ }
668
689
  /**
669
690
  * Signs personal message by calling down into a specific keyring.
670
691
  *
@@ -1074,6 +1095,7 @@ class KeyringController extends base_controller_1.BaseController {
1074
1095
  exports.KeyringController = KeyringController;
1075
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() {
1076
1097
  this.messagingSystem.registerActionHandler(`${name}:signMessage`, this.signMessage.bind(this));
1098
+ this.messagingSystem.registerActionHandler(`${name}:signEip7702AuthorizationMessage`, this.signEip7702Authorization.bind(this));
1077
1099
  this.messagingSystem.registerActionHandler(`${name}:signPersonalMessage`, this.signPersonalMessage.bind(this));
1078
1100
  this.messagingSystem.registerActionHandler(`${name}:signTypedMessage`, this.signTypedMessage.bind(this));
1079
1101
  this.messagingSystem.registerActionHandler(`${name}:decryptMessage`, this.decryptMessage.bind(this));