APIs

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

Create Campaign

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

  • Validate the incoming create message.

  • Call the CreateCampaign method of the keeper.

RPC

The RPC for creating a campaign is as follows:

// CreateCampaign is a method to create a campaign
rpc CreateCampaign(MsgCreateCampaign) returns (MsgCreateCampaignResponse);

Request Message

The request message for CreateCampaign is MsgCreateCampaign. The proto for the request message is as follows:

// MsgCreateCampaign is msg to create a reward campaign
message MsgCreateCampaign {
  // creator is the address of campaign creator account.
  string creator = 1;
  // uid is the unique identifier of the campaign.
  string uid = 2;
  // total_funds is the total funds allocated to the campaign.
  string total_funds = 3 [
    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "yaml:\"total_funds\""
  ];
  // ticket is the payload data.
  string ticket = 4;
}

Response Message

The response message for CreateCampaign is MsgCreateCampaignResponse. The proto for the request message is as follows:

// MsgCreateCampaignResponse campaign create message response type.
message MsgCreateCampaignResponse {}

Update Campaign

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

  • Validate the incoming create message.

  • Call the UpdateCampaign method of the keeper.

RPC

The RPC for updating a campaign is as follows:

// UpdateCampaign is a method to update campaign
rpc UpdateCampaign(MsgUpdateCampaign) returns (MsgUpdateCampaignResponse);

Request Message

The request message for UpdateCampaign is MsgUpdateCampaign. The proto for the request message is as follows:

// MsgUpdateCampaign is campaign update message type.
message MsgUpdateCampaign {
  // creator is the address of creator account.
  string creator = 1;
  // uid is the unique identifier of the campaign.
  string uid = 2;
  // topup_funds is the topup funds to increase the pool balance of the
  // campaign.
  string topup_funds = 3 [
    (gogoproto.customtype) = "cosmossdk.io/math.Int",
    (gogoproto.nullable) = false,
    (gogoproto.moretags) = "yaml:\"topup_funds\""
  ];
  // ticket is the payload data.
  string ticket = 4;
}

Response Message

The response message for UpdateCampaign is MsgUpdateCampaignResponse. The proto for the request message is as follows:

// MsgUpdateCampaignResponse campaign update message response type.
message MsgUpdateCampaignResponse {}

Withdraw Funds

When a withdrawal funds transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the WithdrawFunds method of the keeper.

RPC

The RPC for a withdraw funds of a campaign is as follows:

// WithdrawCampaignFunds is method to withdraw funds from the campaign
rpc WithdrawFunds(MsgWithdrawFunds) returns (MsgWithdrawFundsResponse);

Request Message

The request message for WithdrawFunds is MsgWithdrawFunds. The proto for the request message is as follows:

// MsgWithdrawFunds is withdraw funds message type.
message MsgWithdrawFunds {
  // creator is the address of creator account.
  string creator = 1;
  // uid is the unique identifier of the reward campaign.
  string uid = 2;
  // ticket is the payload data.
  string ticket = 3;
}

Response Message

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

// MsgWithdrawFundsResponse withdraw funds message response type.
message MsgWithdrawFundsResponse {}

Grant Reward

When a grant reward transaction is processed, the following things happen:

  • Validate the incoming create message.

  • Call the GrantReward method of the keeper.

RPC

The RPC for a grant reward of the reward module is as follows:

// GrantReward is method to allocate rewards
rpc GrantReward(MsgGrantReward) returns (MsgGrantRewardResponse);

Request Message

The request message for GrantReward is MsgGrantReward. The proto for the request message is as follows:

// MsgGrantReward is execute reward message type.
message MsgGrantReward {
  // creator is the address of creator account.
  string creator = 1;
  // uid is the unique identifier of the reward.
  string uid = 2;
  // campaign_uid is the unique identifier of the reward campaign.
  string campaign_uid = 3;
  // ticket is the payload data.
  string ticket = 4;
}

Response Message

The response message for GrantReward is MsgGrantRewardResponse. The proto for the request message is as follows:

// MsgWithdrawFundsResponse withdraw funds message response type.
message MsgWithdrawFundsResponse {}

Last updated