Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initialize module x/nft #9174

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions proto/cosmos/nft/v1beta1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package cosmos.nft.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft/types";

// GenesisState defines the NFT module's genesis state
message GenesisState {
repeated google.protobuf.Any nfts = 1 [(cosmos_proto.accepts_interface) = "NFTI", (gogoproto.customname) = "NFTs"];
}
19 changes: 19 additions & 0 deletions proto/cosmos/nft/v1beta1/nft.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
syntax = "proto3";
package cosmos.nft.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft/types";
option (gogoproto.goproto_getters_all) = false;

// BaseNFT defines a base NFT type.
message BaseNFT {
option (gogoproto.equal) = true;

string id = 1;
string name = 2;
string uri = 3 [(gogoproto.customname) = "URI"];
string data = 4;
string owner = 5;
}
46 changes: 46 additions & 0 deletions proto/cosmos/nft/v1beta1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
syntax = "proto3";
package cosmos.nft.v1beta1;

import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-sdk/x/nft/types";

// Query defines the gRPC querier service for NFT module
service Query {

// NFT queries NFT details based on id.
rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts/{id}";
}

// NFTs queries all proposals based on the optional onwer.
rpc NFTs(QueryNFTsRequest) returns (QueryNFTsResponse) {
option (google.api.http).get = "/cosmos/nft/v1beta1/nfts";
}
}

// QueryNFTRequest is the request type for the Query/NFT RPC method
message QueryNFTRequest {
string id = 1;
}

// QueryNFTResponse is the response type for the Query/NFT RPC method
message QueryNFTResponse {
google.protobuf.Any nft = 1 [(cosmos_proto.accepts_interface) = "NFTI", (gogoproto.customname) = "NFT"];
}

// QueryNFTsRequest is the request type for the Query/NFTs RPC method
message QueryNFTsRequest {
string owner = 1;
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryNFTsResponse is the response type for the Query/NFTs RPC method
message QueryNFTsResponse {
repeated google.protobuf.Any nfts = 1 [(cosmos_proto.accepts_interface) = "NFTI", (gogoproto.customname) = "NFTs"];
cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
11 changes: 11 additions & 0 deletions x/nft/types/nft.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// NFTI is an interface used to store NFTs at a given id and owner.
type NFTI interface {
GetId() string // can not return empty string.
GetOwner() sdk.AccAddress
}