Fix site metadata JSON-RPC handler (#10243)

* Fix getting the site metadata from the request origin params.

Regressed from inpage-provider ts migration the request. The property domainMetadata is now set as a params key for the request.

https://github.com/MetaMask/inpage-provider/blob/v7.0.0/src/siteMetadata.js#L19-L25
vs
https://github.com/MetaMask/inpage-provider/blob/main/src/siteMetadata.ts#L19-L27

* Change hardcoded mocked response of the request to the prod response.
feature/default_network_editable
Thomas Huang 4 years ago committed by GitHub
parent 288f60bff2
commit 1dad4abfdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/scripts/controllers/permissions/permissionsMethodMiddleware.js
  2. 2
      test/unit/app/controllers/permissions/mocks.js

@ -74,8 +74,8 @@ export default function createPermissionsMethodMiddleware({
// custom method for getting metadata from the requesting domain,
// sent automatically by the inpage provider when it's initialized
case 'metamask_sendDomainMetadata': {
if (typeof req.domainMetadata?.name === 'string') {
addDomainMetadata(req.origin, req.domainMetadata)
if (typeof req.params?.name === 'string') {
addDomainMetadata(req.origin, req.params)
}
res.result = true
return

@ -600,7 +600,7 @@ export const getters = deepFreeze({
return {
origin,
method: 'metamask_sendDomainMetadata',
domainMetadata: {
params: {
...args,
name,
},

Loading…
Cancel
Save