syntax = "proto3";

package aea.valory.ledger_api.v1_0_0;

message LedgerApiMessage{

  // Custom Types
  message Kwargs{
    bytes kwargs = 1;
  }

  message RawTransaction{
    bytes raw_transaction = 1;
  }

  message SignedTransaction{
    bytes signed_transaction = 1;
  }

  message State{
    bytes state = 1;
  }

  message Terms{
    bytes terms = 1;
  }

  message TransactionDigest{
    bytes transaction_digest = 1;
  }

  message TransactionReceipt{
    bytes transaction_receipt = 1;
  }


  // Performatives and contents
  message Get_Balance_Performative{
    string ledger_id = 1;
    string address = 2;
  }

  message Get_Raw_Transaction_Performative{
    Terms terms = 1;
  }

  message Send_Signed_Transaction_Performative{
    SignedTransaction signed_transaction = 1;
  }

  message Get_Transaction_Receipt_Performative{
    TransactionDigest transaction_digest = 1;
    int32 retry_timeout = 2;
    bool retry_timeout_is_set = 3;
    int32 retry_attempts = 4;
    bool retry_attempts_is_set = 5;
  }

  message Balance_Performative{
    string ledger_id = 1;
    int32 balance = 2;
  }

  message Raw_Transaction_Performative{
    RawTransaction raw_transaction = 1;
  }

  message Transaction_Digest_Performative{
    TransactionDigest transaction_digest = 1;
  }

  message Transaction_Receipt_Performative{
    TransactionReceipt transaction_receipt = 1;
  }

  message Get_State_Performative{
    string ledger_id = 1;
    string callable = 2;
    repeated string args = 3;
    Kwargs kwargs = 4;
  }

  message State_Performative{
    string ledger_id = 1;
    State state = 2;
  }

  message Error_Performative{
    int32 code = 1;
    string message = 2;
    bool message_is_set = 3;
    bytes data = 4;
    bool data_is_set = 5;
  }


  oneof performative{
    Balance_Performative balance = 5;
    Error_Performative error = 6;
    Get_Balance_Performative get_balance = 7;
    Get_Raw_Transaction_Performative get_raw_transaction = 8;
    Get_State_Performative get_state = 9;
    Get_Transaction_Receipt_Performative get_transaction_receipt = 10;
    Raw_Transaction_Performative raw_transaction = 11;
    Send_Signed_Transaction_Performative send_signed_transaction = 12;
    State_Performative state = 13;
    Transaction_Digest_Performative transaction_digest = 14;
    Transaction_Receipt_Performative transaction_receipt = 15;
  }
}
