Transfer
转账 TRX ,单位是SUN。
transfer(fromAddress, toAddress, amount)
参数
- fromAddress(String)*
转账转出地址。
- toAddress(String)*
转账转入地址。
- amount(int)*
转账金额,单位是 SUN 。
返回
TransactionExtention,包括执行结果。
异常
IllegalException,转账失败时抛出此异常。
示例
TransactionExtention transaction = wrapper.transfer("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm", "TP8LKAf3R3FHDAcrQXuwBEWmaGrrUdRvzb", 1_000_000);
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);
执行结果:
e794b5799adbecd5a82a365d3faed5888e9e99eb7bda2f943e3cc46e77a5da7c
getTransactionSignWeight
获取交易签名权重。
getTransactionSignWeight(trx)
参数
- trx(Transaction)*
Transaction 对象。
返回
TransactionSignWeight 对象。
示例
TransactionSignWeight transaction = wrapper.getTransactionSignWeight(wrapper.getTransactionById("786c7516df88941e33ea44f03e637bd8c1ddcfd058634574102c6e3cfb93de0d"));
执行结果:
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
获取交易批准列表。
getTransactionApprovedList(trx)
参数
- trx(Transaction)*
transaction 对象。
返回
TransactionApprovedList 对象。
示例
TransactionApprovedList transaction = wrapper.getTransactionApprovedList(wrapper.getTransactionById("786c7516df88941e33ea44f03e637bd8c1ddcfd058634574102c6e3cfb93de0d"));
执行结果:
approved_list: "A,\303\3379\362\325AU\361\\\016\213q)Xr5\346\322X"
result {
}
transaction {
...
}
estimateBandwidth
计算交易所需的带宽。
estimateBandwidth(Transaction txn)
参数
- txn(Transaction)
需要计算带宽的交易体。必须是签名后的交易。
返回
交易所需的带宽,类型为long
示例
long bandwidth = wrapper.estimateBandwidth(signedTxn);
执行结果:
266