APIs

This section elaborates on the transaction message handler methods being exposed by the House module.

Create

When a create transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the Create method of the keeper.

RPC

The RPC for creating a subaccount is as follows:

// Create defines a method for creating a subaccount.
rpc Create(MsgCreate) returns (MsgCreateResponse);

Request Message

The request message for Create is MsgCreate. The proto for the request message is as follows:

// MsgCreate defines the Msg/Create request type.
message MsgCreate {
  // creator is the msg signer.
  string creator = 1;

  // owner is the owner of the subaccount.
  string owner = 2;

  // locked_balances is the list of balance locks.
  // Fixme: why this attribute needs to be repeated?
  repeated LockedBalance locked_balances = 3 [ (gogoproto.nullable) = false ];
}

Response Message

The response message for Deposit is MsgDepositResponse. The proto for the request message is as follows:

// MsgCreateAccountResponse defines the Msg/CreateAccount response type.
message MsgCreateResponse {}

Top-Up

When a top-up transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the TopUp method of the keeper.

RPC

The RPC for a top-up of the subaccount is as follows:

// TopUp defines a method for topping up a subaccount.
rpc TopUp(MsgTopUp) returns (MsgTopUpResponse);

Request Message

The request message for TopUp is MsgTopUp. The proto for the request message is as follows:

// MsgTopUp defines the Msg/TopUp request type.
message MsgTopUp {
  // creator is the msg signer.
  string creator = 1;

  // address is the subaccount address.
  string address = 2;

  // locked_balances is the list of balance locks.
  // Fixme: Are we sending multiple balance update together? If not, then only
  // locked balance should be enough
  repeated LockedBalance locked_balances = 3 [ (gogoproto.nullable) = false ];
}

Response Message

The response message for TopUp is MsgTopUpResponse. The proto for the request message is as follows:

// MsgTopUpResponse defines the Msg/TopUp response type.
message MsgTopUpResponse {}

Withdraw Unlocked Balances

When a top-up transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the WihtdrawUnlocked method of the keeper.

RPC

The RPC for a top-up of the subaccount is as follows:

// WithdrawUnlockedBalances defines a method for withdrawing unlocked balances.
rpc WithdrawUnlockedBalances(MsgWithdrawUnlockedBalances) returns (MsgWithdrawUnlockedBalancesResponse);

Request Message

The request message for WihtdrawUnlockedBalances is MsgWihtdrawUnlockedBalances. The proto for the request message is as follows:

// MsgWithdrawUnlockedBalances defines the Msg/WithdrawUnlockedBalances request type.
message MsgWithdrawUnlockedBalances {
  // creator is the subaccount owner.
  string creator = 1;
}

Response Message

The response message for WihtdrawUnlockedBalances is MsgWihtdrawUnlockedBalancesResponse. The proto for the request message is as follows:

// MsgWithdrawUnlockedBalancesResponse defines the Msg/WithdrawUnlockedBalances response type.
message MsgWithdrawUnlockedBalancesResponse {}

Wager

When a wager transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the Wager method of the keeper.

RPC

The RPC for a wager of the subaccount is as follows:

rpc Wager(MsgWager) returns (MsgWagerResponse);

Request Message

The request message for Wager is MsgWager. The proto for the request message is as follows:

// MsgWager wraps the MsgWager message. We need it in order not to have
// double interface registration conflicts.
message MsgWager {
  // creator is the subaccount owner.
  string creator = 1;
  // ticket is the jwt ticket data.
  string ticket = 2;
}

Response Message

The response message for Wager is MsgWagerResponse. The proto for the request message is as follows:

// MsgWagerResponse wraps the MsgWagerResponse message. We need it in order not
// to have double interface registration conflicts.
message MsgWagerResponse { sgenetwork.sge.bet.MsgWagerResponse response = 1; }

Last updated