MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
711 stars 546 forks source link

feat: add accounts chain API #2440

Closed FrederikBolding closed 3 weeks ago

FrederikBolding commented 1 month ago

Adds a new endowment: endowment:accounts-chain, which can be used to expose onAccountsChainRequest, and is in many ways identical to endowment:keyring.

  "initialPermissions": {
    "endowment:accounts-chain": {
      "chains": [
        "bip122:000000000019d6689c085ae165831e93"
      ],
      "allowedOrigins": [
        "http://localhost:8080"
      ]
    }
  },

Also adds a new RPC method wallet_invokeAccountsSnap which allows routing requests to either onKeyringRequest or onAccountsChainRequest using a type parameter. Otherwise the RPC method is identical to wallet_invokeKeyring.

wallet_invokeKeyring is now effectively an alias of wallet_invokeAccountsSnap, in a similar fashion to wallet_invokeSnap.

WIP

Progresses https://github.com/MetaMask/snaps/issues/2355

FrederikBolding commented 1 month ago

@metamaskbot update-pr