Class AbstractWalletControllerAbstract

Description

It's an abstract class designated to define an interface to send messages through blockchain and publish public keys

Example

Example of how to define your own ancestor:

import { AbstractWalletController } from '@ylide/sdk';

class EverscaleWalletController extends AbstractWalletController {
readonly registryContract: RegistryContract;

constructor(options: { dev?: boolean } = {}) {
super(options);

// ...
}

async attachPublicKey(publicKey: Uint8Array) {
const me = await this.getAuthenticatedAccount();
if (!me) {
throw new Error('Not authorized');
}
await this.blockchainController.registryContract.attachPublicKey(me.address, publicKey);
}

// Other implementations ...
}

Hierarchy

Constructors

Properties

onSwitchAccountRequest: null | SwitchAccountCallback = null
prefixed: string | boolean

Methods

  • Type Parameters

    Parameters

    • event: T
    • fn: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns AbstractWalletController

  • Method to register user's public key, so other users can discover it and send him messages.

    Parameters

    • account: WalletAccount<any>

      Account for which connection should occur

    • publicKey: Uint8Array

      public key to attach to user's address

    • keyVersion: YlideKeyVersion

      version of the key (e.g. YlideKeyVersion.KEY_V3)

    • registrar: number

      registrar code (e.g. 1 for Ylide Social Hub)

    • Optional options: any

      additional options for this wallet (e.g. "network" for EVM-wallets)

    Returns Promise<void>

  • Method to get blockchain group name

    Description

    Blockchain group is a name of the group of blockchains which are compatible with each other (e.g. "evm")

    Returns string

  • Calls each of the listeners registered for a given event.

    Type Parameters

    Parameters

    • event: T
    • Rest ...args: any[]

    Returns boolean

  • Return an array listing the events for which the emitter has registered listeners.

    Returns WalletEvent[]

  • Method to init controller. Must be called once before any other method. Automatically called when you instantiate using Ylide signleton.

    Returns Promise<void>

  • Method to get whether wallet natively supports multiple accounts connection or not If not - you can still emulate multiaccounts by connection/disconnecting accounts automatically

    Returns boolean

  • Return the number of listeners listening to a given event.

    Parameters

    Returns number

  • Return the listeners registered for a given event.

    Type Parameters

    Parameters

    • event: T

    Returns ((...args: any[]) => void)[]

  • Type Parameters

    Parameters

    • event: T
    • Optional fn: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns AbstractWalletController

  • Add a one-time listener for a given event.

    Type Parameters

    Parameters

    • event: T
    • fn: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns AbstractWalletController

  • Remove the listeners of a given event.

    Type Parameters

    Parameters

    • event: T
    • Optional fn: ((...args: any[]) => void)
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any
    • Optional once: boolean

    Returns AbstractWalletController

  • Method to publish encrypted direct message using Ylide Protocol.

    Parameters

    • from: WalletAccount<any>

      Account from which publish should occur

    • feedId: Uint256

      mailing feedId to publish to (usually YLIDE_MAIN_FEED_ID)

    • contentData: Uint8Array

      raw bytes content to publish

    • recipients: {
          address: Uint256;
          messageKey: MessageKey;
      }[]

      array of recipients (address-public key pairs)

    • Optional options: any

      additional options for this wallet (e.g. "network" for EVM-wallets)

    Returns Promise<SendMailResult>

  • Method used to create Ylide keypair: it gets signature from the wallet for a certain magicString

    Parameters

    • account: WalletAccount<any>

      Account for which you request signature

    • magicString: string

      string which you get from YlideKeysRegistry

    Returns Promise<Uint8Array>

Generated using TypeDoc