This class provides methods to interact with the DEMOS blockchain.

Constructors

Properties

connected: boolean = false

Connection status of the RPC URL

DemosTransactions: {
    broadcast: ((validationData: RPCResponseWithValidityData, demos: Demos) => Promise<any>);
    confirm: ((transaction: Transaction, demos: Demos) => Promise<RPCResponseWithValidityData>);
    empty: (() => Transaction);
    prepare: ((data?: any) => Promise<Transaction>);
    sign: ((raw_tx: Transaction, keypair: IKeyPair) => Promise<Transaction>);
    pay(to: string, amount: number, demos: Demos): Promise<Transaction>;
    transfer(to: string, amount: number, demos: Demos): Promise<Transaction>;
} = DemosTransactions

Type declaration

DemosWebAuth: typeof DemosWebAuth = DemosWebAuth
keypair: IKeyPair = null

The keypair of the connected wallet

l2ps: typeof l2psCalls = l2psCalls
rpc_url: string = null

The RPC URL of the demos node

skeletons: skeletons = skeletons
transactions: {
    broadcast: ((validationData: RPCResponseWithValidityData, demos: Demos) => Promise<any>);
    confirm: ((transaction: Transaction, demos: Demos) => Promise<RPCResponseWithValidityData>);
    empty: (() => Transaction);
    prepare: ((data?: any) => Promise<Transaction>);
    sign: ((raw_tx: Transaction, keypair: IKeyPair) => Promise<Transaction>);
    pay(to: string, amount: number, demos: Demos): Promise<Transaction>;
    transfer(to: string, amount: number, demos: Demos): Promise<Transaction>;
} = DemosTransactions

Type declaration

tx: {
    broadcast: ((validationData: RPCResponseWithValidityData, demos: Demos) => Promise<any>);
    confirm: ((transaction: Transaction, demos: Demos) => Promise<RPCResponseWithValidityData>);
    empty: (() => Transaction);
    prepare: ((data?: any) => Promise<Transaction>);
    sign: ((raw_tx: Transaction, keypair?: IKeyPair) => Promise<Transaction>);
    pay(to: string, amount: number, demos: Demos): Promise<Transaction>;
    transfer(to: string, amount: number, demos: Demos): Promise<Transaction>;
} = ...

Type declaration

web2: {
    createDahr: (() => Promise<Web2Proxy>);
} = ...
xm: {
    createPayload: ((xm_payload: XMScript, keypair?: IKeyPair) => Promise<Transaction>);
} = ...

Accessors

Methods

  • Parameters

    • method: any
    • message: any
    • data: any = {}
    • extra: any = ""
    • sender: any = null
    • receiver: any = null

    Returns Promise<any>

  • Connects to a RPC URL. Throws an error if the connection fails.

    Parameters

    • rpc_url: string

      The URL of the demos node

    Returns Promise<boolean>

    Whether the connection was successful

  • Connects to a Demos wallet using the provided private key.

    Parameters

    • privateKey: string | Buffer | Uint8Array<ArrayBufferLike>

      The private key of the wallet

    • Optionaloptions: {
          isSeed?: boolean;
      }

      The options for the wallet connection

      • OptionalisSeed?: boolean

        Whether the private key is a seed. If true, the seed will be converted to an ed25519 keypair.

    Returns Promise<string>

    The public key of the wallet

  • Returns the public key of the connected wallet.

    Returns string

    The public key of the wallet

  • Get information about an address.

    Parameters

    • address: string

      The address

    Returns Promise<AddressInfo>

  • Get address nonce.

    Parameters

    • address: string

      The address

    Returns Promise<number>

  • Performs a nodeCall on the connected RPC.

    Parameters

    • message: any

      The message to send to the node

    • args: {} = {}

      The arguments to send to the node

      Returns Promise<any>

      The nodeCall response

    • Create a signed DEMOS transaction to send native tokens to a given address.

      Parameters

      • to: string

        The reciever

      • amount: number

        The amount in DEM

      Returns Promise<Transaction>

      The signed transaction.

    • Parameters

      • request: RPCRequest
      • isAuthenticated: boolean = false
      • retries: number = 0
      • sleepTime: number = 250
      • allowedErrorCodes: number[] = []

      Returns Promise<RPCResponse>

    • Create a signed DEMOS transaction to send native tokens to a given address.

      Parameters

      • to: string

        The reciever

      • amount: number

        The amount in DEM

      Returns Promise<Transaction>

      The signed transaction.