HomeGuidesAPI ReferenceChangelog
GuidesAPI ReferenceCommunityDiscordBlogFAQBug BountyAnnouncementsChange Log
API Reference

Transactions

Transfer

Transfer TRX. The amount is in SUN.

transfer(fromAddress, toAddress, amount)

PARAMS

  1. fromAddress(String)*

fromAddress is the owner address.

  1. toAddress(String)*

toAddress is the recipient address.

  1. amount(int)*

amount is the amount of TRX to transfer in SUN.

RETURN

TransactionExtention, including execution results.

THROWS

IllegalException, if fail to transfer.

EXAMPLE

TransactionExtention transaction = wrapper.transfer("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm", "TP8LKAf3R3FHDAcrQXuwBEWmaGrrUdRvzb", 1_000_000);
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);

The result is:

e794b5799adbecd5a82a365d3faed5888e9e99eb7bda2f943e3cc46e77a5da7c

getTransactionSignWeight

Query transaction sign weight.

getTransactionSignWeight(trx)

PARAMS

  1. trx(Transaction)*

transaction object.

RETURN

TransactionSignWeight object.

EXAMPLE

TransactionSignWeight transaction = wrapper.getTransactionSignWeight(wrapper.getTransactionById("786c7516df88941e33ea44f03e637bd8c1ddcfd058634574102c6e3cfb93de0d"));

The result is:

permission {
    permission_name: "owner"
    threshold: 1
    keys {
      address: "A,\303\3379\362\325AU\361\\\016\213q)Xr5\346\322X"
      weight: 1
    }
  }
  approved_list: "A,\303\3379\362\325AU\361\\\016\213q)Xr5\346\322X"
  current_weight: 1
  result {
  }
  transaction {
    ...
  }

getTransactionApprovedList

Query transaction approvedList.

getTransactionApprovedList(trx)

PARAMS

  1. trx(Transaction)*

transaction object.

RETURN

TransactionApprovedList object.

EXAMPLE

TransactionApprovedList transaction = wrapper.getTransactionApprovedList(wrapper.getTransactionById("786c7516df88941e33ea44f03e637bd8c1ddcfd058634574102c6e3cfb93de0d"));

The result is:

approved_list: "A,\303\3379\362\325AU\361\\\016\213q)Xr5\346\322X"
  result {
  }
  transaction {
    ...
  }

estimateBandwidth

Calculate the bandwidth of a transaction.

PARAMS

  1. txn(Transaction)

The transaction to be estimated.

RETURN

The estimated bandwidth in the type of long.

EXAMPLE

long bandwidth = wrapper.estimateBandwidth(signedTxn);

The result is:

266