Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface WalletInterface

All the library in sen-js have been leveraged by wallet instance for getting wallet address, signing transaction for example.\

example

The last parameter in the following example is wallet that respects WalletInstance. By the wallet, the transfer method can sign or read necessary wallet info for the transaction.

splt.transfer(amount, srcAddress, dstAddress, wallet)

Following the interface, you can create a wallet instance that work with the libraries seamlessly.

remarks

We have already written multiple wallet that you can refer as examples

Hierarchy

  • WalletInterface

Implemented by

Index

Properties

walletType

walletType: string

Any string that you can recognize your wallet type. For example: PrivateKey, Phantom, Sollet, ...

Methods

disconnect

  • disconnect(): Promise<void>
  • Call the disconnect method from provider returned by getProvider

    Returns Promise<void>

getAddress

  • getAddress(): Promise<string>
  • Return wallet address

    Returns Promise<string>

    Wallet address (base58)

getProvider

  • Wallet providers are varied from the original wallet (Coin98, Slope, ...). Seems there is no single common standard, thus we only require disconnect method for the returned provider.

    Returns Promise<Provider>

    You can return anything from getProvider that respects to Provider

signAllTransactions

  • signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>
  • Sign the input transactions and return signed transactions

    Parameters

    • transactions: Transaction[]

    Returns Promise<Transaction[]>

    The signed transactions

signMessage

signTransaction

  • signTransaction(transaction: Transaction): Promise<Transaction>
  • Sign the input transaction and return signed transaction

    Parameters

    • transaction: Transaction

      The transaction that needs to be signed

    Returns Promise<Transaction>

    The signed transaction

verifySignature

  • verifySignature(signature: string, message: string, address?: string): Promise<boolean>
  • Verify a singed message

    Parameters

    • signature: string

      Signature (signedMessage.signature)

    • message: string

      The original message (or signedMessage.message)

    • Optional address: string

      Optional. The address that signed the message. If not provided, the address will be fetched by this.getAddress().

    Returns Promise<boolean>

Generated using TypeDoc