Easier Superhero Wallet Integration in JS

Is this “new”:

import {AEX2wallet as webwallet} from '@aeternity/foobar/whatever'

//optional new for web: 
const ACCOUNT = webwallet()

and this old?


const NODE_URL = 'https://testnet.aeternity.io'
const COMPILER_URL = 'COMPILER_URL' // required for using Contract

const ACCOUNT = MemoryAccount({ keypair: { secretKey: 'A_PRIV_KEY', publicKey: 'A_PUB_ADDRESS' } })

(async function () {
  const nodeInstance = await Node({ url: NODE_URL })
  const sdkInstance = await Ae({
     compilerUrl: COMPILER_URL,
     nodes: [ { name: 'test-net', instance: nodeInstance } ],
// note: allow this to remain an array if possible to prevent errors from people adjusting the existing example for noeJS
     accounts: [ ACCOUNT ]
  })

})()

if not, could you please state two separate examples for how you imagine it?

The “old” variation works if you have the private / public key already, which is not the case. For AEX2 you need a lot more code , see: https://github.com/aeternity/aepp-sdk-js/blob/develop/examples/browser/vuejs/connect-two-ae/aepp/src/components/Home.vue#L330. There are some optional things in there but generally this is what you need to do for AEX2.

In general I agree with the fact, that it should be less boilerplaty and easier to use.

4 Likes