diff --git a/request.html b/request.html index 0b45a5e..8e4efaf 100644 --- a/request.html +++ b/request.html @@ -29,6 +29,7 @@

window.ethereum.request

  • walet_getPermissions
  • wallet_watchAsset
  • eth_subscribe (newHeads)
  • +
  • eth_unsubscribe subscription ID:
  • window.ethereum.sendAsync

    @@ -53,6 +54,7 @@

    window.ethereum.sendAsync

  • walet_getPermissions
  • wallet_watchAsset
  • eth_subscribe (newHeads)
  • +
  • eth_unsubscribe subscription ID:
  • window.ethereum.send

    @@ -77,6 +79,7 @@

    window.ethereum.send

  • walet_getPermissions
  • wallet_watchAsset
  • eth_subscribe (newHeads)
  • +
  • eth_unsubscribe subscription ID:
  • Other functions

    diff --git a/request.js b/request.js index 1398ce6..c838d46 100644 --- a/request.js +++ b/request.js @@ -148,6 +148,21 @@ async function sendRawTransaction(method, txInput) { } } +async function ethUnsubscribe(method, txInput) { + const subscriptionId = document.querySelector(txInput).value + const params = [subscriptionId] + + if (method == 'request') { + return request('eth_unsubscribe', params) + } + if (method == 'sendAsync') { + return sendAsync('eth_unsubscribe', params) + } + if (method == 'send') { + return send('eth_unsubscribe', params) + } +} + async function sign(method, messageInput) { const message = document.querySelector(messageInput).value const accounts = await window.ethereum.request({