pushTransaction method
Push transaction to AMAX chain
Implementation
Future<dynamic> pushTransaction(Transaction transaction,
{bool broadcast = true,
bool sign = true,
int blocksBehind = 3,
int expireSecond = 180,
bool autoFill = true}) async {
NodeInfo info = await this.getInfo();
if(autoFill) {
Block refBlock = await getBlock((info.headBlockNum! - blocksBehind).toString());
transaction = await _fullFill(transaction, refBlock);
}
PushTransactionArgs pushTransactionArgs = await _pushTransactionArgs(
info.chainId!, transactionTypes['transaction']!, transaction, sign);
if (broadcast) {
return this._post('/chain/push_transaction', {
'signatures': pushTransactionArgs.signatures,
'compression': 0,
'packed_context_free_data': '',
'packed_trx': ser.arrayToHex(pushTransactionArgs.serializedTransaction),
}).then((processedTrx) {
return processedTrx;
});
}
return pushTransactionArgs;
}