Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: Add resource module (DEV-1281) #330

Merged
merged 76 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
fab0bab
dev-1281: add `resource` module
Toktar Jun 3, 2022
a18b4ff
dev-1281: update keeper ant types in `resource` module
Toktar Jun 3, 2022
e030949
dev-1281: update query implementation for `resource` module
Toktar Jun 6, 2022
48e93e1
Various
askolesov Jun 9, 2022
b0424e5
Make it compilable
Jun 14, 2022
846aa7d
Make it compilable
Jun 14, 2022
91cc8b3
Merge pull request #331 from cheqd/DEV-1281-schema
Toktar Jun 14, 2022
6e85cf1
Fixing validation / build
askolesov Jun 16, 2022
7a8c739
Implementing resources creation
askolesov Jun 16, 2022
a908508
dev-1281: add resource unit tests
Toktar Jun 16, 2022
63250f0
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Toktar Jun 16, 2022
0bc8a81
Fixing tests
askolesov Jun 16, 2022
5125db7
Minimal resource creation
askolesov Jun 16, 2022
5b0524f
dev-1281: update resource unit tests
Toktar Jun 16, 2022
b0f45bb
Implementation of createResource cli command
askolesov Jun 17, 2022
f7a5bda
Fix createResource bash test
askolesov Jun 17, 2022
6669a4a
dev-1281: add resource query
Toktar Jun 17, 2022
c80bcad
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Toktar Jun 17, 2022
e1522ba
dev-1281: update tests
Toktar Jun 17, 2022
28d4ab2
Add validation for resourceType and MimeType
Jun 17, 2022
62fb818
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Jun 17, 2022
cbdbe4a
Add created and checksum for Resource
Jun 17, 2022
1006313
Fixing backlinks from diddocx to resources
askolesov Jun 17, 2022
7d3c314
Merge branch 'DEV-1281-resource-module' of https://github.com/cheqd/c…
askolesov Jun 17, 2022
c69dd23
Add files for queries
askolesov Jun 17, 2022
2eb9da7
Move cheqcksum to bytes
Jun 17, 2022
4cc5973
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Jun 17, 2022
abc8253
Implementation
askolesov Jun 17, 2022
6d17157
Fixes and tests for resourceType and MimeTYpe
Jun 17, 2022
f507eb3
Merge branch 'DEV-1281-resource-module' of https://github.com/cheqd/c…
askolesov Jun 17, 2022
7f2dbb4
Fix merge conflivts
askolesov Jun 17, 2022
1f29461
Finish resource creation
askolesov Jun 17, 2022
30003c4
fix tests
Jun 17, 2022
cc2cf11
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Jun 17, 2022
d8b0bdf
for moving to another machine
Jun 20, 2022
0b32565
Implement query all versions query
askolesov Jun 20, 2022
44f1408
Implementation
askolesov Jun 20, 2022
abc9e33
Add cli command and bash test for query resource
askolesov Jun 20, 2022
9de750d
Finish get allresource versions query and tests
askolesov Jun 20, 2022
07053ea
Finish implementation
Jun 20, 2022
47e8866
Add check for did doc existing in queries
askolesov Jun 21, 2022
8107b42
Finidsh bash tests for collerction_resources, resource_versions
askolesov Jun 21, 2022
a7b12bd
Fix unit tests
askolesov Jun 21, 2022
bd0c640
Fix formatting
askolesov Jun 21, 2022
31d7f09
Fix formatting
askolesov Jun 21, 2022
47b5e06
Cleaning up code
askolesov Jun 21, 2022
e14c024
Fix python tests
askolesov Jun 21, 2022
dff4286
Regenerate protobufs
askolesov Jun 21, 2022
6f053c6
Fix genesis export/import
askolesov Jun 21, 2022
be9d386
Fix formatiing
askolesov Jun 21, 2022
7bd0567
Fix legacy query routing
askolesov Jun 21, 2022
202b3ba
Remove unused errors
askolesov Jun 21, 2022
e339b37
Fix formatting
askolesov Jun 21, 2022
ea5cfb5
Fix genesis validation
askolesov Jun 21, 2022
aeabc13
Remove image from allowed mime types
askolesov Jun 21, 2022
a3b48fc
Fix python tests
askolesov Jun 21, 2022
3db2b76
For the previous commit
askolesov Jun 21, 2022
d61d14c
Fix unit tests
askolesov Jun 21, 2022
2ea7650
Add tests for allresourceversions
Jun 21, 2022
80ff95a
Merge branch 'DEV-1281-resource-module' of github.com:cheqd/cheqd-nod…
Jun 21, 2022
2f20de0
Fix formatting
askolesov Jun 21, 2022
1164a07
Add user friendly resource creation command
askolesov Jun 22, 2022
3a83422
Allow UUIDs as IDs in DIDs
askolesov Jun 23, 2022
fe0e4a6
Optimize list queries not to return resource data
askolesov Jun 23, 2022
accdcc7
Fix formatting
askolesov Jun 23, 2022
3dbff78
Merge branch 'main' into DEV-1281-resource-module
askolesov Jun 23, 2022
ed2e83d
Extend allowed mime types
askolesov Jun 24, 2022
db71cc2
Merge branch 'DEV-1281-resource-module' of https://github.com/cheqd/c…
askolesov Jun 24, 2022
2919543
Rename mimeType to mediaType
askolesov Jun 27, 2022
9ea1ef8
Implement media_type detectin on chain
askolesov Jun 27, 2022
ec02936
Fix tests, formatting
askolesov Jun 27, 2022
59ce8f3
Fix linter issues
askolesov Jun 27, 2022
1085dc1
Allow any value for service-type in did docs
askolesov Jun 27, 2022
e7fe839
Switch from positional arguments to flags
askolesov Jun 29, 2022
f3a3bb5
Remove resource_type, media_type form the versioning logic
askolesov Jun 29, 2022
9fe9dd3
Clarified usage instructions and flags
ankurdotb Jun 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import (
"os"
"path/filepath"

"github.com/cheqd/cheqd-node/x/resource"

cheqdtypes "github.com/cheqd/cheqd-node/x/cheqd/types"
resourcetypes "github.com/cheqd/cheqd-node/x/resource/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/authz"
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
Expand Down Expand Up @@ -37,6 +40,7 @@ import (
appparams "github.com/cheqd/cheqd-node/app/params"
"github.com/cheqd/cheqd-node/x/cheqd"
cheqdkeeper "github.com/cheqd/cheqd-node/x/cheqd/keeper"
resourcekeeper "github.com/cheqd/cheqd-node/x/resource/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/rpc"
Expand Down Expand Up @@ -147,6 +151,7 @@ var (
feegrantmodule.AppModuleBasic{},
authzmodule.AppModuleBasic{},
cheqd.AppModuleBasic{},
resource.AppModuleBasic{},
)

// module account permissions
Expand Down Expand Up @@ -214,7 +219,8 @@ type App struct {
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

cheqdKeeper cheqdkeeper.Keeper
cheqdKeeper cheqdkeeper.Keeper
resourceKeeper resourcekeeper.Keeper

// the module manager
mm *module.Manager
Expand Down Expand Up @@ -243,7 +249,7 @@ func New(
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey, feegrant.StoreKey,
ibchost.StoreKey, ibctransfertypes.StoreKey, authzkeeper.StoreKey,
cheqdtypes.StoreKey,
cheqdtypes.StoreKey, resourcetypes.StoreKey,
)

tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -378,6 +384,10 @@ func New(
appCodec, keys[cheqdtypes.StoreKey],
)

app.resourceKeeper = *resourcekeeper.NewKeeper(
appCodec, keys[resourcetypes.StoreKey],
)

app.GovKeeper = govkeeper.NewKeeper(
appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper,
&stakingKeeper, govRouter,
Expand Down Expand Up @@ -418,6 +428,7 @@ func New(
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeegrantKeeper, app.interfaceRegistry),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
cheqd.NewAppModule(appCodec, app.cheqdKeeper),
resource.NewAppModule(appCodec, app.resourceKeeper, app.cheqdKeeper),
ibc.NewAppModule(app.IBCKeeper),
transferModule,
)
Expand All @@ -437,6 +448,7 @@ func New(
stakingtypes.ModuleName,
ibchost.ModuleName,
cheqdtypes.ModuleName,
resourcetypes.ModuleName,
genutiltypes.ModuleName,
banktypes.ModuleName,
crisistypes.ModuleName,
Expand All @@ -461,6 +473,7 @@ func New(
evidencetypes.ModuleName,
ibchost.ModuleName,
cheqdtypes.ModuleName,
resourcetypes.ModuleName,
genutiltypes.ModuleName,
banktypes.ModuleName,
ibctransfertypes.ModuleName,
Expand Down Expand Up @@ -493,6 +506,7 @@ func New(
feegrant.ModuleName,
authz.ModuleName,
cheqdtypes.ModuleName,
resourcetypes.ModuleName,
vestingtypes.ModuleName,
upgradetypes.ModuleName,
paramstypes.ModuleName,
Expand All @@ -515,6 +529,7 @@ func New(
feegrant.ModuleName,
authz.ModuleName,
cheqdtypes.ModuleName,
resourcetypes.ModuleName,
paramstypes.ModuleName,
vestingtypes.ModuleName,
upgradetypes.ModuleName,
Expand Down Expand Up @@ -573,7 +588,7 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo

func (app *App) TestNetMigration(ctx sdk.Context) {
if ctx.ChainID() == "cheqd-testnet-2" {
app.cheqdKeeper.SetDidNamespace(ctx, "testnet")
app.cheqdKeeper.SetDidNamespace(&ctx, "testnet")
}
}

Expand Down
6 changes: 3 additions & 3 deletions app/migration_v_0_5.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

func (app *App) Migration05(ctx sdk.Context) {
oldKey := "testnettestnet"
namespase := app.cheqdKeeper.GetFromState(ctx, oldKey)
app.cheqdKeeper.DeteteFromState(ctx, oldKey)
app.cheqdKeeper.SetDidNamespace(ctx, namespase)
namespase := app.cheqdKeeper.GetFromState(&ctx, oldKey)
app.cheqdKeeper.DeleteFromState(&ctx, oldKey)
app.cheqdKeeper.SetDidNamespace(&ctx, namespase)
}
17 changes: 10 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ go 1.17
require (
filippo.io/edwards25519 v1.0.0-beta.2
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-sdk v0.45.4
github.com/cosmos/cosmos-sdk v0.45.5
github.com/cosmos/ibc-go v1.4.0
github.com/gabriel-vasile/mimetype v1.4.0
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/lestrrat-go/jwx v1.2.20
Expand All @@ -22,8 +24,8 @@ require (
github.com/stretchr/testify v1.7.1
github.com/tendermint/tendermint v0.34.19
github.com/tendermint/tm-db v0.6.6
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb
google.golang.org/grpc v1.45.0
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd
google.golang.org/grpc v1.46.2
)

require (
Expand Down Expand Up @@ -65,6 +67,7 @@ require (
github.com/gogo/gateway v1.1.0 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/orderedcode v0.0.1 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
Expand Down Expand Up @@ -124,14 +127,14 @@ require (
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.0.0-20220214200702-86341886e292 // indirect
golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.6 // indirect
)

Expand Down
25 changes: 18 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
github.com/gabriel-vasile/mimetype v1.4.0 h1:Cn9dkdYsMIu56tGho+fqzh7XmvY2YyGU0FnbhiOsEro=
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
Expand Down Expand Up @@ -427,8 +429,9 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64=
Expand Down Expand Up @@ -457,6 +460,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
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=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0=
Expand Down Expand Up @@ -1170,15 +1175,17 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210917221730-978cfadd31cf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b h1:MWaHNqZy3KTpuTMAGvv+Kw+ylsEpmyJZizz1dqxnu28=
golang.org/x/net v0.0.0-20211208012354-db4efeb81f4b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
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=
Expand Down Expand Up @@ -1304,11 +1311,13 @@ golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211205182925-97ca703d548d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/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 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
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=
Expand Down Expand Up @@ -1393,7 +1402,6 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
Expand Down Expand Up @@ -1508,8 +1516,9 @@ google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ6
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb h1:ZrsicilzPCS/Xr8qtBZZLpy4P9TYXAfl49ctG1/5tgw=
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd h1:e0TwkXOdbnH/1x5rc5MZ/VYyiZ4v+RdVfrGMqEwT68I=
google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4=
google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
Expand All @@ -1526,8 +1535,9 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.25.1-0.20200805231151-a709e31e5d12/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.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=
Expand Down Expand Up @@ -1562,8 +1572,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
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=
Expand Down
1 change: 1 addition & 0 deletions proto/cheqd/v1/stateValue.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ message Metadata {
string updated = 2;
bool deactivated = 3;
string version_id = 4;
repeated string resources = 5;
}
12 changes: 12 additions & 0 deletions proto/resource/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "resource/v1/resource.proto";

// GenesisState defines the cheqd module's genesis state.
message GenesisState {
repeated Resource resourceList = 1;
}

49 changes: 49 additions & 0 deletions proto/resource/v1/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
syntax = "proto3";
package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "google/api/annotations.proto";
import "resource/v1/resource.proto";


// Query defines the gRPC querier service.
service Query {
rpc Resource(QueryGetResourceRequest) returns (QueryGetResourceResponse) {
option (google.api.http).get = "/1.0/identifiers/{collection_id}/resources/{id}";
}
rpc CollectionResources(QueryGetCollectionResourcesRequest) returns (QueryGetCollectionResourcesResponse) {
option (google.api.http).get = "/1.0/identifiers/{collection_id}/resources";
}
rpc AllResourceVersions(QueryGetAllResourceVersionsRequest) returns (QueryGetAllResourceVersionsResponse) {
option (google.api.http).get = "/1.0/identifiers/{collection_id}/resources/versions";
}
rosspower11 marked this conversation as resolved.
Show resolved Hide resolved
}

message QueryGetResourceRequest {
string collection_id = 1;
string id = 2;
}

message QueryGetResourceResponse {
Resource resource = 1;
}

message QueryGetCollectionResourcesRequest {
string collection_id = 1;
}

message QueryGetCollectionResourcesResponse {
repeated ResourceHeader resources = 1;
}

message QueryGetAllResourceVersionsRequest {
string collection_id = 1; // Mapped to URL path
string name = 2; // Mapped to URL parameter `name`
string resource_type = 3; // Mapped to URL parameter `resource_type`
string media_type = 4; // Mapped to URL parameter `media_type`
}

message QueryGetAllResourceVersionsResponse {
repeated ResourceHeader resources = 1;
}
22 changes: 22 additions & 0 deletions proto/resource/v1/resource.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
syntax = "proto3";
package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";


message Resource {
ResourceHeader header = 1;
bytes data = 2;
}

message ResourceHeader {
string collection_id = 1;
string id = 2;
string name = 3;
string resource_type = 4;
string media_type = 5;
string created = 6;
bytes checksum = 7;
string previous_version_id = 8;
string next_version_id = 9;
}
30 changes: 30 additions & 0 deletions proto/resource/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";
package cheqdid.cheqdnode.resource.v1;

option go_package = "github.com/cheqd/cheqd-node/x/resource/types";

import "cheqd/v1/tx.proto";
import "resource/v1/resource.proto";

// Msg defines the Msg service.
service Msg {
rpc CreateResource(MsgCreateResource) returns (MsgCreateResourceResponse);
}

// this line is used by starport scaffolding # proto/tx/message
message MsgCreateResource {
MsgCreateResourcePayload payload = 1;
repeated cheqdid.cheqdnode.cheqd.v1.SignInfo signatures = 2;
}

message MsgCreateResourcePayload {
string collection_id = 1;
string id = 2;
string name = 3;
string resource_type = 4;
bytes data = 6;
}

message MsgCreateResourceResponse {
Resource resource = 1; // Not necessary
}
Binary file added tests/e2e-bash/resource.dat
Binary file not shown.
Loading