buildTxBody function

Map buildTxBody(
  1. List clauses,
  2. int chainTag,
  3. String blockRef,
  4. int nonce, {
  5. int expiration = 32,
  6. int gasPriceCoef = 0,
  7. int gas = 0,
  8. String? dependsOn,
  9. bool feeDelegation = false,
})

Build a Tx body. Clause should confine to "thor_devkit.transaction.CLAUSE" schema. {to, value, data} Tx body shall confine to "thor_devkit.transaction.BODY" schema.

Implementation

Map buildTxBody(List clauses, int chainTag, String blockRef, int nonce,
    {int expiration = 32,
    int gasPriceCoef = 0,
    int gas = 0,
    String? dependsOn,
    bool feeDelegation = false}) {
  var body = {
    "chainTag": chainTag,
    "blockRef": blockRef,
    "expiration": expiration,
    "clauses": clauses,
    "gasPriceCoef": gasPriceCoef,
    "gas": gas,
    "dependsOn": dependsOn,
    "nonce": nonce,
  };
  if (feeDelegation) {
    body['reserved'] = {'features': 1};
  }

  return body;
}