Add proto files for cosmos bank

This commit is contained in:
neeraj 2024-03-13 14:19:13 +05:30
parent 60aacc6543
commit 0a7a6f287d
2 changed files with 249 additions and 0 deletions

View File

@ -0,0 +1,125 @@
syntax = "proto3";
package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
// Params defines the parameters for the bank module.
message Params {
option (amino.name) = "cosmos-sdk/x/bank/Params";
// Deprecated: Use of SendEnabled in params is deprecated.
// For genesis, use the newly added send_enabled field in the genesis object.
// Storage, lookup, and manipulation of this information is now in the keeper.
//
// As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files.
repeated SendEnabled send_enabled = 1 [deprecated = true];
bool default_send_enabled = 2;
}
// SendEnabled maps coin denom to a send_enabled status (whether a denom is
// sendable).
message SendEnabled {
option (gogoproto.equal) = true;
string denom = 1;
bool enabled = 2;
}
// Input models transaction input.
message Input {
option (cosmos.msg.v1.signer) = "address";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// Output models transaction outputs.
message Output {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin coins = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// Supply represents a struct that passively keeps track of the total supply
// amounts in the network.
// This message is deprecated now that supply is indexed by denom.
message Supply {
option deprecated = true;
option (gogoproto.equal) = true;
option (gogoproto.goproto_getters) = false;
option (cosmos_proto.implements_interface) = "cosmos.bank.v1beta1.SupplyI";
repeated cosmos.base.v1beta1.Coin total = 1 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// DenomUnit represents a struct that describes a given
// denomination unit of the basic token.
message DenomUnit {
// denom represents the string name of the given denom unit (e.g uatom).
string denom = 1;
// exponent represents power of 10 exponent that one must
// raise the base_denom to in order to equal the given DenomUnit's denom
// 1 denom = 10^exponent base_denom
// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
// exponent = 6, thus: 1 atom = 10^6 uatom).
uint32 exponent = 2;
// aliases is a list of string aliases for the given denom
repeated string aliases = 3;
}
// Metadata represents a struct that describes
// a basic token.
message Metadata {
string description = 1;
// denom_units represents the list of DenomUnit's for a given coin
repeated DenomUnit denom_units = 2;
// base represents the base denom (should be the DenomUnit with exponent = 0).
string base = 3;
// display indicates the suggested denom that should be
// displayed in clients.
string display = 4;
// name defines the name of the token (eg: Cosmos Atom)
//
// Since: cosmos-sdk 0.43
string name = 5;
// symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
// be the same as the display.
//
// Since: cosmos-sdk 0.43
string symbol = 6;
// URI to a document (on or off-chain) that contains additional information. Optional.
//
// Since: cosmos-sdk 0.46
string uri = 7 [(gogoproto.customname) = "URI"];
// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
// the document didn't change. Optional.
//
// Since: cosmos-sdk 0.46
string uri_hash = 8 [(gogoproto.customname) = "URIHash"];
}

View File

@ -0,0 +1,124 @@
syntax = "proto3";
package cosmos.bank.v1beta1;
import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/bank/v1beta1/bank.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
// Msg defines the bank Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;
// Send defines a method for sending coins from one account to another account.
rpc Send(MsgSend) returns (MsgSendResponse);
// MultiSend defines a method for sending coins from some accounts to other accounts.
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
// UpdateParams defines a governance operation for updating the x/bank module parameters.
// The authority is defined in the keeper.
//
// Since: cosmos-sdk 0.47
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
// SetSendEnabled is a governance operation for setting the SendEnabled flag
// on any number of Denoms. Only the entries to add or update should be
// included. Entries that already exist in the store, but that aren't
// included in this message, will be left unchanged.
//
// Since: cosmos-sdk 0.47
rpc SetSendEnabled(MsgSetSendEnabled) returns (MsgSetSendEnabledResponse);
}
// MsgSend represents a message to send coins from one account to another.
message MsgSend {
option (cosmos.msg.v1.signer) = "from_address";
option (amino.name) = "cosmos-sdk/MsgSend";
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
repeated cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true,
(amino.encoding) = "legacy_coins",
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
];
}
// MsgSendResponse defines the Msg/Send response type.
message MsgSendResponse {}
// MsgMultiSend represents an arbitrary multi-in, multi-out send message.
message MsgMultiSend {
option (cosmos.msg.v1.signer) = "inputs";
option (amino.name) = "cosmos-sdk/MsgMultiSend";
option (gogoproto.equal) = false;
// Inputs, despite being `repeated`, only allows one sender input. This is
// checked in MsgMultiSend's ValidateBasic.
repeated Input inputs = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
repeated Output outputs = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
// MsgMultiSendResponse defines the Msg/MultiSend response type.
message MsgMultiSendResponse {}
// MsgUpdateParams is the Msg/UpdateParams request type.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
option (amino.name) = "cosmos-sdk/x/bank/MsgUpdateParams";
// params defines the x/bank parameters to update.
//
// NOTE: All parameters must be supplied.
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}
// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
//
// Since: cosmos-sdk 0.47
message MsgUpdateParamsResponse {}
// MsgSetSendEnabled is the Msg/SetSendEnabled request type.
//
// Only entries to add/update/delete need to be included.
// Existing SendEnabled entries that are not included in this
// message are left unchanged.
//
// Since: cosmos-sdk 0.47
message MsgSetSendEnabled {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "cosmos-sdk/MsgSetSendEnabled";
// authority is the address that controls the module.
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// send_enabled is the list of entries to add or update.
repeated SendEnabled send_enabled = 2;
// use_default_for is a list of denoms that should use the params.default_send_enabled value.
// Denoms listed here will have their SendEnabled entries deleted.
// If a denom is included that doesn't have a SendEnabled entry,
// it will be ignored.
repeated string use_default_for = 3;
}
// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.
//
// Since: cosmos-sdk 0.47
message MsgSetSendEnabledResponse {}