Home Reference Source Repository
import {Transaction} from 'fincontracts-lib/src/tx-sender.js'
public class | source

Transaction

A sent transaction, which can be watched for events.

Constructor Summary

Public Constructor
public

constructor(sent: Promise<String, Error>, marketplace: FincontractMarketplace, web3: Web3)

Constructs Transaction object with a promise of sent transaction as first argument and the usual context necessary for interacting with blockchain

Member Summary

Public Members
public

Method Summary

Public Methods
public

async watch(filter: TransactionFilter, callback: Function): Promise<String, Error>

Constructs a listener and starts watching for the event to happen.

Public Constructors

public constructor(sent: Promise<String, Error>, marketplace: FincontractMarketplace, web3: Web3) source

Constructs Transaction object with a promise of sent transaction as first argument and the usual context necessary for interacting with blockchain

Params:

NameTypeAttributeDescription
sent Promise<String, Error>

promise of sent transaction, should be the return value of Sender#send

marketplace FincontractMarketplace

a Fincontracts smart contract instance

web3 Web3

a web3 instance connected to Ethereum node

Public Members

public sent: Promise<String, Error> source

Public Methods

public async watch(filter: TransactionFilter, callback: Function): Promise<String, Error> source

Constructs a listener and starts watching for the event to happen. Once the event happens the callback will be executed and the returned promise gets resolved with the callback's return value. If any error happens during the execution, the promise rejects with that error.

Params:

NameTypeAttributeDescription
filter TransactionFilter

a filter object to listen for events

callback Function

a callback to be executed once event was triggered

Return:

Promise<String, Error>

promise that resolves to the value returned by the callback