Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Plasma

Entrypoint to the Plasma client. Provides convenience methods for common functionality such as sending value.

Hierarchy

  • Plasma

Index

Constructors

constructor

  • Constructs a new Plasma client. All options are required, but privateKey can be null. If you don't set a privateKey, methods that require it such as send will throw an error.

    See PlasmaOptions for the full list of supported options.

    Parameters

    Returns Plasma

Methods

contract

  • Accessor method for the Plasma smart contract. Use this to make smart contract calls directly.

    Returns PlasmaContract

deposit

  • Deposits funds into the Plasma smart contract. Pass the depositNonce included as part of the returned the OnChainDeposit to send to spend the deposited funds.

    Parameters

    Returns Promise<OnChainDeposit>

rootNode

  • Accessor method for the root node's gRPC client. Use this to query balances, list UTXOs, and make other requests to the root node directly.

    Returns IRootClient

send

  • Sends funds.

    Parameters

    • to: string

      Address to send funds to.

    • value: NumberLike

      How much money to send.

    • fee: NumberLike

      A fee amount.

    • Optional depositNonce: NumberLike

      The deposit nonce you'd like to spend.

    Returns Promise<ConfirmedTransaction>

startExit

  • Starts exiting the provided value or outpoint. If a value is provided, the outpoint whose amount is closest but higher than the given value is chosen. For example, if you have two UTXOs with amount 1.5ETH and 2ETH and you call startExit with 1ETH, the 1.5ETH outpoint will be exited.

    The bond parameter is used to to protect against double-spends. Your bond must be higher than the value of your outpoint. The value of the bond will be returned when the challenge period expires.

    WARNING: You will forfeit your bond if you attempt to exit a spent outpoint.

    Parameters

    Returns Promise<void>

Generated using TypeDoc