diff --git a/docs/architecture/adr-4907-rental-nft.md b/docs/architecture/adr-4907-rental-nft.md new file mode 100644 index 00000000..6e7973e7 --- /dev/null +++ b/docs/architecture/adr-4907-rental-nft.md @@ -0,0 +1,181 @@ +# ADR 4907: Rental NFT + +## Changelog + +* 2022-10-19: Initial Draft + +## Status + +DRAFT + +## Abstract + +This ADR is an extension to `x/nft`. It proposes an additional role (user) that can be granted to an address, and when that role is automatically revoked (expired). User roles represent permissions to "use" NFTs, but not the ability to transfer or set up users. This standard is fully compliant with `EIP-4907` + +## Context + +At present, `x/nft` only implements the basic interface of `EIP-721`. In some cases, many developers may need certain functions. For example, the current NFT has high artistic value, and of course the price will be high. At this time, it is meaningful for the entire ecology to have a module with the ability to lease NFT. + +## Decision + +We extend based on `irismod/modules/nft`, which extends the following functions: + +- Store rental information for NFTs +- Expose the `Keeper` interface for writing modules for renting NFTs. +- Expose the external `Message` interface for users to rent out the right to use the NFT they own. +- Query NFT rental information. + +### Rental + +Rental is an extension of NFT, mainly to allow NFT to support rental. + +- rentalInfo: -- The structure in which the Rental information is kept. + +### Types + +#### RentalInfo + +``` +message RentalInfo { + string renter = 1; + uint64 expires = 2; +} +``` + +- `renter`:is the renter address of `RentalInfo`; required +- `expires`:is the time of the rental of `RentalInfo`; required + +### Storage + +A total of one style needs to be stored for royalties: + +1. `{class_id}/{nft_id} ---->RentalInfo (bytes) `:Store the information that an NFT is leased + +### `Keeper` Interface + +``` +type Keeper interface { + UserOf(ctx sdk.Context, classId, nftId string) (renter string) + UserExpires(ctx sdk.Context, classId, nftId string) (expire uint64) + + SetUser(ctx sdk.Context, classId, nftId string, renter string, expire uint64) + + // determines whether the NFT is being rented + HaveUser(ctx sdk.Context, classId, nftId string) bool + + // Delete rental information after expiration + // should be call in EndBlock + DeleteUser(ctx sdk.Context, classId, nftId string) +} +``` + + + +### `Msg` Service + +``` +service Msg { + rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} +} + +message MsgSetUser { + string class_id = 1; + string nft_id = 2; + string renter = 3; + uint64 expire = 4; + + string sender = 5; +} + +message MsgSetUserResponse {} + +``` + +The implementation outline of the server is as follows: + +``` +type msgServer struct { + k Keeper +} + +func (m msgServer) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check current ownership + assertEqual(msg.Sender, m.k.GetOwnerFromClass(msg.Module, msg.ClassId)) + + // check whether the nft is not already rented + assertEqual(false, m.k.HaveUser(ctx, msg.classId, msg.NftId)) + + m.k.SetUser(ctx, msg.classId, msg.NftId, msg.Renter, uint64(msg.Expire)) + return &types.MsgSetUserResponse{}, nil +} + +``` + +Query method: + +``` +service Query { + rpc UserOf(MsgUserOfRequest) returns (MsgUserOfResponse); + rpc UserExpires(MsgUserExpiresRequest) returns (MsgUserExpiresResponse); + rpc HaveUser(MsgHaveUserRequest) returns (MsgHaveUserResponse); +} + +message MsgUserOfRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgUserOfResponse { + string renter = 1; +} + +message MsgUserExpiresRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgUserExpiresResponse { + uint64 expires = 1; +} + +message MsgHaveUserRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgHaveUserResponse { + bool had_renter = 1; +} + +``` + + + +## Consequences + +### Backwards Compatibility + +No backwards incompatibility. + +### Positive + +- NFT Rental Standard on Cosmos Hub. + +### Negative + +None + +### Neutral + +None + +## Further Discussions + + + + + +## References + diff --git a/modules/mt/types/tx.pb.go b/modules/mt/types/tx.pb.go index 4631a428..44a3eb7c 100644 --- a/modules/mt/types/tx.pb.go +++ b/modules/mt/types/tx.pb.go @@ -7,16 +7,15 @@ import ( bytes "bytes" context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -70,7 +69,7 @@ func (m *MsgIssueDenom) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo -// MsgIssueDenomResponse defines the Msg/SaveDenom response type. +// MsgIssueDenomResponse defines the Msg/IssueDenom response type. type MsgIssueDenomResponse struct { } @@ -792,7 +791,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...grpc.CallOption) (*MsgIssueDenomResponse, error) { out := new(MsgIssueDenomResponse) - err := c.cc.Invoke(ctx, "/irismod.mt.Msg/SaveDenom", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.mt.Msg/IssueDenom", in, out, opts...) if err != nil { return nil, err } @@ -866,7 +865,7 @@ type UnimplementedMsgServer struct { } func (*UnimplementedMsgServer) IssueDenom(ctx context.Context, req *MsgIssueDenom) (*MsgIssueDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveDenom not implemented") + return nil, status.Errorf(codes.Unimplemented, "method IssueDenom not implemented") } func (*UnimplementedMsgServer) TransferDenom(ctx context.Context, req *MsgTransferDenom) (*MsgTransferDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferDenom not implemented") @@ -898,7 +897,7 @@ func _Msg_IssueDenom_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.mt.Msg/SaveDenom", + FullMethod: "/irismod.mt.Msg/IssueDenom", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).IssueDenom(ctx, req.(*MsgIssueDenom)) @@ -1001,7 +1000,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "SaveDenom", + MethodName: "IssueDenom", Handler: _Msg_IssueDenom_Handler, }, { diff --git a/modules/nft/client/cli/flags.go b/modules/nft/client/cli/flags.go index f7657394..92ef1fb9 100644 --- a/modules/nft/client/cli/flags.go +++ b/modules/nft/client/cli/flags.go @@ -19,6 +19,10 @@ const ( FlagSymbol = "symbol" FlagMintRestricted = "mint-restricted" FlagUpdateRestricted = "update-restricted" + + FlagRentable = "rentable" + FlagRentalExpiry = "expiry" + FlagRentalUser = "user" ) var ( @@ -29,6 +33,7 @@ var ( FsQuerySupply = flag.NewFlagSet("", flag.ContinueOnError) FsQueryOwner = flag.NewFlagSet("", flag.ContinueOnError) FsTransferDenom = flag.NewFlagSet("", flag.ContinueOnError) + FsRental = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { @@ -41,6 +46,7 @@ func init() { FsIssueDenom.String(FlagData, "", "The data is the app specific metadata of the NFT class. Optional") FsIssueDenom.Bool(FlagMintRestricted, false, "mint restricted of nft under denom") FsIssueDenom.Bool(FlagUpdateRestricted, false, "update restricted of nft under denom") + FsIssueDenom.Bool(FlagRentable, false, "rental plugin enable option") FsMintNFT.String(FlagURI, "", "The uri for supplemental off-chain tokenData (should return a JSON object)") FsMintNFT.String(FlagURIHash, "", "The uri_hash is a hash of the document pointed by uri. Optional") @@ -61,4 +67,7 @@ func init() { FsQuerySupply.String(FlagOwner, "", "The owner of the nft") FsQueryOwner.String(FlagDenomID, "", "The name of the collection") + + FsRental.String(FlagRentalUser, "", "The user of the rented nft") + FsRental.Int64(FlagRentalExpiry, 0, "The expiry of the rented nft") } diff --git a/modules/nft/client/cli/query.go b/modules/nft/client/cli/query.go index d7627c73..fb979df5 100644 --- a/modules/nft/client/cli/query.go +++ b/modules/nft/client/cli/query.go @@ -29,6 +29,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQuerySupply(), GetCmdQueryOwner(), GetCmdQueryNFT(), + GetCmdQueryRental(), ) return queryCmd diff --git a/modules/nft/client/cli/rental.go b/modules/nft/client/cli/rental.go new file mode 100644 index 00000000..125937f3 --- /dev/null +++ b/modules/nft/client/cli/rental.go @@ -0,0 +1,188 @@ +package cli + +import ( + "context" + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/irisnet/irismod/modules/nft/types" + "github.com/spf13/cobra" +) + +// Tx Command for rental plugin + +// GetCmdRental is the CLI tx command for NFT rental plugin. +func GetCmdRental() *cobra.Command { + cmd := &cobra.Command{ + Use: "rental", + Long: "NFT rental plugin tx subcommands", + DisableFlagParsing: true, + Run: func(cmd *cobra.Command, args []string) {}, + } + + cmd.AddCommand( + GetCmdRentalSetUser(), + ) + + return cmd +} + +// GetCmdRentalSetUser is the CLI command for setting user for a rentable NFT. +func GetCmdRentalSetUser() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-user [denom-id] [nft-id]", + Long: "Set user and expiry for an NFT.", + Example: fmt.Sprintf( + "$ %s tx nft rental set-user "+ + "--user= "+ + "--expiry= "+ + "--from= "+ + "--chain-id= "+ + "--fees=", + version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + sender := clientCtx.GetFromAddress().String() + + user, err := cmd.Flags().GetString(FlagRentalUser) + if err != nil { + return err + } + + expiry, err := cmd.Flags().GetInt64(FlagRentalExpiry) + if err != nil { + return err + } + + msg := types.NewMsgSetUser( + args[0], + args[1], + user, + expiry, + sender, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + cmd.Flags().AddFlagSet(FsRental) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// Query Command for rental plugin + +// GetCmdQueryRental is the CLI query command for NFT rental plugin. +func GetCmdQueryRental() *cobra.Command { + cmd := &cobra.Command{ + Use: "rental", + Long: "NFT rental plugin query subcommands", + DisableFlagParsing: true, + Run: func(cmd *cobra.Command, args []string) {}, + } + + cmd.AddCommand( + GetCmdQueryRentalUserOf(), + GetCmdQueryRentalUserExpires(), + GetCmdQueryRentalHasUser(), + ) + + return cmd +} + +// GetCmdQueryRentalUserOf is the CLI command for query user of a rentable NFT. +func GetCmdQueryRentalUserOf() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "user of a rented nft", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.UserOf(context.Background(), &types.QueryUserOfRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryRentalUserExpires is the CLI command for query expiry of a rentable NFT. +func GetCmdQueryRentalUserExpires() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "expiry of a rented nft", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.UserExpires(context.Background(), &types.QueryUserExpiresRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryRentalHasUser is the CLI command for query does an NFT have a user. +func GetCmdQueryRentalHasUser() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "does an nft have a user", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.HasUser(context.Background(), &types.QueryHasUserRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/modules/nft/client/cli/rental_test.go b/modules/nft/client/cli/rental_test.go new file mode 100644 index 00000000..c4326643 --- /dev/null +++ b/modules/nft/client/cli/rental_test.go @@ -0,0 +1,104 @@ +package cli_test + +// +//import ( +// "fmt" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/gogo/protobuf/proto" +// "github.com/irisnet/irismod/modules/nft/client/cli" +// "github.com/irisnet/irismod/modules/nft/client/testutil" +//) +// +//func (s *IntegrationTestSuite) TestRental() { +// owner := s.network.Validators[0] +// user := s.network.Validators[1] +// +// // 1. issue a denom with rental enabled. +// denomID := "denom" +// denomName := "denomName" +// denomSchema := "denomSchema" +// denomSymbol := "dsb" +// mintRestricted := false +// updateRestricted := true +// denomDescription := "denom description" +// denomURI := "denomURI" +// denomURIHash := "denomURIHash" +// denomData := "denomData" +// rentable := true +// +// args := []string{ +// fmt.Sprintf("--%s=%s", cli.FlagDenomName, denomName), +// fmt.Sprintf("--%s=%s", cli.FlagSchema, denomSchema), +// fmt.Sprintf("--%s=%s", cli.FlagSymbol, denomSymbol), +// fmt.Sprintf("--%s=%s", cli.FlagURI, denomURI), +// fmt.Sprintf("--%s=%s", cli.FlagURIHash, denomURIHash), +// fmt.Sprintf("--%s=%s", cli.FlagDescription, denomDescription), +// fmt.Sprintf("--%s=%s", cli.FlagData, denomData), +// fmt.Sprintf("--%s=%t", cli.FlagMintRestricted, mintRestricted), +// fmt.Sprintf("--%s=%t", cli.FlagUpdateRestricted, updateRestricted), +// fmt.Sprintf("--%s=%t", cli.FlagRentable, rentable), +// +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), +// } +// +// respType := proto.Message(&sdk.TxResponse{}) +// expectedCode := uint32(0) +// +// bz, err := testutil.IssueDenomExec(owner.ClientCtx, owner.Address.String(), denomID, args...) +// s.Require().NoError(err) +// s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// txResp := respType.(*sdk.TxResponse) +// s.Require().Equal(expectedCode, txResp.Code) +// +// // 2. mint an nft +// tokenID := "token" +// tokenName := "tokenName" +// tokenURI := "tokenURI" +// tokenURIHash := "tokenURIHash" +// tokenData := "tokenData" +// +// args = []string{ +// fmt.Sprintf("--%s=%s", cli.FlagData, tokenData), +// fmt.Sprintf("--%s=%s", cli.FlagRecipient, owner.Address.String()), +// fmt.Sprintf("--%s=%s", cli.FlagURI, tokenURI), +// fmt.Sprintf("--%s=%s", cli.FlagURIHash, tokenURIHash), +// fmt.Sprintf("--%s=%s", cli.FlagTokenName, tokenName), +// +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), +// } +// +// respType = proto.Message(&sdk.TxResponse{}) +// +// bz, err = testutil.MintNFTExec(owner.ClientCtx, owner.Address.String(), denomID, tokenID, args...) +// s.Require().NoError(err) +// s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// txResp = respType.(*sdk.TxResponse) +// s.Require().Equal(expectedCode, txResp.Code) +// +// // 3. set user for that nft +// +// expiry := "2524579200" // 2050-01-01-00:00:00 +// +// args = []string{ +// fmt.Sprintf("--%s=%s", cli.FlagRentalUser, user.Address.String()), +// fmt.Sprintf("--%s=%s", cli.FlagRentalExpiry, expiry), +// } +// +// respType = proto.Message(&sdk.TxResponse{}) +// +// bz, err = testutil.RentalSetUser(owner.ClientCtx, owner.Address.String(), denomID, tokenID, args...) +// //s.Require().NoError(err) +// // s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType) +// fmt.Print(respType) +// //txResp = respType.(*sdk.TxResponse) +// //s.Require().Equal(expectedCode, txResp.Code) +// +// // 4. get rental info +//} diff --git a/modules/nft/client/cli/tx.go b/modules/nft/client/cli/tx.go index 1e3a2c26..a2dc6c32 100644 --- a/modules/nft/client/cli/tx.go +++ b/modules/nft/client/cli/tx.go @@ -33,6 +33,7 @@ func NewTxCmd() *cobra.Command { GetCmdTransferNFT(), GetCmdBurnNFT(), GetCmdTransferDenom(), + GetCmdRental(), ) return txCmd @@ -107,6 +108,12 @@ func GetCmdIssueDenom() *cobra.Command { schema = string(optionsContent) } + // compose plugin config and user data + composeData, err := composeDenomData(cmd, data) + if err != nil { + return err + } + msg := types.NewMsgIssueDenom( args[0], denomName, @@ -118,7 +125,7 @@ func GetCmdIssueDenom() *cobra.Command { description, uri, uriHash, - data, + composeData, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/nft/client/cli/util.go b/modules/nft/client/cli/util.go new file mode 100644 index 00000000..1f7234a2 --- /dev/null +++ b/modules/nft/client/cli/util.go @@ -0,0 +1,50 @@ +package cli + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" + "github.com/spf13/cobra" +) + +// composeDenomData composes an json string from denomPlugin and user data +func composeDenomData(cmd *cobra.Command, data string) (string, error) { + denomPlugin, err := composeDenomPlugin(cmd) + if err != nil { + return data, err + } + + composedData := types.DenomComposedData{ + UserData: data, + DenomPlugin: denomPlugin, + } + + bz, err := json.Marshal(composedData) + if err != nil { + return data, err + } + + return string(bz), nil +} + +// composeDenomPlugin compose DenomPlugin from cli flag +func composeDenomPlugin(cmd *cobra.Command) (*types.DenomPlugin, error) { + rentalPlugin, err := composeRentalPlugin(cmd) + if err != nil { + return nil, err + } + + return &types.DenomPlugin{ + RentalPlugin: rentalPlugin, + }, nil +} + +// composeRentalPlugin compose RentalPlugin from cli flag +func composeRentalPlugin(cmd *cobra.Command) (*types.RentalPlugin, error) { + rental, err := cmd.Flags().GetBool(FlagRentable) + if err != nil { + return nil, err + } + return &types.RentalPlugin{ + Enabled: rental, + }, nil +} diff --git a/modules/nft/client/testutil/rental_helpers.go b/modules/nft/client/testutil/rental_helpers.go new file mode 100644 index 00000000..e2f646a8 --- /dev/null +++ b/modules/nft/client/testutil/rental_helpers.go @@ -0,0 +1,51 @@ +package testutil + +import ( + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/irisnet/irismod/modules/nft/client/cli" +) + +func RentalSetUser(clientCtx client.Context, from string, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + fmt.Sprintf("--%s=%s", flags.FlagFrom, from), + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdRentalSetUser(), args) +} + +func QueryRentalUserOf(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalUserOf(), args) +} + +func QueryRentalUserExpires(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalUserExpires(), args) +} + +func QueryRentalHasUser(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalHasUser(), args) +} \ No newline at end of file diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index cf9987c0..e7cbcc65 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -22,12 +22,17 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, uriHash, data string, ) error { + + // make sure that plugin has default value if failed to convert input data + userData, denomPlugin := decomposeDenomData(data) + denomMetadata := &types.DenomMetadata{ Creator: creator.String(), Schema: schema, MintRestricted: mintRestricted, UpdateRestricted: updateRestricted, - Data: data, + Data: userData, + RentalPlugin: denomPlugin.RentalPlugin, } metadata, err := codectypes.NewAnyWithValue(denomMetadata) if err != nil { @@ -56,6 +61,11 @@ func (k Keeper) TransferDenomOwner( return err } + plugin, err := k.GetDenomPlugin(ctx, denomID) + if err != nil { + return err + } + // authorize if srcOwner.String() != denom.Creator { return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to transfer denom %s", srcOwner.String(), denomID) @@ -67,6 +77,7 @@ func (k Keeper) TransferDenomOwner( MintRestricted: denom.MintRestricted, UpdateRestricted: denom.UpdateRestricted, Data: denom.Data, + RentalPlugin: plugin.RentalPlugin, } data, err := codectypes.NewAnyWithValue(denomMetadata) if err != nil { @@ -97,6 +108,7 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { return nil, err } + return &types.Denom{ Id: class.Id, Name: class.Name, @@ -116,3 +128,20 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err func (k Keeper) HasDenom(ctx sdk.Context, denomID string) bool { return k.nk.HasClass(ctx, denomID) } + +// GetDenomPlugin returns denom plugin config of a denom +func (k Keeper) GetDenomPlugin(ctx sdk.Context, denomID string) (*types.DenomPlugin, error) { + class, has := k.nk.GetClass(ctx, denomID) + if !has { + return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) + } + + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { + return nil, err + } + + return &types.DenomPlugin{ + RentalPlugin: denomMetadata.RentalPlugin, + }, nil +} diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index dbcb8701..75c8c28f 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -177,3 +177,59 @@ func (k Keeper) NFT(c context.Context, request *types.QueryNFTRequest) (*types.Q return &types.QueryNFTResponse{NFT: &baseNFT}, nil } + +// Rental Plugin Query Service + +// User queries the user of an nft +func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*types.QueryUserOfResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) + } + + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err + } + + return &types.QueryUserOfResponse{User: rental.User}, nil +} + +// Expires queries the expires of an nft +func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRequest) (*types.QueryUserExpiresResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) + } + + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err + } + + return &types.QueryUserExpiresResponse{Expiry: rental.Expiry}, nil +} + +// HasUser queries if an nft has the user +func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) + } + + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err + } + + // if expires or user not existent, return false + var resp types.QueryHasUserResponse + if ctx.BlockTime().Unix() > rental.Expiry || rental.User == "" { + resp.HasUser = false + } + + return &resp, nil +} diff --git a/modules/nft/keeper/keeper_test.go b/modules/nft/keeper/keeper_test.go index 2a8cae1e..60e0e94c 100644 --- a/modules/nft/keeper/keeper_test.go +++ b/modules/nft/keeper/keeper_test.go @@ -94,6 +94,8 @@ func (suite *KeeperSuite) SetupTest() { suite.NoError(err) suite.NotEmpty(collections) suite.Equal(len(collections), 3) + + suite.SetupRentalTest() } func TestKeeperSuite(t *testing.T) { diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index c5679261..36b46ae9 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strconv" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -242,3 +243,54 @@ func (k Keeper) TransferDenom(goCtx context.Context, msg *types.MsgTransferDenom return &types.MsgTransferDenomResponse{}, nil } + +// Rental Plugin + +// SetUser set a user and expires time for an existent nft +func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + user, err := sdk.AccAddressFromBech32(msg.User) + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // nft must exist + if exist := k.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) + } + + // sender must own or be approved for this nft + if owner := k.nk.GetOwner(ctx, msg.DenomId, msg.NftId); !owner.Equals(sender) { + return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) + } + + if err := k.Rent(ctx, msg.DenomId, msg.NftId, types.RentalInfo{ + User: user.String(), + Expiry: msg.Expiry, + }); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetUser, + sdk.NewAttribute(types.AttributeKeyDenomID, msg.DenomId), + sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), + sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expiry, 10)), + sdk.NewAttribute(types.AttributeKeyUser, msg.User), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) + + return &types.MsgSetUserResponse{}, nil +} diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go new file mode 100644 index 00000000..1d276c42 --- /dev/null +++ b/modules/nft/keeper/rental.go @@ -0,0 +1,106 @@ +package keeper + +import ( + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/irisnet/irismod/modules/nft/types" +) + +const defaultExpiry = 0 + +// DefaultRentalPlugin returns a default rental plugin config +func (k Keeper) DefaultRentalPlugin() *types.RentalPlugin { + return &types.RentalPlugin{ + Enabled: false, + } +} + +// DefaultRentalInfo returns a default rental info +func (k Keeper) DefaultRentalInfo() *types.RentalInfo { + return &types.RentalInfo{ + User: "", + Expiry: defaultExpiry, + } +} + +// Rent set rental info for an nft. +// Warning: Rent will overwrite previous rental info no matter whether it arrives expiry thus should be used carefully. +func (k Keeper) Rent(ctx sdk.Context, denomID, tokenID string, rental types.RentalInfo) error { + // 1. get rental plugin info + cfg, err := k.GetRentalPlugin(ctx, denomID) + if err != nil { + return err + } + + // 2. check rental is enabled + if !cfg.Enabled { + return sdkerrors.Wrapf(types.ErrRentalPluginDisabled, "Rental is disabled") + } + + // 3. expiry must be greater than the current block time. + if ctx.BlockTime().Unix() >= rental.Expiry { + return sdkerrors.Wrapf(types.ErrRentalExpiryInvalid, "Expiry is (%d)", rental.Expiry) + } + + // 4. construct new nft data info (we have examined its existence) + var data types.NFTMetadata + token, _ := k.nk.GetNFT(ctx, denomID, tokenID) + if err := k.cdc.Unmarshal(token.Data.GetValue(), &data); err != nil { + return err + } + data.RentalInfo = &rental + + newData, err := codectypes.NewAnyWithValue(&data) + if err != nil { + return err + } + token.Data = newData + + // 5. set rental info with nft update. + err = k.nk.Update(ctx, token) + if err != nil { + return err + } + + return nil +} + +// GetRentalPlugin returns the rental plugin config +func (k Keeper) GetRentalPlugin(ctx sdk.Context, denomID string) (*types.RentalPlugin, error) { + denom, has := k.nk.GetClass(ctx, denomID) + if !has { + return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) + } + + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(denom.Data.GetValue(), &denomMetadata); err != nil { + return nil, err + } + + if denomMetadata.RentalPlugin != nil { + return denomMetadata.RentalPlugin, nil + } + + return k.DefaultRentalPlugin(), nil +} + +// GetRentalInfo returns the rental info of an nft. +func (k Keeper) GetRentalInfo(ctx sdk.Context, denomID, tokenID string) (*types.RentalInfo, error) { + token, exist := k.nk.GetNFT(ctx, denomID, tokenID) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrInvalidNFT, "token ID %s not exists", tokenID) + } + + var nftMetadata types.NFTMetadata + if err := k.cdc.Unmarshal(token.Data.GetValue(), &nftMetadata); err != nil { + return nil, err + } + + if nftMetadata.RentalInfo != nil { + return nftMetadata.RentalInfo, nil + } + + return k.DefaultRentalInfo(), nil +} diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go new file mode 100644 index 00000000..c7a52e18 --- /dev/null +++ b/modules/nft/keeper/rental_test.go @@ -0,0 +1,200 @@ +package keeper_test + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" +) + +var ( + rentalDenomId = "rentalDenomId" + rentalDenomId2 = "rentalDenomId2" + rentalDenomName = "rentalDenomName" + rentalDenomUserData = "rentalDenomUserData" + rentalSchema = "rental schema" + rentalSymbol = "ren" + rentalNftId = "rentalNftId" + rentalNftId2 = "rentalNftId2" + rentalNftId3 = "rentalNftId3" + rentalNftName = "rentalNftName" + + rentalCreator = CreateTestAddrs(4)[3] + rentalRenter = CreateTestAddrs(5)[4] + + rentalUserData = types.DenomComposedData{ + UserData: rentalDenomUserData, + DenomPlugin: &types.DenomPlugin{RentalPlugin: &types.RentalPlugin{Enabled: true}}, + } + + rentalUserData2 = types.DenomComposedData{ + UserData: rentalDenomUserData, + DenomPlugin: &types.DenomPlugin{RentalPlugin: &types.RentalPlugin{Enabled: false}}, + } +) + +func (suite *KeeperSuite) SetupRentalTest() { + + data, err := json.Marshal(&rentalUserData) + suite.NoError(err) + data2, err := json.Marshal(&rentalUserData2) + suite.NoError(err) + + // rentalDenomId enables the rental feature + err = suite.keeper.SaveDenom(suite.ctx, + rentalDenomId, + rentalDenomName, + rentalSchema, + rentalSymbol, + rentalCreator, + false, + false, + "", + "", + "", + string(data), + ) + suite.NoError(err) + + // rentalDenomId2 disables the rental feature + err = suite.keeper.SaveDenom(suite.ctx, + rentalDenomId2, + rentalDenomName, + rentalSchema, + rentalSymbol, + rentalCreator, + false, + false, + "", + "", + "", + string(data2), + ) + suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId, + rentalNftId, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId, + rentalNftId2, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId2, + rentalNftId3, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) + +} + +func (suite *KeeperSuite) TestSetUser() { + expiry := suite.ctx.BlockTime().Unix() + 100 + expiry2 := expiry - 100 + + // able to rent + err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry, + }) + suite.NoError(err) + + // unable to rent for invalid expiry + err = suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry2, + }) + suite.Error(err) + + // unable to rent for not enabling rental + err = suite.keeper.Rent(suite.ctx, + rentalDenomId2, + rentalNftId3, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry2, + }) + suite.Error(err) +} + +func (suite *KeeperSuite) TestUserOf() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.UserOf(suite.ctx, &types.QueryUserOfRequest{ + DenomId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(rentalRenter.String(), resp.User) +} + +func (suite *KeeperSuite) TestUserExpires() { + expiry := suite.ctx.BlockTime().Unix() + 10 + err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.UserExpires(suite.ctx, &types.QueryUserExpiresRequest{ + DenomId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(expiry, resp.Expiry) +} + +func (suite *KeeperSuite) TestHasUser() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, + types.RentalInfo{ + User: rentalRenter.String(), + Expiry: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.HasUser(suite.ctx, &types.QueryHasUserRequest{ + DenomId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(false, resp.HasUser) +} diff --git a/modules/nft/keeper/util.go b/modules/nft/keeper/util.go new file mode 100644 index 00000000..88227e75 --- /dev/null +++ b/modules/nft/keeper/util.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" +) + +// decomposeDenomData decomposes "{"data":"","denomPlugin":""} into data string and denomPlugin struct +func decomposeDenomData(data string) (string, *types.DenomPlugin) { + var dcd types.DenomComposedData + + // if failed to unmarshal, return DenomPlugin with nil field + if err := json.Unmarshal([]byte(data), &dcd); err != nil { + return data, &types.DenomPlugin{RentalPlugin: nil} + } + + return dcd.UserData, dcd.DenomPlugin +} diff --git a/modules/nft/keeper/util_test.go b/modules/nft/keeper/util_test.go new file mode 100644 index 00000000..2bc9611c --- /dev/null +++ b/modules/nft/keeper/util_test.go @@ -0,0 +1,7 @@ +package keeper_test + +import "testing" + +func TestDecomposeDenomData(t *testing.T) { + // TODO +} diff --git a/modules/nft/types/errors.go b/modules/nft/types/errors.go index e5f77082..f43ec267 100644 --- a/modules/nft/types/errors.go +++ b/modules/nft/types/errors.go @@ -15,4 +15,10 @@ var ( ErrInvalidDenom = sdkerrors.Register(ModuleName, 16, "invalid denom") ErrInvalidTokenID = sdkerrors.Register(ModuleName, 17, "invalid nft id") ErrInvalidTokenURI = sdkerrors.Register(ModuleName, 18, "invalid nft uri") + + // Rental Plugin errors + ErrRentalPluginNotExistent = sdkerrors.Register(ModuleName, 30, "rental plugin is not existent") + ErrRentalPluginDisabled = sdkerrors.Register(ModuleName, 31, "rental plugin is disabled") + ErrRentalExpiryInvalid = sdkerrors.Register(ModuleName, 32, "rental expiry is invalid") + ErrRentalInfoNotExsitent = sdkerrors.Register(ModuleName, 33, "rental info is not existent") ) diff --git a/modules/nft/types/events.go b/modules/nft/types/events.go index 2903321e..7c925b48 100644 --- a/modules/nft/types/events.go +++ b/modules/nft/types/events.go @@ -8,6 +8,7 @@ var ( EventTypeMintNFT = "mint_nft" EventTypeBurnNFT = "burn_nft" EventTypeTransferDenom = "transfer_denom" + EventTypeSetUser = "set_user" AttributeValueCategory = ModuleName @@ -19,4 +20,7 @@ var ( AttributeKeyTokenURI = "token_uri" AttributeKeyDenomID = "denom_id" AttributeKeyDenomName = "denom_name" + + AttributeKeyUser = "user" + AttributeKeyExpires = "expires" ) diff --git a/modules/nft/types/msgs.go b/modules/nft/types/msgs.go index 12e47593..fb07f696 100644 --- a/modules/nft/types/msgs.go +++ b/modules/nft/types/msgs.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/nft" ) // constant used to indicate that some field should not be updated @@ -13,6 +14,8 @@ const ( TypeMsgMintNFT = "mint_nft" TypeMsgBurnNFT = "burn_nft" TypeMsgTransferDenom = "transfer_denom" + + TypeMsgSetUser = "set_user" ) var ( @@ -22,6 +25,8 @@ var ( _ sdk.Msg = &MsgMintNFT{} _ sdk.Msg = &MsgBurnNFT{} _ sdk.Msg = &MsgTransferDenom{} + + _ sdk.Msg = &MsgSetUser{} ) // NewMsgIssueDenom is a constructor function for MsgSetName @@ -323,3 +328,56 @@ func (msg MsgTransferDenom) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{from} } + +func NewMsgSetUser(denomId, nftId, user string, + expiry int64, sender string) *MsgSetUser { + return &MsgSetUser{ + DenomId: denomId, + NftId: nftId, + User: user, + Expiry: expiry, + Sender: sender, + } +} + +// Route Implements LegacyMsg +func (m MsgSetUser) Route() string { return RouterKey } + +// Type Implements LegacyMsg +func (m MsgSetUser) Type() string { return TypeMsgSetUser } + +// GetSignBytes Implements LegacyMsg +func (m MsgSetUser) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the Msg.ValidateBasic method. +func (m MsgSetUser) ValidateBasic() error { + if err := nft.ValidateClassID(m.DenomId); err != nil { + return sdkerrors.Wrapf(ErrInvalidDenom, "Invalid class id (%s)", m.DenomId) + } + + if err := nft.ValidateNFTID(m.NftId); err != nil { + return sdkerrors.Wrapf(ErrInvalidTokenID, "Invalid nft id (%s)", m.NftId) + } + + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", m.Sender) + } + + _, err = sdk.AccAddressFromBech32(m.User) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", m.User) + + } + + return nil +} + +// GetSigners implements the Msg.GetSigners method. +func (m MsgSetUser) GetSigners() []sdk.AccAddress { + signer, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{signer} +} diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index db8953af..e307e0f6 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -66,16 +66,56 @@ func (m *BaseNFT) XXX_DiscardUnknown() { var xxx_messageInfo_BaseNFT proto.InternalMessageInfo +type PluginInfo struct { + // RoyaltyInfo royaltyInfo = 1 [] ; + RentalInfo *RentalInfo `protobuf:"bytes,2,opt,name=rentalInfo,proto3" json:"irismod:4907"` +} + +func (m *PluginInfo) Reset() { *m = PluginInfo{} } +func (m *PluginInfo) String() string { return proto.CompactTextString(m) } +func (*PluginInfo) ProtoMessage() {} +func (*PluginInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{1} +} +func (m *PluginInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PluginInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PluginInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PluginInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_PluginInfo.Merge(m, src) +} +func (m *PluginInfo) XXX_Size() int { + return m.Size() +} +func (m *PluginInfo) XXX_DiscardUnknown() { + xxx_messageInfo_PluginInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_PluginInfo proto.InternalMessageInfo + type NFTMetadata struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // RoyaltyInfo royaltyInfo = 3 []; + RentalInfo *RentalInfo `protobuf:"bytes,4,opt,name=rentalInfo,proto3" json:"irismod:4907"` } func (m *NFTMetadata) Reset() { *m = NFTMetadata{} } func (m *NFTMetadata) String() string { return proto.CompactTextString(m) } func (*NFTMetadata) ProtoMessage() {} func (*NFTMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{1} + return fileDescriptor_fe8ab7e15b7f0646, []int{2} } func (m *NFTMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -123,7 +163,7 @@ func (m *Denom) Reset() { *m = Denom{} } func (m *Denom) String() string { return proto.CompactTextString(m) } func (*Denom) ProtoMessage() {} func (*Denom) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{2} + return fileDescriptor_fe8ab7e15b7f0646, []int{3} } func (m *Denom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -152,19 +192,99 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom proto.InternalMessageInfo +// The message is an intermediate struct for composing user data and plugin +// config +type DenomComposedData struct { + UserData string `protobuf:"bytes,1,opt,name=userData,proto3" json:"userData,omitempty"` + DenomPlugin *DenomPlugin `protobuf:"bytes,2,opt,name=denomPlugin,proto3" json:"denomPlugin,omitempty"` +} + +func (m *DenomComposedData) Reset() { *m = DenomComposedData{} } +func (m *DenomComposedData) String() string { return proto.CompactTextString(m) } +func (*DenomComposedData) ProtoMessage() {} +func (*DenomComposedData) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{4} +} +func (m *DenomComposedData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomComposedData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomComposedData.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DenomComposedData) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomComposedData.Merge(m, src) +} +func (m *DenomComposedData) XXX_Size() int { + return m.Size() +} +func (m *DenomComposedData) XXX_DiscardUnknown() { + xxx_messageInfo_DenomComposedData.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomComposedData proto.InternalMessageInfo + +type DenomPlugin struct { + // RoyaltyPlugin royaltyPlugin = 1 [] ; + RentalPlugin *RentalPlugin `protobuf:"bytes,2,opt,name=rentalPlugin,proto3" json:"irismod:4907"` +} + +func (m *DenomPlugin) Reset() { *m = DenomPlugin{} } +func (m *DenomPlugin) String() string { return proto.CompactTextString(m) } +func (*DenomPlugin) ProtoMessage() {} +func (*DenomPlugin) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{5} +} +func (m *DenomPlugin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomPlugin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DenomPlugin) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomPlugin.Merge(m, src) +} +func (m *DenomPlugin) XXX_Size() int { + return m.Size() +} +func (m *DenomPlugin) XXX_DiscardUnknown() { + xxx_messageInfo_DenomPlugin.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomPlugin proto.InternalMessageInfo + type DenomMetadata struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` MintRestricted bool `protobuf:"varint,3,opt,name=mint_restricted,json=mintRestricted,proto3" json:"mint_restricted,omitempty"` UpdateRestricted bool `protobuf:"varint,4,opt,name=update_restricted,json=updateRestricted,proto3" json:"update_restricted,omitempty"` Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + // RoyaltyPlugin royaltyPlugin = 6 []; + RentalPlugin *RentalPlugin `protobuf:"bytes,7,opt,name=rentalPlugin,proto3" json:"irismod:4907"` } func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } func (m *DenomMetadata) String() string { return proto.CompactTextString(m) } func (*DenomMetadata) ProtoMessage() {} func (*DenomMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{3} + return fileDescriptor_fe8ab7e15b7f0646, []int{6} } func (m *DenomMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -203,7 +323,7 @@ func (m *IDCollection) Reset() { *m = IDCollection{} } func (m *IDCollection) String() string { return proto.CompactTextString(m) } func (*IDCollection) ProtoMessage() {} func (*IDCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{4} + return fileDescriptor_fe8ab7e15b7f0646, []int{7} } func (m *IDCollection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -242,7 +362,7 @@ func (m *Owner) Reset() { *m = Owner{} } func (m *Owner) String() string { return proto.CompactTextString(m) } func (*Owner) ProtoMessage() {} func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{5} + return fileDescriptor_fe8ab7e15b7f0646, []int{8} } func (m *Owner) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -281,7 +401,7 @@ func (m *Collection) Reset() { *m = Collection{} } func (m *Collection) String() string { return proto.CompactTextString(m) } func (*Collection) ProtoMessage() {} func (*Collection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{6} + return fileDescriptor_fe8ab7e15b7f0646, []int{9} } func (m *Collection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -312,8 +432,11 @@ var xxx_messageInfo_Collection proto.InternalMessageInfo func init() { proto.RegisterType((*BaseNFT)(nil), "irismod.nft.BaseNFT") + proto.RegisterType((*PluginInfo)(nil), "irismod.nft.PluginInfo") proto.RegisterType((*NFTMetadata)(nil), "irismod.nft.NFTMetadata") proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") + proto.RegisterType((*DenomComposedData)(nil), "irismod.nft.DenomComposedData") + proto.RegisterType((*DenomPlugin)(nil), "irismod.nft.DenomPlugin") proto.RegisterType((*DenomMetadata)(nil), "irismod.nft.DenomMetadata") proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") @@ -323,47 +446,56 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 635 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0x8e, 0x1d, 0xa7, 0x4e, 0xc6, 0x4d, 0xdb, 0x7f, 0xff, 0x08, 0xb9, 0x1c, 0xec, 0x2a, 0x42, - 0xa2, 0x12, 0x28, 0x11, 0x45, 0xe2, 0x50, 0x6e, 0xa6, 0xaa, 0x08, 0x12, 0x45, 0xb2, 0xca, 0x85, - 0x4b, 0xb4, 0xf5,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b, 0x51, 0xd5, 0x2f, 0xee, 0xef, 0xa7, 0x9c, 0xcc, 0x26, 0x54, - 0xe6, 0x6f, 0x56, 0x5f, 0x5d, 0x4e, 0xa9, 0x3c, 0xdb, 0xd0, 0xef, 0xd2, 0xd3, 0xdf, 0x01, 0x00, - 0x00, 0xff, 0xff, 0x4a, 0x49, 0x33, 0x49, 0xcb, 0x04, 0x00, 0x00, + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0x1d, 0xa7, 0x4e, 0x9e, 0x93, 0x6e, 0x76, 0x88, 0xc0, 0xed, 0x21, 0xae, 0x2c, 0x24, + 0x56, 0x02, 0x25, 0xb0, 0x20, 0x10, 0x39, 0x7a, 0xa3, 0x8a, 0x20, 0xd1, 0x45, 0x56, 0x11, 0x12, + 0x07, 0x22, 0xd7, 0x33, 0x49, 0x46, 0x1b, 0x7b, 0x22, 0xcf, 0x58, 0xab, 0x72, 0xe4, 0xc0, 0x15, + 0x24, 0xbe, 0x00, 0x1f, 0x82, 0x0f, 0xd1, 0xe3, 0x1e, 0x39, 0x45, 0x90, 0x5e, 0x10, 0xc7, 0x7e, + 0x02, 0xe4, 0x99, 0x71, 0xd6, 0xde, 0x76, 0xa5, 0x4a, 0xbd, 0xbd, 0x7f, 0x33, 0xef, 0xf7, 0xde, + 0xef, 0x67, 0x0f, 0xf4, 0xd2, 0x85, 0x18, 0xa7, 0x0b, 0x31, 0xda, 0x64, 0x4c, 0x30, 0xe4, 0xd0, + 0x8c, 0xf2, 0x84, 0xe1, 0x51, 0xba, 0x10, 0xc7, 0x83, 0x25, 0x5b, 0x32, 0x19, 0x1f, 0x17, 0x96, + 0x2a, 0x39, 0xee, 0x17, 0x27, 0x32, 0x92, 0x8a, 0x68, 0xad, 0x22, 0xfe, 0xef, 0x06, 0xd8, 0x41, + 0x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 0x7a, 0xce, 0x43, 0x59, 0xaf, 0x7a, 0x07, 0x5f, 0x5f, 0xfd, 0x33, 0x6c, 0x5c, 0xed, 0x86, + 0xc6, 0xab, 0xdd, 0xd0, 0xf8, 0x7b, 0x37, 0x34, 0x7e, 0xbb, 0x1e, 0x36, 0x5e, 0x5d, 0x0f, 0x1b, + 0x7f, 0x5d, 0x0f, 0x1b, 0x3f, 0x7c, 0xb4, 0xa4, 0x62, 0x95, 0x5f, 0x8c, 0x62, 0x96, 0x8c, 0x8b, + 0x7b, 0x53, 0x22, 0xc6, 0xfa, 0xfe, 0x71, 0xc2, 0x70, 0xbe, 0x26, 0xbc, 0x78, 0x88, 0xc6, 0xe2, + 0x72, 0x43, 0xf8, 0xc5, 0x81, 0x7c, 0x5a, 0x3e, 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x9f, + 0x93, 0xeb, 0xa0, 0x06, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -430,6 +562,9 @@ func (this *NFTMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } + if !this.RentalInfo.Equal(that1.RentalInfo) { + return false + } return true } func (this *Denom) Equal(that interface{}) bool { @@ -520,6 +655,9 @@ func (this *DenomMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } + if !this.RentalPlugin.Equal(that1.RentalPlugin) { + return false + } return true } func (this *IDCollection) Equal(that interface{}) bool { @@ -683,6 +821,41 @@ func (m *BaseNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PluginInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PluginInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PluginInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RentalInfo != nil { + { + size, err := m.RentalInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + func (m *NFTMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -703,6 +876,18 @@ func (m *NFTMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RentalInfo != nil { + { + size, err := m.RentalInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -826,6 +1011,83 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DenomComposedData) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DenomComposedData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomComposedData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DenomPlugin != nil { + { + size, err := m.DenomPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.UserData) > 0 { + i -= len(m.UserData) + copy(dAtA[i:], m.UserData) + i = encodeVarintNft(dAtA, i, uint64(len(m.UserData))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DenomPlugin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DenomPlugin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomPlugin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RentalPlugin != nil { + { + size, err := m.RentalPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + func (m *DenomMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -846,6 +1108,18 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RentalPlugin != nil { + { + size, err := m.RentalPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -1064,6 +1338,19 @@ func (m *BaseNFT) Size() (n int) { return n } +func (m *PluginInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RentalInfo != nil { + l = m.RentalInfo.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *NFTMetadata) Size() (n int) { if m == nil { return 0 @@ -1078,6 +1365,10 @@ func (m *NFTMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } + if m.RentalInfo != nil { + l = m.RentalInfo.Size() + n += 1 + l + sovNft(uint64(l)) + } return n } @@ -1132,6 +1423,36 @@ func (m *Denom) Size() (n int) { return n } +func (m *DenomComposedData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UserData) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + if m.DenomPlugin != nil { + l = m.DenomPlugin.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + +func (m *DenomPlugin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RentalPlugin != nil { + l = m.RentalPlugin.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *DenomMetadata) Size() (n int) { if m == nil { return 0 @@ -1156,6 +1477,10 @@ func (m *DenomMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } + if m.RentalPlugin != nil { + l = m.RentalPlugin.Size() + n += 1 + l + sovNft(uint64(l)) + } return n } @@ -1462,7 +1787,7 @@ func (m *BaseNFT) Unmarshal(dAtA []byte) error { } return nil } -func (m *NFTMetadata) Unmarshal(dAtA []byte) error { +func (m *PluginInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1485,17 +1810,17 @@ func (m *NFTMetadata) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: NFTMetadata: wiretype end group for non-group") + return fmt.Errorf("proto: PluginInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: NFTMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PluginInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RentalInfo", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNft @@ -1505,55 +1830,27 @@ func (m *NFTMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNft } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNft } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNft - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthNft + if m.RentalInfo == nil { + m.RentalInfo = &RentalInfo{} } - if postIndex > l { - return io.ErrUnexpectedEOF + if err := m.RentalInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1576,7 +1873,157 @@ func (m *NFTMetadata) Unmarshal(dAtA []byte) error { } return nil } -func (m *Denom) Unmarshal(dAtA []byte) error { +func (m *NFTMetadata) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NFTMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NFTMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalInfo == nil { + m.RentalInfo = &RentalInfo{} + } + if err := m.RentalInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Denom) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1954,6 +2401,210 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } +func (m *DenomComposedData) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DenomComposedData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomComposedData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DenomPlugin == nil { + m.DenomPlugin = &DenomPlugin{} + } + if err := m.DenomPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DenomPlugin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DenomPlugin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomPlugin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalPlugin == nil { + m.RentalPlugin = &RentalPlugin{} + } + if err := m.RentalPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2119,6 +2770,42 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalPlugin == nil { + m.RentalPlugin = &RentalPlugin{} + } + if err := m.RentalPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipNft(dAtA[iNdEx:]) diff --git a/modules/nft/types/query.pb.go b/modules/nft/types/query.pb.go index 3c8f197f..52fbc9e8 100644 --- a/modules/nft/types/query.pb.go +++ b/modules/nft/types/query.pb.go @@ -641,6 +641,300 @@ func (m *QueryNFTResponse) GetNFT() *BaseNFT { return nil } +// QueryUserOfRequest is the request type for the Query/Renter RPC method +type QueryUserOfRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryUserOfRequest) Reset() { *m = QueryUserOfRequest{} } +func (m *QueryUserOfRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUserOfRequest) ProtoMessage() {} +func (*QueryUserOfRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{12} +} +func (m *QueryUserOfRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserOfRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserOfRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserOfRequest.Merge(m, src) +} +func (m *QueryUserOfRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUserOfRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserOfRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserOfRequest proto.InternalMessageInfo + +func (m *QueryUserOfRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QueryUserOfRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryUserOfResponse is the response type for the Query/Renter RPC method +type QueryUserOfResponse struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryUserOfResponse) Reset() { *m = QueryUserOfResponse{} } +func (m *QueryUserOfResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserOfResponse) ProtoMessage() {} +func (*QueryUserOfResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{13} +} +func (m *QueryUserOfResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserOfResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserOfResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserOfResponse.Merge(m, src) +} +func (m *QueryUserOfResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUserOfResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserOfResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserOfResponse proto.InternalMessageInfo + +func (m *QueryUserOfResponse) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +// QueryExpiresRequest is the request type for the Query/Expires RPC method +type QueryUserExpiresRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryUserExpiresRequest) Reset() { *m = QueryUserExpiresRequest{} } +func (m *QueryUserExpiresRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUserExpiresRequest) ProtoMessage() {} +func (*QueryUserExpiresRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{14} +} +func (m *QueryUserExpiresRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserExpiresRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserExpiresRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserExpiresRequest.Merge(m, src) +} +func (m *QueryUserExpiresRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUserExpiresRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserExpiresRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserExpiresRequest proto.InternalMessageInfo + +func (m *QueryUserExpiresRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QueryUserExpiresRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryExpiresResponse is the response type for the Query/Expires RPC method +type QueryUserExpiresResponse struct { + Expiry int64 `protobuf:"varint,1,opt,name=expiry,proto3" json:"expiry,omitempty"` +} + +func (m *QueryUserExpiresResponse) Reset() { *m = QueryUserExpiresResponse{} } +func (m *QueryUserExpiresResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserExpiresResponse) ProtoMessage() {} +func (*QueryUserExpiresResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{15} +} +func (m *QueryUserExpiresResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserExpiresResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryUserExpiresResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserExpiresResponse.Merge(m, src) +} +func (m *QueryUserExpiresResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUserExpiresResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserExpiresResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserExpiresResponse proto.InternalMessageInfo + +func (m *QueryUserExpiresResponse) GetExpiry() int64 { + if m != nil { + return m.Expiry + } + return 0 +} + +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +type QueryHasUserRequest struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryHasUserRequest) Reset() { *m = QueryHasUserRequest{} } +func (m *QueryHasUserRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserRequest) ProtoMessage() {} +func (*QueryHasUserRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{16} +} +func (m *QueryHasUserRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHasUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHasUserRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHasUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserRequest.Merge(m, src) +} +func (m *QueryHasUserRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHasUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHasUserRequest proto.InternalMessageInfo + +func (m *QueryHasUserRequest) GetDenomId() string { + if m != nil { + return m.DenomId + } + return "" +} + +func (m *QueryHasUserRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +type QueryHasUserResponse struct { + HasUser bool `protobuf:"varint,1,opt,name=has_user,json=hasUser,proto3" json:"has_user,omitempty"` +} + +func (m *QueryHasUserResponse) Reset() { *m = QueryHasUserResponse{} } +func (m *QueryHasUserResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserResponse) ProtoMessage() {} +func (*QueryHasUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{17} +} +func (m *QueryHasUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHasUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHasUserResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryHasUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserResponse.Merge(m, src) +} +func (m *QueryHasUserResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHasUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHasUserResponse proto.InternalMessageInfo + +func (m *QueryHasUserResponse) GetHasUser() bool { + if m != nil { + return m.HasUser + } + return false +} + func init() { proto.RegisterType((*QuerySupplyRequest)(nil), "irismod.nft.QuerySupplyRequest") proto.RegisterType((*QuerySupplyResponse)(nil), "irismod.nft.QuerySupplyResponse") @@ -654,61 +948,80 @@ func init() { proto.RegisterType((*QueryDenomsResponse)(nil), "irismod.nft.QueryDenomsResponse") proto.RegisterType((*QueryNFTRequest)(nil), "irismod.nft.QueryNFTRequest") proto.RegisterType((*QueryNFTResponse)(nil), "irismod.nft.QueryNFTResponse") + proto.RegisterType((*QueryUserOfRequest)(nil), "irismod.nft.QueryUserOfRequest") + proto.RegisterType((*QueryUserOfResponse)(nil), "irismod.nft.QueryUserOfResponse") + proto.RegisterType((*QueryUserExpiresRequest)(nil), "irismod.nft.QueryUserExpiresRequest") + proto.RegisterType((*QueryUserExpiresResponse)(nil), "irismod.nft.QueryUserExpiresResponse") + proto.RegisterType((*QueryHasUserRequest)(nil), "irismod.nft.QueryHasUserRequest") + proto.RegisterType((*QueryHasUserResponse)(nil), "irismod.nft.QueryHasUserResponse") } func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } var fileDescriptor_ce02d034d3adf2e9 = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, - 0x1c, 0xed, 0xb4, 0xb4, 0xe0, 0xa0, 0x01, 0xa6, 0x08, 0xb5, 0xe2, 0xb6, 0x59, 0xfe, 0x8a, 0xb8, - 0x2b, 0x78, 0x30, 0xf1, 0xe0, 0xa1, 0x98, 0x1a, 0x2e, 0xa0, 0x95, 0x13, 0x31, 0x31, 0xdb, 0x76, - 0x5a, 0x1a, 0xbb, 0x33, 0x4b, 0x67, 0x56, 0xd3, 0x10, 0x62, 0x62, 0xbc, 0x9a, 0x90, 0x78, 0xf4, - 0x93, 0xf8, 0x0d, 0x38, 0x92, 0x78, 0xd0, 0x53, 0x63, 0x8a, 0x9f, 0x80, 0x4f, 0x60, 0x76, 0x66, - 0x96, 0xee, 0xba, 0x2d, 0x98, 0x86, 0xdb, 0xee, 0xce, 0x9b, 0xf7, 0xde, 0xbc, 0xdf, 0xfc, 0x7e, - 0x59, 0x38, 0x41, 0x6a, 0xdc, 0x3c, 0x70, 0x71, 0xab, 0x6d, 0x38, 0x2d, 0xca, 0x29, 0x1a, 0x6f, - 0xb4, 0x1a, 0xcc, 0xa6, 0x55, 0x83, 0xd4, 0x78, 0x76, 0xba, 0x4e, 0xeb, 0x54, 0x7c, 0x37, 0xbd, - 0x27, 0x09, 0xc9, 0xce, 0xd5, 0x29, 0xad, 0x37, 0xb1, 0x69, 0x39, 0x0d, 0xd3, 0x22, 0x84, 0x72, - 0x8b, 0x37, 0x28, 0x61, 0x6a, 0xf5, 0x96, 0xc7, 0x48, 0x6a, 0x5c, 0xbd, 0xae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f, 0x1c, - 0x15, 0x8a, 0x27, 0x5d, 0x0d, 0x9c, 0x76, 0x35, 0xf0, 0xbb, 0xab, 0x81, 0xe3, 0x33, 0x2d, 0x76, - 0x7a, 0xa6, 0xc5, 0x7e, 0x9d, 0x69, 0xb1, 0xbd, 0xb5, 0x7a, 0x83, 0xef, 0xbb, 0x65, 0xa3, 0x42, - 0x6d, 0x41, 0x46, 0x30, 0xbf, 0x20, 0xb5, 0x69, 0xd5, 0x6d, 0x62, 0x26, 0xc8, 0x79, 0xdb, 0xc1, - 0xac, 0x9c, 0x12, 0xbf, 0x17, 0x8f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x30, 0x83, 0x65, 0x31, - 0xed, 0x08, 0x00, 0x00, + // 983 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x6f, 0x1b, 0x45, + 0x18, 0xc6, 0xb3, 0x71, 0x62, 0xbb, 0x6f, 0x40, 0x69, 0x27, 0x69, 0xeb, 0x98, 0x62, 0x9b, 0x69, + 0x9b, 0xa6, 0x69, 0xba, 0xdb, 0xa4, 0x48, 0x48, 0x1c, 0x38, 0x38, 0xe0, 0x12, 0x21, 0x35, 0xb0, + 0x94, 0x4b, 0x85, 0x54, 0x6d, 0xe2, 0x59, 0xc7, 0xc2, 0x9e, 0xd9, 0x78, 0xc6, 0x80, 0x55, 0x45, + 0x48, 0xa8, 0x57, 0x44, 0x24, 0x8e, 0x7c, 0x12, 0xbe, 0x41, 0x8f, 0x95, 0xb8, 0x70, 0x8a, 0x50, + 0xc2, 0x1d, 0xa9, 0x9f, 0x00, 0xcd, 0x9f, 0xb5, 0x77, 0xb2, 0xeb, 0x14, 0xad, 0x7a, 0xf3, 0xee, + 0x3e, 0xf3, 0x3e, 0xbf, 0x79, 0xdf, 0x9d, 0x67, 0x0d, 0x8b, 0x34, 0x14, 0xde, 0xe1, 0x90, 0x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xd7, 0xd1, 0xda, 0xd8, 0x7d, 0x40, 0xa8, 0x08, 0x7a, 0x9e, 0x3c, 0x53, + 0x16, 0x80, 0x3e, 0x97, 0x47, 0xe8, 0x57, 0x07, 0x16, 0x12, 0x21, 0x90, 0xf5, 0x3a, 0xa7, 0x03, + 0x27, 0xeb, 0x75, 0xce, 0x48, 0x12, 0xfc, 0x50, 0xe1, 0xdc, 0x47, 0xf7, 0xce, 0xe3, 0x10, 0x2d, + 0xcc, 0x24, 0x7a, 0xe1, 0x40, 0xc9, 0x24, 0x03, 0xca, 0xd8, 0xb1, 0x9d, 0x3e, 0xd5, 0x0f, 0x2e, + 0x50, 0x18, 0x8a, 0x0f, 0x15, 0x85, 0x8b, 0x36, 0xce, 0x53, 0xc4, 0x61, 0x93, 0x85, 0xd1, 0x6c, + 0xbd, 0x3c, 0xad, 0x39, 0xaf, 0x4e, 0x6b, 0xce, 0xdf, 0xa7, 0x35, 0xe7, 0xf8, 0xac, 0x36, 0xf3, + 0xea, 0xac, 0x36, 0xf3, 0xd7, 0x59, 0x6d, 0xe6, 0xe9, 0x46, 0xa7, 0x2b, 0x0e, 0x86, 0x7b, 0xee, + 0x3e, 0xeb, 0xab, 0x8a, 0x94, 0x88, 0x71, 0xe5, 0x3e, 0x6b, 0x0f, 0x7b, 0x84, 0xab, 0xa1, 0x8b, + 0x51, 0x44, 0xf8, 0x5e, 0x51, 0xfd, 0xcd, 0x7e, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xda, + 0xc9, 0x53, 0xe6, 0xf5, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -735,6 +1048,12 @@ type QueryClient interface { Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) // NFT queries the NFT for the given denom and token ID NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) + // UserOf queries the user/renter of an NFT + UserOf(ctx context.Context, in *QueryUserOfRequest, opts ...grpc.CallOption) (*QueryUserOfResponse, error) + // UserOf queries the rental expiry of an NFT + UserExpires(ctx context.Context, in *QueryUserExpiresRequest, opts ...grpc.CallOption) (*QueryUserExpiresResponse, error) + // HasUser queries if an NFT has a user/renter + HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) } type queryClient struct { @@ -799,6 +1118,33 @@ func (c *queryClient) NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc return out, nil } +func (c *queryClient) UserOf(ctx context.Context, in *QueryUserOfRequest, opts ...grpc.CallOption) (*QueryUserOfResponse, error) { + out := new(QueryUserOfResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/UserOf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UserExpires(ctx context.Context, in *QueryUserExpiresRequest, opts ...grpc.CallOption) (*QueryUserExpiresResponse, error) { + out := new(QueryUserExpiresResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/UserExpires", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) { + out := new(QueryHasUserResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/HasUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Supply queries the total supply of a given denom or owner @@ -813,6 +1159,12 @@ type QueryServer interface { Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) // NFT queries the NFT for the given denom and token ID NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) + // UserOf queries the user/renter of an NFT + UserOf(context.Context, *QueryUserOfRequest) (*QueryUserOfResponse, error) + // UserOf queries the rental expiry of an NFT + UserExpires(context.Context, *QueryUserExpiresRequest) (*QueryUserExpiresResponse, error) + // HasUser queries if an NFT has a user/renter + HasUser(context.Context, *QueryHasUserRequest) (*QueryHasUserResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -837,6 +1189,15 @@ func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsReq func (*UnimplementedQueryServer) NFT(ctx context.Context, req *QueryNFTRequest) (*QueryNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented") } +func (*UnimplementedQueryServer) UserOf(ctx context.Context, req *QueryUserOfRequest) (*QueryUserOfResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserOf not implemented") +} +func (*UnimplementedQueryServer) UserExpires(ctx context.Context, req *QueryUserExpiresRequest) (*QueryUserExpiresResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserExpires not implemented") +} +func (*UnimplementedQueryServer) HasUser(ctx context.Context, req *QueryHasUserRequest) (*QueryHasUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HasUser not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -950,6 +1311,60 @@ func _Query_NFT_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +func _Query_UserOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserOfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserOf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/UserOf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserOf(ctx, req.(*QueryUserOfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UserExpires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserExpiresRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserExpires(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/UserExpires", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserExpires(ctx, req.(*QueryUserExpiresRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HasUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHasUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HasUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/HasUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HasUser(ctx, req.(*QueryHasUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.nft.Query", HandlerType: (*QueryServer)(nil), @@ -978,6 +1393,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NFT", Handler: _Query_NFT_Handler, }, + { + MethodName: "UserOf", + Handler: _Query_UserOf_Handler, + }, + { + MethodName: "UserExpires", + Handler: _Query_UserExpires_Handler, + }, + { + MethodName: "HasUser", + Handler: _Query_HasUser_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nft/query.proto", @@ -1454,19 +1881,221 @@ func (m *QueryNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *QueryUserOfRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QuerySupplyRequest) Size() (n int) { - if m == nil { + +func (m *QueryUserOfRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserOfResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUserOfResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserExpiresRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUserExpiresRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserExpiresResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryUserExpiresResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiry != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Expiry)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryHasUserRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryHasUserRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHasUserResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryHasUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HasUser { + i-- + if m.HasUser { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QuerySupplyRequest) Size() (n int) { + if m == nil { return 0 } var l int @@ -1654,6 +2283,94 @@ func (m *QueryNFTResponse) Size() (n int) { return n } +func (m *QueryUserOfRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserOfResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserExpiresRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserExpiresResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Expiry != 0 { + n += 1 + sovQuery(uint64(m.Expiry)) + } + return n +} + +func (m *QueryHasUserRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHasUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HasUser { + n += 2 + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2929,6 +3646,569 @@ func (m *QueryNFTResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryUserOfRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserOfRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUserOfResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserOfResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUserExpiresRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserExpiresRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryUserExpiresResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryUserExpiresResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) + } + m.Expiry = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expiry |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHasUserRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHasUserRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryHasUserResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryHasUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasUser", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasUser = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/nft/types/query.pb.gw.go b/modules/nft/types/query.pb.gw.go index 30ff7df3..e2ef4cfd 100644 --- a/modules/nft/types/query.pb.gw.go +++ b/modules/nft/types/query.pb.gw.go @@ -379,6 +379,234 @@ func local_request_Query_NFT_0(ctx context.Context, marshaler runtime.Marshaler, } +func request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserOfRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.UserOf(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserOfRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.UserOf(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.UserExpires(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.UserExpires(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.HasUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["denom_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") + } + + protoReq.DenomId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.HasUser(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -523,6 +751,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_UserOf_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UserOf_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserOf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UserExpires_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_UserExpires_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserExpires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_HasUser_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -684,6 +981,66 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_UserOf_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UserOf_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserOf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UserExpires_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_UserExpires_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_UserExpires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_HasUser_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -699,6 +1056,12 @@ var ( pattern_Query_Denoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"irismod", "nft", "denoms"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "nft", "nfts", "denom_id", "token_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UserOf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UserExpires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -713,4 +1076,10 @@ var ( forward_Query_Denoms_0 = runtime.ForwardResponseMessage forward_Query_NFT_0 = runtime.ForwardResponseMessage + + forward_Query_UserOf_0 = runtime.ForwardResponseMessage + + forward_Query_UserExpires_0 = runtime.ForwardResponseMessage + + forward_Query_HasUser_0 = runtime.ForwardResponseMessage ) diff --git a/modules/nft/types/rental.pb.go b/modules/nft/types/rental.pb.go new file mode 100644 index 00000000..a0aef9ba --- /dev/null +++ b/modules/nft/types/rental.pb.go @@ -0,0 +1,570 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: nft/rental.proto + +package types + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// RentalPlugin is denom-level rental config +type RentalPlugin struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"irismod:4907:enabled"` +} + +func (m *RentalPlugin) Reset() { *m = RentalPlugin{} } +func (m *RentalPlugin) String() string { return proto.CompactTextString(m) } +func (*RentalPlugin) ProtoMessage() {} +func (*RentalPlugin) Descriptor() ([]byte, []int) { + return fileDescriptor_e57beeaf512eaaa2, []int{0} +} +func (m *RentalPlugin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RentalPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RentalPlugin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RentalPlugin) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalPlugin.Merge(m, src) +} +func (m *RentalPlugin) XXX_Size() int { + return m.Size() +} +func (m *RentalPlugin) XXX_DiscardUnknown() { + xxx_messageInfo_RentalPlugin.DiscardUnknown(m) +} + +var xxx_messageInfo_RentalPlugin proto.InternalMessageInfo + +func (m *RentalPlugin) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + +// RentalInfo is token-level rental info +type RentalInfo struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"irismod:4907:user"` + Expiry int64 `protobuf:"varint,2,opt,name=expiry,proto3" json:"irismod:4907:expiry"` +} + +func (m *RentalInfo) Reset() { *m = RentalInfo{} } +func (m *RentalInfo) String() string { return proto.CompactTextString(m) } +func (*RentalInfo) ProtoMessage() {} +func (*RentalInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e57beeaf512eaaa2, []int{1} +} +func (m *RentalInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RentalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RentalInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RentalInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalInfo.Merge(m, src) +} +func (m *RentalInfo) XXX_Size() int { + return m.Size() +} +func (m *RentalInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RentalInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RentalInfo proto.InternalMessageInfo + +func (m *RentalInfo) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +func (m *RentalInfo) GetExpiry() int64 { + if m != nil { + return m.Expiry + } + return 0 +} + +func init() { + proto.RegisterType((*RentalPlugin)(nil), "irismod.nft.RentalPlugin") + proto.RegisterType((*RentalInfo)(nil), "irismod.nft.RentalInfo") +} + +func init() { proto.RegisterFile("nft/rental.proto", fileDescriptor_e57beeaf512eaaa2) } + +var fileDescriptor_e57beeaf512eaaa2 = []byte{ + // 260 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4b, 0x2b, 0xd1, + 0x2f, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 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0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0xe6, 0xe4, 0xa5, 0x96, 0xe8, 0x43, 0xcd, + 0xd3, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0xd6, 0x07, 0x85, 0x55, 0x49, 0x65, 0x41, 0x6a, + 0x71, 0x12, 0x1b, 0x38, 0x20, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x66, 0xc0, 0x43, 0x4e, + 0x3f, 0x01, 0x00, 0x00, +} + +func (this *RentalPlugin) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RentalPlugin) + if !ok { + that2, ok := that.(RentalPlugin) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Enabled != that1.Enabled { + return false + } + return true +} +func (this *RentalInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RentalInfo) + if !ok { + that2, ok := that.(RentalInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.User != that1.User { + return false + } + if this.Expiry != that1.Expiry { + return false + } + return true +} +func (m *RentalPlugin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RentalPlugin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RentalPlugin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *RentalInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RentalInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expiry != 0 { + i = encodeVarintRental(dAtA, i, uint64(m.Expiry)) + i-- + dAtA[i] = 0x10 + } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintRental(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRental(dAtA []byte, offset int, v uint64) int { + offset -= sovRental(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RentalPlugin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Enabled { + n += 2 + } + return n +} + +func (m *RentalInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovRental(uint64(l)) + } + if m.Expiry != 0 { + n += 1 + sovRental(uint64(m.Expiry)) + } + return n +} + +func sovRental(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRental(x uint64) (n int) { + return sovRental(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RentalPlugin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RentalPlugin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RentalPlugin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRental(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRental + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RentalInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RentalInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RentalInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRental + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRental + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) + } + m.Expiry = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expiry |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRental(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRental + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRental(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRental + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRental + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowRental + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthRental + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRental + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRental + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRental = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRental = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRental = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/nft/types/tx.pb.go b/modules/nft/types/tx.pb.go index 01772340..168e7171 100644 --- a/modules/nft/types/tx.pb.go +++ b/modules/nft/types/tx.pb.go @@ -6,16 +6,15 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/gogo/protobuf/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -77,7 +76,7 @@ func (m *MsgIssueDenom) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo -// MsgIssueDenomResponse defines the Msg/SaveDenom response type. +// MsgIssueDenomResponse defines the Msg/IssueDenom response type. type MsgIssueDenomResponse struct { } @@ -240,7 +239,7 @@ func (m *MsgEditNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEditNFT proto.InternalMessageInfo -// MsgEditNFTResponse defines the Msg/UpdateNFT response type. +// MsgEditNFTResponse defines the Msg/EditNFT response type. type MsgEditNFTResponse struct { } @@ -322,7 +321,7 @@ func (m *MsgMintNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo -// MsgMintNFTResponse defines the Msg/SaveNFT response type. +// MsgMintNFTResponse defines the Msg/MintNFT response type. type MsgMintNFTResponse struct { } @@ -399,7 +398,7 @@ func (m *MsgBurnNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo -// MsgBurnNFTResponse defines the Msg/RemoveNFT response type. +// MsgBurnNFTResponse defines the Msg/BurnNFT response type. type MsgBurnNFTResponse struct { } @@ -514,6 +513,85 @@ func (m *MsgTransferDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgTransferDenomResponse proto.InternalMessageInfo +// MsgSetUser defines the Msg/SetUser response type. +type MsgSetUser struct { + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` + Expiry int64 `protobuf:"varint,4,opt,name=expiry,proto3" json:"expiry,omitempty"` + Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgSetUser) Reset() { *m = MsgSetUser{} } +func (m *MsgSetUser) String() string { return proto.CompactTextString(m) } +func (*MsgSetUser) ProtoMessage() {} +func (*MsgSetUser) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{12} +} +func (m *MsgSetUser) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUser.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetUser) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUser.Merge(m, src) +} +func (m *MsgSetUser) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUser) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUser.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUser proto.InternalMessageInfo + +// MsgSetUserResponse defines the Msg/SetUser response type. +type MsgSetUserResponse struct { +} + +func (m *MsgSetUserResponse) Reset() { *m = MsgSetUserResponse{} } +func (m *MsgSetUserResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetUserResponse) ProtoMessage() {} +func (*MsgSetUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{13} +} +func (m *MsgSetUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUserResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSetUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUserResponse.Merge(m, src) +} +func (m *MsgSetUserResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUserResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgIssueDenom)(nil), "irismod.nft.MsgIssueDenom") proto.RegisterType((*MsgIssueDenomResponse)(nil), "irismod.nft.MsgIssueDenomResponse") @@ -527,53 +605,60 @@ func init() { proto.RegisterType((*MsgBurnNFTResponse)(nil), "irismod.nft.MsgBurnNFTResponse") proto.RegisterType((*MsgTransferDenom)(nil), "irismod.nft.MsgTransferDenom") proto.RegisterType((*MsgTransferDenomResponse)(nil), "irismod.nft.MsgTransferDenomResponse") + proto.RegisterType((*MsgSetUser)(nil), "irismod.nft.MsgSetUser") + proto.RegisterType((*MsgSetUserResponse)(nil), "irismod.nft.MsgSetUserResponse") } func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } var fileDescriptor_09d30374d974e015 = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xe3, 0x36, 0x3f, 0x13, 0xfa, 0xc3, 0x52, 0xda, 0x6d, 0x00, 0xa7, 0x0a, 0x42, 0x54, - 0x02, 0x25, 0x12, 0xdc, 0x7a, 0x0c, 0x3f, 0xa2, 0x88, 0x80, 0x64, 0xb5, 0x17, 0x0e, 0x54, 0x6e, - 0x76, 0xeb, 0x2c, 0xaa, 0xd7, 0xd1, 0xee, 0x5a, 0xa2, 0x6f, 0xc1, 0x23, 0xf0, 0x1c, 0x3c, 0x41, - 0xc5, 0xa9, 0x47, 0x4e, 0x15, 0xa4, 0x12, 0x42, 0x1c, 0x79, 0x02, 0xe4, 0xb5, 0x9d, 0xac, 0x9d, - 0xa6, 0x27, 0x0e, 0x88, 0xdb, 0xee, 0xf7, 0x4d, 0x66, 0xe6, 0xfb, 0x66, 0x33, 0x86, 0x6b, 0xfc, - 0x48, 0x75, 0xd5, 0x87, 0xce, 0x48, 0x84, 0x2a, 0x44, 0x0d, 0x26, 0x98, 0x0c, 0x42, 0xd2, 0xe1, - 0x47, 0xaa, 0xb9, 0xe6, 0x87, 0x7e, 0xa8, 0xf1, 0x6e, 0x7c, 0x4a, 0x42, 0xda, 0x9f, 0xcb, 0xb0, - 0xd4, 0x97, 0xfe, 0xae, 0x94, 0x11, 0x7d, 0x4a, 0x79, 0x18, 0xa0, 0x65, 0x28, 0x33, 0x82, 0xad, - 0x2d, 0x6b, 0xbb, 0xee, 0x96, 0x19, 0x41, 0x08, 0x16, 0xb8, 0x17, 0x50, 0x5c, 0xd6, 0x88, 0x3e, - 0xa3, 0x75, 0xa8, 0xc8, 0xc1, 0x90, 0x06, 0x1e, 0xb6, 0x35, 0x9a, 0xde, 0x34, 0x4e, 0x39, 0xa1, - 0x02, 0x2f, 0xa4, 0xb8, 0xbe, 0x69, 0xfc, 0x24, 0x38, 0x0c, 0x8f, 0xf1, 0x62, 0x8a, 0xeb, 0x1b, - 0xba, 0x0f, 0x2b, 0x01, 0xe3, 0xea, 0x40, 0x50, 0xa9, 0x04, 0x1b, 0x28, 0x4a, 0x70, 0x65, 0xcb, - 0xda, 0xae, 0xb9, 0xcb, 0x31, 0xec, 0x4e, 0x50, 0xf4, 0x00, 0xae, 0x47, 0x23, 0xe2, 0x29, 0x6a, - 0x86, 0x56, 0x75, 0xe8, 0x6a, 0x42, 0x18, 0xc1, 0x5b, 0xd0, 0x20, 0x54, 0x0e, 0x04, 0x1b, 0x29, - 0x16, 0x72, 0x5c, 0xd3, 0x25, 0x4d, 0x08, 0xad, 0x82, 0x1d, 0x09, 0x86, 0xeb, 0x9a, 0x89, 0x8f, - 0x68, 0x13, 0x6a, 0x91, 0x60, 0x07, 0x43, 0x4f, 0x0e, 0x31, 0x68, 0xb8, 0x1a, 0x09, 0xf6, 0xc2, - 0x93, 0xc3, 0xd8, 0x00, 0xe2, 0x29, 0x0f, 0x37, 0x12, 0x03, 0xe2, 0xf3, 0xce, 0xc2, 0xcf, 0x4f, - 0x2d, 0xab, 0xbd, 0x01, 0x37, 0x73, 0xde, 0xb9, 0x54, 0x8e, 0x42, 0x2e, 0x69, 0xfb, 0x97, 0x05, - 0xcb, 0x7d, 0xe9, 0xef, 0x09, 0x8f, 0xcb, 0x23, 0x2a, 0x5e, 0x3f, 0xdf, 0x9b, 0xb1, 0xb5, 0x03, - 0x35, 0x12, 0xff, 0xe6, 0x80, 0x91, 0xc4, 0xda, 0xde, 0x8d, 0xdf, 0xe7, 0xad, 0x95, 0x13, 0x2f, - 0x38, 0xde, 0x69, 0x67, 0x4c, 0xdb, 0xad, 0xea, 0xe3, 0xee, 0x74, 0x0c, 0xb6, 0x31, 0x86, 0xcd, - 0x44, 0x86, 0xf6, 0xba, 0x57, 0x1d, 0x9f, 0xb7, 0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, 0x90, - 0xcd, 0xbb, 0x57, 0x90, 0x66, 0x57, 0xd9, 0x5b, 0x99, 0xe9, 0x2a, 0x25, 0x66, 0xbb, 0x2a, 0x4c, - 0x1c, 0xed, 0xc3, 0x52, 0x7e, 0xdc, 0x77, 0xe6, 0x95, 0x4e, 0x3c, 0xbf, 0x77, 0x25, 0x9d, 0xa5, - 0xed, 0xbd, 0x3c, 0xfd, 0xee, 0x94, 0x4e, 0xc7, 0x8e, 0x75, 0x36, 0x76, 0xac, 0x6f, 0x63, 0xc7, - 0xfa, 0x78, 0xe1, 0x94, 0xce, 0x2e, 0x9c, 0xd2, 0xd7, 0x0b, 0xa7, 0xf4, 0xf6, 0xa1, 0xcf, 0xd4, - 0x30, 0x3a, 0xec, 0x0c, 0xc2, 0xa0, 0x1b, 0xa7, 0xe3, 0x54, 0x75, 0xd3, 0xb4, 0xdd, 0x20, 0x24, - 0xd1, 0x31, 0x95, 0x5d, 0xfd, 0xe5, 0x3d, 0x19, 0x51, 0x79, 0x58, 0xd1, 0x9f, 0xd6, 0xc7, 0x7f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x33, 0x0c, 0x0e, 0x8d, 0x07, 0x00, 0x00, + // 726 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xe3, 0xfc, 0xde, 0x7c, 0xfd, 0xf9, 0x86, 0xfe, 0xb8, 0x01, 0x92, 0x2a, 0x08, 0x51, + 0x09, 0x94, 0x48, 0xb0, 0xeb, 0x32, 0x50, 0x44, 0x11, 0x01, 0xc9, 0xb4, 0x1b, 0x16, 0x54, 0x6e, + 0x3c, 0x49, 0x06, 0xd5, 0xe3, 0x68, 0x66, 0x2c, 0x35, 0x5b, 0x9e, 0x00, 0xde, 0x80, 0xe7, 0xe0, + 0x09, 0xba, 0xec, 0x92, 0x55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 0xc1, 0x0c, 0x18, 0xb1, 0xaa, + 0x92, 0x09, 0x97, 0x68, 0x0b, 0x2a, 0x01, 0x23, 0x47, 0x23, 0x87, 0x8f, 0x2c, 0x90, 0x70, 0x39, + 0x60, 0xe4, 0x99, 0xc3, 0x47, 0x61, 0x00, 0xae, 0x23, 0x1c, 0xab, 0x16, 0x05, 0x10, 0xae, 0x77, + 0x0b, 0x3f, 0x3e, 0x35, 0x8d, 0xd6, 0x26, 0xac, 0xa7, 0xb2, 0xb3, 0x31, 0x1f, 0xfb, 0x94, 0xe3, + 0xd6, 0x4f, 0x03, 0x96, 0x7b, 0x7c, 0x78, 0xc0, 0x1c, 0xca, 0x07, 0x98, 0xbd, 0x7c, 0x7a, 0x90, + 0x89, 0xb5, 0x0d, 0x15, 0x37, 0xfc, 0x9b, 0x23, 0xe2, 0x46, 0xd1, 0x76, 0x6f, 0xfc, 0xba, 0x68, + 0xae, 0x4c, 0x1c, 0xef, 0x64, 0xb7, 0x15, 0x33, 0x2d, 0xbb, 0x2c, 0x97, 0xfb, 0xb3, 0x36, 0x98, + 0x5a, 0x1b, 0xb6, 0x22, 0x1b, 0x32, 0xeb, 0x6e, 0x79, 0x7a, 0xd1, 0x34, 0x0f, 0xed, 0xfd, 0xc8, + 0x4f, 0x2c, 0xba, 0x38, 0x13, 0xad, 0x75, 0xa7, 0x94, 0xea, 0xce, 0x2d, 0xa8, 0x32, 0xdc, 0x27, + 0x63, 0x82, 0xa9, 0x90, 0xa1, 0x56, 0xed, 0x19, 0x90, 0x4a, 0xa6, 0x92, 0x4a, 0x46, 0xa5, 0x60, + 0xc1, 0x46, 0xda, 0x6b, 0x12, 0xc3, 0x99, 0x01, 0xd0, 0xe3, 0xc3, 0x3d, 0x97, 0x88, 0xbf, 0x3c, + 0x02, 0xdd, 0x64, 0xf9, 0x2a, 0x93, 0x6b, 0x80, 0x66, 0x4e, 0x12, 0x83, 0xdf, 0x23, 0x83, 0x3d, + 0x42, 0xc5, 0xbf, 0xd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, 0x1d, 0xc2, 0x52, 0x7a, 0x12, 0x6f, + 0x2f, 0xba, 0x3a, 0xca, 0xfc, 0xee, 0xb5, 0x74, 0x52, 0x76, 0x0f, 0xca, 0xf1, 0x8c, 0x65, 0xb4, + 0x29, 0x22, 0xab, 0x6d, 0x6e, 0x22, 0x5a, 0xb9, 0xee, 0xf3, 0xb3, 0x6f, 0x8d, 0xdc, 0xd9, 0xb4, + 0x61, 0x9c, 0x4f, 0x1b, 0xc6, 0xd7, 0x69, 0xc3, 0xf8, 0x70, 0xd9, 0xc8, 0x9d, 0x5f, 0x36, 0x72, + 0x5f, 0x2e, 0x1b, 0xb9, 0x37, 0x0f, 0x86, 0x44, 0x8c, 0x82, 0xe3, 0x76, 0xdf, 0xf7, 0x3a, 0x61, + 0x29, 0x8a, 0x45, 0x47, 0x95, 0xec, 0x78, 0xbe, 0x1b, 0x9c, 0x60, 0xde, 0x91, 0xdf, 0x16, 0x93, + 0x31, 0xe6, 0xc7, 0x25, 0xf9, 0xf1, 0xf0, 0xe8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x6a, + 0xee, 0xb6, 0x6f, 0x08, 0x00, 0x00, } func (this *MsgIssueDenom) Equal(that interface{}) bool { @@ -847,6 +932,8 @@ type MsgClient interface { BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) // TransferDenom defines a method for transferring a denom. TransferDenom(ctx context.Context, in *MsgTransferDenom, opts ...grpc.CallOption) (*MsgTransferDenomResponse, error) + // SetUser defines a method for set user for an NFT. + SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) } type msgClient struct { @@ -859,7 +946,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...grpc.CallOption) (*MsgIssueDenomResponse, error) { out := new(MsgIssueDenomResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SaveDenom", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/IssueDenom", in, out, opts...) if err != nil { return nil, err } @@ -868,7 +955,7 @@ func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...g func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) { out := new(MsgMintNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SaveNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/MintNFT", in, out, opts...) if err != nil { return nil, err } @@ -877,7 +964,7 @@ func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.Ca func (c *msgClient) EditNFT(ctx context.Context, in *MsgEditNFT, opts ...grpc.CallOption) (*MsgEditNFTResponse, error) { out := new(MsgEditNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/UpdateNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/EditNFT", in, out, opts...) if err != nil { return nil, err } @@ -895,7 +982,7 @@ func (c *msgClient) TransferNFT(ctx context.Context, in *MsgTransferNFT, opts .. func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) { out := new(MsgBurnNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/RemoveNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/BurnNFT", in, out, opts...) if err != nil { return nil, err } @@ -911,6 +998,15 @@ func (c *msgClient) TransferDenom(ctx context.Context, in *MsgTransferDenom, opt return out, nil } +func (c *msgClient) SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) { + out := new(MsgSetUserResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // IssueDenom defines a method for issue a denom. @@ -925,6 +1021,8 @@ type MsgServer interface { BurnNFT(context.Context, *MsgBurnNFT) (*MsgBurnNFTResponse, error) // TransferDenom defines a method for transferring a denom. TransferDenom(context.Context, *MsgTransferDenom) (*MsgTransferDenomResponse, error) + // SetUser defines a method for set user for an NFT. + SetUser(context.Context, *MsgSetUser) (*MsgSetUserResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -932,23 +1030,26 @@ type UnimplementedMsgServer struct { } func (*UnimplementedMsgServer) IssueDenom(ctx context.Context, req *MsgIssueDenom) (*MsgIssueDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveDenom not implemented") + return nil, status.Errorf(codes.Unimplemented, "method IssueDenom not implemented") } func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*MsgMintNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method MintNFT not implemented") } func (*UnimplementedMsgServer) EditNFT(ctx context.Context, req *MsgEditNFT) (*MsgEditNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method EditNFT not implemented") } func (*UnimplementedMsgServer) TransferNFT(ctx context.Context, req *MsgTransferNFT) (*MsgTransferNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferNFT not implemented") } func (*UnimplementedMsgServer) BurnNFT(ctx context.Context, req *MsgBurnNFT) (*MsgBurnNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method BurnNFT not implemented") } func (*UnimplementedMsgServer) TransferDenom(ctx context.Context, req *MsgTransferDenom) (*MsgTransferDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferDenom not implemented") } +func (*UnimplementedMsgServer) SetUser(ctx context.Context, req *MsgSetUser) (*MsgSetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -964,7 +1065,7 @@ func _Msg_IssueDenom_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/SaveDenom", + FullMethod: "/irismod.nft.Msg/IssueDenom", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).IssueDenom(ctx, req.(*MsgIssueDenom)) @@ -982,7 +1083,7 @@ func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/SaveNFT", + FullMethod: "/irismod.nft.Msg/MintNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) @@ -1000,7 +1101,7 @@ func _Msg_EditNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/UpdateNFT", + FullMethod: "/irismod.nft.Msg/EditNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).EditNFT(ctx, req.(*MsgEditNFT)) @@ -1036,7 +1137,7 @@ func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/RemoveNFT", + FullMethod: "/irismod.nft.Msg/BurnNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) @@ -1062,20 +1163,38 @@ func _Msg_TransferDenom_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetUser) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Msg/SetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetUser(ctx, req.(*MsgSetUser)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.nft.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "SaveDenom", + MethodName: "IssueDenom", Handler: _Msg_IssueDenom_Handler, }, { - MethodName: "SaveNFT", + MethodName: "MintNFT", Handler: _Msg_MintNFT_Handler, }, { - MethodName: "UpdateNFT", + MethodName: "EditNFT", Handler: _Msg_EditNFT_Handler, }, { @@ -1083,13 +1202,17 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_TransferNFT_Handler, }, { - MethodName: "RemoveNFT", + MethodName: "BurnNFT", Handler: _Msg_BurnNFT_Handler, }, { MethodName: "TransferDenom", Handler: _Msg_TransferDenom_Handler, }, + { + MethodName: "SetUser", + Handler: _Msg_SetUser_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nft/tx.proto", @@ -1657,6 +1780,85 @@ func (m *MsgTransferDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgSetUser) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetUser) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if m.Expiry != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Expiry)) + i-- + dAtA[i] = 0x20 + } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintTx(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0x1a + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetUserResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSetUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1934,6 +2136,43 @@ func (m *MsgTransferDenomResponse) Size() (n int) { return n } +func (m *MsgSetUser) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.DenomId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.User) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Expiry != 0 { + n += 1 + sovTx(uint64(m.Expiry)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3796,6 +4035,253 @@ func (m *MsgTransferDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSetUser) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetUser: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUser: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.DenomId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) + } + m.Expiry = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expiry |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetUserResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSetUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index c1163cce..30d27ef7 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package irismod.nft; import "gogoproto/gogo.proto"; +import "nft/rental.proto"; option go_package = "github.com/irisnet/irismod/modules/nft/types"; option (gogoproto.goproto_getters_all) = false; @@ -18,11 +19,18 @@ message BaseNFT { string uri_hash = 6; } +message PluginInfo { + // RoyaltyInfo royaltyInfo = 1 [] ; + RentalInfo rentalInfo = 2 [ (gogoproto.jsontag) = "irismod:4907" ]; +} + message NFTMetadata { option (gogoproto.equal) = true; string name = 1; string data = 2; + // RoyaltyInfo royaltyInfo = 3 []; + RentalInfo rentalInfo = 4 [ (gogoproto.jsontag) = "irismod:4907" ]; } // Denom defines a type of NFT @@ -42,6 +50,18 @@ message Denom { string data = 11; } +// The message is an intermediate struct for composing user data and plugin +// config +message DenomComposedData { + string userData = 1; + DenomPlugin denomPlugin = 2; +} + +message DenomPlugin { + // RoyaltyPlugin royaltyPlugin = 1 [] ; + RentalPlugin rentalPlugin = 2 [ (gogoproto.jsontag) = "irismod:4907" ]; +} + message DenomMetadata { option (gogoproto.equal) = true; @@ -50,6 +70,9 @@ message DenomMetadata { bool mint_restricted = 3; bool update_restricted = 4; string data = 5; + + // RoyaltyPlugin royaltyPlugin = 6 []; + RentalPlugin rentalPlugin = 7 [ (gogoproto.jsontag) = "irismod:4907" ]; } // IDCollection defines a type of collection with specified ID diff --git a/proto/nft/query.proto b/proto/nft/query.proto index 912d5d8b..82f700cb 100644 --- a/proto/nft/query.proto +++ b/proto/nft/query.proto @@ -39,6 +39,25 @@ service Query { rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) { option (google.api.http).get = "/irismod/nft/nfts/{denom_id}/{token_id}"; } + + // Rental Plugin Query Service + + // UserOf queries the user/renter of an NFT + rpc UserOf(QueryUserOfRequest) returns (QueryUserOfResponse) { + option (google.api.http).get = "/irismod/rental/user/{denom_id}/{nft_id}"; + } + + // UserOf queries the rental expiry of an NFT + rpc UserExpires(QueryUserExpiresRequest) returns (QueryUserExpiresResponse) { + option (google.api.http).get = + "/irismod/rental/expires/{denom_id}/{nft_id}"; + } + + // HasUser queries if an NFT has a user/renter + rpc HasUser(QueryHasUserRequest) returns (QueryHasUserResponse) { + option (google.api.http).get = + "/irismod/rental/has_user/{denom_id}/{nft_id}"; + } } // QuerySupplyRequest is the request type for the Query/HTLC RPC method @@ -109,4 +128,33 @@ message QueryNFTRequest { } // QueryNFTResponse is the response type for the Query/NFT RPC method -message QueryNFTResponse { BaseNFT nft = 1 [ (gogoproto.customname) = "NFT" ]; } \ No newline at end of file +message QueryNFTResponse { BaseNFT nft = 1 [ (gogoproto.customname) = "NFT" ]; } + +// Rental Plugin Query Message Definition + +// QueryUserOfRequest is the request type for the Query/Renter RPC method +message QueryUserOfRequest { + string denom_id = 1; + string nft_id = 2; +} + +// QueryUserOfResponse is the response type for the Query/Renter RPC method +message QueryUserOfResponse { string user = 1; } + +// QueryExpiresRequest is the request type for the Query/Expires RPC method +message QueryUserExpiresRequest { + string denom_id = 1; + string nft_id = 2; +} + +// QueryExpiresResponse is the response type for the Query/Expires RPC method +message QueryUserExpiresResponse { int64 expiry = 1; } + +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +message QueryHasUserRequest { + string denom_id = 1; + string nft_id = 2; +} + +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +message QueryHasUserResponse { bool has_user = 1; } \ No newline at end of file diff --git a/proto/nft/rental.proto b/proto/nft/rental.proto new file mode 100644 index 00000000..ee28f069 --- /dev/null +++ b/proto/nft/rental.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package irismod.nft; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/irismod/modules/nft/types"; + +// RentalPlugin is denom-level rental config +message RentalPlugin { + option (gogoproto.equal) = true; + + bool enabled = 1 [ (gogoproto.jsontag) = "irismod:4907:enabled" ]; +} + +// RentalInfo is token-level rental info +message RentalInfo { + option (gogoproto.equal) = true; + + string user = 1 [ (gogoproto.jsontag) = "irismod:4907:user" ]; + int64 expiry = 2 [ (gogoproto.jsontag) = "irismod:4907:expiry" ]; +} \ No newline at end of file diff --git a/proto/nft/tx.proto b/proto/nft/tx.proto index a4a49282..763cd846 100644 --- a/proto/nft/tx.proto +++ b/proto/nft/tx.proto @@ -25,6 +25,11 @@ service Msg { // TransferDenom defines a method for transferring a denom. rpc TransferDenom(MsgTransferDenom) returns (MsgTransferDenomResponse); + + // Rental Plugin Service + + // SetUser defines a method for set user for an NFT. + rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} } // MsgIssueDenom defines an SDK message for creating a new denom. @@ -120,3 +125,15 @@ message MsgTransferDenom { // MsgTransferDenomResponse defines the Msg/TransferDenom response type. message MsgTransferDenomResponse {} + +// MsgSetUser defines the Msg/SetUser response type. +message MsgSetUser { + string denom_id = 1; + string nft_id = 2; + string user = 3; + int64 expiry = 4; + string sender = 5; +} + +// MsgSetUserResponse defines the Msg/SetUser response type. +message MsgSetUserResponse {} \ No newline at end of file diff --git a/simapp/app.go b/simapp/app.go index c63d0c3e..9daa29ac 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -115,7 +115,6 @@ import ( "github.com/irisnet/irismod/modules/token" tokenkeeper "github.com/irisnet/irismod/modules/token/keeper" tokentypes "github.com/irisnet/irismod/modules/token/types" - // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" )