RabbyHub / Rabby

The game-changing wallet for Ethereum and all EVM chains
https://rabby.io
Other
1.37k stars 389 forks source link

Signing and confirming transactions through another extension #2360

Closed brauliobo closed 3 months ago

brauliobo commented 3 months ago

Hi, I'm writing an extension that will trigger Rebalance transactions with vfat.io. I need this extension to work autonomously, so the signature and confirmation of the transactions in the Rabby wallets needs to happen without user interactions.

Can you please advise if iRabby is receiving events that can control its behaviour? I know this is potentially a security issue.

If not, I'll proceed on writing an event handler to automatically sign and confirm transactions

vvvvvv1vvvvvv commented 3 months ago

Rabby Wallet cannot confirm transactions without user interactions

brauliobo commented 3 months ago

this is how it can be achieved by adding the following lines to the SubmitActions component:

  let btnClick = (text) => {
    // @ts-ignore
    let btn = [...document.querySelectorAll('button')].find(b => b.innerText.indexOf(text) != null)?.click()
  }

  chrome.runtime.onMessageExternal.addListener(async (message, sender, sendResponse) => {
    while (!disabledProcess) await new Promise(res => setTimeout(res, 3*1000))
    await new Promise(res => setTimeout(res, 5*1000))
    sendResponse({ done: true })
    if (message.type == 'rabby_sign')    btnClick('Sign')
    if (message.type == 'rabby_confirm') btnClick('Confirm')
    if (message.type == 'rabby_cancel')  btnClick('Cancel')
  })

A possible design would be to ask for the user to authorize extensions or other senders that would remotely confirm transactions.