Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GenericExtensionWallet

This wallet (proxy) allows interacting with the CIPXX compatible extension wallets.

example
 const wallet = new GenericExtensionWallet()
 wallet
 .connect({appName: 'MySuperDApp', networkName: NetworkName.SignumMainnet})
 .then( connection => {
     console.log('Successfully connected', connection)
     const ledger = LedgerClientFactory.createClient({ nodeHost: connection.currentNodeHost });
     console.log('Sending some money...')
     return ledger.transaction.sendAmountToSingleRecipient({
         senderPublicKey: connection.publicKey,
         recipientId: Address.fromReedSolomonAddress('TS-K37B-9V85-FB95-793HN').getNumericId(),
         feePlanck: String(FeeQuantPlanck),
         amountPlanck: Amount.fromSigna(1).getPlanck()
     })
 })
 .then( unsignedTransaction => {
     return wallet.confirm(unsignedTransaction.unsignedTransactionBytes)
 })
 .then( confirmedTransaction => {
     console.log('Successfully sent money:', confirmedTransaction)
 }).catch(console.error)
note

At this time, this wallet does only work in the browser

Hierarchy

  • GenericExtensionWallet

Implements

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

connection

Methods

confirm

  • Requests a confirmation, i.e. cryptographic signing, of a transaction.

    The unsignedTransaction byte sequence is being returned by any of the SignumJS operations as long as no private key is passed as parameter to the operation

    example
    const { unsignedTransactionBytes } = await ledger.transaction.sendAmountToSingleRecipient({
             senderPublicKey: connection.publicKey, // only public key is passed!
             recipientId: Address.fromReedSolomonAddress('TS-K37B-9V85-FB95-793HN').getNumericId(),
             feePlanck: String(FeeQuantPlanck),
             amountPlanck: Amount.fromSigna(1).getPlanck()
         })
    const { transactionId, fullHash } = await wallet.confirm(unsignedTransactionBytes)
    throws

    Error if signing failed for some reason, i.e. rejected operation or invalid transaction data

    Parameters

    • unsignedTransaction: string

      The hexadecimal byte string of an unsigned transaction.

    Returns Promise<ConfirmedTransaction>

    The confirmed transaction, in case of success

connect

  • Tries to connect to the extension wallet. Each recurring call tries overwrites current connection

    throws

    Errors on unavailability, wrong networks or permission issues

    Parameters

    • args: GenericExtensionWalletConnectArgs

      The argument object

    Returns Promise<WalletConnection>

    The connection if successful, or null, if not available

sendEncryptedMessage