oasis-wallet-web icon indicating copy to clipboard operation
oasis-wallet-web copied to clipboard

Add basic dApp communication to new ext wallet

Open lukaw3d opened this issue 2 years ago • 0 comments

Implement dapp getting accounts from new extension:

  • dApp calls await oasisExt.keys.list(await oasisExt.connection.connect())
  • background page should receive oasisExt.ext.ready({ async keysList(origin, req) { should open popup and ask to share wallet address (UI not important, can just show a wallet subpage with confirm button and first account address)
  • if user confirms, return oasis1 address to dApp

Later:

  • will need to store approved pages and auto-respond
  • will need to allow revoking approved pages

https://github.com/oasisprotocol/oasis-sdk/tree/main/client-sdk/ts-web/ext-utils implements oasisExt, sample dapp, and sample ext.

https://github.com/lukaw3d/oasis-test-dapp implements and publishes another sample dapp (fill Extension ID, click Connect, click Oasis_accounts)

New code should be more maintainable than existing:

  • https://github.com/oasisprotocol/oasis-wallet-ext/blob/801b67e/src/background/service/ExtUtils.js#L40
  • https://github.com/oasisprotocol/oasis-wallet-ext/blob/801b67e/src/background/service/ExtDappService.js#L42
  • https://github.com/oasisprotocol/oasis-wallet-ext/blob/801b67e/src/popup/pages/ApprovePage/index.js#L121

lukaw3d avatar Apr 01 '22 00:04 lukaw3d