Waellet - aepp communication support

Since the most recent version v0.0.7 the waellet extension now supports communication with decentralized application.

Changelog

  • Fixing problem with updating balance in account, and problem with redirect to phishing warning when visiting scam page
  • Injecting Aepp object
  • Aepp comunication
  • Created Alert Component
  • Sign popup validate balance
  • Confirm or Reject close window
  • Closing Sign popup resolve promise and return info
  • Refactor Main Loader
  • ability to allow connection to wallet
  • validate if login when open confirm popup and after login redirect to view
  • ability to get balance of current active account
  • Add responsiveness in sign transaction popup and allow connection popup
  • validate input in aepp.request.connect method
  • ability to remove all conected websites to wallet
  • unifying postmessages responses

More info

As the extension is not yet reviewed on the Chrome store and Firefox store if someone wants to try this can do so by downloading the latest release from github and installing it locally as per the build and run instructions here

The flow of interacting with an Aepp

When a webpage is opened the extension is injecting an Aepp object in it.

In order for a webpage (assuming but not limited to decentralized application) wants to interact with the waellet extension it needs to perform 2 steps.

  1. First the page should ask the user for confirmation and authorization of the connection.

Example call for connection authorization:

Aepp.request.connect().then(res => console.log(res))

Result (promise):

{message: "Connection established"}
  1. The page can invoke a transaction signature request from the user like so:

Example call for transaction sign:

Aepp.request.sign({recipientId:"ak_2DDLbYBhHcuAzNg5Un853NRbUr8JVjZeMc6mTUpwmiVzA4ic6X", amount: 0.01}).then(res => console.log(res))

Result (promise) uppon confirmation:

{
    id: null,
    jsonrpc: "2.0",
    method: "aeppMessage",
    params: {
        blockHash: "mh_VwBkz71U5J1RyQ69Qh7cxppcgPBF3tMYfe5Ax8QjRPdoseGBM"
        blockHeight: 107995
        hash: "th_26afSySRJ9e4GmSoHmQmVznNcQ7hX2QegdLNY3jp97QkH2on3J"
        rawTx: "tx_+KILAfhCuEAu/iwX2+kqj88/2ipV3JjR9uBOuaF44+cZ+NlC5zUpuLZaOJbnCRVG9EOYu10ODwzU6IA+kLV7AgS4QB8++r8DuFr4WAwBoQHtjkoydDIUdxM7lxV2UeyYWqOiyrOB6VayhQVsCBqa6aEBn20z778KlP922eIO7Yi6pWnqSCZIbnO9EwZxELGuL8yHI4byb8EAAIYPR44IQAAASYARZhes"
    },
    signatures: [
        "sg_79atNkHrAARikgzn1RYDtEHm53dsVtG45hMzrKU7EPns3stoqSDraPLtzgtbyeC6YuVgnr7XdfvHwCCkhZa12yqyvUaHh"
    ],
    length: 1
    tx: {
        amount: "10000000000000000"
        fee: 16800000000000
        nonce: 73
        payload: "ba_Xfbg4g=="
        recipientId: "ak_2DDLbYBhHcuAzNg5Un853NRbUr8JVjZeMc6mTUpwmiVzA4ic6X"
        senderId: "ak_2od3ay11R99S4SALQX4qaj2kjpqKUkkBMUoakVijj95TzatGfL"
        type: "SpendTx"
        version: 1
    }
}

If the transaction is confirmed it can be later preview in waellet’s transaction history like so:

2 Likes

Fantastic, this will be nice for aepp devs. Maybe the Base aepp team should also quickly showcase how the base aepp interacts with aepps. Especially on desktop, within the base aepp its pretty clear.

1 Like