
syntax = "proto3";

package soma.rpc;

import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "soma/rpc/executed_transaction.proto";
import "soma/rpc/signature.proto";
import "soma/rpc/transaction.proto";

service TransactionExecutionService {
  rpc ExecuteTransaction(ExecuteTransactionRequest) returns (ExecuteTransactionResponse);
  rpc SimulateTransaction(SimulateTransactionRequest) returns (SimulateTransactionResponse);
}

message ExecuteTransactionRequest {
  // The transaction to execute.
  optional Transaction transaction = 1;

  // Set of `UserSignature`s authorizing the execution of the provided
  // transaction.
  repeated UserSignature signatures = 2;

  // Mask specifying which fields to read.
  // If no mask is specified, defaults to `effects.status,checkpoint`.
  optional google.protobuf.FieldMask read_mask = 3;
}

// Response message for `NodeService.ExecuteTransaction`.
message ExecuteTransactionResponse {
  optional ExecutedTransaction transaction = 1;
}

message SimulateTransactionRequest {
  optional Transaction transaction = 1;

  // Mask specifying which fields to read.
  optional google.protobuf.FieldMask read_mask = 2;

  // buf:lint:ignore ENUM_ZERO_VALUE_SUFFIX
  enum TransactionChecks {
    ENABLED = 0;
    DISABLED = 1;
  }

  // Specify whether checks should be ENABLED (default) or DISABLED while executing the transaction
  optional TransactionChecks checks = 3;
}

message SimulateTransactionResponse {
  optional ExecutedTransaction transaction = 1;
}
