Interface TransactionApi

Transaction API

This module provides methods related to blockchain transactions

const client = LedgerClientFactory.createClient({nodehost: "https://europe.signum.network" })
const account = await client.transaction.getAccount( { accountId: '7661432345798605326' })

@category
interface TransactionApi {
    broadcastTransaction: ((signedTransactionPayload: string) => Promise<TransactionId>);
    cancelSubscription: ((args: CancelSubscriptionArgs) => Promise<TransactionId | UnsignedTransaction>);
    createSubscription: ((args: CreateSubscriptionArgs) => Promise<TransactionId | UnsignedTransaction>);
    getDistributionAmountsFromTransaction: ((transactionId: string, accountId: string) => Promise<DistributionAmount>);
    getSubscription: ((subscriptionId: string) => Promise<Subscription>);
    getSubscriptionPayments: ((args: GetSubscriptionPaymentsArgs) => Promise<TransactionList>);
    getTransaction: ((transactionId: string) => Promise<Transaction>);
    getTransactionByFullHash: ((fullhash: string) => Promise<Transaction>);
    getUnconfirmedTransactions: (() => Promise<UnconfirmedTransactionList>);
    parseTransactionBytes: ((transactionHexBytes: string) => Promise<Transaction>);
    sendAmountToMultipleRecipients: ((args: SendAmountToMultipleRecipientsArgs) => Promise<TransactionId | UnsignedTransaction>);
    sendAmountToSingleRecipient: ((args: SendAmountArgs) => Promise<TransactionId | UnsignedTransaction>);
    sendSameAmountToMultipleRecipients: ((args: SendSameAmountToMultipleRecipientsArgs) => Promise<TransactionId | UnsignedTransaction>);
    signAndBroadcastTransaction: ((unsignedTransaction: UnsignedTransactionArgs) => Promise<TransactionId>);
}

Properties

broadcastTransaction: ((signedTransactionPayload: string) => Promise<TransactionId>)

Broadcasts a transaction to the network/blockchain

Type declaration

    • (signedTransactionPayload): Promise<TransactionId>
    • Parameters

      • signedTransactionPayload: string

        The signed transaction payload encoded in base64

      Returns Promise<TransactionId>

      The Transaction Id or Unsigned Bytes as Hex String if no private key was sent

cancelSubscription: ((args: CancelSubscriptionArgs) => Promise<TransactionId | UnsignedTransaction>)

Cancels a subscription

Type declaration

createSubscription: ((args: CreateSubscriptionArgs) => Promise<TransactionId | UnsignedTransaction>)

Create a subscription

Type declaration

getDistributionAmountsFromTransaction: ((transactionId: string, accountId: string) => Promise<DistributionAmount>)

Gets the amount a token holder received from a previous distribution to asset/token holders

Distribution to token holders is very efficient at very high transaction rate, so one need explicitely query the node for the underlying amounts of a run distribution.

Type declaration

    • (transactionId, accountId): Promise<DistributionAmount>
    • Parameters

      • transactionId: string

        The transaction Id of the distribution

      • accountId: string

        The relevant account

      Returns Promise<DistributionAmount>

      the received income from an asset distribution payment

getSubscription: ((subscriptionId: string) => Promise<Subscription>)

Gets a subscription

Type declaration

    • (subscriptionId): Promise<Subscription>
    • Parameters

      • subscriptionId: string

        The id of the subscription

      Returns Promise<Subscription>

      The Subscription Object (as promise)

getSubscriptionPayments: ((args: GetSubscriptionPaymentsArgs) => Promise<TransactionList>)

Gets the payments from a specific subscription aka Auto-Payment

Type declaration

getTransaction: ((transactionId: string) => Promise<Transaction>)

Get a transaction and its details from the network/blockchain

Type declaration

    • (transactionId): Promise<Transaction>
    • Parameters

      • transactionId: string

        The transaction Id

      Returns Promise<Transaction>

      The Transaction

getTransactionByFullHash: ((fullhash: string) => Promise<Transaction>)

Get a transaction using the hash reference instead of the id

Type declaration

    • (fullhash): Promise<Transaction>
    • Parameters

      • fullhash: string

        The transactions full hash

      Returns Promise<Transaction>

      The Transaction

getUnconfirmedTransactions: (() => Promise<UnconfirmedTransactionList>)

Get the all current unconfirmed transactions

Type declaration

parseTransactionBytes: ((transactionHexBytes: string) => Promise<Transaction>)

Parses a transaction byte sequence to its JSON representation

Type declaration

    • (transactionHexBytes): Promise<Transaction>
    • Parameters

      • transactionHexBytes: string

        The transaction byte sequence in hexadecimal format

      Returns Promise<Transaction>

      The parsed Transaction object

sendAmountToMultipleRecipients: ((args: SendAmountToMultipleRecipientsArgs) => Promise<TransactionId | UnsignedTransaction>)

Sends a multi-out request to the blockchain with arbitrary value for each recipient

Type declaration

sendAmountToSingleRecipient: ((args: SendAmountArgs) => Promise<TransactionId | UnsignedTransaction>)

Sends an amount to another account/recipient

Type declaration

sendSameAmountToMultipleRecipients: ((args: SendSameAmountToMultipleRecipientsArgs) => Promise<TransactionId | UnsignedTransaction>)

Sends a multi-out request to the blockchain with same value for all recipients

Type declaration

signAndBroadcastTransaction: ((unsignedTransaction: UnsignedTransactionArgs) => Promise<TransactionId>)

Signs and broadcasts a transaction

Usually, you don't need this, as all sending methods in SignumJS sign and broadcast. As not all BRS API functions are implemented yet in SignumJS this method is handy for those, i.e. all direct calls to ChainService.send

Type declaration