Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Contract<State>

A base interface to be implemented by SmartWeave Contracts clients.

Type parameters

  • State = unknown

Hierarchy

  • Contract

Implemented by

Index

Methods

connect

readState

  • readState(blockHeight?: number, currentTx?: { contractTxId: string; interactionTxId: string }[]): Promise<EvalStateResult<State>>

setEvaluationOptions

viewState

  • Returns the "view" of the state, computed by the SWC - ie. object that is a derivative of a current state and some specific smart contract business logic. Similar to the "interactRead" from the current SDK version.

    TODO: tags and transfer params are not currently handled.

    Type parameters

    • Input = unknown

    • View = unknown

    Parameters

    • input: Input
    • Optional blockHeight: number
    • Optional tags: Tags
    • Optional transfer: ArTransfer

    Returns Promise<InteractionResult<State, View>>

viewStateForTx

  • A version of the viewState method to be used from within the contract's source code. The transaction passed as an argument is the currently processed interaction transaction. The "caller" will be se to the owner of the interaction transaction, that requires to call this method.

    note: calling "interactRead" from withing contract's source code was not previously possible - this is a new feature.

    Type parameters

    • Input = unknown

    • View = unknown

    Parameters

    Returns Promise<InteractionResult<State, View>>

writeInteraction

  • writeInteraction<Input>(input: Input, tags?: Tags, transfer?: ArTransfer): Promise<string>

Generated using TypeDoc