triggerSmartContract method

Future<JSON> triggerSmartContract({
  1. required String address,
  2. required String contractAddress,
  3. required String functionSelector,
  4. required String parameter,
  5. bool visible = true,
  6. int feeLimit = 1000000,
  7. int? call_value,
  8. int? call_token_value,
  9. String? token_id,
})

Trigger a smart contract (write, modifies the blockchain)

Implementation

Future<JSON> triggerSmartContract({
  required String address,
  required String contractAddress,
  required String functionSelector,
  required String parameter,
  bool visible = true,
  int feeLimit = 1000000, // 1 TRX
  int? call_value, // Amount of TRX within the transaction
  int? call_token_value, // Amount of TRC10 token within the transaction
  String? token_id, // Token ID for TRC10
}) {
  return postCall<JSON>(
    "$baseURL/wallet/triggercontract",
    data: {
      "owner_address": address,
      "contract_address": contractAddress,
      "function_selector": functionSelector,
      "parameter": parameter,
      "visible": visible,
      "fee_limit": feeLimit,
      if (call_value != null) "call_value": call_value,
      if (call_token_value != null) "call_token_value": call_token_value,
      if (token_id != null) "token_id": token_id,
    },
  );
}