Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

  • new Batch(web3: default, _fromAddress: string, factoryContract: any, contractName: BaseContracts, contractAbi: any[]): Batch
  • Parameters

    • web3: default
    • _fromAddress: string
    • factoryContract: any
    • contractName: BaseContracts
    • contractAbi: any[]

    Returns Batch

Properties

contract

contract: any = null

Protected contractAbi

contractAbi: any[]

Protected contractName

contractName: BaseContracts

Protected factoryContract

factoryContract: any

Protected web3

web3: default

Accessors

fromAddress

  • get fromAddress(): string
  • Returns string

Methods

all

  • all(onlyExistingBatches?: boolean): Promise<(null | IBatch)[]>
  • Get all batches

    Parameters

    • onlyExistingBatches: boolean = true

      If set to true it will return only the batches owned by "fromAddress"

    Returns Promise<(null | IBatch)[]>

    Batches details

allBatchIds

  • allBatchIds(onlyExistingBatches?: boolean): Promise<number[]>
  • Get all batch ids

    Parameters

    • onlyExistingBatches: boolean = true

      If set to true it will return only the batches owned by "fromAddress"

    Returns Promise<number[]>

    Batch ids

burn

  • burn(options: { batchId: number; materialsUuid: number[] }): Transaction<{}>
  • Burn batch material uuid

    Parameters

    • options: { batchId: number; materialsUuid: number[] }

      Burn options

      • batchId: number

        The id of the batch

      • materialsUuid: number[]

        The uuids of the materials to be burned

    Returns Transaction<{}>

    Burn event

create

  • Create a new batch

    Parameters

    • options: { code: string; materialsUuid: number[] }

      Batch create options

      • code: string
      • materialsUuid: number[]

    Returns Transaction<CreateTransactionEvents>

    Batch create event

destroyBatch

  • Destory batch and add existing materials to users balance

    Parameters

    • batchId: number

      Target batch id

    Returns Transaction<BatchTransferEvent>

ensureContract

  • ensureContract(): Promise<any>

getById

  • getById(batchId: number, full?: boolean): Promise<null | IBatch>
  • Get batch by id

    Parameters

    • batchId: number

      Batch id

    • full: boolean = true

      Instead of return materials uuid, it will return the material instance details

    Returns Promise<null | IBatch>

    Batch informations

getContractAddress

  • getContractAddress(): Promise<any>

getPastEvents

  • getPastEvents<T>(eventName: string, filter?: object, includeBlockData?: boolean): Promise<T[]>
  • Type parameters

    • T

    Parameters

    • eventName: string
    • filter: object = {}
    • includeBlockData: boolean = false

    Returns Promise<T[]>

getRawPastEvents

  • getRawPastEvents(eventName: string, filter?: object): Promise<default[]>
  • Parameters

    • eventName: string
    • filter: object = {}

    Returns Promise<default[]>

remove

  • Remove a batch (burn)

    Parameters

    • batchId: number

      The id of the batch

    Returns Transaction<{}>

Generated using TypeDoc