Class Web3Account

Represents a BaseAccount object.

See

  • sign - Sign an array of bytes.
  • address - The address of the account.
  • sellRolls - Sell rolls.
  • buyRolls - Buy rolls.
  • sendTransaction - Send a transaction.
  • callSmartContract - Call a smart contract.
  • deploySmartContract - Deploy a smart contract.

Hierarchy

  • BaseClient
    • Web3Account

Implements

Constructors

Properties

account: IAccount
chainId: bigint
clientConfig: IClientConfig
publicApiClient: IPublicApiClient

Methods

  • Compacts bytes payload per operation.

    Parameters

    • data: DataType

      The operation data.

    • opTypeId: OperationTypeId

      The operation type id.

    • expirePeriod: number

      The expire period.

    Returns Buffer

    The compacted bytes payload.

  • Executes a blockchain operation

    Parameters

    • txData: IContractData | ICallData | IRollsData

      The transaction data for the operation.

    • operationType: OperationTypeId

      The type of operation to be executed.

    • useRetry: boolean = false

      Determines whether to use retry logic in case of failures.

    • errorMessage: string = 'Operation did not return a valid response'

      Custom error message to throw if operation fails.

    • Optional preExecutionCallback: ((data) => Promise<void>)

      An optional callback function to be executed before the operation, for any pre-execution logic or validation.

    Returns Promise<string>

    Returns a promise that resolves to the operation ID.

  • Sends a post JSON rpc request to the node.

    Type Parameters

    • T

    Parameters

    • resource: JSON_RPC_REQUEST_METHOD

      The rpc method to call.

    • params: object

      The parameters to pass to the rpc method.

    Returns Promise<T>

    A promise that resolves as the result of the rpc method.

    Throws

    An error if the rpc method returns an error.

  • Set new providers as IProvider.

    Parameters

    • providers: IProvider[]

      The new providers to set as an array of IProvider.

    Returns void

    Throws

    Will throw an error if no public providers are included in the given array of providers.

    Throws

    Will throw an error if no private providers are included in the given array of providers.

Generated using TypeDoc