Skip to content

Commit

Permalink
Merge remote-tracking branch 'pokt/main' into chore/scaffold-proof-msg
Browse files Browse the repository at this point in the history
* pokt/main:
  [Gateway] Scaffold the Gateway type (#57)
  [Gateway] Scaffold Gateway module and nothing else
  fix: post-merge imports
  [Session] Adding the Session type (#54)
  [WIP][Session] Adding the Relay type (#53)
  • Loading branch information
bryanchriswhite committed Oct 13, 2023
2 parents 1b0f739 + 0ec3f58 commit 036c986
Show file tree
Hide file tree
Showing 42 changed files with 1,897 additions and 3 deletions.
23 changes: 23 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ import (
suppliermodulekeeper "pocket/x/supplier/keeper"
suppliermoduletypes "pocket/x/supplier/types"

gatewaymodule "pocket/x/gateway"
gatewaymodulekeeper "pocket/x/gateway/keeper"
gatewaymoduletypes "pocket/x/gateway/types"
// this line is used by starport scaffolding # stargate/app/moduleImport

appparams "pocket/app/params"
Expand Down Expand Up @@ -196,6 +199,7 @@ var (
sessionmodule.AppModuleBasic{},
applicationmodule.AppModuleBasic{},
suppliermodule.AppModuleBasic{},
gatewaymodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand All @@ -212,6 +216,7 @@ var (
suppliermoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
servicemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
applicationmoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
gatewaymoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner, authtypes.Staking},
// this line is used by starport scaffolding # stargate/app/maccPerms
}
)
Expand Down Expand Up @@ -280,6 +285,7 @@ type App struct {
ApplicationKeeper applicationmodulekeeper.Keeper
SupplierKeeper suppliermodulekeeper.Keeper

GatewayKeeper gatewaymodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -331,6 +337,7 @@ func New(
sessionmoduletypes.StoreKey,
applicationmoduletypes.StoreKey,
suppliermoduletypes.StoreKey,
gatewaymoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -599,6 +606,17 @@ func New(
)
supplierModule := suppliermodule.NewAppModule(appCodec, app.SupplierKeeper, app.AccountKeeper, app.BankKeeper)

app.GatewayKeeper = *gatewaymodulekeeper.NewKeeper(
appCodec,
keys[gatewaymoduletypes.StoreKey],
keys[gatewaymoduletypes.MemStoreKey],
app.GetSubspace(gatewaymoduletypes.ModuleName),

app.BankKeeper,
app.AccountKeeper,
)
gatewayModule := gatewaymodule.NewAppModule(appCodec, app.GatewayKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

/**** IBC Routing ****/
Expand Down Expand Up @@ -665,6 +683,7 @@ func New(
sessionModule,
applicationModule,
supplierModule,
gatewayModule,
// this line is used by starport scaffolding # stargate/app/appModule

crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
Expand Down Expand Up @@ -702,6 +721,7 @@ func New(
sessionmoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand Down Expand Up @@ -732,6 +752,7 @@ func New(
sessionmoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -767,6 +788,7 @@ func New(
sessionmoduletypes.ModuleName,
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -996,6 +1018,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(sessionmoduletypes.ModuleName)
paramsKeeper.Subspace(applicationmoduletypes.ModuleName)
paramsKeeper.Subspace(suppliermoduletypes.ModuleName)
paramsKeeper.Subspace(gatewaymoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
256 changes: 256 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46634,6 +46634,203 @@ paths:
additionalProperties: {}
tags:
- Query
/pocket/gateway/gateway:
get:
operationId: PocketGatewayGatewayAll
responses:
'200':
description: A successful response.
schema:
type: object
properties:
gateway:
type: array
items:
type: object
properties:
address:
type: string
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: >-
PageResponse is to be embedded in gRPC response messages where
the

corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
- name: pagination.reverse
description: >-
reverse is set to true if results are to be returned in the
descending order.


Since: cosmos-sdk 0.43
in: query
required: false
type: boolean
tags:
- Query
/pocket/gateway/gateway/{address}:
get:
summary: Queries a list of Gateway items.
operationId: PocketGatewayGateway
responses:
'200':
description: A successful response.
schema:
type: object
properties:
gateway:
type: object
properties:
address:
type: string
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: address
in: path
required: true
type: string
tags:
- Query
/pocket/gateway/params:
get:
summary: Parameters queries the parameters of the module.
operationId: PocketGatewayParams
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
tags:
- Query
/pocket/pocket/params:
get:
summary: Parameters queries the parameters of the module.
Expand Down Expand Up @@ -75741,6 +75938,65 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
pocket.gateway.Gateway:
type: object
properties:
address:
type: string
pocket.gateway.Params:
type: object
description: Params defines the parameters for the module.
pocket.gateway.QueryAllGatewayResponse:
type: object
properties:
gateway:
type: array
items:
type: object
properties:
address:
type: string
pagination:
type: object
properties:
next_key:
type: string
format: byte
description: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently. It will be empty if
there are no more results.
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
description: |-
PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.

message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
pocket.gateway.QueryGetGatewayResponse:
type: object
properties:
gateway:
type: object
properties:
address:
type: string
pocket.gateway.QueryParamsResponse:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
pocket.pocket.Params:
type: object
description: Params defines the parameters for the module.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ require (
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/grpc v1.56.1
gopkg.in/yaml.v2 v2.4.0
)
Expand Down Expand Up @@ -259,6 +258,7 @@ require (
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/api v0.122.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
9 changes: 9 additions & 0 deletions proto/pocket/gateway/gateway.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package pocket.gateway;

option go_package = "pocket/x/gateway/types";

message Gateway {
string address = 1;
}

Loading

0 comments on commit 036c986

Please sign in to comment.