diff --git a/app/app.go b/app/app.go index 71b86b7..a17dc00 100644 --- a/app/app.go +++ b/app/app.go @@ -7,6 +7,8 @@ import ( "os" "path/filepath" + "github.com/cosmos/cosmos-sdk/x/nft" + "github.com/cosmos/cosmos-sdk/x/consensus" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" @@ -160,6 +162,7 @@ var ( govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, onfttypes.ModuleName: nil, + nft.ModuleName: nil, } ) diff --git a/exported/onft.go b/exported/onft.go index bc922fe..05d1046 100644 --- a/exported/onft.go +++ b/exported/onft.go @@ -14,6 +14,7 @@ type ONFTI interface { GetName() string GetDescription() string GetMediaURI() string + GetURIHash() string GetPreviewURI() string GetData() string IsTransferable() bool diff --git a/genesis.go b/genesis.go index 75715cb..61c1931 100644 --- a/genesis.go +++ b/genesis.go @@ -22,7 +22,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) { } func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - return types.NewGenesisState(k.GetCollections(ctx), k.GetParams(ctx)) + collections, err := k.GetCollections(ctx) + if err != nil { + panic(err.Error()) + } + return types.NewGenesisState(collections, k.GetParams(ctx)) } func DefaultGenesisState() *types.GenesisState { diff --git a/go.mod b/go.mod index 0fb83e0..7fa33f4 100644 --- a/go.mod +++ b/go.mod @@ -1,37 +1,39 @@ module github.com/OmniFlix/onft -go 1.20 +go 1.21 require ( cosmossdk.io/api v0.3.1 - cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.1 + cosmossdk.io/errors v1.0.0 + cosmossdk.io/math v1.1.2 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-sdk v0.47.3 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/cosmos-sdk v0.47.5 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.0 github.com/golang/protobuf v1.5.3 github.com/google/uuid v1.3.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 + github.com/pkg/errors v0.9.1 github.com/spf13/cast v1.5.1 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/stretchr/testify v1.8.4 - google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 + google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 google.golang.org/grpc v1.56.2 - google.golang.org/protobuf v1.30.0 + google.golang.org/protobuf v1.31.0 ) require ( - cloud.google.com/go v0.110.0 // indirect - cloud.google.com/go/compute v1.19.0 // indirect + cloud.google.com/go v0.110.4 // indirect + cloud.google.com/go/compute v1.20.1 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v0.13.0 // indirect - cloud.google.com/go/storage v1.29.0 // indirect + cloud.google.com/go/iam v1.1.0 // indirect + cloud.google.com/go/storage v1.30.1 // indirect cosmossdk.io/core v0.5.1 // indirect - cosmossdk.io/depinject v1.0.0-alpha.3 // indirect - cosmossdk.io/log v1.1.0 // indirect + cosmossdk.io/depinject v1.0.0-alpha.4 // indirect + cosmossdk.io/log v1.2.1 // indirect cosmossdk.io/tools/rosetta v0.2.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect @@ -51,7 +53,6 @@ require ( github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect github.com/confio/ics23/go v0.9.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -70,7 +71,7 @@ require ( github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gin-gonic/gin v1.8.1 // indirect + github.com/gin-gonic/gin v1.9.1 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect @@ -84,9 +85,9 @@ require ( github.com/google/btree v1.1.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/orderedcode v0.0.1 // indirect - github.com/google/s2a-go v0.1.3 // indirect + github.com/google/s2a-go v0.1.4 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect - github.com/googleapis/gax-go/v2 v2.8.0 // indirect + github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -124,7 +125,6 @@ require ( github.com/mtibben/percent v0.2.1 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect @@ -133,7 +133,7 @@ require ( github.com/rakyll/statik v0.1.7 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rs/cors v1.8.3 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.30.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -147,15 +147,15 @@ require ( github.com/zondax/ledger-go v0.14.1 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.9.0 // indirect - golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect - golang.org/x/net v0.10.0 // indirect - golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/term v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb // indirect + golang.org/x/net v0.12.0 // indirect + golang.org/x/oauth2 v0.8.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/term v0.10.0 // indirect + golang.org/x/text v0.12.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.122.0 // indirect + google.golang.org/api v0.126.0 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect @@ -174,8 +174,4 @@ replace ( // following versions might cause unexpected behavior github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - - // latest grpc doesn't work with with our modified proto compiler, so we need to enforce - // the following version across all dependencies. - google.golang.org/grpc => google.golang.org/grpc v1.54.0 ) diff --git a/go.sum b/go.sum index a28500b..312ac2a 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= @@ -38,6 +39,7 @@ cloud.google.com/go v0.105.0/go.mod h1:PrLgOJNe5nfE9UMxKxgXj4mD3voiP+YQ6gdt6KMFO cloud.google.com/go v0.107.0/go.mod h1:wpc2eNrD7hXUTy8EKS10jkxpZBjASrORK7goS+3YX2I= cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go v0.110.4/go.mod h1:+EYjdK8e5RME/VY/qLCAtuyALQ9q67dvuum8i+H5xsI= cloud.google.com/go/accessapproval v1.4.0/go.mod h1:zybIuC3KpDOvotz59lFe5qxRZx6C75OtwbisN56xYB4= cloud.google.com/go/accessapproval v1.5.0/go.mod h1:HFy3tuiGvMdcd/u+Cu5b9NkO1pEICJ46IR82PoUdplw= cloud.google.com/go/accesscontextmanager v1.3.0/go.mod h1:TgCBehyr5gNMz7ZaH9xubp+CE8dkrszb4oK9CWyvD4o= @@ -123,6 +125,7 @@ cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvj cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.19.0 h1:+9zda3WGgW1ZSTlVppLCYFIr48Pa35q1uG2N1itbCEQ= cloud.google.com/go/compute v1.19.0/go.mod h1:rikpw2y+UMidAe9tISo04EHNOIf42RLYF/q8Bs93scU= +cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= @@ -213,6 +216,7 @@ cloud.google.com/go/iam v0.7.0/go.mod h1:H5Br8wRaDGNc8XP3keLc4unfUUZeyH3Sfl9XpQE cloud.google.com/go/iam v0.8.0/go.mod h1:lga0/y3iH6CX7sYqypWJ33hf7kkfXJag67naqGESjkE= cloud.google.com/go/iam v0.13.0 h1:+CmB+K0J/33d0zSQ9SlFWUeCCEn5XJA0ZMZ3pHE9u8k= cloud.google.com/go/iam v0.13.0/go.mod h1:ljOg+rcNfzZ5d6f1nAUJ8ZIxOaZUVoS14bKCtaLZ/D0= +cloud.google.com/go/iam v1.1.0/go.mod h1:nxdHjaKfCr7fNYx/HJMM8LgiMugmveWlkatear5gVyk= cloud.google.com/go/iap v1.4.0/go.mod h1:RGFwRJdihTINIe4wZ2iCP0zF/qu18ZwyKxrhMhygBEc= cloud.google.com/go/iap v1.5.0/go.mod h1:UH/CGgKd4KyohZL5Pt0jSKE4m3FR51qg6FKQ/z/Ix9A= cloud.google.com/go/ids v1.1.0/go.mod h1:WIuwCaYVOzHIj2OhN9HAwvW+DBdmUAdcWlFxRl+KubM= @@ -356,6 +360,7 @@ cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeL cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +cloud.google.com/go/storage v1.30.1/go.mod h1:NfxhC0UJE1aXSx7CIIbCf7y9HKT7BiccwkR7+P7gN8E= cloud.google.com/go/storagetransfer v1.5.0/go.mod h1:dxNzUopWy7RQevYFHewchb29POFv3/AaBgnhqzqiK0w= cloud.google.com/go/storagetransfer v1.6.0/go.mod h1:y77xm4CQV/ZhFZH75PLEXY0ROiS7Gh6pSKrM8dJyg6I= cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= @@ -403,12 +408,16 @@ cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= +cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= +cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0= cosmossdk.io/log v1.1.0 h1:v0ogPHYeTzPcBTcPR1A3j1hkei4pZama8kz8LKlCMv0= cosmossdk.io/log v1.1.0/go.mod h1:6zjroETlcDs+mm62gd8Ig7mZ+N+fVOZS91V17H+M4N4= +cosmossdk.io/log v1.2.1/go.mod h1:GNSCc/6+DhFIj1aLn/j7Id7PaO8DzNylUZoOYBL9+I4= cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg= cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0= cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -552,9 +561,15 @@ github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38 github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= @@ -591,6 +606,7 @@ github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/Azg github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= github.com/cosmos/cosmos-sdk v0.47.3 h1:r0hGmZoAzP2D+MaPaFGHwAaTdFQq3pNpHaUp1BsffbM= github.com/cosmos/cosmos-sdk v0.47.3/go.mod h1:c4OfLdAykA9zsj1CqrxBRqXzVz48I++JSvIMPSPcEmk= +github.com/cosmos/cosmos-sdk v0.47.5/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -645,6 +661,7 @@ github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KP github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= @@ -669,6 +686,15 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= @@ -745,6 +771,7 @@ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6 github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= @@ -755,7 +782,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -768,6 +794,7 @@ github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4er github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= @@ -853,6 +880,7 @@ github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.3 h1:FAgZmpLl/SXurPEZyCMPBIiiYeTbqfjlbdnCNTAkbGE= github.com/google/s2a-go v0.1.3/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= +github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -876,6 +904,7 @@ github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMd github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -1058,6 +1087,7 @@ github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+ github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= github.com/lyft/protoc-gen-star v0.6.1/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= +github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= @@ -1251,8 +1281,10 @@ github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/zerolog v1.30.0/go.mod h1:/tk+P47gFdPXq4QYjvCmT5/Gsug2nagsFWBWhAiSi1w= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -1434,6 +1466,7 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g= golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1450,9 +1483,11 @@ golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMk golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU= golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= +golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -1482,6 +1517,7 @@ golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1553,6 +1589,7 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1582,6 +1619,7 @@ golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A golang.org/x/oauth2 v0.4.0/go.mod h1:RznEsdpjGAINPTOF0UH/t+xJ75L18YO3Ho6Pyn+uRec= golang.org/x/oauth2 v0.7.0 h1:qe6s0zUXlPX80/dITx3440hWZ7GwMwgDDyrSGTPJG/g= golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1599,6 +1637,7 @@ golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1711,6 +1750,7 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1721,6 +1761,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1737,6 +1778,7 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1747,8 +1789,10 @@ golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1880,6 +1924,8 @@ google.golang.org/api v0.102.0/go.mod h1:3VFl6/fzoA+qNuS1N1/VfXY4LjoXN/wzeIp7Twe google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0= google.golang.org/api v0.122.0 h1:zDobeejm3E7pEG1mNHvdxvjs5XJoCMzyNH+CmwL94Es= google.golang.org/api v0.122.0/go.mod h1:gcitW0lvnyWjSp9nKxAbdHKIZ6vF4aajGueeslZOyms= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -2010,8 +2056,52 @@ google.golang.org/genproto v0.0.0-20221202195650-67e5cbc046fd/go.mod h1:cTsE614G google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 h1:KpwkzHKEF7B9Zxg18WzOa7djJ+Ha5DzthMyZYQfEn2A= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= +google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130/go.mod h1:O9kGHb51iE/nOGvQaDUuadVYqovW56s5emA88lQnj6Y= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= +google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= +google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= +google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= +google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.2/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -2030,6 +2120,7 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -2068,6 +2159,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/keeper/collection.go b/keeper/collection.go index 9948d79..817402b 100644 --- a/keeper/collection.go +++ b/keeper/collection.go @@ -2,14 +2,8 @@ package keeper import ( errorsmod "cosmossdk.io/errors" - "github.com/OmniFlix/onft/exported" - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/query" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - "github.com/OmniFlix/onft/types" + sdk "github.com/cosmos/cosmos-sdk/types" ) func (k Keeper) SetCollection(ctx sdk.Context, collection types.Collection) error { @@ -18,14 +12,7 @@ func (k Keeper) SetCollection(ctx sdk.Context, collection types.Collection) erro if err != nil { return err } - if k.HasDenomID(ctx, denom.Id) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s has already exists", denom.Id) - } - - if k.HasDenomSymbol(ctx, denom.Symbol) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomSymbol %s has already exists", denom.Symbol) - } - k.SetDenom(ctx, types.NewDenom( + if err := k.SaveDenom(ctx, denom.Id, denom.Symbol, denom.Name, @@ -33,28 +20,28 @@ func (k Keeper) SetCollection(ctx sdk.Context, collection types.Collection) erro creator, denom.Description, denom.PreviewURI, - )) - - k.setDenomOwner(ctx, denom.Id, creator) + denom.Uri, + denom.UriHash, + denom.Data, + ); err != nil { + return err + } for _, onft := range collection.ONFTs { - metadata := types.Metadata{ - Name: onft.GetName(), - Description: onft.GetDescription(), - MediaURI: onft.GetMediaURI(), - PreviewURI: onft.GetPreviewURI(), - } - - if err := k.MintONFT(ctx, - collection.Denom.Id, + if err := k.SaveNFT(ctx, + denom.Id, onft.GetID(), - metadata, + onft.GetName(), + onft.GetDescription(), + onft.GetMediaURI(), + onft.GetURIHash(), + onft.GetPreviewURI(), onft.GetData(), + onft.GetCreatedTime(), onft.IsTransferable(), onft.IsExtensible(), onft.IsNSFW(), - onft.RoyaltyShare, - creator, + onft.GetRoyaltyShare(), onft.GetOwner(), ); err != nil { return err @@ -69,78 +56,35 @@ func (k Keeper) GetCollection(ctx sdk.Context, denomID string) (types.Collection return types.Collection{}, errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not existed ", denomID) } - onfts := k.GetONFTs(ctx, denomID) - return types.NewCollection(denom, onfts), nil -} - -func (k Keeper) GetCollections(ctx sdk.Context) (cs []types.Collection) { - for _, denom := range k.GetDenoms(ctx) { - onfts := k.GetONFTs(ctx, denom.Id) - cs = append(cs, types.NewCollection(denom, onfts)) - } - return cs -} - -func (k Keeper) GetPaginateCollection(ctx sdk.Context, - request *types.QueryCollectionRequest, denomId string, -) (types.Collection, *query.PageResponse, error) { - denom, err := k.GetDenom(ctx, denomId) - if err != nil { - return types.Collection{}, nil, errorsmod.Wrapf(types.ErrInvalidDenom, "denomId %s not existed ", denomId) - } - var onfts []exported.ONFTI - store := ctx.KVStore(k.storeKey) - onftStore := prefix.NewStore(store, types.KeyONFT(denomId, "")) - pagination, err := query.Paginate(onftStore, request.Pagination, func(key []byte, value []byte) error { - var oNFT types.ONFT - k.cdc.MustUnmarshal(value, &oNFT) - onfts = append(onfts, oNFT) - return nil - }) + onfts, err := k.GetONFTs(ctx, denomID) if err != nil { - return types.Collection{}, nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err) + return types.Collection{}, err } - return types.NewCollection(denom, onfts), pagination, nil + return types.NewCollection(denom, onfts), nil } -func (k Keeper) GetTotalSupply(ctx sdk.Context, denomID string) uint64 { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.KeyCollection(denomID)) - if len(bz) == 0 { - return 0 - } - return types.MustUnMarshalSupply(k.cdc, bz) -} +func (k Keeper) GetCollections(ctx sdk.Context) (collections []types.Collection, err error) { + for _, class := range k.nk.GetClasses(ctx) { + onfts, err := k.GetONFTs(ctx, class.Id) + if err != nil { + return nil, err + } -func (k Keeper) GetTotalSupplyOfOwner(ctx sdk.Context, id string, owner sdk.AccAddress) (supply uint64) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyOwner(owner, id, "")) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - supply++ + denom, err := k.GetDenomInfo(ctx, class.Id) + if err != nil { + return nil, err + } + + collections = append(collections, types.NewCollection(*denom, onfts)) } - return supply + return collections, nil } -func (k Keeper) increaseSupply(ctx sdk.Context, denomID string) { - supply := k.GetTotalSupply(ctx, denomID) - supply++ - - store := ctx.KVStore(k.storeKey) - bz := types.MustMarshalSupply(k.cdc, supply) - store.Set(types.KeyCollection(denomID), bz) +func (k Keeper) GetTotalSupply(ctx sdk.Context, denomID string) uint64 { + return k.nk.GetTotalSupply(ctx, denomID) } -func (k Keeper) decreaseSupply(ctx sdk.Context, denomID string) { - supply := k.GetTotalSupply(ctx, denomID) - supply-- - - store := ctx.KVStore(k.storeKey) - if supply == 0 { - store.Delete(types.KeyCollection(denomID)) - return - } - - bz := types.MustMarshalSupply(k.cdc, supply) - store.Set(types.KeyCollection(denomID), bz) +// GetBalance returns the amount of NFTs owned in a class by an account +func (k Keeper) GetBalance(ctx sdk.Context, id string, owner sdk.AccAddress) (supply uint64) { + return k.nk.GetBalance(ctx, id, owner) } diff --git a/keeper/denom.go b/keeper/denom.go index 4d2861f..4a3ed83 100644 --- a/keeper/denom.go +++ b/keeper/denom.go @@ -2,31 +2,47 @@ package keeper import ( errorsmod "cosmossdk.io/errors" + 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/cosmos/cosmos-sdk/x/nft" "github.com/OmniFlix/onft/types" ) -func (k Keeper) HasDenomID(ctx sdk.Context, id string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.KeyDenomID(id)) -} - -func (k Keeper) HasDenomSymbol(ctx sdk.Context, symbol string) bool { - if len(symbol) == 0 { - return false +// SaveDenom saves a denom +func (k Keeper) SaveDenom( + ctx sdk.Context, + id, + symbol, + name, + schema string, + creator sdk.AccAddress, + description, + previewUri string, + uri, + uriHash, + data string, +) error { + denomMetadata := &types.DenomMetadata{ + Creator: creator.String(), + Schema: schema, + PreviewUri: previewUri, + Data: data, } - store := ctx.KVStore(k.storeKey) - return store.Has(types.KeyDenomSymbol(symbol)) -} - -func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&denom) - store.Set(types.KeyDenomID(denom.Id), bz) - if len(denom.Symbol) > 0 { - store.Set(types.KeyDenomSymbol(denom.Symbol), []byte(denom.Id)) + metadata, err := codectypes.NewAnyWithValue(denomMetadata) + if err != nil { + return err } + return k.nk.SaveClass(ctx, nft.Class{ + Id: id, + Name: name, + Symbol: symbol, + Description: description, + Uri: uri, + UriHash: uriHash, + Data: metadata, + }) } func (k Keeper) GetDenom(ctx sdk.Context, id string) (denom types.Denom, err error) { @@ -41,46 +57,140 @@ func (k Keeper) GetDenom(ctx sdk.Context, id string) (denom types.Denom, err err return denom, nil } -func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []types.Denom) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyDenomID("")) - defer iterator.Close() +// TransferDenomOwner transfers the ownership to new address +func (k Keeper) TransferDenomOwner( + ctx sdk.Context, + denomID string, + srcOwner, + dstOwner sdk.AccAddress, +) error { + denom, err := k.GetDenomInfo(ctx, denomID) + if err != nil { + return err + } + sender := srcOwner.String() + recipient := dstOwner.String() + + // authorize + if sender != denom.Creator { + return errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "%s is not allowed to transfer denom %s", sender, + denomID, + ) + } - for ; iterator.Valid(); iterator.Next() { - var denom types.Denom - k.cdc.MustUnmarshal(iterator.Value(), &denom) - denoms = append(denoms, denom) + denomMetadata := &types.DenomMetadata{ + Creator: recipient, + Schema: denom.Schema, + PreviewUri: denom.PreviewURI, + Data: denom.Data, + } + data, err := codectypes.NewAnyWithValue(denomMetadata) + if err != nil { + return err + } + class := nft.Class{ + Id: denom.Id, + Name: denom.Name, + Symbol: denom.Symbol, + Description: denom.Description, + Uri: denom.Uri, + UriHash: denom.UriHash, + Data: data, } - return denoms + k.emitTransferONFTDenomEvent(ctx, denomID, denom.Symbol, sender, recipient) + + return k.nk.UpdateClass(ctx, class) } -func (k Keeper) GetDenomsByOwner(ctx sdk.Context, owner sdk.AccAddress) (denoms []types.Denom) { - store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.KeyDenomCreator(owner, "")) - defer iterator.Close() +func (k Keeper) HasDenom(ctx sdk.Context, id string) bool { + return k.nk.HasClass(ctx, id) +} + +func (k Keeper) UpdateDenom(ctx sdk.Context, msg *types.MsgUpdateDenom) error { + denom, err := k.GetDenomInfo(ctx, msg.Id) + if err != nil { + return err + } + + // authorize + if msg.Sender != denom.Creator { + return errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "%s is not allowed to transfer denom %s", msg.Sender, + denom.Id, + ) + } - for ; iterator.Valid(); iterator.Next() { - denomId := types.MustUnMarshalDenomID(k.cdc, iterator.Value()) - denom, _ := k.GetDenom(ctx, denomId) - denoms = append(denoms, denom) + denomMetadata := &types.DenomMetadata{ + Creator: denom.Creator, + Schema: denom.Schema, + PreviewUri: denom.PreviewURI, + Data: denom.Data, + } + if msg.PreviewURI != types.DoNotModify { + denomMetadata.PreviewUri = msg.PreviewURI + } + data, err := codectypes.NewAnyWithValue(denomMetadata) + if err != nil { + return err } - return denoms + class := nft.Class{ + Id: denom.Id, + Name: denom.Name, + Symbol: denom.Symbol, + Description: denom.Description, + Uri: denom.Uri, + UriHash: denom.UriHash, + Data: data, + } + if msg.Name != types.DoNotModify { + class.Name = msg.Name + } + if msg.Description != types.DoNotModify { + class.Description = msg.Description + } + k.emitUpdateONFTDenomEvent(ctx, class.Id, class.Name, class.Description, denomMetadata.PreviewUri, msg.Sender) + return k.nk.UpdateClass(ctx, class) } -func (k Keeper) AuthorizeDenomCreator(ctx sdk.Context, id string, creator sdk.AccAddress) (types.Denom, error) { - denom, err := k.GetDenom(ctx, id) +func (k Keeper) GetDenoms(ctx sdk.Context) (denoms []types.Denom, err error) { + classes := k.nk.GetClasses(ctx) + for _, class := range classes { + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { + return nil, err + } + denoms = append(denoms, types.Denom{ + Id: class.Id, + Name: class.Name, + Schema: denomMetadata.Schema, + Creator: denomMetadata.Creator, + Symbol: class.Symbol, + Description: class.Description, + PreviewURI: denomMetadata.PreviewUri, + Uri: class.Uri, + UriHash: class.UriHash, + }) + } + return denoms, nil +} + +func (k Keeper) AuthorizeDenomCreator(ctx sdk.Context, id string, creator sdk.AccAddress) error { + denom, err := k.GetDenomInfo(ctx, id) if err != nil { - return types.Denom{}, err + return err } if creator.String() != denom.Creator { - return types.Denom{}, errorsmod.Wrap(types.ErrUnauthorized, creator.String()) + return errorsmod.Wrap(types.ErrUnauthorized, creator.String()) } - return denom, nil + return nil } func (k Keeper) HasPermissionToMint(ctx sdk.Context, denomID string, sender sdk.AccAddress) bool { - denom, err := k.GetDenom(ctx, denomID) + denom, err := k.GetDenomInfo(ctx, denomID) if err != nil { return false } @@ -91,19 +201,23 @@ func (k Keeper) HasPermissionToMint(ctx sdk.Context, denomID string, sender sdk. return false } -func (k Keeper) deleteDenomOwner(ctx sdk.Context, denomID string, owner sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyDenomCreator(owner, denomID)) -} - -func (k Keeper) setDenomOwner(ctx sdk.Context, denomId string, owner sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - - bz := types.MustMarshalDenomID(k.cdc, denomId) - store.Set(types.KeyDenomCreator(owner, denomId), bz) -} +func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, error) { + class, ok := k.nk.GetClass(ctx, denomID) + if !ok { + return nil, errorsmod.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) + } -func (k Keeper) swapDenomOwner(ctx sdk.Context, denomID string, srcOwner, dstOwner sdk.AccAddress) { - k.deleteDenomOwner(ctx, denomID, srcOwner) - k.setDenomOwner(ctx, denomID, dstOwner) + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { + return nil, err + } + return &types.Denom{ + Id: class.Id, + Name: class.Name, + Schema: denomMetadata.Schema, + Creator: denomMetadata.Creator, + Symbol: class.Symbol, + Description: class.Description, + PreviewURI: class.Uri, + }, nil } diff --git a/keeper/events.go b/keeper/events.go index 890e1a7..86550d7 100644 --- a/keeper/events.go +++ b/keeper/events.go @@ -17,13 +17,14 @@ func (k Keeper) emitCreateONFTDenomEvent(ctx sdk.Context, denomId, symbol, name, ) } -func (k Keeper) emitUpdateONFTDenomEvent(ctx sdk.Context, denomId, symbol, name, creator string) { +func (k Keeper) emitUpdateONFTDenomEvent(ctx sdk.Context, denomId, name, description, previewURI, creator string) { ctx.EventManager().EmitEvent( sdk.NewEvent( onfttypes.EventTypeUpdateONFTDenom, sdk.NewAttribute(onfttypes.AttributeKeyDenomID, denomId), - sdk.NewAttribute(onfttypes.AttributeKeySymbol, symbol), sdk.NewAttribute(onfttypes.AttributeKeyName, name), + sdk.NewAttribute(onfttypes.AttributeKeyDescription, description), + sdk.NewAttribute(onfttypes.AttributeKeyPreviewURI, previewURI), sdk.NewAttribute(onfttypes.AttributeKeyCreator, creator), ), ) diff --git a/keeper/grpc_query.go b/keeper/grpc_query.go index 121df98..8658276 100644 --- a/keeper/grpc_query.go +++ b/keeper/grpc_query.go @@ -4,8 +4,8 @@ import ( "context" "strings" - "github.com/cosmos/cosmos-sdk/store/prefix" - "github.com/cosmos/cosmos-sdk/types/query" + "github.com/cosmos/cosmos-sdk/x/nft" + "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -30,7 +30,7 @@ func (k Keeper) Supply(c context.Context, request *types.QuerySupplyRequest) (*t if err != nil { return nil, status.Errorf(codes.InvalidArgument, "invalid owner address %s", request.Owner) } - supply = k.GetTotalSupplyOfOwner(ctx, denom, owner) + supply = k.GetBalance(ctx, denom, owner) } return &types.QuerySupplyResponse{ Amount: supply, @@ -39,14 +39,114 @@ func (k Keeper) Supply(c context.Context, request *types.QuerySupplyRequest) (*t func (k Keeper) Collection(c context.Context, request *types.QueryCollectionRequest) (*types.QueryCollectionResponse, error) { ctx := sdk.UnwrapSDKContext(c) + denom, err := k.GetDenomInfo(ctx, request.DenomId) + if err != nil { + return nil, err + } + + r := &nft.QueryNFTsRequest{ + ClassId: request.DenomId, + Pagination: shapePageRequest(request.Pagination), + } - collection, pagination, err := k.GetPaginateCollection(ctx, request, request.DenomId) + result, err := k.nk.NFTs(c, r) if err != nil { return nil, err } + + var nfts []types.ONFT + for _, _nft := range result.Nfts { + owner := k.nk.GetOwner(ctx, request.DenomId, _nft.Id) + + nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, _nft.Data.GetValue()) + if err != nil { + return nil, err + } + + nfts = append(nfts, types.ONFT{ + Id: _nft.Id, + Metadata: types.Metadata{ + Name: nftMetadata.Name, + Description: nftMetadata.Description, + MediaURI: _nft.Uri, + UriHash: _nft.UriHash, + PreviewURI: nftMetadata.PreviewURI, + }, + Owner: owner.String(), + Data: nftMetadata.Data, + Transferable: nftMetadata.Transferable, + Extensible: nftMetadata.Extensible, + CreatedAt: nftMetadata.CreatedAt, + Nsfw: nftMetadata.Nsfw, + RoyaltyShare: nftMetadata.RoyaltyShare, + }) + } + + collection := &types.Collection{ + Denom: *denom, + ONFTs: nfts, + } + + response := &types.QueryCollectionResponse{ + Collection: collection, + Pagination: result.Pagination, + } + + return response, nil +} + +func (k Keeper) IBCCollection(c context.Context, request *types.QueryIBCCollectionRequest) (*types.QueryCollectionResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + + denom, err := k.GetDenomInfo(ctx, "ibc/"+request.Hash) + if err != nil { + return nil, err + } + + r := &nft.QueryNFTsRequest{ + ClassId: denom.Id, + Pagination: shapePageRequest(request.Pagination), + } + + result, err := k.nk.NFTs(c, r) + if err != nil { + return nil, err + } + var onfts []types.ONFT + for _, _nft := range result.Nfts { + owner := k.nk.GetOwner(ctx, denom.Id, _nft.Id) + + nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, _nft.Data.GetValue()) + if err != nil { + return nil, err + } + + onfts = append(onfts, types.ONFT{ + Id: _nft.Id, + Metadata: types.Metadata{ + Name: nftMetadata.Name, + Description: nftMetadata.Description, + MediaURI: _nft.Uri, + UriHash: _nft.UriHash, + PreviewURI: nftMetadata.PreviewURI, + }, + Owner: owner.String(), + Data: nftMetadata.Data, + Transferable: nftMetadata.Transferable, + Extensible: nftMetadata.Extensible, + CreatedAt: nftMetadata.CreatedAt, + Nsfw: nftMetadata.Nsfw, + RoyaltyShare: nftMetadata.RoyaltyShare, + }) + } + + collection := &types.Collection{ + Denom: *denom, + ONFTs: onfts, + } return &types.QueryCollectionResponse{ - Collection: &collection, - Pagination: pagination, + Collection: collection, + Pagination: result.Pagination, }, nil } @@ -54,56 +154,64 @@ func (k Keeper) Denom(c context.Context, request *types.QueryDenomRequest) (*typ denom := strings.ToLower(strings.TrimSpace(request.DenomId)) ctx := sdk.UnwrapSDKContext(c) - denomObject, err := k.GetDenom(ctx, denom) + denomObject, err := k.GetDenomInfo(ctx, denom) if err != nil { return nil, err } return &types.QueryDenomResponse{ - Denom: &denomObject, + Denom: denomObject, }, nil } -func (k Keeper) Denoms(c context.Context, request *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error) { +func (k Keeper) IBCDenom(c context.Context, request *types.QueryIBCDenomRequest) (*types.QueryDenomResponse, error) { ctx := sdk.UnwrapSDKContext(c) - var ( - denoms []types.Denom - pagination *query.PageResponse - err error - ) - store := ctx.KVStore(k.storeKey) + denomObject, err := k.GetDenomInfo(ctx, "ibc/"+request.Hash) + if err != nil { + return nil, err + } + + return &types.QueryDenomResponse{ + Denom: denomObject, + }, nil +} + +func (k Keeper) Denoms(c context.Context, request *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error) { + ctx := sdk.UnwrapSDKContext(c) + result, err := k.nk.Classes(c, &nft.QueryClassesRequest{ + Pagination: shapePageRequest(request.Pagination), + }) + if err != nil { + return nil, err + } + var denoms []types.Denom if request.Owner != "" { owner, err := sdk.AccAddressFromBech32(request.Owner) if err != nil { return nil, err } - denomStore := prefix.NewStore(store, types.KeyDenomCreator(owner, "")) - pagination, err = query.Paginate(denomStore, request.Pagination, func(key []byte, value []byte) error { - denomId := types.MustUnMarshalDenomID(k.cdc, value) - denom, _ := k.GetDenom(ctx, denomId) - denoms = append(denoms, denom) - return nil - }) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err) + for _, class := range result.Classes { + denom, err := k.GetDenomInfo(ctx, class.Id) + if err != nil { + return nil, err + } + if denom.Creator == owner.String() { + denoms = append(denoms, *denom) + } } - } else { - denomStore := prefix.NewStore(store, types.KeyDenomID("")) - pagination, err = query.Paginate(denomStore, request.Pagination, func(key []byte, value []byte) error { - var denom types.Denom - k.cdc.MustUnmarshal(value, &denom) - denoms = append(denoms, denom) - return nil - }) - if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "paginate: %v", err) + for _, class := range result.Classes { + denom, err := k.GetDenomInfo(ctx, class.Id) + if err != nil { + return nil, err + } + denoms = append(denoms, *denom) } } return &types.QueryDenomsResponse{ Denoms: denoms, - Pagination: pagination, + Pagination: result.Pagination, }, nil } @@ -112,12 +220,12 @@ func (k Keeper) ONFT(c context.Context, request *types.QueryONFTRequest) (*types onftID := strings.ToLower(strings.TrimSpace(request.Id)) ctx := sdk.UnwrapSDKContext(c) - nft, err := k.GetONFT(ctx, denom, onftID) + onft, err := k.GetONFT(ctx, denom, onftID) if err != nil { return nil, errorsmod.Wrapf(types.ErrUnknownONFT, "invalid ONFT %s from collection %s", request.Id, request.DenomId) } - oNFT, ok := nft.(types.ONFT) + oNFT, ok := onft.(types.ONFT) if !ok { return nil, errorsmod.Wrapf(types.ErrUnknownONFT, "invalid type ONFT %s from collection %s", request.Id, request.DenomId) } @@ -128,57 +236,44 @@ func (k Keeper) ONFT(c context.Context, request *types.QueryONFTRequest) (*types } func (k Keeper) OwnerONFTs(c context.Context, request *types.QueryOwnerONFTsRequest) (*types.QueryOwnerONFTsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) + r := &nft.QueryNFTsRequest{ + ClassId: request.DenomId, + Owner: request.Owner, + Pagination: shapePageRequest(request.Pagination), + } - address, err := sdk.AccAddressFromBech32(request.Owner) + result, err := k.nk.NFTs(c, r) if err != nil { - return nil, status.Errorf(codes.InvalidArgument, "invalid owner address %s", request.Owner) - } - - owner := types.Owner{ - Address: address.String(), - IDCollections: types.IDCollections{}, - } - var ownerCollections []types.OwnerONFTCollection - idsMap := make(map[string][]string) - store := ctx.KVStore(k.storeKey) - onftStore := prefix.NewStore(store, types.KeyOwner(address, request.DenomId, "")) - pagination, err := query.Paginate(onftStore, request.Pagination, func(key []byte, value []byte) error { - denomId := request.DenomId - onftId := string(key) - if len(denomId) == 0 { - denomId, onftId, _ = types.SplitKeyDenom(key) - } - if ids, ok := idsMap[denomId]; ok { - idsMap[denomId] = append(ids, onftId) - } else { - idsMap[denomId] = []string{onftId} - owner.IDCollections = append( - owner.IDCollections, - types.IDCollection{DenomId: denomId}, - ) - } - return nil - }) - for i := 0; i < len(owner.IDCollections); i++ { - owner.IDCollections[i].OnftIds = idsMap[owner.IDCollections[i].DenomId] - denom, _ := k.GetDenom(ctx, owner.IDCollections[i].DenomId) - var onfts []types.ONFT - for _, onftid := range owner.IDCollections[i].OnftIds { - onft, _ := k.GetONFT(ctx, denom.Id, onftid) - onfts = append(onfts, onft.(types.ONFT)) - } - ownerCollection := types.OwnerONFTCollection{ - Denom: denom, - Onfts: onfts, + return nil, err + } + + denomMap := make(map[string][]string) + var denoms []string + for _, _nft := range result.Nfts { + if denomMap[_nft.ClassId] == nil { + denomMap[_nft.ClassId] = []string{} + denoms = append(denoms, _nft.ClassId) } - ownerCollections = append(ownerCollections, ownerCollection) + denomMap[_nft.ClassId] = append(denomMap[_nft.ClassId], _nft.Id) } - return &types.QueryOwnerONFTsResponse{ - Owner: address.String(), - Collections: ownerCollections, - Pagination: pagination, - }, nil + + var idc []types.IDCollection + for _, denomID := range denoms { + idc = append(idc, types.IDCollection{ + DenomId: denomID, + OnftIds: denomMap[denomID], + }) + } + + response := &types.QueryOwnerONFTsResponse{ + Owner: &types.Owner{ + Address: request.Owner, + IDCollections: idc, + }, + Pagination: result.Pagination, + } + + return response, nil } // Params queries params of oNFT module diff --git a/keeper/keeper.go b/keeper/keeper.go index 95a98ef..24469d7 100644 --- a/keeper/keeper.go +++ b/keeper/keeper.go @@ -6,10 +6,9 @@ import ( "github.com/cometbft/cometbft/libs/log" storetypes "github.com/cosmos/cosmos-sdk/store/types" - errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" "github.com/OmniFlix/onft/types" ) @@ -21,6 +20,7 @@ type Keeper struct { accountKeeper types.AccountKeeper bankKeeper types.BankKeeper distributionKeeper types.DistributionKeeper + nk nftkeeper.Keeper authority string } @@ -43,6 +43,7 @@ func NewKeeper( accountKeeper: accountKeeper, bankKeeper: bankKeeper, distributionKeeper: distrKeeper, + nk: nftkeeper.NewKeeper(storeKey, cdc, accountKeeper, bankKeeper), authority: authority, } } @@ -56,180 +57,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { return ctx.Logger().With("module", fmt.Sprintf("OmniFlix/%s", types.ModuleName)) } -func (k Keeper) CreateDenom( - ctx sdk.Context, id, symbol, name, schema string, - creator sdk.AccAddress, description, previewUri string, fee sdk.Coin, -) error { - if k.HasDenomID(ctx, id) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s has already exists", id) - } - - if k.HasDenomSymbol(ctx, symbol) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomSymbol %s has already exists", symbol) - } - - err := k.distributionKeeper.FundCommunityPool( - ctx, - sdk.NewCoins(fee), - creator, - ) - if err != nil { - return err - } - // create denom - k.SetDenom(ctx, types.NewDenom(id, symbol, name, schema, creator, description, previewUri)) - // index denom with creator - k.setDenomOwner(ctx, id, creator) - // emit events - k.emitCreateONFTDenomEvent(ctx, id, symbol, name, creator.String()) - return nil -} - -func (k Keeper) UpdateDenom(ctx sdk.Context, id, name, description, previewURI string, sender sdk.AccAddress) error { - if !k.HasDenomID(ctx, id) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denom id %s not exists", id) - } - denom, err := k.AuthorizeDenomCreator(ctx, id, sender) - if err != nil { - return err - } - if len(name) > 0 && name != types.DoNotModify { - denom.Name = name - } - if len(description) > 0 && description != types.DoNotModify { - denom.Description = description - } - if len(previewURI) > 0 && previewURI != types.DoNotModify { - denom.PreviewURI = previewURI - } - k.SetDenom(ctx, denom) - k.emitUpdateONFTDenomEvent(ctx, denom.Id, denom.Symbol, denom.Name, denom.Creator) - return nil -} - -func (k Keeper) TransferDenomOwner(ctx sdk.Context, id string, curOwner, newOwner sdk.AccAddress) error { - denom, err := k.GetDenom(ctx, id) - if err != nil { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", id) - } - // bech32 encode is expensive - curOwnerAddr := curOwner.String() - newOwnerAddr := newOwner.String() - if curOwnerAddr != denom.Creator { - return errorsmod.Wrapf(sdkerrors.ErrUnauthorized, "unauthorized address %s", curOwnerAddr) - } - denom.Creator = newOwnerAddr - // update denom - k.SetDenom(ctx, denom) - // update denom owner index - k.swapDenomOwner(ctx, id, curOwner, newOwner) - // emit events - k.emitTransferONFTDenomEvent(ctx, denom.Id, denom.Symbol, curOwnerAddr, newOwnerAddr) - return nil -} - -func (k Keeper) MintONFT( - ctx sdk.Context, - denomID, onftID string, - metadata types.Metadata, - data string, - transferable, extensible, nsfw bool, - royaltyShare sdk.Dec, - sender, recipient sdk.AccAddress, -) error { - if !k.HasPermissionToMint(ctx, denomID, sender) { - return errorsmod.Wrapf(types.ErrUnauthorized, "only creator of denom has permission to mint") - } - if !k.HasDenomID(ctx, denomID) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) - } - - if k.HasONFT(ctx, denomID, onftID) { - return errorsmod.Wrapf(types.ErrONFTAlreadyExists, "ONFT %s already exists in collection %s", onftID, denomID) - } - // create nft - k.setONFT(ctx, denomID, types.NewONFT( - onftID, - metadata, - data, - transferable, - extensible, - recipient, - ctx.BlockHeader().Time, - nsfw, - royaltyShare, - )) - // index nft with owner - k.setOwner(ctx, denomID, onftID, recipient) - // increase collection supply count - k.increaseSupply(ctx, denomID) - // emit events - k.emitMintONFTEvent(ctx, onftID, denomID, metadata.MediaURI, recipient.String()) - return nil -} - -func (k Keeper) EditONFT(ctx sdk.Context, denomID, onftID string, owner sdk.AccAddress) error { - if !k.HasDenomID(ctx, denomID) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) - } - _, err := k.GetDenom(ctx, denomID) - if err != nil { - return err - } - - onft, err := k.Authorize(ctx, denomID, onftID, owner) - if err != nil { - return err - } - - k.setONFT(ctx, denomID, onft) - return nil -} - -func (k Keeper) TransferOwnership(ctx sdk.Context, denomID, onftID string, srcOwner, dstOwner sdk.AccAddress) error { - if !k.HasDenomID(ctx, denomID) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) - } - - onft, err := k.Authorize(ctx, denomID, onftID, srcOwner) - if err != nil { - return err - } - if !onft.IsTransferable() { - return errorsmod.Wrap(types.ErrNotTransferable, onft.GetID()) - } - // modify owner - dstOwnerAddr := dstOwner.String() - onft.Owner = dstOwnerAddr - // update onft - k.setONFT(ctx, denomID, onft) - // update nft owner index - k.swapOwner(ctx, denomID, onftID, srcOwner, dstOwner) - // emit events - k.emitTransferONFTEvent(ctx, onft.Id, denomID, srcOwner.String(), dstOwnerAddr) - return nil -} - -func (k Keeper) BurnONFT(ctx sdk.Context, - denomID, onftID string, - owner sdk.AccAddress, -) error { - if !k.HasDenomID(ctx, denomID) { - return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) - } - - onft, err := k.Authorize(ctx, denomID, onftID, owner) - if err != nil { - return err - } - - // delete oNFT - k.deleteONFT(ctx, denomID, onft) - // delete nft owner index - k.deleteOwner(ctx, denomID, onftID, owner) - // update nft supply count - k.decreaseSupply(ctx, denomID) - // emit events - k.emitBurnONFTEvent(ctx, onftID, denomID, onft.Owner) - return nil +// NFTkeeper returns a cosmos-sdk nftkeeper.Keeper. +func (k Keeper) NFTkeeper() nftkeeper.Keeper { + return k.nk } diff --git a/keeper/migrator.go b/keeper/migrator.go index 0e6d991..ee87789 100644 --- a/keeper/migrator.go +++ b/keeper/migrator.go @@ -24,5 +24,5 @@ func NewMigrator(k Keeper, ss exported.Subspace) Migrator { // and managed by the x/params modules and stores them directly into the onft // module state. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v2.Migrate(ctx, ctx.KVStore(m.keeper.storeKey), m.legacySubspace, m.keeper.cdc) + return v2.Migrate(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc, m.keeper) } diff --git a/keeper/msg_server.go b/keeper/msg_server.go index 1de9714..24bfda9 100644 --- a/keeper/msg_server.go +++ b/keeper/msg_server.go @@ -3,6 +3,8 @@ package keeper import ( "context" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" errorsmod "cosmossdk.io/errors" @@ -36,12 +38,14 @@ func (m msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParam } func (m msgServer) CreateDenom(goCtx context.Context, msg *types.MsgCreateDenom) (*types.MsgCreateDenomResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } - - ctx := sdk.UnwrapSDKContext(goCtx) + if m.Keeper.HasDenom(ctx, msg.Id) { + return nil, errorsmod.Wrapf(types.ErrDenomIdExists, "denom id already exists %s", msg.Id) + } denomCreationFee := m.Keeper.GetDenomCreationFee(ctx) if !msg.CreationFee.Equal(denomCreationFee) { if msg.CreationFee.Denom != denomCreationFee.Denom { @@ -63,7 +67,7 @@ func (m msgServer) CreateDenom(goCtx context.Context, msg *types.MsgCreateDenom) denomCreationFee.String(), ) } - if err := m.Keeper.CreateDenom(ctx, + if err := m.Keeper.SaveDenom(ctx, msg.Id, msg.Symbol, msg.Name, @@ -71,27 +75,30 @@ func (m msgServer) CreateDenom(goCtx context.Context, msg *types.MsgCreateDenom) sender, msg.Description, msg.PreviewURI, - msg.CreationFee, + msg.Uri, + msg.UriHash, + msg.Data, ); err != nil { return nil, err } + // emit events + m.Keeper.emitCreateONFTDenomEvent(ctx, msg.Id, msg.Symbol, msg.Name, msg.Sender) + return &types.MsgCreateDenomResponse{}, nil } func (m msgServer) UpdateDenom(goCtx context.Context, msg *types.MsgUpdateDenom) (*types.MsgUpdateDenomResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - sender, err := sdk.AccAddressFromBech32(msg.Sender) + _, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } - err = m.Keeper.UpdateDenom(ctx, msg.Id, msg.Name, msg.Description, msg.PreviewURI, sender) + ctx := sdk.UnwrapSDKContext(goCtx) + err = m.Keeper.UpdateDenom(ctx, msg) if err != nil { return nil, err } - return &types.MsgUpdateDenomResponse{}, nil } @@ -116,32 +123,50 @@ func (m msgServer) TransferDenom(goCtx context.Context, msg *types.MsgTransferDe } func (m msgServer) MintONFT(goCtx context.Context, msg *types.MsgMintONFT) (*types.MsgMintONFTResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } - recipient, err := sdk.AccAddressFromBech32(msg.Recipient) if err != nil { return nil, err } + if !m.Keeper.HasPermissionToMint(ctx, msg.DenomId, sender) { + return nil, errorsmod.Wrapf( + sdkerrors.ErrUnauthorized, + "%s is not allowed to mint nft under denom %s", + sender.String(), + msg.DenomId, + ) + } - ctx := sdk.UnwrapSDKContext(goCtx) - if err := m.Keeper.MintONFT(ctx, + if m.Keeper.HasONFT(ctx, msg.DenomId, msg.Id) { + return nil, errorsmod.Wrapf( + types.ErrONFTAlreadyExists, + "ONFT with id %s already exists in collection %s", msg.Id, msg.DenomId) + } + if err := m.Keeper.SaveNFT(ctx, msg.DenomId, msg.Id, - msg.Metadata, + msg.Metadata.Name, + msg.Metadata.Description, + msg.Metadata.MediaURI, + msg.Metadata.UriHash, + msg.Metadata.PreviewURI, msg.Data, + ctx.BlockTime(), msg.Transferable, msg.Extensible, msg.Nsfw, msg.RoyaltyShare, - sender, recipient, ); err != nil { return nil, err } + m.Keeper.emitMintONFTEvent(ctx, msg.Id, msg.DenomId, msg.Metadata.MediaURI, msg.Recipient) return &types.MsgMintONFTResponse{}, nil } @@ -166,6 +191,8 @@ func (m msgServer) TransferONFT(goCtx context.Context, return nil, err } + m.Keeper.emitTransferONFTEvent(ctx, msg.Id, msg.DenomId, msg.Sender, msg.Recipient) + return &types.MsgTransferONFTResponse{}, nil } @@ -182,5 +209,7 @@ func (m msgServer) BurnONFT(goCtx context.Context, return nil, err } + m.Keeper.emitBurnONFTEvent(ctx, msg.Id, msg.DenomId, msg.Sender) + return &types.MsgBurnONFTResponse{}, nil } diff --git a/keeper/onft.go b/keeper/onft.go index 4531a67..f4fc075 100644 --- a/keeper/onft.go +++ b/keeper/onft.go @@ -1,79 +1,212 @@ package keeper import ( + "time" + errorsmod "cosmossdk.io/errors" "github.com/OmniFlix/onft/exported" "github.com/OmniFlix/onft/types" + 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/cosmos/cosmos-sdk/x/nft" ) -func (k Keeper) GetONFT(ctx sdk.Context, denomID, onftID string) (nft exported.ONFTI, err error) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) SaveNFT( + ctx sdk.Context, + denomID, + nftID, + name, + description, + mediaURI, + uriHash, + previewURI, + nftData string, + createdAt time.Time, + transferable, + extensible, + nsfw bool, + royaltyShare sdk.Dec, + receiver sdk.AccAddress, +) error { + nftMetadata := &types.ONFTMetadata{ + Name: name, + Description: description, + PreviewURI: previewURI, + Data: nftData, + Transferable: transferable, + Extensible: extensible, + Nsfw: nsfw, + CreatedAt: createdAt, + RoyaltyShare: royaltyShare, + } + data, err := codectypes.NewAnyWithValue(nftMetadata) + if err != nil { + return err + } + return k.nk.Mint(ctx, nft.NFT{ + ClassId: denomID, + Id: nftID, + Uri: mediaURI, + UriHash: uriHash, + Data: data, + }, receiver) +} + +func (k Keeper) TransferOwnership(ctx sdk.Context, denomID, onftID string, srcOwner, dstOwner sdk.AccAddress) error { + if !k.nk.HasClass(ctx, denomID) { + return errorsmod.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) + } + onft, exist := k.nk.GetNFT(ctx, denomID, onftID) + if !exist { + return errorsmod.Wrapf(types.ErrInvalidONFT, "nft ID %s not exists", onftID) + } - bz := store.Get(types.KeyONFT(denomID, onftID)) - if bz == nil { - return nil, errorsmod.Wrapf(types.ErrUnknownCollection, "not found oNFT: %s", denomID) + err := k.Authorize(ctx, denomID, onftID, srcOwner) + if err != nil { + return err + } + onftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, onft.Data.GetValue()) + if err != nil { + return errorsmod.Wrapf(types.ErrInvalidONFTMetadata, "unable to parse nft metadata") } - var oNFT types.ONFT - k.cdc.MustUnmarshal(bz, &oNFT) - return oNFT, nil + if !onftMetadata.Transferable { + return errorsmod.Wrap(types.ErrNotTransferable, onft.GetId()) + } + return k.nk.Transfer(ctx, denomID, onftID, dstOwner) } -func (k Keeper) GetONFTs(ctx sdk.Context, denom string) (onfts []exported.ONFTI) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) BurnONFT( + ctx sdk.Context, + denomID, + onftID string, + owner sdk.AccAddress, +) error { + if !k.nk.HasClass(ctx, denomID) { + return sdkerrors.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) + } + _, exist := k.nk.GetNFT(ctx, denomID, onftID) + if !exist { + return sdkerrors.Wrapf(types.ErrInvalidONFT, "nft ID %s not exists", onftID) + } - iterator := sdk.KVStorePrefixIterator(store, types.KeyONFT(denom, "")) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var oNFT types.ONFT - k.cdc.MustUnmarshal(iterator.Value(), &oNFT) - onfts = append(onfts, oNFT) + err := k.Authorize(ctx, denomID, onftID, owner) + if err != nil { + return err } - return onfts + + return k.nk.Burn(ctx, denomID, onftID) } -func (k Keeper) GetOwnerONFTs(ctx sdk.Context, denom string, owner string) (onfts []*types.ONFT) { - store := ctx.KVStore(k.storeKey) - - iterator := sdk.KVStorePrefixIterator(store, types.KeyONFT(denom, "")) - defer iterator.Close() - var onftList []*types.ONFT - for ; iterator.Valid(); iterator.Next() { - var oNFT types.ONFT - k.cdc.MustUnmarshal(iterator.Value(), &oNFT) - if oNFT.Owner == owner { - onftList = append(onftList, &oNFT) - } +func (k Keeper) GetONFT(ctx sdk.Context, denomID, onftID string) (nft exported.ONFTI, err error) { + if !k.nk.HasClass(ctx, denomID) { + return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denomID %s not exists", denomID) + } + onft, exist := k.nk.GetNFT(ctx, denomID, onftID) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrInvalidONFT, "not found NFT: %s", onftID) } - return onftList -} -func (k Keeper) Authorize(ctx sdk.Context, denomID, onftID string, owner sdk.AccAddress) (types.ONFT, error) { - onft, err := k.GetONFT(ctx, denomID, onftID) + nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, onft.Data.GetValue()) if err != nil { - return types.ONFT{}, err + return nil, err } - if !owner.Equals(onft.GetOwner()) { - return types.ONFT{}, errorsmod.Wrap(types.ErrUnauthorized, owner.String()) + owner := k.nk.GetOwner(ctx, denomID, onftID) + metadata := types.Metadata{ + Name: nftMetadata.Name, + Description: nftMetadata.Description, + MediaURI: onft.Uri, + PreviewURI: nftMetadata.PreviewURI, } - return onft.(types.ONFT), nil + return types.ONFT{ + Id: onft.Id, + Metadata: metadata, + Data: nftMetadata.Data, + Owner: owner.String(), + Transferable: nftMetadata.Transferable, + Extensible: nftMetadata.Extensible, + Nsfw: nftMetadata.Extensible, + CreatedAt: nftMetadata.CreatedAt, + RoyaltyShare: nftMetadata.RoyaltyShare, + }, nil } -func (k Keeper) HasONFT(ctx sdk.Context, denomID, onftID string) bool { - store := ctx.KVStore(k.storeKey) - return store.Has(types.KeyONFT(denomID, onftID)) +func (k Keeper) GetONFTs(ctx sdk.Context, denomID string) (onfts []exported.ONFTI, err error) { + nfts := k.nk.GetNFTsOfClass(ctx, denomID) + for _, nft := range nfts { + + nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, nft.Data.GetValue()) + if err != nil { + return nil, err + } + + owner := k.nk.GetOwner(ctx, denomID, nft.GetId()) + metadata := types.Metadata{ + Name: nftMetadata.Name, + Description: nftMetadata.Description, + MediaURI: nft.Uri, + PreviewURI: nftMetadata.PreviewURI, + } + onfts = append(onfts, types.ONFT{ + Id: nft.GetId(), + Metadata: metadata, + Data: nftMetadata.Data, + Owner: owner.String(), + Transferable: nftMetadata.Transferable, + Extensible: nftMetadata.Extensible, + Nsfw: nftMetadata.Extensible, + CreatedAt: nftMetadata.CreatedAt, + RoyaltyShare: nftMetadata.RoyaltyShare, + }) + } + return onfts, nil } -func (k Keeper) setONFT(ctx sdk.Context, denomID string, onft types.ONFT) { - store := ctx.KVStore(k.storeKey) +func (k Keeper) GetOwnerONFTs(ctx sdk.Context, denomID string, owner sdk.AccAddress) (onfts []exported.ONFTI, err error) { + nfts := k.nk.GetNFTsOfClassByOwner(ctx, denomID, owner) + for _, nft := range nfts { - bz := k.cdc.MustMarshal(&onft) - store.Set(types.KeyONFT(denomID, onft.GetID()), bz) + nftMetadata, err := types.UnmarshalNFTMetadata(k.cdc, nft.Data.GetValue()) + if err != nil { + return nil, err + } + + owner := k.nk.GetOwner(ctx, denomID, nft.GetId()) + metadata := types.Metadata{ + Name: nftMetadata.Name, + Description: nftMetadata.Description, + MediaURI: nft.Uri, + PreviewURI: nftMetadata.PreviewURI, + } + onfts = append(onfts, types.ONFT{ + Id: nft.GetId(), + Metadata: metadata, + Data: nftMetadata.Data, + Owner: owner.String(), + Transferable: nftMetadata.Transferable, + Extensible: nftMetadata.Extensible, + Nsfw: nftMetadata.Extensible, + CreatedAt: nftMetadata.CreatedAt, + RoyaltyShare: nftMetadata.RoyaltyShare, + }) + } + return onfts, nil } -func (k Keeper) deleteONFT(ctx sdk.Context, denomID string, onft exported.ONFTI) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.KeyONFT(denomID, onft.GetID())) +func (k Keeper) Authorize( + ctx sdk.Context, + denomID, + onftID string, + owner sdk.AccAddress, +) error { + if !owner.Equals(k.nk.GetOwner(ctx, denomID, onftID)) { + return sdkerrors.Wrap(types.ErrUnauthorized, owner.String()) + } + return nil +} + +func (k Keeper) HasONFT(ctx sdk.Context, denomID, onftID string) bool { + return k.nk.HasNFT(ctx, denomID, onftID) } diff --git a/keeper/owner.go b/keeper/owner.go index 7c5d2c5..83f2c4e 100644 --- a/keeper/owner.go +++ b/keeper/owner.go @@ -80,7 +80,7 @@ func (k Keeper) setOwner(ctx sdk.Context, store.Set(types.KeyOwner(owner, denomId, onftId), bz) } -func (k Keeper) swapOwner(ctx sdk.Context, denomID, tokenID string, srcOwner, dstOwner sdk.AccAddress) { - k.deleteOwner(ctx, denomID, tokenID, srcOwner) - k.setOwner(ctx, denomID, tokenID, dstOwner) +func (k Keeper) swapOwner(ctx sdk.Context, denomID, nftID string, srcOwner, dstOwner sdk.AccAddress) { + k.deleteOwner(ctx, denomID, nftID, srcOwner) + k.setOwner(ctx, denomID, nftID, dstOwner) } diff --git a/keeper/pagination.go b/keeper/pagination.go new file mode 100644 index 0000000..f49f444 --- /dev/null +++ b/keeper/pagination.go @@ -0,0 +1,39 @@ +package keeper + +import "github.com/cosmos/cosmos-sdk/types/query" + +var ( + paginationDefaultLimit uint64 = 100 + paginationMaxLimit uint64 = 100 +) + +// shapePageRequest shapes the PageRequest params to avoid querying all items. +// PageRequest.offset is forbidden and PageRequest.count_total must be zero. +// PageRequest.limit mustn't exceed paginationMaxLimit and is set to +// paginationDefaultLimit when unset. +func shapePageRequest(req *query.PageRequest) *query.PageRequest { + res := newDefaultPageRequest() + + if req == nil { + return res + } + + res.Key = req.Key + res.Reverse = req.Reverse + if req.Limit > 0 && req.Limit <= paginationMaxLimit { + res.Limit = req.Limit + } + + return res +} + +// newDefaultPageRequest returns a default PageRequest. +func newDefaultPageRequest() *query.PageRequest { + return &query.PageRequest{ + Key: nil, + Offset: 0, + Limit: paginationDefaultLimit, + CountTotal: false, + Reverse: false, + } +} diff --git a/migrations/v2/expected_keepers.go b/migrations/v2/expected_keepers.go new file mode 100644 index 0000000..68ea37c --- /dev/null +++ b/migrations/v2/expected_keepers.go @@ -0,0 +1,22 @@ +package v2 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// NFTKeeper save the denom of class +type NFTKeeper interface { + SaveDenom( + ctx sdk.Context, + id, + symbol, + name, + schema string, + creator sdk.AccAddress, + description, + previewUri string, + uri, + uriHash, + data string, + ) error +} diff --git a/migrations/v2/keeper.go b/migrations/v2/keeper.go new file mode 100644 index 0000000..6c34a1b --- /dev/null +++ b/migrations/v2/keeper.go @@ -0,0 +1,184 @@ +package v2 + +import ( + "reflect" + "time" + "unsafe" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/x/nft" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" + + "github.com/OmniFlix/onft/types" +) + +type keeper struct { + storeKey storetypes.StoreKey + cdc codec.BinaryCodec + + nftKeeper NFTKeeper +} + +func (k keeper) saveNFT( + ctx sdk.Context, + denomID, + nftID, + nftName, + nftDescription, + nftMediaURI, + nftPreviewURI, + nftURIHash, + nftData string, + extensible, + transferable, + nsfw bool, + nftCreatedAt time.Time, + nftRoyaltyShare sdk.Dec, + recipient sdk.AccAddress, +) error { + nftMetadata := &types.ONFTMetadata{ + Name: nftName, + Description: nftDescription, + PreviewURI: nftPreviewURI, + Extensible: extensible, + Transferable: transferable, + Nsfw: nsfw, + Data: nftData, + CreatedAt: nftCreatedAt, + RoyaltyShare: nftRoyaltyShare, + UriHash: nftURIHash, + } + data, err := codectypes.NewAnyWithValue(nftMetadata) + if err != nil { + return err + } + + nftObj := nft.NFT{ + ClassId: denomID, + Id: nftID, + Uri: nftMediaURI, + UriHash: nftURIHash, + Data: data, + } + k.setNFT(ctx, nftObj) + k.setOwner(ctx, nftObj.ClassId, nftObj.Id, recipient) + k.incrTotalSupply(ctx, nftObj.ClassId) + return nil +} + +func (k keeper) setNFT(ctx sdk.Context, token nft.NFT) { + nftStore := k.getNFTStore(ctx, token.ClassId) + bz := k.cdc.MustMarshal(&token) + nftStore.Set([]byte(token.Id), bz) +} + +func (k keeper) setOwner(ctx sdk.Context, classID, nftID string, owner sdk.AccAddress) { + store := ctx.KVStore(k.storeKey) + store.Set(ownerStoreKey(classID, nftID), owner.Bytes()) + + ownerStore := k.getClassStoreByOwner(ctx, owner, classID) + ownerStore.Set([]byte(nftID), nftkeeper.Placeholder) +} + +func (k keeper) incrTotalSupply(ctx sdk.Context, classID string) { + supply := k.GetTotalSupply(ctx, classID) + 1 + k.updateTotalSupply(ctx, classID, supply) +} + +// GetTotalSupply returns the number of all nfts under the specified classID +func (k keeper) GetTotalSupply(ctx sdk.Context, classID string) uint64 { + store := ctx.KVStore(k.storeKey) + bz := store.Get(classTotalSupply(classID)) + return sdk.BigEndianToUint64(bz) +} + +func (k keeper) updateTotalSupply(ctx sdk.Context, classID string, supply uint64) { + store := ctx.KVStore(k.storeKey) + supplyKey := classTotalSupply(classID) + store.Set(supplyKey, sdk.Uint64ToBigEndian(supply)) +} + +func (k keeper) getClassStoreByOwner(ctx sdk.Context, owner sdk.AccAddress, classID string) prefix.Store { + store := ctx.KVStore(k.storeKey) + key := nftOfClassByOwnerStoreKey(owner, classID) + return prefix.NewStore(store, key) +} + +func (k keeper) getNFTStore(ctx sdk.Context, classID string) prefix.Store { + store := ctx.KVStore(k.storeKey) + return prefix.NewStore(store, nftStoreKey(classID)) +} + +// classTotalSupply returns the byte representation of the ClassTotalSupply +func classTotalSupply(classID string) []byte { + key := make([]byte, len(nftkeeper.ClassTotalSupply)+len(classID)) + copy(key, nftkeeper.ClassTotalSupply) + copy(key[len(nftkeeper.ClassTotalSupply):], classID) + return key +} + +// nftStoreKey returns the byte representation of the nft +func nftStoreKey(classID string) []byte { + key := make([]byte, len(nftkeeper.NFTKey)+len(classID)+len(nftkeeper.Delimiter)) + copy(key, nftkeeper.NFTKey) + copy(key[len(nftkeeper.NFTKey):], classID) + copy(key[len(nftkeeper.NFTKey)+len(classID):], nftkeeper.Delimiter) + return key +} + +// ownerStoreKey returns the byte representation of the nft owner +// Items are stored with the following key: values +// 0x04 +func ownerStoreKey(classID, nftID string) []byte { + // key is of format: + classIDBz := UnsafeStrToBytes(classID) + nftIDBz := UnsafeStrToBytes(nftID) + + key := make([]byte, len(nftkeeper.OwnerKey)+len(classIDBz)+len(nftkeeper.Delimiter)+len(nftIDBz)) + copy(key, nftkeeper.OwnerKey) + copy(key[len(nftkeeper.OwnerKey):], classIDBz) + copy(key[len(nftkeeper.OwnerKey)+len(classIDBz):], nftkeeper.Delimiter) + copy(key[len(nftkeeper.OwnerKey)+len(classIDBz)+len(nftkeeper.Delimiter):], nftIDBz) + return key +} + +// nftOfClassByOwnerStoreKey returns the byte representation of the nft owner +// Items are stored with the following key: values +// 0x03 +func nftOfClassByOwnerStoreKey(owner sdk.AccAddress, classID string) []byte { + owner = address.MustLengthPrefix(owner) + classIDBz := UnsafeStrToBytes(classID) + + key := make([]byte, len(nftkeeper.NFTOfClassByOwnerKey)+len(owner)+len(nftkeeper.Delimiter)+len(classIDBz)+len(nftkeeper.Delimiter)) + copy(key, nftkeeper.NFTOfClassByOwnerKey) + copy(key[len(nftkeeper.NFTOfClassByOwnerKey):], owner) + copy(key[len(nftkeeper.NFTOfClassByOwnerKey)+len(owner):], nftkeeper.Delimiter) + copy(key[len(nftkeeper.NFTOfClassByOwnerKey)+len(owner)+len(nftkeeper.Delimiter):], classIDBz) + copy(key[len(nftkeeper.NFTOfClassByOwnerKey)+len(owner)+len(nftkeeper.Delimiter)+len(classIDBz):], nftkeeper.Delimiter) + return key +} + +// UnsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes +// must not be altered after this function is called as it will cause a segmentation fault. +func UnsafeStrToBytes(s string) []byte { + var buf []byte + sHdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) + bufHdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) + bufHdr.Data = sHdr.Data + bufHdr.Cap = sHdr.Len + bufHdr.Len = sHdr.Len + return buf +} + +// UnsafeBytesToStr is meant to make a zero allocation conversion +// from []byte -> string to speed up operations, it is not meant +// to be used generally, but for a specific pattern to delete keys +// from a map. +func UnsafeBytesToStr(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/migrations/v2/keys.go b/migrations/v2/keys.go new file mode 100644 index 0000000..98e52b1 --- /dev/null +++ b/migrations/v2/keys.go @@ -0,0 +1,102 @@ +package v2 + +import ( + "bytes" + "errors" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + PrefixONFT = []byte{0x01} + PrefixOwners = []byte{0x02} + PrefixCollection = []byte{0x03} + PrefixDenom = []byte{0x04} + PrefixDenomSymbol = []byte{0x05} + PrefixCreator = []byte{0x06} + + delimiter = []byte("/") +) + +func SplitKeyOwner(key []byte) (address sdk.AccAddress, denom, id string, err error) { + key = key[len(PrefixOwners)+len(delimiter):] + keys := bytes.Split(key, delimiter) + if len(keys) != 3 { + return address, denom, id, errors.New("wrong KeyOwner") + } + + address, _ = sdk.AccAddressFromBech32(string(keys[0])) + denom = string(keys[1]) + id = string(keys[2]) + return +} + +func SplitKeyDenom(key []byte) (denomID, nftID string, err error) { + keys := bytes.Split(key, delimiter) + if len(keys) != 2 { + return denomID, nftID, errors.New("wrong KeyOwner") + } + + denomID = string(keys[0]) + nftID = string(keys[1]) + return +} + +func KeyOwner(address sdk.AccAddress, denomID, onftID string) []byte { + key := append(PrefixOwners, delimiter...) + if address != nil { + key = append(key, []byte(address.String())...) + key = append(key, delimiter...) + } + + if address != nil && len(denomID) > 0 { + key = append(key, []byte(denomID)...) + key = append(key, delimiter...) + } + + if address != nil && len(denomID) > 0 && len(onftID) > 0 { + key = append(key, []byte(onftID)...) + } + return key +} + +func KeyONFT(denomID, onftID string) []byte { + key := append(PrefixONFT, delimiter...) + if len(denomID) > 0 { + key = append(key, []byte(denomID)...) + key = append(key, delimiter...) + } + + if len(denomID) > 0 && len(onftID) > 0 { + key = append(key, []byte(onftID)...) + } + return key +} + +func KeyCollection(denomID string) []byte { + key := append(PrefixCollection, delimiter...) + return append(key, []byte(denomID)...) +} + +func KeyDenomID(id string) []byte { + key := append(PrefixDenom, delimiter...) + return append(key, []byte(id)...) +} + +func KeyDenomCreator(address sdk.AccAddress, denomId string) []byte { + key := append(PrefixCreator, delimiter...) + if address != nil { + key = append(key, []byte(address)...) + key = append(key, delimiter...) + } + if address != nil && len(denomId) > 0 { + key = append(key, []byte(denomId)...) + key = append(key, delimiter...) + } + return key +} + +func KeyDenomSymbol(symbol string) []byte { + key := append(PrefixDenomSymbol, delimiter...) + return append(key, []byte(symbol)...) +} diff --git a/migrations/v2/migrate.go b/migrations/v2/migrate.go index 121670e..93d8891 100644 --- a/migrations/v2/migrate.go +++ b/migrations/v2/migrate.go @@ -4,6 +4,7 @@ import ( "github.com/OmniFlix/onft/exported" "github.com/OmniFlix/onft/types" "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -19,19 +20,27 @@ var ParamsKey = []byte{0x07} // module state. func Migrate( ctx sdk.Context, - store sdk.KVStore, + storeKey storetypes.StoreKey, legacySubspace exported.Subspace, cdc codec.BinaryCodec, + nftKeeper NFTKeeper, ) error { var currParams types.Params legacySubspace.GetParamSet(ctx, &currParams) + k := keeper{ + storeKey: storeKey, + cdc: cdc, + nftKeeper: nftKeeper, + } + if err := currParams.ValidateBasic(); err != nil { return err } + store := ctx.KVStore(k.storeKey) bz := cdc.MustMarshal(&currParams) store.Set(ParamsKey, bz) - return nil + return MigrateCollections(ctx, storeKey, cdc, ctx.Logger(), k) } diff --git a/migrations/v2/migrator_test.go b/migrations/v2/migrator_test.go index 36c2f07..7da86ed 100644 --- a/migrations/v2/migrator_test.go +++ b/migrations/v2/migrator_test.go @@ -36,7 +36,7 @@ func TestMigrate(t *testing.T) { store := ctx.KVStore(storeKey) legacySubspace := newMockSubspace(types.DefaultParams()) - require.NoError(t, v2.Migrate(ctx, store, legacySubspace, cdc)) + require.NoError(t, v2.Migrate(ctx, storeKey, legacySubspace, cdc, nil)) var res types.Params bz := store.Get(v2.ParamsKey) diff --git a/migrations/v2/store.go b/migrations/v2/store.go new file mode 100644 index 0000000..bf2a8cd --- /dev/null +++ b/migrations/v2/store.go @@ -0,0 +1,132 @@ +package v2 + +import ( + "time" + + "github.com/cometbft/cometbft/libs/log" + + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/OmniFlix/onft/types" +) + +// MigrateCollections is used to migrate nft data from onft to x/nft +func MigrateCollections(ctx sdk.Context, + storeKey storetypes.StoreKey, + cdc codec.BinaryCodec, + logger log.Logger, + k keeper, +) error { + logger.Info("migrate store data from version 1 to 2") + startTime := time.Now() + + store := ctx.KVStore(storeKey) + iterator := sdk.KVStorePrefixIterator(store, KeyDenomID("")) + defer iterator.Close() + + var ( + totkalDenoms int64 + totalNFTs int64 + ) + for ; iterator.Valid(); iterator.Next() { + var denom types.Denom + cdc.MustUnmarshal(iterator.Value(), &denom) + + // delete unused key + store.Delete(KeyDenomID(denom.Id)) + store.Delete(KeyDenomSymbol(denom.Name)) + store.Delete(KeyCollection(denom.Id)) + + creator, err := sdk.AccAddressFromBech32(denom.Creator) + if err != nil { + return err + } + + if err := k.nftKeeper.SaveDenom( + ctx, + denom.Id, + denom.Symbol, + denom.Name, + denom.Schema, + creator, + denom.Description, + denom.PreviewURI, + denom.Uri, + denom.UriHash, + denom.Data, + ); err != nil { + return err + } + + totalNFTsInDenom, err := migrateONFT(ctx, k, logger, denom.Id) + if err != nil { + return err + } + totkalDenoms++ + totalNFTs += totalNFTsInDenom + + } + logger.Info("migrate store data success", + "Total Denoms", totkalDenoms, + "total NFTs", totalNFTs, + "time taken", time.Since(startTime).String(), + ) + return nil +} + +func migrateONFT( + ctx sdk.Context, + k keeper, + logger log.Logger, + denomID string, +) (int64, error) { + var iterator sdk.Iterator + defer func() { + if iterator != nil { + _ = iterator.Close() + } + }() + + store := ctx.KVStore(k.storeKey) + + total := int64(0) + iterator = sdk.KVStorePrefixIterator(store, KeyONFT(denomID, "")) + for ; iterator.Valid(); iterator.Next() { + var oNFT types.ONFT + k.cdc.MustUnmarshal(iterator.Value(), &oNFT) + + owner, err := sdk.AccAddressFromBech32(oNFT.Owner) + if err != nil { + return 0, err + } + + // delete unused key + store.Delete(KeyONFT(denomID, oNFT.Id)) + store.Delete(KeyOwner(owner, denomID, oNFT.Id)) + + if err := k.saveNFT( + ctx, + denomID, + oNFT.Id, + oNFT.Metadata.Name, + oNFT.Metadata.Description, + oNFT.Metadata.MediaURI, + oNFT.Metadata.PreviewURI, + oNFT.Metadata.UriHash, + oNFT.Data, + oNFT.Extensible, + oNFT.Transferable, + oNFT.Nsfw, + oNFT.CreatedAt, + oNFT.RoyaltyShare, + owner, + ); err != nil { + return 0, err + } + total++ + } + logger.Info("migrate onft collection success", "DenomID", denomID, "TotalNFTs", total) + return total, nil +} diff --git a/proto/OmniFlix/onft/v1beta1/onft.proto b/proto/OmniFlix/onft/v1beta1/onft.proto index ce60066..6f3db9e 100644 --- a/proto/OmniFlix/onft/v1beta1/onft.proto +++ b/proto/OmniFlix/onft/v1beta1/onft.proto @@ -35,6 +35,18 @@ message Denom { (gogoproto.moretags) = "yaml:\"preview_uri\"", (gogoproto.customname) = "PreviewURI" ]; + string uri = 8; + string uri_hash = 9; + string data = 10; +} + +message DenomMetadata { + string creator = 1; + string schema = 2; + string description = 3; + string preview_uri = 4; + string data = 5; + string uri_hash = 6; } //ASSET or ONFT @@ -73,6 +85,31 @@ message Metadata { (gogoproto.moretags) = "yaml:\"preview_uri\"", (gogoproto.customname) = "PreviewURI" ]; + string uri_hash = 5; +} + +message ONFTMetadata { + string name = 1; + string description =2; + string preview_uri = 3 [ + (gogoproto.moretags) = "yaml:\"preview_uri\"", + (gogoproto.customname) = "PreviewURI" + ]; + string data = 4; + bool transferable = 5; + bool extensible = 6; + google.protobuf.Timestamp created_at = 7 [ + (gogoproto.nullable) = false, + (gogoproto.stdtime) = true, + (gogoproto.moretags) = "yaml:\"created_at\"" + ]; + bool nsfw = 8; + string royalty_share = 9 [ + (gogoproto.nullable) = false, + (gogoproto.moretags) = "yaml:\"royalty_share\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec" + ]; + string uri_hash = 10; } message Owner { diff --git a/proto/OmniFlix/onft/v1beta1/query.proto b/proto/OmniFlix/onft/v1beta1/query.proto index 91571ec..0b289cc 100644 --- a/proto/OmniFlix/onft/v1beta1/query.proto +++ b/proto/OmniFlix/onft/v1beta1/query.proto @@ -14,10 +14,18 @@ service Query { option (google.api.http).get = "/omniflix/onft/v1beta1/collections/{denom_id}"; } + rpc IBCCollection(QueryIBCCollectionRequest) returns (QueryCollectionResponse) { + option (google.api.http).get = "/omniflix/onft/v1beta1/collections/ibc/{hash}"; + } + rpc Denom(QueryDenomRequest) returns (QueryDenomResponse) { option (google.api.http).get = "/omniflix/onft/v1beta1/denoms/{denom_id}"; } + rpc IBCDenom(QueryIBCDenomRequest) returns (QueryDenomResponse) { + option (google.api.http).get = "/omniflix/onft/v1beta1/denoms/ibc/{hash}"; + } + rpc Denoms(QueryDenomsRequest) returns (QueryDenomsResponse) { option (google.api.http).get = "/omniflix/onft/v1beta1/denoms"; } @@ -45,6 +53,11 @@ message QueryCollectionResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } +message QueryIBCCollectionRequest { + string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + message QueryDenomRequest { string denom_id = 1 [(gogoproto.moretags) = "yaml:\"denom_id\""]; } @@ -53,6 +66,10 @@ message QueryDenomResponse { Denom denom = 1; } +message QueryIBCDenomRequest { + string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; +} + message QueryDenomsRequest { // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 1; @@ -81,9 +98,8 @@ message QueryOwnerONFTsRequest { } message QueryOwnerONFTsResponse { - string owner = 1; - repeated OwnerONFTCollection collections = 2 [(gogoproto.nullable) = false]; - cosmos.base.query.v1beta1.PageResponse pagination = 3; + Owner owner = 1; + cosmos.base.query.v1beta1.PageResponse pagination = 2; } message QuerySupplyRequest { diff --git a/proto/OmniFlix/onft/v1beta1/tx.proto b/proto/OmniFlix/onft/v1beta1/tx.proto index b1911eb..1bd61b6 100644 --- a/proto/OmniFlix/onft/v1beta1/tx.proto +++ b/proto/OmniFlix/onft/v1beta1/tx.proto @@ -49,6 +49,9 @@ message MsgCreateDenom { (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coin" ]; + string uri = 9; + string uri_hash = 10; + string data = 11; } message MsgCreateDenomResponse {} diff --git a/simulation/operations.go b/simulation/operations.go index 021df6f..34a45cb 100644 --- a/simulation/operations.go +++ b/simulation/operations.go @@ -425,7 +425,7 @@ func SimulateMsgUpdateDenom(k keeper.Keeper, ak types.AccountKeeper, bk types.Ba } } -func getRandomNFTFromOwner(ctx sdk.Context, k keeper.Keeper, r *rand.Rand) (address sdk.AccAddress, denomID, tokenID string) { +func getRandomNFTFromOwner(ctx sdk.Context, k keeper.Keeper, r *rand.Rand) (address sdk.AccAddress, denomID, nftID string) { owners := k.GetOwners(ctx) ownersLen := len(owners) @@ -454,10 +454,10 @@ func getRandomNFTFromOwner(ctx sdk.Context, k keeper.Keeper, r *rand.Rand) (addr // get random nft from collection i = r.Intn(idsLen) - tokenID = idCollection.OnftIds[i] + nftID = idCollection.OnftIds[i] ownerAddress, _ := sdk.AccAddressFromBech32(owner.Address) - return ownerAddress, denomID, tokenID + return ownerAddress, denomID, nftID } func getRandomDenom(ctx sdk.Context, k keeper.Keeper, r *rand.Rand) (types.Denom, error) { diff --git a/types/builder.go b/types/builder.go new file mode 100644 index 0000000..cccbecb --- /dev/null +++ b/types/builder.go @@ -0,0 +1,348 @@ +package types + +import ( + "encoding/base64" + "encoding/hex" + "encoding/json" + "errors" + "fmt" + + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/nft" + proto "github.com/cosmos/gogoproto/proto" +) + +const ( + Namespace = "omniflix:" + KeyMediaFieldValue = "value" +) + +var ( + ClassKeyName = fmt.Sprintf("%s%s", Namespace, "name") + ClassKeySymbol = fmt.Sprintf("%s%s", Namespace, "symbol") + ClassKeyDescription = fmt.Sprintf("%s%s", Namespace, "description") + ClassKeyURIHash = fmt.Sprintf("%s%s", Namespace, "uri_hash") + ClassKeyCreator = fmt.Sprintf("%s%s", Namespace, "creator") + ClassKeySchema = fmt.Sprintf("%s%s", Namespace, "schema") + ClassKeyPreviewURI = fmt.Sprintf("%s%s", Namespace, "preview_uri") + nftKeyName = fmt.Sprintf("%s%s", Namespace, "name") + nftKeyURIHash = fmt.Sprintf("%s%s", Namespace, "uri_hash") + nftKeyPreviewURI = fmt.Sprintf("%s%s", Namespace, "preview_uri") + nftKeyTransferable = fmt.Sprintf("%s%s", Namespace, "transferable") + nftKeyExtensible = fmt.Sprintf("%s%s", Namespace, "extensible") + nftKeyNSFW = fmt.Sprintf("%s%s", Namespace, "nsfw") + nftKeyRoyaltyShare = fmt.Sprintf("%s%s", Namespace, "royalty_share") +) + +type ClassBuilder struct { + cdc codec.Codec + getModuleAddress func(string) sdk.AccAddress +} +type NFTBuilder struct { + cdc codec.Codec +} +type MediaField struct { + Value interface{} `json:"value"` + Mime string `json:"mime,omitempty"` +} + +func NewClassBuilder( + cdc codec.Codec, + getModuleAddress func(string) sdk.AccAddress, +) ClassBuilder { + return ClassBuilder{ + cdc: cdc, + getModuleAddress: getModuleAddress, + } +} + +// BuildMetadata encode class into the metadata format defined by ics721 +func (cb ClassBuilder) BuildMetadata(class nft.Class) (string, error) { + var message proto.Message + if err := cb.cdc.UnpackAny(class.Data, &message); err != nil { + return "", err + } + + metadata, ok := message.(*DenomMetadata) + if !ok { + return "", errors.New("unsupported classMetadata") + } + + kvals := make(map[string]interface{}) + if len(metadata.Data) > 0 { + err := json.Unmarshal([]byte(metadata.Data), &kvals) + if err != nil && IsIBCDenom(class.Id) { + // when classData is not a legal json, there is no need to parse the data + return base64.RawStdEncoding.EncodeToString([]byte(metadata.Data)), nil + } + // note: if metadata.Data is null, it may cause map to be redefined as nil + if kvals == nil { + kvals = make(map[string]interface{}) + } + } + creator, err := sdk.AccAddressFromBech32(metadata.Creator) + if err != nil { + return "", err + } + + hexCreator := hex.EncodeToString(creator) + kvals[ClassKeyName] = MediaField{Value: class.Name} + kvals[ClassKeySymbol] = MediaField{Value: class.Symbol} + kvals[ClassKeyDescription] = MediaField{Value: class.Description} + kvals[ClassKeyURIHash] = MediaField{Value: class.UriHash} + kvals[ClassKeyCreator] = MediaField{Value: hexCreator} + kvals[ClassKeySchema] = MediaField{Value: metadata.Schema} + kvals[ClassKeyPreviewURI] = MediaField{Value: metadata.PreviewUri} + data, err := json.Marshal(kvals) + if err != nil { + return "", err + } + return base64.RawStdEncoding.EncodeToString(data), nil +} + +// Build create a class from ics721 packetData +func (cb ClassBuilder) Build(classID, classURI, classData string) (nft.Class, error) { + classDataBz, err := base64.RawStdEncoding.DecodeString(classData) + if err != nil { + return nft.Class{}, err + } + + var ( + name = "" + symbol = "" + description = "" + uriHash = "" + schema = "" + previewURI = "" + creator = cb.getModuleAddress(ModuleName).String() + ) + + dataMap := make(map[string]interface{}) + if err := json.Unmarshal(classDataBz, &dataMap); err != nil { + any, err := codectypes.NewAnyWithValue(&DenomMetadata{ + Creator: creator, + Schema: schema, + Description: description, + PreviewUri: previewURI, + Data: string(classDataBz), + }) + if err != nil { + return nft.Class{}, err + } + return nft.Class{ + Id: classID, + Uri: classURI, + Name: name, + Symbol: symbol, + Description: description, + UriHash: uriHash, + Data: any, + }, nil + } + if v, ok := dataMap[ClassKeyName]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + name = vStr + delete(dataMap, ClassKeyName) + } + } + } + + if v, ok := dataMap[ClassKeySymbol]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + symbol = vStr + delete(dataMap, ClassKeySymbol) + } + } + } + + if v, ok := dataMap[ClassKeyDescription]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + description = vStr + delete(dataMap, ClassKeyDescription) + } + } + } + + if v, ok := dataMap[ClassKeyURIHash]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + uriHash = vStr + delete(dataMap, ClassKeyURIHash) + } + } + } + + if v, ok := dataMap[ClassKeyCreator]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + creatorAcc, err := sdk.AccAddressFromHexUnsafe(vStr) + if err != nil { + return nft.Class{}, err + } + creator = creatorAcc.String() + delete(dataMap, ClassKeyCreator) + } + } + } + + if v, ok := dataMap[ClassKeySchema]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + schema = vStr + delete(dataMap, ClassKeySchema) + } + } + } + + if v, ok := dataMap[ClassKeyPreviewURI]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + schema = vStr + delete(dataMap, ClassKeyPreviewURI) + } + } + } + + data := "" + if len(dataMap) > 0 { + dataBz, err := json.Marshal(dataMap) + if err != nil { + return nft.Class{}, err + } + data = string(dataBz) + } + + denomMeta, err := codectypes.NewAnyWithValue(&DenomMetadata{ + Creator: creator, + Schema: schema, + Data: data, + }) + if err != nil { + return nft.Class{}, err + } + + return nft.Class{ + Id: classID, + Uri: classURI, + Name: name, + Symbol: symbol, + Description: description, + UriHash: uriHash, + Data: denomMeta, + }, nil +} + +func NewNFTBuilder(cdc codec.Codec) NFTBuilder { + return NFTBuilder{ + cdc: cdc, + } +} + +// BuildMetadata encode nft into the metadata format defined by ics721 +func (nb NFTBuilder) BuildMetadata(token nft.NFT) (string, error) { + var message proto.Message + if err := nb.cdc.UnpackAny(token.Data, &message); err != nil { + return "", err + } + + nftMetadata, ok := message.(*ONFTMetadata) + if !ok { + return "", errors.New("unsupport classMetadata") + } + kvals := make(map[string]interface{}) + if len(nftMetadata.Data) > 0 { + err := json.Unmarshal([]byte(nftMetadata.Data), &kvals) + if err != nil && IsIBCDenom(token.ClassId) { + // when nftMetadata is not a legal json, there is no need to parse the data + return base64.RawStdEncoding.EncodeToString([]byte(nftMetadata.Data)), nil + } + // note: if nftMetadata.Data is null, it may cause map to be redefined as nil + if kvals == nil { + kvals = make(map[string]interface{}) + } + } + kvals[nftKeyName] = MediaField{Value: nftMetadata.Name} + kvals[nftKeyURIHash] = MediaField{Value: token.UriHash} + data, err := json.Marshal(kvals) + if err != nil { + return "", err + } + return base64.RawStdEncoding.EncodeToString(data), nil +} + +// Build create a nft from ics721 packet data +func (nb NFTBuilder) Build(classId, nftID, tokenURI, nftData string) (nft.NFT, error) { + nftDataBz, err := base64.RawStdEncoding.DecodeString(nftData) + if err != nil { + return nft.NFT{}, err + } + + dataMap := make(map[string]interface{}) + if err := json.Unmarshal(nftDataBz, &dataMap); err != nil { + metadata, err := codectypes.NewAnyWithValue(&ONFTMetadata{ + Data: string(nftDataBz), + }) + if err != nil { + return nft.NFT{}, err + } + + return nft.NFT{ + ClassId: classId, + Id: nftID, + Uri: tokenURI, + Data: metadata, + }, nil + } + + var ( + name string + uriHash string + ) + if v, ok := dataMap[nftKeyName]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + name = vStr + delete(dataMap, nftKeyName) + } + } + } + + if v, ok := dataMap[nftKeyURIHash]; ok { + if vMap, ok := v.(map[string]interface{}); ok { + if vStr, ok := vMap[KeyMediaFieldValue].(string); ok { + uriHash = vStr + delete(dataMap, nftKeyURIHash) + } + } + } + + data := "" + if len(dataMap) > 0 { + dataBz, err := json.Marshal(dataMap) + if err != nil { + return nft.NFT{}, err + } + data = string(dataBz) + } + + metadata, err := codectypes.NewAnyWithValue(&ONFTMetadata{ + Name: name, + Data: data, + }) + if err != nil { + return nft.NFT{}, err + } + + return nft.NFT{ + ClassId: classId, + Id: nftID, + Uri: tokenURI, + UriHash: uriHash, + Data: metadata, + }, nil +} diff --git a/types/codec.go b/types/codec.go index 68e9657..09d55bc 100644 --- a/types/codec.go +++ b/types/codec.go @@ -7,6 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" + "github.com/cosmos/gogoproto/proto" ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { @@ -40,6 +41,11 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { (*exported.ONFTI)(nil), &ONFT{}, ) + registry.RegisterImplementations( + (*proto.Message)(nil), + &DenomMetadata{}, + &ONFTMetadata{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/types/errors.go b/types/errors.go index 0f01e77..3d3e5dc 100644 --- a/types/errors.go +++ b/types/errors.go @@ -29,4 +29,6 @@ var ( ErrInvalidDenomCreationFee = errorsmod.Register(ModuleName, 22, "invalid denom creation fee") ErrInvalidFeeDenom = errorsmod.Register(ModuleName, 23, "invalid creation fee denom") ErrNotEnoughFeeAmount = errorsmod.Register(ModuleName, 24, "invalid creation fee amount") + ErrInvalidONFTMetadata = errorsmod.Register(ModuleName, 25, "invalid nft data") + ErrDenomIdExists = errorsmod.Register(ModuleName, 26, "denom exists") ) diff --git a/types/keys.go b/types/keys.go index 0e1b4ba..46d9000 100644 --- a/types/keys.go +++ b/types/keys.go @@ -42,14 +42,14 @@ func SplitKeyOwner(key []byte) (address sdk.AccAddress, denom, id string, err er return } -func SplitKeyDenom(key []byte) (denomID, tokenID string, err error) { +func SplitKeyDenom(key []byte) (denomID, nftID string, err error) { keys := bytes.Split(key, delimiter) if len(keys) != 2 { - return denomID, tokenID, errors.New("wrong KeyOwner") + return denomID, nftID, errors.New("wrong KeyOwner") } denomID = string(keys[0]) - tokenID = string(keys[1]) + nftID = string(keys[1]) return } diff --git a/types/onft.go b/types/onft.go index cdab141..157b74f 100644 --- a/types/onft.go +++ b/types/onft.go @@ -4,11 +4,24 @@ import ( "time" "github.com/OmniFlix/onft/exported" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) var _ exported.ONFTI = ONFT{} +func UnmarshalNFTMetadata(cdc codec.BinaryCodec, bz []byte) (ONFTMetadata, error) { + var nftMetadata ONFTMetadata + if len(bz) == 0 { + return nftMetadata, nil + } + + if err := cdc.Unmarshal(bz, &nftMetadata); err != nil { + return nftMetadata, err + } + return nftMetadata, nil +} + func NewONFT( id string, metadata Metadata, data string, transferable, extensible bool, owner sdk.AccAddress, createdTime time.Time, nsfw bool, royaltyShare sdk.Dec, @@ -42,6 +55,10 @@ func (onft ONFT) GetMediaURI() string { return onft.Metadata.MediaURI } +func (onft ONFT) GetURIHash() string { + return onft.Metadata.UriHash +} + func (onft ONFT) GetPreviewURI() string { return onft.Metadata.PreviewURI } diff --git a/types/onft.pb.go b/types/onft.pb.go index adad1cb..58676b2 100644 --- a/types/onft.pb.go +++ b/types/onft.pb.go @@ -113,6 +113,9 @@ type Denom struct { Creator string `protobuf:"bytes,5,opt,name=creator,proto3" json:"creator,omitempty"` Description string `protobuf:"bytes,6,opt,name=description,proto3" json:"description,omitempty"` PreviewURI string `protobuf:"bytes,7,opt,name=preview_uri,json=previewUri,proto3" json:"preview_uri,omitempty" yaml:"preview_uri"` + Uri string `protobuf:"bytes,8,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,9,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Data string `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"` } func (m *Denom) Reset() { *m = Denom{} } @@ -148,6 +151,48 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom 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"` + Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` + PreviewUri string `protobuf:"bytes,4,opt,name=preview_uri,json=previewUri,proto3" json:"preview_uri,omitempty"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + UriHash string `protobuf:"bytes,6,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` +} + +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_de1608f52787b22e, []int{3} +} +func (m *DenomMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomMetadata.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 *DenomMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomMetadata.Merge(m, src) +} +func (m *DenomMetadata) XXX_Size() int { + return m.Size() +} +func (m *DenomMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_DenomMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomMetadata proto.InternalMessageInfo + // ASSET or ONFT type ONFT struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -165,7 +210,7 @@ func (m *ONFT) Reset() { *m = ONFT{} } func (m *ONFT) String() string { return proto.CompactTextString(m) } func (*ONFT) ProtoMessage() {} func (*ONFT) Descriptor() ([]byte, []int) { - return fileDescriptor_de1608f52787b22e, []int{3} + return fileDescriptor_de1608f52787b22e, []int{4} } func (m *ONFT) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,13 +244,14 @@ type Metadata struct { Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty" yaml:"description"` MediaURI string `protobuf:"bytes,3,opt,name=media_uri,json=mediaUri,proto3" json:"media_uri,omitempty" yaml:"media_uri"` PreviewURI string `protobuf:"bytes,4,opt,name=preview_uri,json=previewUri,proto3" json:"preview_uri,omitempty" yaml:"preview_uri"` + UriHash string `protobuf:"bytes,5,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` } func (m *Metadata) Reset() { *m = Metadata{} } func (m *Metadata) String() string { return proto.CompactTextString(m) } func (*Metadata) ProtoMessage() {} func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_de1608f52787b22e, []int{4} + return fileDescriptor_de1608f52787b22e, []int{5} } func (m *Metadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -234,6 +280,52 @@ func (m *Metadata) XXX_DiscardUnknown() { var xxx_messageInfo_Metadata proto.InternalMessageInfo +type ONFTMetadata struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + PreviewURI string `protobuf:"bytes,3,opt,name=preview_uri,json=previewUri,proto3" json:"preview_uri,omitempty" yaml:"preview_uri"` + Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Transferable bool `protobuf:"varint,5,opt,name=transferable,proto3" json:"transferable,omitempty"` + Extensible bool `protobuf:"varint,6,opt,name=extensible,proto3" json:"extensible,omitempty"` + CreatedAt time.Time `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3,stdtime" json:"created_at" yaml:"created_at"` + Nsfw bool `protobuf:"varint,8,opt,name=nsfw,proto3" json:"nsfw,omitempty"` + RoyaltyShare github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,9,opt,name=royalty_share,json=royaltyShare,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"royalty_share" yaml:"royalty_share"` + UriHash string `protobuf:"bytes,10,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` +} + +func (m *ONFTMetadata) Reset() { *m = ONFTMetadata{} } +func (m *ONFTMetadata) String() string { return proto.CompactTextString(m) } +func (*ONFTMetadata) ProtoMessage() {} +func (*ONFTMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_de1608f52787b22e, []int{6} +} +func (m *ONFTMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ONFTMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ONFTMetadata.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 *ONFTMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_ONFTMetadata.Merge(m, src) +} +func (m *ONFTMetadata) XXX_Size() int { + return m.Size() +} +func (m *ONFTMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_ONFTMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_ONFTMetadata proto.InternalMessageInfo + type Owner struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` IDCollections []IDCollection `protobuf:"bytes,2,rep,name=id_collections,json=idCollections,proto3" json:"id_collections" yaml:"idcs"` @@ -243,7 +335,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_de1608f52787b22e, []int{5} + return fileDescriptor_de1608f52787b22e, []int{7} } func (m *Owner) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -276,64 +368,74 @@ func init() { proto.RegisterType((*Collection)(nil), "OmniFlix.onft.v1beta1.Collection") proto.RegisterType((*IDCollection)(nil), "OmniFlix.onft.v1beta1.IDCollection") proto.RegisterType((*Denom)(nil), "OmniFlix.onft.v1beta1.Denom") + proto.RegisterType((*DenomMetadata)(nil), "OmniFlix.onft.v1beta1.DenomMetadata") proto.RegisterType((*ONFT)(nil), "OmniFlix.onft.v1beta1.ONFT") proto.RegisterType((*Metadata)(nil), "OmniFlix.onft.v1beta1.Metadata") + proto.RegisterType((*ONFTMetadata)(nil), "OmniFlix.onft.v1beta1.ONFTMetadata") proto.RegisterType((*Owner)(nil), "OmniFlix.onft.v1beta1.Owner") } func init() { proto.RegisterFile("OmniFlix/onft/v1beta1/onft.proto", fileDescriptor_de1608f52787b22e) } var fileDescriptor_de1608f52787b22e = []byte{ - // 771 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x8f, 0xdb, 0x44, - 0x14, 0x8e, 0xb3, 0xf9, 0x39, 0xd9, 0xb4, 0x30, 0x2c, 0x95, 0xb5, 0x80, 0x1d, 0xb9, 0x15, 0xea, - 0x05, 0x47, 0x0d, 0x97, 0xaa, 0x02, 0x89, 0x9a, 0x65, 0xa5, 0x1c, 0xca, 0x22, 0xd3, 0x4a, 0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xf8, 0xbe, 0x35, 0x9b, 0xf9, 0x01, 0xee, 0x6e, 0x4b, 0x7f, 0x60, 0x36, 0xd2, 0x68, - 0x60, 0xdd, 0xf7, 0x78, 0xd7, 0x4b, 0x60, 0xd7, 0xe8, 0xde, 0x8d, 0x37, 0x6a, 0xc9, 0x60, 0xd7, - 0x63, 0x9f, 0xa3, 0x7e, 0xc6, 0x28, 0x27, 0xe0, 0x30, 0x98, 0x5f, 0x34, 0xda, 0x94, 0x7e, 0xef, - 0x99, 0x06, 0x8d, 0xbf, 0xde, 0x31, 0x7b, 0x5c, 0xd3, 0x02, 0x3d, 0x79, 0x9d, 0x2d, 0xf8, 0xbf, - 0x2d, 0xda, 0x7a, 0x2b, 0x8b, 0xfe, 0xe8, 0xa0, 0xf6, 0x09, 0xd8, 0xc4, 0x45, 0x5d, 0x42, 0x69, - 0xc1, 0xa4, 0xb4, 0x46, 0xad, 0x42, 0xbc, 0x42, 0x77, 0x38, 0x9d, 0x25, 0xd7, 0x8f, 0x44, 0xf5, - 0xe8, 0xdc, 0xbf, 0xc5, 0xb3, 0xf5, 0x07, 0x25, 0x7a, 0x60, 0x1f, 0x9f, 0x61, 0x1d, 0x95, 0x37, - 0x92, 0x72, 0x9a, 0xc8, 0x20, 0x1e, 0x72, 0x5a, 0xcb, 0x9a, 0xbb, 0x45, 0x9f, 0x5d, 0xfc, 0xe1, - 0x35, 0x2e, 0x36, 0x9e, 0x73, 0xb9, 0xf1, 0x9c, 0xdf, 0x37, 0x9e, 0xf3, 0xe6, 0xca, 0x6b, 0x5c, - 0x5e, 0x79, 0x8d, 0x5f, 0xae, 0xbc, 0xc6, 0xf7, 0x5e, 0xcd, 0x05, 0xbb, 0xaf, 0x38, 0x38, 0x60, - 0xde, 0x01, 0x5b, 0x7e, 0xfa, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x21, 0xf5, 0xc0, 0xa9, 0xe3, - 0x05, 0x00, 0x00, + // 902 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x4f, 0x8f, 0xdb, 0x44, + 0x14, 0x8f, 0x93, 0x38, 0xc9, 0xbe, 0x6c, 0xda, 0x32, 0x2c, 0x95, 0x59, 0xc0, 0x8e, 0xdc, 0x0a, + 0xf5, 0x82, 0xa3, 0x2e, 0x97, 0xaa, 0x02, 0x89, 0x9a, 0x65, 0xc5, 0x1e, 0x96, 0x45, 0xa6, 0x95, + 0x10, 0x97, 0x68, 0x62, 0xcf, 0x26, 0xa3, 0xc6, 0x99, 0xc8, 0x33, 0xe9, 0x36, 0x5f, 0x02, 0xed, + 0x95, 0x1b, 0x17, 0x24, 0xee, 0x7c, 0x89, 0x3d, 0xf6, 0x08, 0x1c, 0x0c, 0x64, 0x2f, 0x9c, 0xf3, + 0x09, 0xd0, 0xfc, 0x71, 0x62, 0xb7, 0xdd, 0x1e, 0x7a, 0xe6, 0x94, 0x79, 0xef, 0xfd, 0xde, 0xcc, + 0xfb, 0xbd, 0xf9, 0xbd, 0x71, 0xa0, 0x7f, 0x9a, 0xce, 0xe8, 0xd1, 0x94, 0x3e, 0x1f, 0xb0, 0xd9, + 0x99, 0x18, 0x3c, 0xbb, 0x3f, 0x22, 0x02, 0xdf, 0x57, 0x46, 0x30, 0xcf, 0x98, 0x60, 0xe8, 0xbd, + 0x02, 0x11, 0x28, 0xa7, 0x41, 0xec, 0xef, 0x8d, 0xd9, 0x98, 0x29, 0xc4, 0x40, 0xae, 0x34, 0x78, + 0xdf, 0x1b, 0x33, 0x36, 0x9e, 0x92, 0x81, 0xb2, 0x46, 0x8b, 0xb3, 0x81, 0xa0, 0x29, 0xe1, 0x02, + 0xa7, 0x73, 0x0d, 0xf0, 0x7f, 0xb4, 0x00, 0xbe, 0x64, 0xd3, 0x29, 0x89, 0x05, 0x65, 0x33, 0xf4, + 0x00, 0xec, 0x84, 0xcc, 0x58, 0xea, 0x58, 0x7d, 0xeb, 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c, 0x8c, 0x66, + 0xf4, 0xe5, 0xc9, 0x6c, 0xbe, 0xe5, 0x64, 0x96, 0x75, 0x6b, 0x57, 0x74, 0x6b, 0x5a, 0xf2, 0x47, + 0x03, 0x76, 0xa5, 0x7a, 0x4f, 0x4a, 0x92, 0xdb, 0xb6, 0xc5, 0x74, 0xa1, 0xff, 0x9a, 0x2e, 0xbc, + 0xf1, 0x21, 0x69, 0xbc, 0x65, 0xb9, 0x85, 0xde, 0x9b, 0x25, 0xbd, 0xff, 0xaf, 0xec, 0x37, 0x29, + 0xbb, 0x72, 0xc3, 0x50, 0x7d, 0x99, 0x7e, 0xb2, 0xc0, 0x3e, 0x55, 0xaf, 0x83, 0x03, 0x6d, 0x9c, + 0x24, 0x19, 0xe1, 0xbc, 0x78, 0x47, 0x8d, 0x89, 0xe6, 0x70, 0x83, 0x26, 0xc3, 0x78, 0xf3, 0x49, + 0x2c, 0x3e, 0xb1, 0x77, 0xae, 0x79, 0xaa, 0xca, 0x9f, 0xcf, 0xf0, 0xae, 0xf9, 0xd4, 0xf6, 0xca, + 0x5e, 0xbe, 0x9d, 0x24, 0x9a, 0xc4, 0xdc, 0x8f, 0x7a, 0x34, 0x29, 0x45, 0xb5, 0xee, 0xc2, 0xcf, + 0x2e, 0xff, 0x71, 0x6b, 0x97, 0x2b, 0xd7, 0x7a, 0xb1, 0x72, 0xad, 0xbf, 0x57, 0xae, 0x75, 0x71, + 0xe5, 0xd6, 0x5e, 0x5c, 0xb9, 0xb5, 0xdf, 0xaf, 0xdc, 0xda, 0x0f, 0x6e, 0xa9, 0x45, 0xd5, 0xff, + 0x2c, 0xaa, 0x3d, 0xa3, 0x96, 0xba, 0xb3, 0x4f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x02, 0xaf, + 0x94, 0x2f, 0xd1, 0x08, 0x00, 0x00, } func (this *Collection) Equal(that interface{}) bool { @@ -440,6 +542,15 @@ func (this *Denom) Equal(that interface{}) bool { if this.PreviewURI != that1.PreviewURI { return false } + if this.Uri != that1.Uri { + return false + } + if this.UriHash != that1.UriHash { + return false + } + if this.Data != that1.Data { + return false + } return true } func (this *ONFT) Equal(that interface{}) bool { @@ -521,6 +632,9 @@ func (this *Metadata) Equal(that interface{}) bool { if this.PreviewURI != that1.PreviewURI { return false } + if this.UriHash != that1.UriHash { + return false + } return true } func (this *Owner) Equal(that interface{}) bool { @@ -661,6 +775,27 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x52 + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintOnft(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x4a + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x42 + } if len(m.PreviewURI) > 0 { i -= len(m.PreviewURI) copy(dAtA[i:], m.PreviewURI) @@ -713,6 +848,71 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DenomMetadata) 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 *DenomMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintOnft(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x32 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x2a + } + if len(m.PreviewUri) > 0 { + i -= len(m.PreviewUri) + copy(dAtA[i:], m.PreviewUri) + i = encodeVarintOnft(dAtA, i, uint64(len(m.PreviewUri))) + i-- + dAtA[i] = 0x22 + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x1a + } + if len(m.Schema) > 0 { + i -= len(m.Schema) + copy(dAtA[i:], m.Schema) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Schema))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *ONFT) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -835,6 +1035,13 @@ func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintOnft(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x2a + } if len(m.PreviewURI) > 0 { i -= len(m.PreviewURI) copy(dAtA[i:], m.PreviewURI) @@ -866,6 +1073,112 @@ func (m *Metadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ONFTMetadata) 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 *ONFTMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ONFTMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintOnft(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x52 + } + { + size := m.RoyaltyShare.Size() + i -= size + if _, err := m.RoyaltyShare.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintOnft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + if m.Nsfw { + i-- + if m.Nsfw { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.CreatedAt, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintOnft(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x3a + if m.Extensible { + i-- + if m.Extensible { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Transferable { + i-- + if m.Transferable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x22 + } + if len(m.PreviewURI) > 0 { + i -= len(m.PreviewURI) + copy(dAtA[i:], m.PreviewURI) + i = encodeVarintOnft(dAtA, i, uint64(len(m.PreviewURI))) + i-- + dAtA[i] = 0x1a + } + if len(m.Description) > 0 { + i -= len(m.Description) + copy(dAtA[i:], m.Description) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Description))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintOnft(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *Owner) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -991,60 +1304,130 @@ func (m *Denom) Size() (n int) { if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - return n -} - -func (m *ONFT) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) + l = len(m.Uri) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - l = m.Metadata.Size() - n += 1 + l + sovOnft(uint64(l)) - l = len(m.Data) + l = len(m.UriHash) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - l = len(m.Owner) + l = len(m.Data) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - if m.Transferable { - n += 2 - } - if m.Extensible { - n += 2 - } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) - n += 1 + l + sovOnft(uint64(l)) - if m.Nsfw { - n += 2 - } - l = m.RoyaltyShare.Size() - n += 1 + l + sovOnft(uint64(l)) return n } -func (m *Metadata) Size() (n int) { +func (m *DenomMetadata) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) + l = len(m.Creator) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - l = len(m.Description) + l = len(m.Schema) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } - l = len(m.MediaURI) + l = len(m.Description) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.PreviewUri) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + return n +} + +func (m *ONFT) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = m.Metadata.Size() + n += 1 + l + sovOnft(uint64(l)) + l = len(m.Data) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + if m.Transferable { + n += 2 + } + if m.Extensible { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovOnft(uint64(l)) + if m.Nsfw { + n += 2 + } + l = m.RoyaltyShare.Size() + n += 1 + l + sovOnft(uint64(l)) + return n +} + +func (m *Metadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.Description) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.MediaURI) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.PreviewURI) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + return n +} + +func (m *ONFTMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + l = len(m.Description) if l > 0 { n += 1 + l + sovOnft(uint64(l)) } @@ -1052,6 +1435,27 @@ func (m *Metadata) Size() (n int) { if l > 0 { n += 1 + l + sovOnft(uint64(l)) } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } + if m.Transferable { + n += 2 + } + if m.Extensible { + n += 2 + } + l = github_com_gogo_protobuf_types.SizeOfStdTime(m.CreatedAt) + n += 1 + l + sovOnft(uint64(l)) + if m.Nsfw { + n += 2 + } + l = m.RoyaltyShare.Size() + n += 1 + l + sovOnft(uint64(l)) + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovOnft(uint64(l)) + } return n } @@ -1564,6 +1968,102 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } m.PreviewURI = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Uri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + 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 ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOnft(dAtA[iNdEx:]) @@ -1585,7 +2085,7 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } -func (m *ONFT) Unmarshal(dAtA []byte) error { +func (m *DenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1608,15 +2108,15 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ONFT: wiretype end group for non-group") + return fmt.Errorf("proto: DenomMetadata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ONFT: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DenomMetadata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1644,13 +2144,13 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Id = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOnft @@ -1660,28 +2160,27 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthOnft } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthOnft } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Schema = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1709,11 +2208,11 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Data = string(dAtA[iNdEx:postIndex]) + m.Description = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PreviewUri", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1741,13 +2240,13 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Owner = string(dAtA[iNdEx:postIndex]) + m.PreviewUri = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Transferable", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) } - var v int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOnft @@ -1757,17 +2256,260 @@ func (m *ONFT) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - m.Transferable = bool(v != 0) + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Extensible", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) } - var v int + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOnft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ONFT) 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 ErrIntOverflowOnft + } + 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: ONFT: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ONFT: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Metadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + 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 ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + 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 Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Transferable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Transferable = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensible", wireType) + } + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOnft @@ -2048,6 +2790,375 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } m.PreviewURI = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOnft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOnft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ONFTMetadata) 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 ErrIntOverflowOnft + } + 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: ONFTMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ONFTMetadata: 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 ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + 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 Description", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Description = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PreviewURI", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PreviewURI = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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 ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Transferable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Transferable = bool(v != 0) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Extensible", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Extensible = bool(v != 0) + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOnft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.CreatedAt, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Nsfw", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Nsfw = bool(v != 0) + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RoyaltyShare", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RoyaltyShare.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOnft + } + 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 ErrInvalidLengthOnft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOnft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipOnft(dAtA[iNdEx:]) diff --git a/types/owner.go b/types/owner.go index 85bde3a..fd8e421 100644 --- a/types/owner.go +++ b/types/owner.go @@ -19,7 +19,7 @@ func (idc IDCollection) Supply() int { return len(idc.OnftIds) } -// AddID adds an tokenID to the idCollection +// AddID adds an nftID to the idCollection func (idc IDCollection) AddId(onftId string) IDCollection { idc.OnftIds = append(idc.OnftIds, onftId) return idc @@ -69,7 +69,7 @@ func NewOwner(owner sdk.AccAddress, idCollections ...IDCollection) Owner { type Owners []Owner -// NewOwner creates a new Owner +// NewOwners creates a new Owner func NewOwners(owner ...Owner) Owners { return append([]Owner{}, owner...) } diff --git a/types/query.pb.go b/types/query.pb.go index 6e7f9fc..24a4848 100644 --- a/types/query.pb.go +++ b/types/query.pb.go @@ -134,6 +134,58 @@ func (m *QueryCollectionResponse) GetPagination() *query.PageResponse { return nil } +type QueryIBCCollectionRequest struct { + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryIBCCollectionRequest) Reset() { *m = QueryIBCCollectionRequest{} } +func (m *QueryIBCCollectionRequest) String() string { return proto.CompactTextString(m) } +func (*QueryIBCCollectionRequest) ProtoMessage() {} +func (*QueryIBCCollectionRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1e7e0660fe727010, []int{2} +} +func (m *QueryIBCCollectionRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIBCCollectionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIBCCollectionRequest.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 *QueryIBCCollectionRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIBCCollectionRequest.Merge(m, src) +} +func (m *QueryIBCCollectionRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryIBCCollectionRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIBCCollectionRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIBCCollectionRequest proto.InternalMessageInfo + +func (m *QueryIBCCollectionRequest) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + +func (m *QueryIBCCollectionRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + type QueryDenomRequest struct { DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` } @@ -142,7 +194,7 @@ func (m *QueryDenomRequest) Reset() { *m = QueryDenomRequest{} } func (m *QueryDenomRequest) String() string { return proto.CompactTextString(m) } func (*QueryDenomRequest) ProtoMessage() {} func (*QueryDenomRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{2} + return fileDescriptor_1e7e0660fe727010, []int{3} } func (m *QueryDenomRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -186,7 +238,7 @@ func (m *QueryDenomResponse) Reset() { *m = QueryDenomResponse{} } func (m *QueryDenomResponse) String() string { return proto.CompactTextString(m) } func (*QueryDenomResponse) ProtoMessage() {} func (*QueryDenomResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{3} + return fileDescriptor_1e7e0660fe727010, []int{4} } func (m *QueryDenomResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -222,6 +274,50 @@ func (m *QueryDenomResponse) GetDenom() *Denom { return nil } +type QueryIBCDenomRequest struct { + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` +} + +func (m *QueryIBCDenomRequest) Reset() { *m = QueryIBCDenomRequest{} } +func (m *QueryIBCDenomRequest) String() string { return proto.CompactTextString(m) } +func (*QueryIBCDenomRequest) ProtoMessage() {} +func (*QueryIBCDenomRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_1e7e0660fe727010, []int{5} +} +func (m *QueryIBCDenomRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryIBCDenomRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryIBCDenomRequest.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 *QueryIBCDenomRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryIBCDenomRequest.Merge(m, src) +} +func (m *QueryIBCDenomRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryIBCDenomRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryIBCDenomRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryIBCDenomRequest proto.InternalMessageInfo + +func (m *QueryIBCDenomRequest) GetHash() string { + if m != nil { + return m.Hash + } + return "" +} + type QueryDenomsRequest struct { // pagination defines an optional pagination for the request. Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -232,7 +328,7 @@ func (m *QueryDenomsRequest) Reset() { *m = QueryDenomsRequest{} } func (m *QueryDenomsRequest) String() string { return proto.CompactTextString(m) } func (*QueryDenomsRequest) ProtoMessage() {} func (*QueryDenomsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{4} + return fileDescriptor_1e7e0660fe727010, []int{6} } func (m *QueryDenomsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -284,7 +380,7 @@ func (m *QueryDenomsResponse) Reset() { *m = QueryDenomsResponse{} } func (m *QueryDenomsResponse) String() string { return proto.CompactTextString(m) } func (*QueryDenomsResponse) ProtoMessage() {} func (*QueryDenomsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{5} + return fileDescriptor_1e7e0660fe727010, []int{7} } func (m *QueryDenomsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,7 +432,7 @@ func (m *QueryONFTRequest) Reset() { *m = QueryONFTRequest{} } func (m *QueryONFTRequest) String() string { return proto.CompactTextString(m) } func (*QueryONFTRequest) ProtoMessage() {} func (*QueryONFTRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{6} + return fileDescriptor_1e7e0660fe727010, []int{8} } func (m *QueryONFTRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -387,7 +483,7 @@ func (m *QueryONFTResponse) Reset() { *m = QueryONFTResponse{} } func (m *QueryONFTResponse) String() string { return proto.CompactTextString(m) } func (*QueryONFTResponse) ProtoMessage() {} func (*QueryONFTResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{7} + return fileDescriptor_1e7e0660fe727010, []int{9} } func (m *QueryONFTResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -433,7 +529,7 @@ func (m *QueryOwnerONFTsRequest) Reset() { *m = QueryOwnerONFTsRequest{} func (m *QueryOwnerONFTsRequest) String() string { return proto.CompactTextString(m) } func (*QueryOwnerONFTsRequest) ProtoMessage() {} func (*QueryOwnerONFTsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{8} + return fileDescriptor_1e7e0660fe727010, []int{10} } func (m *QueryOwnerONFTsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -484,16 +580,15 @@ func (m *QueryOwnerONFTsRequest) GetPagination() *query.PageRequest { } type QueryOwnerONFTsResponse struct { - Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` - Collections []OwnerONFTCollection `protobuf:"bytes,2,rep,name=collections,proto3" json:"collections"` - Pagination *query.PageResponse `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` + Owner *Owner `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner,omitempty"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryOwnerONFTsResponse) Reset() { *m = QueryOwnerONFTsResponse{} } func (m *QueryOwnerONFTsResponse) String() string { return proto.CompactTextString(m) } func (*QueryOwnerONFTsResponse) ProtoMessage() {} func (*QueryOwnerONFTsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{9} + return fileDescriptor_1e7e0660fe727010, []int{11} } func (m *QueryOwnerONFTsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -522,17 +617,10 @@ func (m *QueryOwnerONFTsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryOwnerONFTsResponse proto.InternalMessageInfo -func (m *QueryOwnerONFTsResponse) GetOwner() string { +func (m *QueryOwnerONFTsResponse) GetOwner() *Owner { if m != nil { return m.Owner } - return "" -} - -func (m *QueryOwnerONFTsResponse) GetCollections() []OwnerONFTCollection { - if m != nil { - return m.Collections - } return nil } @@ -552,7 +640,7 @@ func (m *QuerySupplyRequest) Reset() { *m = QuerySupplyRequest{} } func (m *QuerySupplyRequest) String() string { return proto.CompactTextString(m) } func (*QuerySupplyRequest) ProtoMessage() {} func (*QuerySupplyRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{10} + return fileDescriptor_1e7e0660fe727010, []int{12} } func (m *QuerySupplyRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -603,7 +691,7 @@ func (m *QuerySupplyResponse) Reset() { *m = QuerySupplyResponse{} } func (m *QuerySupplyResponse) String() string { return proto.CompactTextString(m) } func (*QuerySupplyResponse) ProtoMessage() {} func (*QuerySupplyResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{11} + return fileDescriptor_1e7e0660fe727010, []int{13} } func (m *QuerySupplyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -648,7 +736,7 @@ func (m *OwnerONFTCollection) Reset() { *m = OwnerONFTCollection{} } func (m *OwnerONFTCollection) String() string { return proto.CompactTextString(m) } func (*OwnerONFTCollection) ProtoMessage() {} func (*OwnerONFTCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{12} + return fileDescriptor_1e7e0660fe727010, []int{14} } func (m *OwnerONFTCollection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -699,7 +787,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{13} + return fileDescriptor_1e7e0660fe727010, []int{15} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -738,7 +826,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1e7e0660fe727010, []int{14} + return fileDescriptor_1e7e0660fe727010, []int{16} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -777,8 +865,10 @@ func (m *QueryParamsResponse) GetParams() Params { func init() { proto.RegisterType((*QueryCollectionRequest)(nil), "OmniFlix.onft.v1beta1.QueryCollectionRequest") proto.RegisterType((*QueryCollectionResponse)(nil), "OmniFlix.onft.v1beta1.QueryCollectionResponse") + proto.RegisterType((*QueryIBCCollectionRequest)(nil), "OmniFlix.onft.v1beta1.QueryIBCCollectionRequest") proto.RegisterType((*QueryDenomRequest)(nil), "OmniFlix.onft.v1beta1.QueryDenomRequest") proto.RegisterType((*QueryDenomResponse)(nil), "OmniFlix.onft.v1beta1.QueryDenomResponse") + proto.RegisterType((*QueryIBCDenomRequest)(nil), "OmniFlix.onft.v1beta1.QueryIBCDenomRequest") proto.RegisterType((*QueryDenomsRequest)(nil), "OmniFlix.onft.v1beta1.QueryDenomsRequest") proto.RegisterType((*QueryDenomsResponse)(nil), "OmniFlix.onft.v1beta1.QueryDenomsResponse") proto.RegisterType((*QueryONFTRequest)(nil), "OmniFlix.onft.v1beta1.QueryONFTRequest") @@ -795,61 +885,66 @@ func init() { func init() { proto.RegisterFile("OmniFlix/onft/v1beta1/query.proto", fileDescriptor_1e7e0660fe727010) } var fileDescriptor_1e7e0660fe727010 = []byte{ - // 864 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x4f, 0x13, 0x4f, - 0x18, 0xc7, 0x3b, 0xa5, 0xed, 0x0f, 0x1e, 0x92, 0x9f, 0x3a, 0x20, 0x36, 0x15, 0xda, 0x32, 0x89, - 0x52, 0x9b, 0xb0, 0x2b, 0x25, 0x04, 0x84, 0x93, 0xc5, 0xa0, 0x5e, 0x00, 0x57, 0x4f, 0x5c, 0xcc, - 0xb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x25, 0x89, 0xb2, 0x28, 0x37, 0x56, 0x9c, 0xf8, 0x73, 0x92, - 0xb9, 0xd4, 0x52, 0x8d, 0xda, 0x2a, 0x71, 0x4f, 0x88, 0xf2, 0x1f, 0xfb, 0xf8, 0xb0, 0x82, 0x37, - 0x00, 0x3a, 0xee, 0x93, 0xd1, 0x2c, 0xca, 0x8d, 0x17, 0x6e, 0x4a, 0x9c, 0x45, 0x72, 0x58, 0x24, - 0x5e, 0x35, 0xc1, 0x22, 0x6d, 0xab, 0x55, 0x4d, 0xc4, 0x52, 0x3c, 0x96, 0xe4, 0x0b, 0x82, 0x6b, - 0x5d, 0x48, 0x56, 0x9d, 0x9a, 0x96, 0x86, 0xef, 0x02, 0x94, 0xcf, 0x7e, 0x65, 0x54, 0xe3, 0x85, - 0x59, 0xa9, 0x67, 0x03, 0x24, 0x8f, 0xb9, 0xc7, 0x08, 0xdf, 0xef, 0x81, 0x39, 0xd7, 0x17, 0x93, - 0xc7, 0xf7, 0x71, 0xae, 0xc3, 0x15, 0x86, 0x79, 0xcf, 0xc9, 0x7f, 0xc8, 0xa2, 0x91, 0x07, 0x80, - 0xbd, 0x4e, 0x44, 0x9a, 0x05, 0x88, 0x33, 0x81, 0xc8, 0x70, 0x3a, 0x20, 0x43, 0x6e, 0xc4, 0xa5, - 0xa4, 0xe1, 0xf5, 0x64, 0xb9, 0x3c, 0xfe, 0xa6, 0xa0, 0x61, 0x9b, 0x82, 0x27, 0x21, 0x4e, 0x5f, - 0x98, 0x5a, 0x83, 0x15, 0x6c, 0x4c, 0xe1, 0x5f, 0xc8, 0x47, 0x04, 0x13, 0xbe, 0xa0, 0x82, 0x7f, - 0x15, 0x12, 0x0c, 0xca, 0x4a, 0xa2, 0xec, 0x48, 0xbf, 0x04, 0x8a, 0xb1, 0xa3, 0x93, 0x4c, 0x44, - 0x11, 0x16, 0x17, 0xd7, 0x1f, 0x05, 0x2e, 0x33, 0xb6, 0xad, 0xcd, 0x8d, 0x27, 0xc3, 0x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x45, 0xeb, 0xae, 0xa2, 0xc5, - 0x79, 0x9c, 0x19, 0xe3, 0x97, 0x37, 0x1c, 0xcd, 0xb7, 0x2d, 0xc2, 0xd1, 0xfc, 0x2b, 0xa4, 0xef, - 0x8c, 0xf1, 0x65, 0x51, 0x5c, 0x39, 0x6a, 0xa7, 0xd1, 0x71, 0x3b, 0x8d, 0x7e, 0xb5, 0xd3, 0xe8, - 0xf0, 0x34, 0x1d, 0x39, 0x3e, 0x4d, 0x47, 0x7e, 0x9e, 0xa6, 0x23, 0x3b, 0xe9, 0xaa, 0x6e, 0x3f, - 0x6b, 0x96, 0xa4, 0x32, 0x35, 0x64, 0xff, 0x1f, 0x63, 0xbb, 0x55, 0xd7, 0xac, 0x52, 0x82, 0xfd, - 0xc9, 0x5d, 0xfc, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x49, 0xbd, 0xb7, 0x5b, 0xc6, 0x0b, 0x00, 0x00, + // 934 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xcf, 0x6f, 0x2a, 0x55, + 0x14, 0xc7, 0xb9, 0x3c, 0xc0, 0xbe, 0xd3, 0xe8, 0xd3, 0x5b, 0x7c, 0x22, 0xbe, 0x07, 0xbc, 0x6b, + 0xf4, 0x61, 0x4d, 0x67, 0x5a, 0x9a, 0xa6, 0xb5, 0x5d, 0x49, 0x4d, 0xb5, 0x9b, 0xb6, 0x8e, 0xae, + 0xba, 0x31, 0x03, 0x4c, 0xe9, 0x24, 0xcc, 0x5c, 0xca, 0x1d, 0x54, 0x42, 0xba, 0x71, 0x61, 0x5c, + 0x99, 0x26, 0x9a, 0xc6, 0xb8, 0x34, 0x6a, 0xfc, 0x53, 0xba, 0x6c, 0xe2, 0xc6, 0x15, 0x31, 0xd4, + 0xa5, 0xab, 0xfe, 0x05, 0xe6, 0xfe, 0x98, 0x32, 0x23, 0x30, 0xf0, 0x08, 0x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0xd1, + 0x38, 0x8b, 0x26, 0x55, 0x53, 0x2c, 0xda, 0x91, 0x59, 0xb7, 0x54, 0x2c, 0x23, 0xe0, 0x49, 0x7e, + 0x43, 0xf0, 0xc6, 0x10, 0x12, 0x6b, 0x52, 0x97, 0x59, 0xf8, 0x43, 0x80, 0xea, 0xdd, 0xaf, 0x82, + 0x6a, 0xb1, 0xf4, 0x4c, 0x1b, 0x59, 0x00, 0x2d, 0xe0, 0x1e, 0x70, 0xc2, 0x1f, 0x8f, 0xc0, 0x7c, + 0x3e, 0x11, 0x53, 0xc6, 0x0f, 0x71, 0x7e, 0x87, 0xe0, 0x4d, 0xc1, 0xb9, 0x5f, 0xde, 0x1d, 0x56, + 0xef, 0x6d, 0x48, 0x9c, 0x9a, 0xec, 0x54, 0x29, 0xf7, 0xe8, 0xb6, 0x97, 0x5f, 0x94, 0xca, 0xf1, + 0x5f, 0x89, 0x21, 0x0e, 0xe7, 0x26, 0xd9, 0x2e, 0xbc, 0x26, 0x48, 0x3e, 0xe2, 0xa5, 0x98, 0xb1, + 0x7e, 0xe4, 0x13, 0xc0, 0xc1, 0x4b, 0x94, 0xe2, 0x25, 0x48, 0x0a, 0x03, 0x25, 0xf6, 0x93, 0x31, + 0x62, 0x4b, 0x27, 0x69, 0x4a, 0x76, 0x20, 0xed, 0x0b, 0x13, 0x22, 0x9a, 0x46, 0x13, 0xd2, 0x0a, + 0x62, 0x30, 0xdf, 0x35, 0xac, 0x14, 0x9a, 0x55, 0x29, 0x9c, 0x86, 0x24, 0xfd, 0xca, 0xb5, 0x5a, + 0x42, 0xec, 0x87, 0x86, 0xfc, 0x42, 0x7e, 0x46, 0xb0, 0x14, 0x0a, 0xaa, 0x92, 0xdf, 0x86, 0x94, + 0xc8, 0x88, 0x65, 0x50, 0xe1, 0xc1, 0xa4, 0xec, 0xcb, 0x89, 0xab, 0x5e, 0x3e, 0x66, 0x28, 0x8f, + 0xf9, 0xf5, 0x99, 0x01, 0xaf, 0x0a, 0xb6,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x05, 0xea, 0x1a, 0xd6, 0xc7, 0xa0, 0x2a, 0xb0, 0x01, 0x69, 0x57, 0x4c, 0xdb, 0x73, + 0xfc, 0x13, 0x82, 0x94, 0x1c, 0xb5, 0xd1, 0x85, 0x0c, 0x8d, 0xfa, 0xe8, 0x42, 0x86, 0x27, 0xf7, + 0x44, 0xb4, 0x61, 0x15, 0x99, 0xe4, 0xe1, 0x3d, 0x26, 0xc7, 0x5f, 0x34, 0x5a, 0x68, 0xde, 0x46, + 0xa3, 0x85, 0x87, 0xf0, 0xc4, 0x1e, 0x93, 0xe3, 0xb6, 0xbc, 0x75, 0xd5, 0xcf, 0xa1, 0xeb, 0x7e, + 0x0e, 0xfd, 0xdd, 0xcf, 0xa1, 0x8b, 0x9b, 0x5c, 0xec, 0xfa, 0x26, 0x17, 0xfb, 0xeb, 0x26, 0x17, + 0x3b, 0xce, 0xd5, 0x6d, 0xef, 0xb4, 0x5d, 0xd1, 0xaa, 0xd4, 0xd1, 0xc3, 0x7f, 0x76, 0xbc, 0x4e, + 0xd3, 0x62, 0x95, 0x94, 0xf8, 0xe3, 0xb2, 0xfe, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x0d, + 0x58, 0x45, 0x9a, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -865,7 +960,9 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { Collection(ctx context.Context, in *QueryCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) + IBCCollection(ctx context.Context, in *QueryIBCCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) + IBCDenom(ctx context.Context, in *QueryIBCDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) ONFT(ctx context.Context, in *QueryONFTRequest, opts ...grpc.CallOption) (*QueryONFTResponse, error) OwnerONFTs(ctx context.Context, in *QueryOwnerONFTsRequest, opts ...grpc.CallOption) (*QueryOwnerONFTsResponse, error) @@ -890,6 +987,15 @@ func (c *queryClient) Collection(ctx context.Context, in *QueryCollectionRequest return out, nil } +func (c *queryClient) IBCCollection(ctx context.Context, in *QueryIBCCollectionRequest, opts ...grpc.CallOption) (*QueryCollectionResponse, error) { + out := new(QueryCollectionResponse) + err := c.cc.Invoke(ctx, "/OmniFlix.onft.v1beta1.Query/IBCCollection", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Denom(ctx context.Context, in *QueryDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) { out := new(QueryDenomResponse) err := c.cc.Invoke(ctx, "/OmniFlix.onft.v1beta1.Query/Denom", in, out, opts...) @@ -899,6 +1005,15 @@ func (c *queryClient) Denom(ctx context.Context, in *QueryDenomRequest, opts ... return out, nil } +func (c *queryClient) IBCDenom(ctx context.Context, in *QueryIBCDenomRequest, opts ...grpc.CallOption) (*QueryDenomResponse, error) { + out := new(QueryDenomResponse) + err := c.cc.Invoke(ctx, "/OmniFlix.onft.v1beta1.Query/IBCDenom", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) { out := new(QueryDenomsResponse) err := c.cc.Invoke(ctx, "/OmniFlix.onft.v1beta1.Query/Denoms", in, out, opts...) @@ -947,7 +1062,9 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { Collection(context.Context, *QueryCollectionRequest) (*QueryCollectionResponse, error) + IBCCollection(context.Context, *QueryIBCCollectionRequest) (*QueryCollectionResponse, error) Denom(context.Context, *QueryDenomRequest) (*QueryDenomResponse, error) + IBCDenom(context.Context, *QueryIBCDenomRequest) (*QueryDenomResponse, error) Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) ONFT(context.Context, *QueryONFTRequest) (*QueryONFTResponse, error) OwnerONFTs(context.Context, *QueryOwnerONFTsRequest) (*QueryOwnerONFTsResponse, error) @@ -962,9 +1079,15 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Collection(ctx context.Context, req *QueryCollectionRequest) (*QueryCollectionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Collection not implemented") } +func (*UnimplementedQueryServer) IBCCollection(ctx context.Context, req *QueryIBCCollectionRequest) (*QueryCollectionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IBCCollection not implemented") +} func (*UnimplementedQueryServer) Denom(ctx context.Context, req *QueryDenomRequest) (*QueryDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Denom not implemented") } +func (*UnimplementedQueryServer) IBCDenom(ctx context.Context, req *QueryIBCDenomRequest) (*QueryDenomResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method IBCDenom not implemented") +} func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsRequest) (*QueryDenomsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Denoms not implemented") } @@ -1003,6 +1126,24 @@ func _Query_Collection_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Query_IBCCollection_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryIBCCollectionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).IBCCollection(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OmniFlix.onft.v1beta1.Query/IBCCollection", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).IBCCollection(ctx, req.(*QueryIBCCollectionRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Denom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDenomRequest) if err := dec(in); err != nil { @@ -1021,6 +1162,24 @@ func _Query_Denom_Handler(srv interface{}, ctx context.Context, dec func(interfa return interceptor(ctx, in, info, handler) } +func _Query_IBCDenom_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryIBCDenomRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).IBCDenom(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/OmniFlix.onft.v1beta1.Query/IBCDenom", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).IBCDenom(ctx, req.(*QueryIBCDenomRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_Denoms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryDenomsRequest) if err := dec(in); err != nil { @@ -1119,10 +1278,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Collection", Handler: _Query_Collection_Handler, }, + { + MethodName: "IBCCollection", + Handler: _Query_IBCCollection_Handler, + }, { MethodName: "Denom", Handler: _Query_Denom_Handler, }, + { + MethodName: "IBCDenom", + Handler: _Query_IBCDenom_Handler, + }, { MethodName: "Denoms", Handler: _Query_Denoms_Handler, @@ -1237,6 +1404,48 @@ func (m *QueryCollectionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *QueryIBCCollectionRequest) 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 *QueryIBCCollectionRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIBCCollectionRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryDenomRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1302,6 +1511,36 @@ func (m *QueryDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *QueryIBCDenomRequest) 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 *QueryIBCDenomRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryIBCDenomRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *QueryDenomsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1544,26 +1783,17 @@ func (m *QueryOwnerONFTsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } - if len(m.Collections) > 0 { - for iNdEx := len(m.Collections) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Collections[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + if m.Owner != nil { + { + size, err := m.Owner.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - } - if len(m.Owner) > 0 { - i -= len(m.Owner) - copy(dAtA[i:], m.Owner) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Owner))) i-- dAtA[i] = 0xa } @@ -1783,6 +2013,23 @@ func (m *QueryCollectionResponse) Size() (n int) { return n } +func (m *QueryIBCCollectionRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryDenomRequest) Size() (n int) { if m == nil { return 0 @@ -1809,6 +2056,19 @@ func (m *QueryDenomResponse) Size() (n int) { return n } +func (m *QueryIBCDenomRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Hash) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryDenomsRequest) Size() (n int) { if m == nil { return 0 @@ -1902,16 +2162,10 @@ func (m *QueryOwnerONFTsResponse) Size() (n int) { } var l int _ = l - l = len(m.Owner) - if l > 0 { + if m.Owner != nil { + l = m.Owner.Size() n += 1 + l + sovQuery(uint64(l)) } - if len(m.Collections) > 0 { - for _, e := range m.Collections { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } if m.Pagination != nil { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) @@ -2231,6 +2485,124 @@ func (m *QueryCollectionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryIBCCollectionRequest) 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: QueryIBCCollectionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIBCCollectionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + 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 *QueryDenomRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2399,6 +2771,88 @@ func (m *QueryDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryIBCDenomRequest) 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: QueryIBCDenomRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryIBCDenomRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Hash", 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.Hash = 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 *QueryDenomsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3020,38 +3474,6 @@ func (m *QueryOwnerONFTsResponse) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Owner", 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.Owner = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Collections", wireType) - } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -3077,12 +3499,14 @@ func (m *QueryOwnerONFTsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Collections = append(m.Collections, OwnerONFTCollection{}) - if err := m.Collections[len(m.Collections)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.Owner == nil { + m.Owner = &Owner{} + } + if err := m.Owner.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } diff --git a/types/query.pb.gw.go b/types/query.pb.gw.go index f2ffd9a..48d0420 100644 --- a/types/query.pb.gw.go +++ b/types/query.pb.gw.go @@ -105,6 +105,78 @@ func local_request_Query_Collection_0(ctx context.Context, marshaler runtime.Mar } +var ( + filter_Query_IBCCollection_0 = &utilities.DoubleArray{Encoding: map[string]int{"hash": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} +) + +func request_Query_IBCCollection_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIBCCollectionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_IBCCollection_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.IBCCollection(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_IBCCollection_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIBCCollectionRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_IBCCollection_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.IBCCollection(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_Denom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDenomRequest var metadata runtime.ServerMetadata @@ -159,6 +231,60 @@ func local_request_Query_Denom_0(ctx context.Context, marshaler runtime.Marshale } +func request_Query_IBCDenom_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIBCDenomRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := client.IBCDenom(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_IBCDenom_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryIBCDenomRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["hash"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "hash") + } + + protoReq.Hash, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "hash", err) + } + + msg, err := server.IBCDenom(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_Denoms_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -484,6 +610,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_IBCCollection_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_IBCCollection_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_IBCCollection_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Denom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -507,6 +656,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_IBCDenom_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_IBCDenom_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_IBCDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Denoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -683,6 +855,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_IBCCollection_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_IBCCollection_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_IBCCollection_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Denom_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -703,6 +895,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_IBCDenom_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_IBCDenom_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_IBCDenom_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_Denoms_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -809,8 +1021,12 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_Collection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"omniflix", "onft", "v1beta1", "collections", "denom_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_IBCCollection_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"omniflix", "onft", "v1beta1", "collections", "ibc", "hash"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Denom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"omniflix", "onft", "v1beta1", "denoms", "denom_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_IBCDenom_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"omniflix", "onft", "v1beta1", "denoms", "ibc", "hash"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Denoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"omniflix", "onft", "v1beta1", "denoms"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ONFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"omniflix", "onft", "v1beta1", "denoms", "denom_id", "onfts", "id"}, "", runtime.AssumeColonVerbOpt(false))) @@ -825,8 +1041,12 @@ var ( var ( forward_Query_Collection_0 = runtime.ForwardResponseMessage + forward_Query_IBCCollection_0 = runtime.ForwardResponseMessage + forward_Query_Denom_0 = runtime.ForwardResponseMessage + forward_Query_IBCDenom_0 = runtime.ForwardResponseMessage + forward_Query_Denoms_0 = runtime.ForwardResponseMessage forward_Query_ONFT_0 = runtime.ForwardResponseMessage diff --git a/types/tx.pb.go b/types/tx.pb.go index 5d89f8d..8c30b28 100644 --- a/types/tx.pb.go +++ b/types/tx.pb.go @@ -41,6 +41,9 @@ type MsgCreateDenom struct { Schema string `protobuf:"bytes,6,opt,name=schema,proto3" json:"schema,omitempty"` Sender string `protobuf:"bytes,7,opt,name=sender,proto3" json:"sender,omitempty"` CreationFee types.Coin `protobuf:"bytes,8,opt,name=creation_fee,json=creationFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coin" json:"creation_fee" yaml:"creation_fee"` + Uri string `protobuf:"bytes,9,opt,name=uri,proto3" json:"uri,omitempty"` + UriHash string `protobuf:"bytes,10,opt,name=uri_hash,json=uriHash,proto3" json:"uri_hash,omitempty"` + Data string `protobuf:"bytes,11,opt,name=data,proto3" json:"data,omitempty"` } func (m *MsgCreateDenom) Reset() { *m = MsgCreateDenom{} } @@ -602,66 +605,69 @@ func init() { func init() { proto.RegisterFile("OmniFlix/onft/v1beta1/tx.proto", fileDescriptor_adb8c7aefdb74d05) } var fileDescriptor_adb8c7aefdb74d05 = []byte{ - // 942 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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61, 0x43, 0xfc, 0x1d, 0xfb, 0xf0, - 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x0f, 0xa9, 0xb0, 0x77, 0x0a, 0x00, 0x00, + // 978 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x31, 0x6f, 0xdb, 0x46, + 0x14, 0x16, 0x25, 0x45, 0x96, 0x4e, 0x8e, 0x13, 0x9c, 0x9d, 0x84, 0x16, 0x5a, 0xd2, 0x20, 0x5a, + 0x27, 0x08, 0x60, 0x0a, 0x76, 0x81, 0x0e, 0x6e, 0x97, 0x28, 0xa9, 0xd1, 0x0c, 0x6a, 0x02, 0x26, + 0x5e, 0x32, 0x54, 0x38, 0x91, 0x27, 0xea, 0x60, 0x91, 0x14, 0xee, 0x4e, 0x8e, 0xb5, 0x16, 0x5d, + 0x0b, 0x74, 0xea, 0xdc, 0xa5, 0x4b, 0xa7, 0x02, 0xed, 0xd6, 0xad, 0x93, 0xc7, 0xa0, 0x53, 0xd1, + 0x41, 0x6d, 0xed, 0xa1, 0x9d, 0xfd, 0x0b, 0x0a, 0xde, 0x1d, 0x29, 0xd2, 0x15, 0x65, 0x03, 0x6d, + 0x27, 0xdd, 0xbd, 0xfb, 0xee, 0xde, 0xf7, 0xde, 0xf7, 0xde, 0xa3, 0x80, 0xf1, 0x2c, 0x08, 0xc9, + 0xc1, 0x88, 0x9c, 0xb4, 0xa3, 0x70, 0xc0, 0xdb, 0xc7, 0xbb, 0x7d, 0xcc, 0xd1, 0x6e, 0x9b, 0x9f, + 0xd8, 0x63, 0x1a, 0xf1, 0x08, 0xde, 0x49, 0xce, 0xed, 0xf8, 0xdc, 0x56, 0xe7, 0xad, 0x7b, 0x6e, + 0xc4, 0x82, 0x88, 0xb5, 0x03, 0xe6, 0xb7, 0x8f, 0x77, 0xe3, 0x1f, 0x89, 0x6f, 0x6d, 0xca, 0x83, + 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x66, 0xa5, 0x98, 0x66, 0x75, 0x31, 0xcd, 0x4d, 0x70, 0xef, 0x12, 0x9d, 0x94, 0xea, 0x91, + 0x28, 0xb4, 0xce, 0x84, 0x86, 0xff, 0x27, 0xcb, 0x5c, 0xba, 0x12, 0x67, 0x29, 0x87, 0xaf, 0x64, + 0xba, 0x64, 0x13, 0x3e, 0x17, 0xdf, 0x20, 0xf8, 0x3e, 0x68, 0xa0, 0x09, 0x1f, 0x46, 0x94, 0xf0, + 0xa9, 0xe4, 0xd3, 0xd1, 0x7f, 0xfe, 0x61, 0x67, 0x43, 0x0d, 0xcf, 0x47, 0x9e, 0x47, 0x31, 0x63, + 0x2f, 0x38, 0x25, 0xa1, 0xef, 0xcc, 0xa1, 0xf0, 0x03, 0x50, 0x93, 0x5f, 0x31, 0x41, 0xb7, 0xb9, + 0xf7, 0x76, 0x41, 0x9d, 0x4b, 0x37, 0xaa, 0xca, 0xd5, 0x95, 0xfd, 0xb5, 0xcf, 0xfe, 0xfc, 0xee, + 0xe1, 0xfc, 0x31, 0x95, 0xb7, 0x2c, 0xaf, 0x84, 0xf3, 0xde, 0x4f, 0x37, 0x40, 0xa5, 0xcb, 0x7c, + 0xe8, 0x82, 0x66, 0xf6, 0x4b, 0xf6, 0x6e, 0x51, 0x5b, 0xe5, 0x66, 0x67, 0x6b, 0xe7, 0x5a, 0xb0, + 0xc4, 0x59, 0xec, 0x24, 0x3b, 0x5e, 0x97, 0x38, 0xc9, 0xc0, 0x96, 0x39, 0x59, 0x30, 0xef, 0x20, + 0x01, 0x37, 0xf3, 0xc3, 0xee, 0x7e, 0xf1, 0xfd, 0x1c, 0xb0, 0xd5, 0xbe, 0x26, 0x30, 0x75, 0xf5, + 0x0a, 0xd4, 0xd3, 0xd1, 0x66, 0x15, 0x5f, 0x4e, 0x30, 0xad, 0x87, 0x57, 0x63, 0xd2, 0xb7, 0x07, + 0x60, 0x35, 0xd7, 0x77, 0xdb, 0x57, 0x93, 0x13, 0x3e, 0xec, 0xeb, 0xe1, 0xb2, 0x31, 0xa4, 0x5d, + 0xb3, 0x24, 0x86, 0x04, 0xb3, 0x2c, 0x86, 0xcb, 0x0d, 0x11, 0xc7, 0x90, 0x6b, 0x86, 0xed, 0xab, + 0x94, 0x94, 0xb8, 0x65, 0x31, 0x2c, 0x2a, 0xe2, 0xce, 0x87, 0xa7, 0x7f, 0x18, 0xa5, 0xd3, 0x33, + 0x43, 0x7b, 0x73, 0x66, 0x68, 0xbf, 0x9f, 0x19, 0xda, 0x97, 0xe7, 0x46, 0xe9, 0xcd, 0xb9, 0x51, + 0xfa, 0xe5, 0xdc, 0x28, 0xbd, 0x32, 0x32, 0x63, 0x36, 0xff, 0xaf, 0x4e, 0x8c, 0xd8, 0x7e, 0x4d, + 0xfc, 0x9f, 0x7b, 0xef, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x65, 0x3e, 0x3b, 0xb8, 0x0a, + 0x00, 0x00, } func (this *MsgCreateDenom) Equal(that interface{}) bool { @@ -707,6 +713,15 @@ func (this *MsgCreateDenom) Equal(that interface{}) bool { if !this.CreationFee.Equal(&that1.CreationFee) { return false } + if this.Uri != that1.Uri { + return false + } + if this.UriHash != that1.UriHash { + return false + } + if this.Data != that1.Data { + return false + } return true } func (this *MsgUpdateDenom) Equal(that interface{}) bool { @@ -1214,6 +1229,27 @@ func (m *MsgCreateDenom) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x5a + } + if len(m.UriHash) > 0 { + i -= len(m.UriHash) + copy(dAtA[i:], m.UriHash) + i = encodeVarintTx(dAtA, i, uint64(len(m.UriHash))) + i-- + dAtA[i] = 0x52 + } + if len(m.Uri) > 0 { + i -= len(m.Uri) + copy(dAtA[i:], m.Uri) + i = encodeVarintTx(dAtA, i, uint64(len(m.Uri))) + i-- + dAtA[i] = 0x4a + } { size, err := m.CreationFee.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1829,6 +1865,18 @@ func (m *MsgCreateDenom) Size() (n int) { } l = m.CreationFee.Size() n += 1 + l + sovTx(uint64(l)) + l = len(m.Uri) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.UriHash) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -2340,6 +2388,102 @@ func (m *MsgCreateDenom) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Uri", 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.Uri = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UriHash", 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.UriHash = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + 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 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.Data = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/types/utils.go b/types/utils.go index 5d4e387..b78dc3a 100644 --- a/types/utils.go +++ b/types/utils.go @@ -16,3 +16,7 @@ var ( func GenUniqueID(prefix string) string { return prefix + strings.ReplaceAll(uuid.New().String(), "-", "") } + +func IsIBCDenom(denomID string) bool { + return strings.HasPrefix(denomID, "ibc/") +}