Class AbstractBlockchainControllerAbstract

Description

It's an abstract class designated to define an interface to read messaging data from blockchain: messages metadata, content and public keys of recipients

Example

Example of how to define your own ancestor:

import { Ylide, AbstractBlockchainController } from '@ylide/sdk';

class EverscaleBlockchainController extends AbstractBlockchainController {
readonly registryContract: RegistryContract;

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

// ...
}

async extractAddressFromPublicKey(
publicKey: PublicKey
): Promise<string | null> {
return this.registryContract.getAddressByPublicKey(publicKey.bytes);
}

// Other implementations ...
}

Hierarchy

  • AbstractBlockchainController

Constructors

Methods

  • Method to get blockchain group name

    Description

    Blockchain group is a name of the group of blockchains which are compatible with each other

    Returns string

  • Method to compare messages by time. Sometimes two messages could have the same time, so we need to sort them using some internal properties (e.g. blockNumber/logicalTime/etc).

    Returns

    -1 if a < b, 0 if a == b, 1 if a > b

    Description

    This method is used to sort messages in the list

    Parameters

    • a: IMessage<any>

      First message to compare

    • b: IMessage<any>

      Second message to compare

    Returns number

  • Method to get balance of the address. Currency used is the same which is used to pay for the Ylide tx in this blockchain. Usually it is the smallest native currency (e.g. wei in Ethereum)

    Returns

    Decimal number in a string format

    Parameters

    • address: string

      Recipient's wallet address

    Returns Promise<{
        e18: string;
        numeric: number;
        original: string;
    }>

  • 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 check if this msgId is valid for this blockchain controller

    Returns

    true if msgId is valid for this blockchain

    Parameters

    • msgId: string

      Msg ID to check

    Returns boolean

Generated using TypeDoc