Skip to main content

wallet_sessionChanged

This notification is published by the wallet to notify the callers of updates to a shared session's authorization scopes. The event payload contains the new sessionScopes.
note

MetaMask doesn't support session IDs.

Parameters

sessionScopes object
required

Scope for a multi-chain connection

scopes array

string

Pattern: [-a-z0-9]{3,8}(:[-_a-zA-Z0-9]{1,32})?

methods array

Methods that the wallet must support in order to be used with this provider.

string

notifications array

Notifications that the wallet must support in order to be used with this provider.

string

rpcEndpoints array

JSON-RPC endpoints for this namespace.

string

rpcDocuments array

OpenRPC documents that define RPC methods in which to anchor the methods authorized in a CAIP-25 interaction.

string

Returns

Customize request
Parameter
Value
[]
array
[]
array
[]
array
[]
array
[]
array
{ "eip155:1337": { "accounts": [ "eip155:1337:0x5cfe73b6021e818b776b421b1c4db2474086a7e1" ], "methods": [ "wallet_watchAsset", "eth_sendTransaction", "eth_decrypt", "eth_getEncryptionPublicKey", "web3_clientVersion", "eth_subscribe", "eth_unsubscribe", "eth_blockNumber", "eth_call", "eth_chainId", "eth_estimateGas", "eth_feeHistory", "eth_gasPrice", "eth_getBalance", "eth_getBlockByHash", "eth_getBlockByNumber", "eth_getBlockTransactionCountByHash", "eth_getBlockTransactionCountByNumber", "eth_getCode", "eth_getFilterChanges", "eth_getFilterLogs", "eth_getLogs", "eth_getProof", "eth_getStorageAt", "eth_getTransactionByBlockHashAndIndex", "eth_getTransactionByBlockNumberAndIndex", "eth_getTransactionByHash", "eth_getTransactionCount", "eth_getTransactionReceipt", "eth_getUncleCountByBlockHash", "eth_getUncleCountByBlockNumber", "eth_newBlockFilter", "eth_newFilter", "eth_newPendingTransactionFilter", "eth_sendRawTransaction", "eth_syncing", "eth_uninstallFilter" ], "notifications": [ "eth_subscription" ] } }
object
{ "wallet": { "accounts": [], "methods": [ "wallet_registerOnboarding", "wallet_scanQRCode" ], "notifications": [] }, "wallet:eip155": { "accounts": [ "wallet:eip155:0x5cfe73b6021e818b776b421b1c4db2474086a7e1" ], "methods": [ "wallet_addEthereumChain", "personal_sign", "eth_signTypedData_v4" ], "notifications": [] } }
object
{ "wallet:eip155": { "accounts": [ "wallet:eip155:0x5cfe73b6021e818b776b421b1c4db2474086a7e1" ], "methods": [ "wallet_addEthereumChain", "personal_sign", "eth_signTypedData_v4" ], "notifications": [] } }
object
Connect your MetaMask wallet to run requests successfully.
Request
await window.ethereum.request({
"method": "wallet_sessionChanged",
"params": {
sessionScopes: {
eip155:1337: {
accounts: [
"eip155:1337:0x5cfe73b6021e818b776b421b1c4db2474086a7e1"
],
methods: [
"wallet_watchAsset",
"eth_sendTransaction",
"eth_decrypt",
"eth_getEncryptionPublicKey",
"web3_clientVersion",
"eth_subscribe",
"eth_unsubscribe",
"eth_blockNumber",
"eth_call",
"eth_chainId",
"eth_estimateGas",
"eth_feeHistory",
"eth_gasPrice",
"eth_getBalance",
"eth_getBlockByHash",
"eth_getBlockByNumber",
"eth_getBlockTransactionCountByHash",
"eth_getBlockTransactionCountByNumber",
"eth_getCode",
"eth_getFilterChanges",
"eth_getFilterLogs",
"eth_getLogs",
"eth_getProof",
"eth_getStorageAt",
"eth_getTransactionByBlockHashAndIndex",
"eth_getTransactionByBlockNumberAndIndex",
"eth_getTransactionByHash",
"eth_getTransactionCount",
"eth_getTransactionReceipt",
"eth_getUncleCountByBlockHash",
"eth_getUncleCountByBlockNumber",
"eth_newBlockFilter",
"eth_newFilter",
"eth_newPendingTransactionFilter",
"eth_sendRawTransaction",
"eth_syncing",
"eth_uninstallFilter"
],
notifications: [
"eth_subscription"
]
},
wallet: {
accounts: [],
methods: [
"wallet_registerOnboarding",
"wallet_scanQRCode"
],
notifications: []
},
wallet:eip155: {
accounts: [
"wallet:eip155:0x5cfe73b6021e818b776b421b1c4db2474086a7e1"
],
methods: [
"wallet_addEthereumChain",
"personal_sign",
"eth_signTypedData_v4"
],
notifications: []
}
}
},
});