diff --git a/app/app.go b/app/app.go index 7c3de4940..29a60e11c 100644 --- a/app/app.go +++ b/app/app.go @@ -148,9 +148,6 @@ import ( did "github.com/onsonr/sonr/x/did" didkeeper "github.com/onsonr/sonr/x/did/keeper" didtypes "github.com/onsonr/sonr/x/did/types" - macaroon "github.com/onsonr/sonr/x/macaroon" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" - macaroontypes "github.com/onsonr/sonr/x/macaroon/types" service "github.com/onsonr/sonr/x/service" servicekeeper "github.com/onsonr/sonr/x/service/keeper" servicetypes "github.com/onsonr/sonr/x/service/types" @@ -236,7 +233,6 @@ type SonrApp struct { UpgradeKeeper *upgradekeeper.Keeper legacyAmino *codec.LegacyAmino VaultKeeper vaultkeeper.Keeper - MacaroonKeeper macaroonkeeper.Keeper ServiceKeeper servicekeeper.Keeper sm *module.SimulationManager BasicModuleManager module.BasicManager @@ -371,7 +367,6 @@ func NewChainApp( packetforwardtypes.StoreKey, didtypes.StoreKey, vaulttypes.StoreKey, - macaroontypes.StoreKey, servicetypes.StoreKey, ) @@ -632,16 +627,6 @@ func NewChainApp( app.StakingKeeper, ) - // Create the macaroon Keeper - app.MacaroonKeeper = macaroonkeeper.NewKeeper( - appCodec, - sdkruntime.NewKVStoreService(keys[macaroontypes.StoreKey]), - logger, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - app.AccountKeeper, - app.DidKeeper, - ) - // Create the vault Keeper app.VaultKeeper = vaultkeeper.NewKeeper( appCodec, @@ -650,7 +635,6 @@ func NewChainApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.AccountKeeper, app.DidKeeper, - app.MacaroonKeeper, ) // Create the service Keeper @@ -661,7 +645,6 @@ func NewChainApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), app.DidKeeper, app.GroupKeeper, - app.MacaroonKeeper, app.NFTKeeper, app.VaultKeeper, ) @@ -924,10 +907,9 @@ func NewChainApp( did.NewAppModule(appCodec, app.DidKeeper, app.NFTKeeper), - macaroon.NewAppModule(appCodec, app.MacaroonKeeper, app.DidKeeper), vault.NewAppModule(appCodec, app.VaultKeeper, app.DidKeeper), - service.NewAppModule(appCodec, app.ServiceKeeper, app.DidKeeper, app.MacaroonKeeper), + service.NewAppModule(appCodec, app.ServiceKeeper, app.DidKeeper), ) // BasicModuleManager defines the module BasicManager is in charge of setting up basic, @@ -977,7 +959,6 @@ func NewChainApp( packetforwardtypes.ModuleName, didtypes.ModuleName, vaulttypes.ModuleName, - macaroontypes.ModuleName, servicetypes.ModuleName, ) @@ -999,7 +980,6 @@ func NewChainApp( packetforwardtypes.ModuleName, didtypes.ModuleName, vaulttypes.ModuleName, - macaroontypes.ModuleName, servicetypes.ModuleName, ) @@ -1030,7 +1010,6 @@ func NewChainApp( packetforwardtypes.ModuleName, didtypes.ModuleName, vaulttypes.ModuleName, - macaroontypes.ModuleName, servicetypes.ModuleName, } app.ModuleManager.SetOrderInitGenesis(genesisModuleOrder...) @@ -1491,7 +1470,6 @@ func initParamsKeeper( WithKeyTable(packetforwardtypes.ParamKeyTable()) paramsKeeper.Subspace(didtypes.ModuleName) paramsKeeper.Subspace(vaulttypes.ModuleName) - paramsKeeper.Subspace(macaroontypes.ModuleName) paramsKeeper.Subspace(servicetypes.ModuleName) return paramsKeeper diff --git a/proto/did/v1/state.proto b/proto/did/v1/state.proto index 7dd8eb3dc..83555ced0 100644 --- a/proto/did/v1/state.proto +++ b/proto/did/v1/state.proto @@ -104,6 +104,37 @@ message Controller { int64 creation_block = 9; } +// Grant is a Grant message type. +message Grant { + option (cosmos.orm.v1.table) = { + id : 1 + primary_key : {fields : "id" auto_increment : true} + index : {id : 1 fields : "subject,origin" unique : true} + }; + + uint64 id = 1; + string controller = 2; + string subject = 3; + string origin = 4; + int64 expiry_height = 5; +} + +// Macaroon is a Macaroon message type. +message Macaroon { + option (cosmos.orm.v1.table) = { + id : 2 + primary_key : {fields : "id" auto_increment : true} + index : {id : 1 fields : "subject,origin" unique : true} + }; + + uint64 id = 1; + string controller = 2; + string subject = 3; + string origin = 4; + int64 expiry_height = 5; + string macaroon = 6; +} + // Verification represents a verification method message Verification { option (cosmos.orm.v1.table) = { diff --git a/proto/macaroon/module/v1/module.proto b/proto/macaroon/module/v1/module.proto deleted file mode 100644 index a7eca65cb..000000000 --- a/proto/macaroon/module/v1/module.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -package onsonr.sonr.macaroon.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; - -// Module is the app config object of the module. -// Learn more: https://docs.cosmos.network/main/building-modules/depinject -message Module { - option (cosmos.app.v1alpha1.module) = {go_import: "github.com/onsonr/sonr/x/macaroon"}; -} diff --git a/proto/macaroon/v1/genesis.proto b/proto/macaroon/v1/genesis.proto deleted file mode 100644 index 9f6e813e3..000000000 --- a/proto/macaroon/v1/genesis.proto +++ /dev/null @@ -1,62 +0,0 @@ -syntax = "proto3"; -package macaroon.v1; - -import "amino/amino.proto"; -import "did/v1/tx.proto"; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/onsonr/sonr/x/macaroon/types"; - -// GenesisState defines the module genesis state -message GenesisState { - // Params defines all the parameters of the module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -// Params defines the set of module parameters. -message Params { - option (amino.name) = "macaroon/params"; - option (gogoproto.equal) = true; - option (gogoproto.goproto_stringer) = false; - - // The list of methods - Methods methods = 1; - - // The list of scopes - Scopes scopes = 2; - - // The list of caveats - Caveats caveats = 3; -} - -// Methods defines the available DID methods -message Methods { - option (amino.name) = "macaroon/methods"; - option (gogoproto.equal) = true; - string default = 1; - repeated string supported = 2; -} - -// Scopes defines the set of scopes -message Scopes { - option (amino.name) = "macaroon/scopes"; - option (gogoproto.equal) = true; - string base = 1; - repeated string supported = 2; -} - -// Caveats defines the available caveats -message Caveats { - option (amino.name) = "macaroon/caveats"; - option (gogoproto.equal) = true; - - repeated Caveat supported_first_party = 1; - repeated Caveat supported_third_party = 2; -} - -// Caveat defines the caveat -message Caveat { - repeated string scopes = 1; - string caveat = 2; - string description = 3; -} diff --git a/proto/macaroon/v1/query.proto b/proto/macaroon/v1/query.proto deleted file mode 100644 index d27db303d..000000000 --- a/proto/macaroon/v1/query.proto +++ /dev/null @@ -1,64 +0,0 @@ -syntax = "proto3"; -package macaroon.v1; - -import "google/api/annotations.proto"; -import "macaroon/v1/genesis.proto"; - -option go_package = "github.com/onsonr/sonr/x/macaroon/types"; - -// Query provides defines the gRPC querier service. -service Query { - // Params queries all parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/macaroon/v1/params"; - } - - // RefreshToken refreshes a macaroon token as post authentication. - rpc RefreshToken(QueryRefreshTokenRequest) - returns (QueryRefreshTokenResponse) { - option (google.api.http).post = "/macaroon/v1/refresh"; - } - - // ValidateToken validates a macaroon token as pre authentication. - rpc ValidateToken(QueryValidateTokenRequest) - returns (QueryValidateTokenResponse) { - option (google.api.http).post = "/macaroon/v1/validate"; - } -} - -// QueryParamsRequest is the request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is the response type for the Query/Params RPC method. -message QueryParamsResponse { - // params defines the parameters of the module. - Params params = 1; -} - -// QueryRefreshTokenRequest is the request type for the Query/RefreshToken RPC -// method. -message QueryRefreshTokenRequest { - // The macaroon token to refresh - string token = 1; -} - -// QueryRefreshTokenResponse is the response type for the Query/RefreshToken -// RPC method. -message QueryRefreshTokenResponse { - // The macaroon token - string token = 1; -} - -// QueryValidateTokenRequest is the request type for the Query/ValidateToken -// RPC method. -message QueryValidateTokenRequest { - // The macaroon token to validate - string token = 1; -} - -// QueryValidateTokenResponse is the response type for the Query/ValidateToken -// RPC method. -message QueryValidateTokenResponse { - // The macaroon token - bool valid = 1; -} diff --git a/proto/macaroon/v1/state.proto b/proto/macaroon/v1/state.proto deleted file mode 100644 index 1951876de..000000000 --- a/proto/macaroon/v1/state.proto +++ /dev/null @@ -1,39 +0,0 @@ -syntax = "proto3"; -package macaroon.v1; - -import "cosmos/orm/v1/orm.proto"; - -option go_package = "github.com/onsonr/sonr/x/macaroon/types"; - -// https://github.com/cosmos/cosmos-sdk/blob/main/orm/README.md - -// Grant is a Grant message type. -message Grant { - option (cosmos.orm.v1.table) = { - id : 1 - primary_key : {fields : "id" auto_increment : true} - index : {id : 1 fields : "subject,origin" unique : true} - }; - - uint64 id = 1; - string controller = 2; - string subject = 3; - string origin = 4; - int64 expiry_height = 5; -} - -// Macaroon is a Macaroon message type. -message Macaroon { - option (cosmos.orm.v1.table) = { - id : 2 - primary_key : {fields : "id" auto_increment : true} - index : {id : 1 fields : "subject,origin" unique : true} - }; - - uint64 id = 1; - string controller = 2; - string subject = 3; - string origin = 4; - int64 expiry_height = 5; - string macaroon = 6; -} diff --git a/proto/macaroon/v1/tx.proto b/proto/macaroon/v1/tx.proto deleted file mode 100644 index b07619f5d..000000000 --- a/proto/macaroon/v1/tx.proto +++ /dev/null @@ -1,66 +0,0 @@ -syntax = "proto3"; -package macaroon.v1; - -import "cosmos/msg/v1/msg.proto"; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; -import "macaroon/v1/genesis.proto"; - -option go_package = "github.com/onsonr/sonr/x/macaroon/types"; - -// Msg defines the Msg service. -service Msg { - option (cosmos.msg.v1.service) = true; - - // UpdateParams defines a governance operation for updating the parameters. - rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); - - // IssueMacaroon asserts the given controller is the owner of the given - // address. - rpc IssueMacaroon(MsgIssueMacaroon) returns (MsgIssueMacaroonResponse); -} - -// MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -message MsgUpdateParams { - option (cosmos.msg.v1.signer) = "authority"; - - // authority is the address of the governance account. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // params defines the parameters to update. - // - // NOTE: All parameters must be supplied. - Params params = 2 [ (gogoproto.nullable) = false ]; -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -message MsgUpdateParamsResponse {} - -// MsgIssueMacaroon is the message type for the IssueMacaroon RPC. -message MsgIssueMacaroon { - option (cosmos.msg.v1.signer) = "controller"; - - // Controller is the address of the controller to authenticate. - string controller = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // Origin is the origin of the request in wildcard form. - string origin = 2; - - // Permissions is the scope of the service. - map permissions = 3; - - // token is the macron token to authenticate the operation. - string token = 4; -} - -// MsgIssueMacaroonResponse is the response type for the IssueMacaroon -// RPC. -message MsgIssueMacaroonResponse { - bool success = 1; - string token = 2; -} diff --git a/x/macaroon/keeper/issuer.go b/x/did/keeper/issuer.go similarity index 100% rename from x/macaroon/keeper/issuer.go rename to x/did/keeper/issuer.go diff --git a/x/macaroon/README.md b/x/macaroon/README.md deleted file mode 100644 index 29e37dd56..000000000 --- a/x/macaroon/README.md +++ /dev/null @@ -1,104 +0,0 @@ -# `x/macaroon` - -The Macaroon module is responsible for providing decentralized access control and service authorization for the Sonr ecosystem. It implements macaroon-based authentication and authorization mechanisms. - -## Concepts - -Macaroons are a type of bearer credential that allow for decentralized delegation, attenuation, and third-party caveats. This module implements the core functionality for creating, validating, and managing macaroons within the Sonr ecosystem. - -## State - -The module maintains the following state: - -### Grant - -Represents a permission grant with the following fields: -- `id`: Unique identifier (auto-incremented) -- `controller`: Address of the controller -- `subject`: Subject of the grant -- `origin`: Origin of the grant -- `expiry_height`: Block height at which the grant expires - -### Macaroon - -Represents a macaroon token with the following fields: -- `id`: Unique identifier (auto-incremented) -- `controller`: Address of the controller -- `subject`: Subject of the macaroon -- `origin`: Origin of the macaroon -- `expiry_height`: Block height at which the macaroon expires -- `macaroon`: The actual macaroon token - -## State Transitions - -State transitions occur through the following messages: -- `MsgUpdateParams`: Updates the module parameters -- `MsgIssueMacaroon`: Issues a new macaroon - -## Messages - -### MsgUpdateParams - -Updates the module parameters. Can only be executed by the governance account. - -Fields: -- `authority`: Address of the governance account -- `params`: New parameter values - -### MsgIssueMacaroon - -Issues a new macaroon for a given controller and origin. - -Fields: -- `controller`: Address of the controller -- `origin`: Origin of the request in wildcard form -- `permissions`: Map of permissions -- `token`: Macaroon token to authenticate the operation - -## Queries - -The module provides the following queries: - -- `Params`: Retrieves the current module parameters -- `RefreshToken`: Refreshes a macaroon token (post-authentication) -- `ValidateToken`: Validates a macaroon token (pre-authentication) - -## Parameters - -The module has the following parameters: - -- `methods`: Defines the available DID methods - - `default`: Default method - - `supported`: List of supported methods -- `scopes`: Defines the set of scopes - - `base`: Base scope - - `supported`: List of supported scopes -- `caveats`: Defines the available caveats - - `supported_first_party`: List of supported first-party caveats - - `supported_third_party`: List of supported third-party caveats -- `transactions`: Defines the allowlist and denylist for transactions - - `allowlist`: List of allowed transactions - - `denylist`: List of denied transactions - -## Events - -The module may emit events related to macaroon issuance, validation, and refreshing. (Specific event details to be implemented) - -## Client - -The module provides gRPC endpoints for all queries and message types defined in the protobuf files. - -## Future Improvements - -- Implement more advanced caveat types -- Add support for third-party caveats -- Enhance macaroon revocation mechanisms -- Implement additional security features and checks - -## Tests - -(To be implemented: Acceptance tests for the module's functionality) - -## Appendix - -For more information on macaroons and their implementation, refer to the original macaroon paper: "Macaroons: Cookies with Contextual Caveats for Decentralized Authorization in the Cloud" by Arnar Birgisson, et al. diff --git a/x/macaroon/autocli.go b/x/macaroon/autocli.go deleted file mode 100644 index 9ca7fc95e..000000000 --- a/x/macaroon/autocli.go +++ /dev/null @@ -1,31 +0,0 @@ -package module - -import ( - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - modulev1 "github.com/onsonr/sonr/api/macaroon/v1" -) - -// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. -func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { - return &autocliv1.ModuleOptions{ - Query: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Query_ServiceDesc.ServiceName, - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "Params", - Use: "params", - Short: "Query the current consensus parameters", - }, - }, - }, - Tx: &autocliv1.ServiceCommandDescriptor{ - Service: modulev1.Msg_ServiceDesc.ServiceName, - RpcCommandOptions: []*autocliv1.RpcCommandOptions{ - { - RpcMethod: "UpdateParams", - Skip: false, // set to true if authority gated - }, - }, - }, - } -} diff --git a/x/macaroon/client/cli/query.go b/x/macaroon/client/cli/query.go deleted file mode 100644 index ea22e1db0..000000000 --- a/x/macaroon/client/cli/query.go +++ /dev/null @@ -1,50 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -// !NOTE: Must enable in module.go (disabled in favor of autocli.go) - -func GetQueryCmd() *cobra.Command { - queryCmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Querying commands for " + types.ModuleName, - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - queryCmd.AddCommand( - GetCmdParams(), - ) - return queryCmd -} - -func GetCmdParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Show all module params", - Args: cobra.ExactArgs(0), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Params(cmd.Context(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/macaroon/client/cli/tx.go b/x/macaroon/client/cli/tx.go deleted file mode 100644 index 1497ffb39..000000000 --- a/x/macaroon/client/cli/tx.go +++ /dev/null @@ -1,69 +0,0 @@ -package cli - -import ( - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -// !NOTE: Must enable in module.go (disabled in favor of autocli.go) - -// NewTxCmd returns a root CLI command handler for certain modules -// transaction commands. -func NewTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: types.ModuleName, - Short: types.ModuleName + " subcommands.", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand( - MsgUpdateParams(), - ) - return txCmd -} - -// Returns a CLI command handler for registering a -// contract for the module. -func MsgUpdateParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-params [some-value]", - Short: "Update the params (must be submitted from the authority)", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - cliCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - senderAddress := cliCtx.GetFromAddress() - // - // someValue, err := strconv.ParseBool(args[0]) - // if err != nil { - // return err - // } - - msg := &types.MsgUpdateParams{ - Authority: senderAddress.String(), - Params: types.Params{ - // SomeValue: someValue, - }, - } - - if err := msg.Validate(); err != nil { - return err - } - - return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - return cmd -} diff --git a/x/macaroon/depinject.go b/x/macaroon/depinject.go deleted file mode 100644 index 1bdbda6c5..000000000 --- a/x/macaroon/depinject.go +++ /dev/null @@ -1,65 +0,0 @@ -package module - -import ( - "os" - - "cosmossdk.io/core/address" - "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" - "cosmossdk.io/depinject" - "cosmossdk.io/log" - "github.com/cosmos/cosmos-sdk/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - - modulev1 "github.com/onsonr/sonr/api/macaroon/module/v1" - didkeeper "github.com/onsonr/sonr/x/did/keeper" - "github.com/onsonr/sonr/x/macaroon/keeper" -) - -var _ appmodule.AppModule = AppModule{} - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (am AppModule) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. -func (am AppModule) IsAppModule() {} - -func init() { - appmodule.Register( - &modulev1.Module{}, - appmodule.Provide(ProvideModule), - ) -} - -type ModuleInputs struct { - depinject.In - - Cdc codec.Codec - StoreService store.KVStoreService - AddressCodec address.Codec - AccountKeeper authkeeper.AccountKeeper - DidKeeper didkeeper.Keeper - - StakingKeeper stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper -} - -type ModuleOutputs struct { - depinject.Out - - Module appmodule.AppModule - Keeper keeper.Keeper -} - -func ProvideModule(in ModuleInputs) ModuleOutputs { - govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - - k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper) - m := NewAppModule(in.Cdc, k, in.DidKeeper) - - return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}} -} diff --git a/x/macaroon/keeper/genesis.go b/x/macaroon/keeper/genesis.go deleted file mode 100644 index 5247553be..000000000 --- a/x/macaroon/keeper/genesis.go +++ /dev/null @@ -1,37 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/log" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -func (k Keeper) Logger() log.Logger { - return k.logger -} - -// InitGenesis initializes the module's state from a genesis state. -func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) error { - // this line is used by starport scaffolding # genesis/module/init - if err := data.Params.Validate(); err != nil { - return err - } - - return k.Params.Set(ctx, data.Params) -} - -// ExportGenesis exports the module's state to a genesis state. -func (k *Keeper) ExportGenesis(ctx context.Context) *types.GenesisState { - params, err := k.Params.Get(ctx) - if err != nil { - panic(err) - } - - // this line is used by starport scaffolding # genesis/module/export - - return &types.GenesisState{ - Params: params, - } -} diff --git a/x/macaroon/keeper/genesis_test.go b/x/macaroon/keeper/genesis_test.go deleted file mode 100644 index 5b12b88b1..000000000 --- a/x/macaroon/keeper/genesis_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/onsonr/sonr/x/macaroon/types" - "github.com/stretchr/testify/require" -) - -func TestGenesis(t *testing.T) { - f := SetupTest(t) - - genesisState := &types.GenesisState{ - Params: types.DefaultParams(), - - // this line is used by starport scaffolding # genesis/test/state - } - - f.k.InitGenesis(f.ctx, genesisState) - - got := f.k.ExportGenesis(f.ctx) - require.NotNil(t, got) - - // this line is used by starport scaffolding # genesis/test/assert -} diff --git a/x/macaroon/keeper/keeper.go b/x/macaroon/keeper/keeper.go deleted file mode 100644 index 3018c3bc8..000000000 --- a/x/macaroon/keeper/keeper.go +++ /dev/null @@ -1,82 +0,0 @@ -package keeper - -import ( - "cosmossdk.io/collections" - storetypes "cosmossdk.io/core/store" - "cosmossdk.io/log" - "cosmossdk.io/orm/model/ormdb" - "github.com/cosmos/cosmos-sdk/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - apiv1 "github.com/onsonr/sonr/api/macaroon/v1" - didkeeper "github.com/onsonr/sonr/x/did/keeper" - "github.com/onsonr/sonr/x/macaroon/types" -) - -type Keeper struct { - cdc codec.BinaryCodec - - logger log.Logger - - // state management - Schema collections.Schema - Params collections.Item[types.Params] - OrmDB apiv1.StateStore - - AccountKeeper authkeeper.AccountKeeper - DIDKeeper didkeeper.Keeper - - authority string -} - -// NewKeeper creates a new Keeper instance -func NewKeeper( - cdc codec.BinaryCodec, - storeService storetypes.KVStoreService, - logger log.Logger, - authority string, - accKeeper authkeeper.AccountKeeper, - didKeeper didkeeper.Keeper, -) Keeper { - logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) - - sb := collections.NewSchemaBuilder(storeService) - - if authority == "" { - authority = authtypes.NewModuleAddress(govtypes.ModuleName).String() - } - - db, err := ormdb.NewModuleDB(&types.ORMModuleSchema, ormdb.ModuleDBOptions{KVStoreService: storeService}) - if err != nil { - panic(err) - } - - store, err := apiv1.NewStateStore(db) - if err != nil { - panic(err) - } - - k := Keeper{ - cdc: cdc, - logger: logger, - - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), - OrmDB: store, - - AccountKeeper: accKeeper, - DIDKeeper: didKeeper, - - authority: authority, - } - - schema, err := sb.Build() - if err != nil { - panic(err) - } - - k.Schema = schema - - return k -} diff --git a/x/macaroon/keeper/keeper_test.go b/x/macaroon/keeper/keeper_test.go deleted file mode 100644 index 38333fafb..000000000 --- a/x/macaroon/keeper/keeper_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package keeper_test - -import ( - "testing" - - "cosmossdk.io/core/store" - "cosmossdk.io/log" - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - - didkeeper "github.com/onsonr/sonr/x/did/keeper" - module "github.com/onsonr/sonr/x/macaroon" - "github.com/onsonr/sonr/x/macaroon/keeper" - "github.com/onsonr/sonr/x/macaroon/types" -) - -var maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - minttypes.ModuleName: {authtypes.Minter}, - govtypes.ModuleName: {authtypes.Burner}, -} - -type testFixture struct { - suite.Suite - - ctx sdk.Context - k keeper.Keeper - msgServer types.MsgServer - queryServer types.QueryServer - appModule *module.AppModule - - accountkeeper authkeeper.AccountKeeper - didk didkeeper.Keeper - bankkeeper bankkeeper.BaseKeeper - stakingKeeper *stakingkeeper.Keeper - mintkeeper mintkeeper.Keeper - - addrs []sdk.AccAddress - govModAddr string -} - -func SetupTest(t *testing.T) *testFixture { - t.Helper() - f := new(testFixture) - require := require.New(t) - - // Base setup - logger := log.NewTestLogger(t) - encCfg := moduletestutil.MakeTestEncodingConfig() - - f.govModAddr = authtypes.NewModuleAddress(govtypes.ModuleName).String() - f.addrs = simtestutil.CreateIncrementalAccounts(3) - - key := storetypes.NewKVStoreKey(types.ModuleName) - storeService := runtime.NewKVStoreService(key) - testCtx := testutil.DefaultContextWithDB(t, key, storetypes.NewTransientStoreKey("transient_test")) - - f.ctx = testCtx.Ctx - - // Register SDK modules. - registerBaseSDKModules(f, encCfg, storeService, logger, require) - - // Setup Keeper. - f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk) - f.msgServer = keeper.NewMsgServerImpl(f.k) - f.queryServer = keeper.NewQuerier(f.k) - f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk) - - return f -} - -func registerModuleInterfaces(encCfg moduletestutil.TestEncodingConfig) { - authtypes.RegisterInterfaces(encCfg.InterfaceRegistry) - stakingtypes.RegisterInterfaces(encCfg.InterfaceRegistry) - - types.RegisterInterfaces(encCfg.InterfaceRegistry) -} - -func registerBaseSDKModules( - f *testFixture, - encCfg moduletestutil.TestEncodingConfig, - storeService store.KVStoreService, - logger log.Logger, - require *require.Assertions, -) { - registerModuleInterfaces(encCfg) - - // Auth Keeper. - f.accountkeeper = authkeeper.NewAccountKeeper( - encCfg.Codec, storeService, - authtypes.ProtoBaseAccount, - maccPerms, - authcodec.NewBech32Codec(sdk.Bech32MainPrefix), sdk.Bech32MainPrefix, - f.govModAddr, - ) - - // Bank Keeper. - f.bankkeeper = bankkeeper.NewBaseKeeper( - encCfg.Codec, storeService, - f.accountkeeper, - nil, - f.govModAddr, logger, - ) - - // Staking Keeper. - f.stakingKeeper = stakingkeeper.NewKeeper( - encCfg.Codec, storeService, - f.accountkeeper, f.bankkeeper, f.govModAddr, - authcodec.NewBech32Codec(sdk.Bech32PrefixValAddr), - authcodec.NewBech32Codec(sdk.Bech32PrefixConsAddr), - ) - require.NoError(f.stakingKeeper.SetParams(f.ctx, stakingtypes.DefaultParams())) - f.accountkeeper.SetModuleAccount(f.ctx, f.stakingKeeper.GetNotBondedPool(f.ctx)) - f.accountkeeper.SetModuleAccount(f.ctx, f.stakingKeeper.GetBondedPool(f.ctx)) - - // Mint Keeper. - f.mintkeeper = mintkeeper.NewKeeper( - encCfg.Codec, storeService, - f.stakingKeeper, f.accountkeeper, f.bankkeeper, - authtypes.FeeCollectorName, f.govModAddr, - ) - f.accountkeeper.SetModuleAccount(f.ctx, f.accountkeeper.GetModuleAccount(f.ctx, minttypes.ModuleName)) - f.mintkeeper.InitGenesis(f.ctx, f.accountkeeper, minttypes.DefaultGenesisState()) -} diff --git a/x/macaroon/keeper/orm_test.go b/x/macaroon/keeper/orm_test.go deleted file mode 100644 index 4a539a8bb..000000000 --- a/x/macaroon/keeper/orm_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package keeper_test - -import ( - "testing" -) - -func TestORM(t *testing.T) { - f := SetupTest(t) - if f == nil { - t.FailNow() - } - // dt := f.k.OrmDB.ExampleDataTable() - // acc := []byte("test_acc") - // amt := uint64(7) - // - // err := dt.Insert(f.ctx, &apiv1.ExampleData{ - // Account: acc, - // Amount: amt, - // }) - // require.NoError(t, err) - // - // d, err := dt.Has(f.ctx, []byte("test_acc")) - // require.NoError(t, err) - // require.True(t, d) - // - // res, err := dt.Get(f.ctx, []byte("test_acc")) - // require.NoError(t, err) - // require.NotNil(t, res) - // require.EqualValues(t, amt, res.Amount) -} diff --git a/x/macaroon/keeper/querier.go b/x/macaroon/keeper/querier.go deleted file mode 100644 index 3a2973e12..000000000 --- a/x/macaroon/keeper/querier.go +++ /dev/null @@ -1,42 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -var _ types.QueryServer = Querier{} - -type Querier struct { - Keeper -} - -func NewQuerier(keeper Keeper) Querier { - return Querier{Keeper: keeper} -} - -func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - p, err := k.Keeper.Params.Get(ctx) - if err != nil { - return nil, err - } - - return &types.QueryParamsResponse{Params: &p}, nil -} - -// RefreshToken implements types.QueryServer. -func (k Querier) RefreshToken(goCtx context.Context, req *types.QueryRefreshTokenRequest) (*types.QueryRefreshTokenResponse, error) { - // ctx := sdk.UnwrapSDKContext(goCtx) - return &types.QueryRefreshTokenResponse{}, nil -} - -// ValidateToken implements types.QueryServer. -func (k Querier) ValidateToken(goCtx context.Context, req *types.QueryValidateTokenRequest) (*types.QueryValidateTokenResponse, error) { - // ctx := sdk.UnwrapSDKContext(goCtx) - return &types.QueryValidateTokenResponse{}, nil -} diff --git a/x/macaroon/keeper/rpc.go b/x/macaroon/keeper/rpc.go deleted file mode 100644 index 5229d346a..000000000 --- a/x/macaroon/keeper/rpc.go +++ /dev/null @@ -1,41 +0,0 @@ -package keeper - -import ( - "context" - - "cosmossdk.io/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -type msgServer struct { - k Keeper -} - -var _ types.MsgServer = msgServer{} - -// NewMsgServerImpl returns an implementation of the module MsgServer interface. -func NewMsgServerImpl(keeper Keeper) types.MsgServer { - return &msgServer{k: keeper} -} - -func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if ms.k.authority != msg.Authority { - return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, msg.Authority) - } - - return nil, ms.k.Params.Set(ctx, msg.Params) -} - -// AuthorizeService implements types.MsgServer. -func (ms msgServer) AuthorizeService(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) { - // ctx := sdk.UnwrapSDKContext(goCtx) - return &types.MsgIssueMacaroonResponse{}, nil -} - -// IssueMacaroon implements types.MsgServer. -func (ms msgServer) IssueMacaroon(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) { - // ctx := sdk.UnwrapSDKContext(goCtx) - return &types.MsgIssueMacaroonResponse{}, nil -} diff --git a/x/macaroon/keeper/rpc_test.go b/x/macaroon/keeper/rpc_test.go deleted file mode 100644 index 98e0192d8..000000000 --- a/x/macaroon/keeper/rpc_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/onsonr/sonr/x/macaroon/types" -) - -func TestParams(t *testing.T) { - f := SetupTest(t) - require := require.New(t) - - testCases := []struct { - name string - request *types.MsgUpdateParams - err bool - }{ - { - name: "fail; invalid authority", - request: &types.MsgUpdateParams{ - Authority: f.addrs[0].String(), - Params: types.DefaultParams(), - }, - err: true, - }, - { - name: "success", - request: &types.MsgUpdateParams{ - Authority: f.govModAddr, - Params: types.DefaultParams(), - }, - err: false, - }, - } - - for _, tc := range testCases { - tc := tc - t.Run(tc.name, func(t *testing.T) { - _, err := f.msgServer.UpdateParams(f.ctx, tc.request) - - if tc.err { - require.Error(err) - } else { - require.NoError(err) - - r, err := f.queryServer.Params(f.ctx, &types.QueryParamsRequest{}) - require.NoError(err) - - require.EqualValues(&tc.request.Params, r.Params) - } - - }) - } -} diff --git a/x/macaroon/module.go b/x/macaroon/module.go deleted file mode 100644 index ddcaba0b4..000000000 --- a/x/macaroon/module.go +++ /dev/null @@ -1,149 +0,0 @@ -package module - -import ( - "context" - "encoding/json" - - "cosmossdk.io/client/v2/autocli" - errorsmod "cosmossdk.io/errors" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" - "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/types/module" - "github.com/gorilla/mux" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - - didkeeper "github.com/onsonr/sonr/x/did/keeper" - "github.com/onsonr/sonr/x/macaroon/keeper" - "github.com/onsonr/sonr/x/macaroon/types" -) - -const ( - // ConsensusVersion defines the current x/macaroon module consensus version. - ConsensusVersion = 1 - -// this line is used by starport scaffolding # simapp/module/const -) - -var ( - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleGenesis = AppModule{} - _ module.AppModule = AppModule{} - - _ autocli.HasAutoCLIConfig = AppModule{} -) - -// AppModuleBasic defines the basic application module used by the wasm module. -type AppModuleBasic struct { - cdc codec.Codec -} - -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - didk didkeeper.Keeper -} - -// NewAppModule constructor -func NewAppModule( - cdc codec.Codec, - keeper keeper.Keeper, - didkeeper didkeeper.Keeper, -) *AppModule { - return &AppModule{ - AppModuleBasic: AppModuleBasic{cdc: cdc}, - keeper: keeper, - didk: didkeeper, - } -} - -func (a AppModuleBasic) Name() string { - return types.ModuleName -} - -func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(&types.GenesisState{ - Params: types.DefaultParams(), - }) -} - -func (a AppModuleBasic) ValidateGenesis(marshaler codec.JSONCodec, _ client.TxEncodingConfig, message json.RawMessage) error { - var data types.GenesisState - err := marshaler.UnmarshalJSON(message, &data) - if err != nil { - return err - } - if err := data.Params.Validate(); err != nil { - return errorsmod.Wrap(err, "params") - } - return nil -} - -func (a AppModuleBasic) RegisterRESTRoutes(_ client.Context, _ *mux.Router) { -} - -func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)) - if err != nil { - // same behavior as in cosmos-sdk - panic(err) - } -} - -// Disable in favor of autocli.go. If you wish to use these, it will override AutoCLI methods. -/* -func (a AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.NewTxCmd() -} - -func (a AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} -*/ - -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -func (a AppModuleBasic) RegisterInterfaces(r codectypes.InterfaceRegistry) { - types.RegisterInterfaces(r) -} - -func (a AppModule) InitGenesis(ctx sdk.Context, marshaler codec.JSONCodec, message json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - marshaler.MustUnmarshalJSON(message, &genesisState) - - if err := a.keeper.Params.Set(ctx, genesisState.Params); err != nil { - panic(err) - } - - return nil -} - -func (a AppModule) ExportGenesis(ctx sdk.Context, marshaler codec.JSONCodec) json.RawMessage { - genState := a.keeper.ExportGenesis(ctx) - return marshaler.MustMarshalJSON(genState) -} - -func (a AppModule) RegisterInvariants(_ sdk.InvariantRegistry) { -} - -func (a AppModule) QuerierRoute() string { - return types.QuerierRoute -} - -func (a AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(a.keeper)) - types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(a.keeper)) -} - -// ConsensusVersion is a sequence number for state-breaking change of the -// module. It should be incremented on each consensus-breaking change -// introduced by the module. To avoid wrong/empty versions, the initial version -// should be set to 1. -func (a AppModule) ConsensusVersion() uint64 { - return ConsensusVersion -} diff --git a/x/macaroon/types/builder.go b/x/macaroon/types/builder.go deleted file mode 100644 index 18eb95ab5..000000000 --- a/x/macaroon/types/builder.go +++ /dev/null @@ -1,51 +0,0 @@ -package types - -import ( - fmt "fmt" - "time" -) - -const ( - OriginMacroonCaveat MacroonCaveat = "origin" - ScopesMacroonCaveat MacroonCaveat = "scopes" - SubjectMacroonCaveat MacroonCaveat = "subject" - ExpMacroonCaveat MacroonCaveat = "exp" - TokenMacroonCaveat MacroonCaveat = "token" -) - -var MacroonCaveats = []MacroonCaveat{OriginMacroonCaveat, ScopesMacroonCaveat, SubjectMacroonCaveat, ExpMacroonCaveat, TokenMacroonCaveat} - -type MacroonCaveat string - -func (c MacroonCaveat) Equal(other string) bool { - return string(c) == other -} - -func (c MacroonCaveat) String() string { - return string(c) -} - -func (c MacroonCaveat) Verify(value string) error { - switch c { - case OriginMacroonCaveat: - return nil - case ScopesMacroonCaveat: - return nil - case SubjectMacroonCaveat: - return nil - case ExpMacroonCaveat: - // Check if the expiration time is still valid - exp, err := time.Parse(time.RFC3339, value) - if err != nil { - return err - } - if time.Now().After(exp) { - return fmt.Errorf("expired") - } - return nil - case TokenMacroonCaveat: - return nil - default: - return fmt.Errorf("unknown caveat: %s", c) - } -} diff --git a/x/macaroon/types/codec.go b/x/macaroon/types/codec.go deleted file mode 100644 index 550adfc39..000000000 --- a/x/macaroon/types/codec.go +++ /dev/null @@ -1,37 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" - // this line is used by starport scaffolding # 1 -) - -var ( - amino = codec.NewLegacyAmino() - AminoCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - sdk.RegisterLegacyAminoCodec(amino) -} - -// RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgUpdateParams{}, ModuleName+"/MsgUpdateParams", nil) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - // this line is used by starport scaffolding # 3 - - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgUpdateParams{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} diff --git a/x/macaroon/types/errors.go b/x/macaroon/types/errors.go deleted file mode 100644 index 2121b3b1d..000000000 --- a/x/macaroon/types/errors.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import sdkerrors "cosmossdk.io/errors" - -var ( - ErrInvalidGenesisState = sdkerrors.Register(ModuleName, 100, "invalid genesis state") - ErrUnauthorizedMacaroonToken = sdkerrors.Register(ModuleName, 200, "unauthorized macaroon token") - ErrInvalidMacaroonScopes = sdkerrors.Register(ModuleName, 201, "invalid macaroon scopes") - ErrInvalidMacaroonController = sdkerrors.Register(ModuleName, 202, "invalid macaroon controller") - ErrInvalidTransactionSignature = sdkerrors.Register(ModuleName, 203, "invalid supplied transaction signature") -) diff --git a/x/macaroon/types/formatter.go b/x/macaroon/types/formatter.go deleted file mode 100644 index ab1254f4c..000000000 --- a/x/macaroon/types/formatter.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/x/macaroon/types/genesis.go b/x/macaroon/types/genesis.go deleted file mode 100644 index 2c15cd92a..000000000 --- a/x/macaroon/types/genesis.go +++ /dev/null @@ -1,22 +0,0 @@ -package types - -// this line is used by starport scaffolding # genesis/types/import - -// DefaultIndex is the default global index -const DefaultIndex uint64 = 1 - -// DefaultGenesis returns the default genesis state -func DefaultGenesis() *GenesisState { - return &GenesisState{ - // this line is used by starport scaffolding # genesis/types/default - Params: DefaultParams(), - } -} - -// Validate performs basic genesis state validation returning an error upon any -// failure. -func (gs GenesisState) Validate() error { - // this line is used by starport scaffolding # genesis/types/validate - - return gs.Params.Validate() -} diff --git a/x/macaroon/types/genesis.pb.go b/x/macaroon/types/genesis.pb.go deleted file mode 100644 index 02a2ae7ba..000000000 --- a/x/macaroon/types/genesis.pb.go +++ /dev/null @@ -1,1746 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: macaroon/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - _ "github.com/onsonr/sonr/x/did/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// GenesisState defines the module genesis state -type GenesisState struct { - // Params defines all the parameters of the module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// Params defines the set of module parameters. -type Params struct { - // The list of methods - Methods *Methods `protobuf:"bytes,1,opt,name=methods,proto3" json:"methods,omitempty"` - // The list of scopes - Scopes *Scopes `protobuf:"bytes,2,opt,name=scopes,proto3" json:"scopes,omitempty"` - // The list of caveats - Caveats *Caveats `protobuf:"bytes,3,opt,name=caveats,proto3" json:"caveats,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{1} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMethods() *Methods { - if m != nil { - return m.Methods - } - return nil -} - -func (m *Params) GetScopes() *Scopes { - if m != nil { - return m.Scopes - } - return nil -} - -func (m *Params) GetCaveats() *Caveats { - if m != nil { - return m.Caveats - } - return nil -} - -// Methods defines the available DID methods -type Methods struct { - Default string `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"` - Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"` -} - -func (m *Methods) Reset() { *m = Methods{} } -func (m *Methods) String() string { return proto.CompactTextString(m) } -func (*Methods) ProtoMessage() {} -func (*Methods) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{2} -} -func (m *Methods) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Methods) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Methods.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 *Methods) XXX_Merge(src proto.Message) { - xxx_messageInfo_Methods.Merge(m, src) -} -func (m *Methods) XXX_Size() int { - return m.Size() -} -func (m *Methods) XXX_DiscardUnknown() { - xxx_messageInfo_Methods.DiscardUnknown(m) -} - -var xxx_messageInfo_Methods proto.InternalMessageInfo - -func (m *Methods) GetDefault() string { - if m != nil { - return m.Default - } - return "" -} - -func (m *Methods) GetSupported() []string { - if m != nil { - return m.Supported - } - return nil -} - -// Scopes defines the set of scopes -type Scopes struct { - Base string `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"` - Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"` -} - -func (m *Scopes) Reset() { *m = Scopes{} } -func (m *Scopes) String() string { return proto.CompactTextString(m) } -func (*Scopes) ProtoMessage() {} -func (*Scopes) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{3} -} -func (m *Scopes) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Scopes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Scopes.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 *Scopes) XXX_Merge(src proto.Message) { - xxx_messageInfo_Scopes.Merge(m, src) -} -func (m *Scopes) XXX_Size() int { - return m.Size() -} -func (m *Scopes) XXX_DiscardUnknown() { - xxx_messageInfo_Scopes.DiscardUnknown(m) -} - -var xxx_messageInfo_Scopes proto.InternalMessageInfo - -func (m *Scopes) GetBase() string { - if m != nil { - return m.Base - } - return "" -} - -func (m *Scopes) GetSupported() []string { - if m != nil { - return m.Supported - } - return nil -} - -// Caveats defines the available caveats -type Caveats struct { - SupportedFirstParty []*Caveat `protobuf:"bytes,1,rep,name=supported_first_party,json=supportedFirstParty,proto3" json:"supported_first_party,omitempty"` - SupportedThirdParty []*Caveat `protobuf:"bytes,2,rep,name=supported_third_party,json=supportedThirdParty,proto3" json:"supported_third_party,omitempty"` -} - -func (m *Caveats) Reset() { *m = Caveats{} } -func (m *Caveats) String() string { return proto.CompactTextString(m) } -func (*Caveats) ProtoMessage() {} -func (*Caveats) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{4} -} -func (m *Caveats) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Caveats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Caveats.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 *Caveats) XXX_Merge(src proto.Message) { - xxx_messageInfo_Caveats.Merge(m, src) -} -func (m *Caveats) XXX_Size() int { - return m.Size() -} -func (m *Caveats) XXX_DiscardUnknown() { - xxx_messageInfo_Caveats.DiscardUnknown(m) -} - -var xxx_messageInfo_Caveats proto.InternalMessageInfo - -func (m *Caveats) GetSupportedFirstParty() []*Caveat { - if m != nil { - return m.SupportedFirstParty - } - return nil -} - -func (m *Caveats) GetSupportedThirdParty() []*Caveat { - if m != nil { - return m.SupportedThirdParty - } - return nil -} - -type Caveat struct { - Scopes []string `protobuf:"bytes,1,rep,name=scopes,proto3" json:"scopes,omitempty"` - Caveat string `protobuf:"bytes,2,opt,name=caveat,proto3" json:"caveat,omitempty"` - Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` -} - -func (m *Caveat) Reset() { *m = Caveat{} } -func (m *Caveat) String() string { return proto.CompactTextString(m) } -func (*Caveat) ProtoMessage() {} -func (*Caveat) Descriptor() ([]byte, []int) { - return fileDescriptor_06e0b5dfdf5e52ba, []int{5} -} -func (m *Caveat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Caveat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Caveat.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 *Caveat) XXX_Merge(src proto.Message) { - xxx_messageInfo_Caveat.Merge(m, src) -} -func (m *Caveat) XXX_Size() int { - return m.Size() -} -func (m *Caveat) XXX_DiscardUnknown() { - xxx_messageInfo_Caveat.DiscardUnknown(m) -} - -var xxx_messageInfo_Caveat proto.InternalMessageInfo - -func (m *Caveat) GetScopes() []string { - if m != nil { - return m.Scopes - } - return nil -} - -func (m *Caveat) GetCaveat() string { - if m != nil { - return m.Caveat - } - return "" -} - -func (m *Caveat) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "macaroon.v1.GenesisState") - proto.RegisterType((*Params)(nil), "macaroon.v1.Params") - proto.RegisterType((*Methods)(nil), "macaroon.v1.Methods") - proto.RegisterType((*Scopes)(nil), "macaroon.v1.Scopes") - proto.RegisterType((*Caveats)(nil), "macaroon.v1.Caveats") - proto.RegisterType((*Caveat)(nil), "macaroon.v1.Caveat") -} - -func init() { proto.RegisterFile("macaroon/v1/genesis.proto", fileDescriptor_06e0b5dfdf5e52ba) } - -var fileDescriptor_06e0b5dfdf5e52ba = []byte{ - // 471 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcf, 0x6a, 0xdb, 0x30, - 0x18, 0xb7, 0x92, 0xe2, 0xe0, 0x2f, 0x83, 0x6e, 0x6a, 0x57, 0xdc, 0x52, 0x9c, 0xe0, 0xcb, 0xca, - 0x06, 0x36, 0xd9, 0x6e, 0xbd, 0xb5, 0x83, 0xf5, 0x34, 0x28, 0x6a, 0x4f, 0x65, 0x50, 0x14, 0x5b, - 0x4d, 0x0c, 0xb3, 0x25, 0x24, 0x25, 0xb4, 0xaf, 0xb0, 0xd3, 0x8e, 0x3b, 0xf6, 0x11, 0x06, 0x83, - 0x3d, 0x43, 0x8f, 0x3d, 0xee, 0x34, 0x46, 0x72, 0xd8, 0x1e, 0x63, 0x58, 0x92, 0xbd, 0x96, 0x06, - 0xd6, 0x8b, 0x90, 0xbe, 0xdf, 0x1f, 0xfd, 0xf4, 0x7d, 0x36, 0x6c, 0x97, 0x34, 0xa3, 0x92, 0xf3, - 0x2a, 0x9d, 0x8f, 0xd2, 0x09, 0xab, 0x98, 0x2a, 0x54, 0x22, 0x24, 0xd7, 0x1c, 0xf7, 0x1b, 0x28, - 0x99, 0x8f, 0x76, 0x9e, 0xd1, 0xb2, 0xa8, 0x78, 0x6a, 0x56, 0x8b, 0xef, 0xac, 0xe7, 0x45, 0x5e, - 0xab, 0xf4, 0xa5, 0x2b, 0x6c, 0x4e, 0xf8, 0x84, 0x9b, 0x6d, 0x5a, 0xef, 0x6c, 0x35, 0x3e, 0x80, - 0x27, 0x47, 0xd6, 0xf7, 0x44, 0x53, 0xcd, 0xf0, 0x08, 0x7c, 0x41, 0x25, 0x2d, 0x55, 0x88, 0x86, - 0x68, 0xaf, 0xff, 0x7a, 0x23, 0xb9, 0x73, 0x4f, 0x72, 0x6c, 0xa0, 0xc3, 0xb5, 0x9b, 0x9f, 0x03, - 0x8f, 0x38, 0x62, 0xfc, 0x0d, 0x81, 0x6f, 0x01, 0x9c, 0x40, 0xaf, 0x64, 0x7a, 0xca, 0xf3, 0x46, - 0xbe, 0x79, 0x4f, 0xfe, 0xde, 0x62, 0xa4, 0x21, 0xe1, 0x57, 0xe0, 0xab, 0x8c, 0x0b, 0xa6, 0xc2, - 0xce, 0x8a, 0xdb, 0x4e, 0x0c, 0x44, 0x1c, 0xa5, 0x36, 0xcf, 0xe8, 0x9c, 0x51, 0xad, 0xc2, 0xee, - 0x0a, 0xf3, 0xb7, 0x16, 0x23, 0x0d, 0x69, 0x7f, 0xf7, 0xcb, 0xf5, 0xc0, 0xfb, 0x73, 0x3d, 0x40, - 0x9f, 0x7e, 0x7f, 0x7d, 0xb9, 0xde, 0x76, 0xd2, 0xa5, 0xfe, 0x00, 0x3d, 0x17, 0x07, 0x87, 0xd0, - 0xcb, 0xd9, 0x05, 0x9d, 0x7d, 0xd4, 0x26, 0x75, 0x40, 0x9a, 0x23, 0xde, 0x85, 0x40, 0xcd, 0x84, - 0xe0, 0x52, 0xb3, 0x3c, 0xec, 0x0c, 0xbb, 0x7b, 0x01, 0xf9, 0x57, 0xd8, 0xdf, 0x6e, 0xcc, 0x9f, - 0xb6, 0xe6, 0xee, 0x61, 0xf1, 0x29, 0xf8, 0x36, 0x3d, 0xc6, 0xb0, 0x36, 0xa6, 0x8a, 0x39, 0x67, - 0xb3, 0xff, 0x8f, 0x6d, 0xf8, 0x30, 0xb3, 0xed, 0x40, 0xfc, 0x1d, 0x41, 0xcf, 0x3d, 0x13, 0x1f, - 0xc1, 0xf3, 0x56, 0x72, 0x7e, 0x51, 0x48, 0xa5, 0xcf, 0x05, 0x95, 0xfa, 0x2a, 0x44, 0xc3, 0xee, - 0x83, 0x4e, 0x5a, 0x11, 0xd9, 0x68, 0x15, 0xef, 0x6a, 0xc1, 0x71, 0xcd, 0xbf, 0x6f, 0xa4, 0xa7, - 0x85, 0xcc, 0x9d, 0x51, 0xe7, 0x31, 0x46, 0xa7, 0xb5, 0xc0, 0x18, 0xad, 0x6a, 0x87, 0x1b, 0x45, - 0x7c, 0x06, 0xbe, 0x55, 0xe2, 0xad, 0x76, 0xe2, 0xc8, 0xbc, 0xbb, 0x19, 0xee, 0x16, 0xf8, 0x96, - 0x6c, 0xbe, 0x84, 0x80, 0xb8, 0x13, 0x1e, 0x42, 0x3f, 0x67, 0x2a, 0x93, 0x85, 0xd0, 0x05, 0xaf, - 0xcc, 0xe0, 0x03, 0x72, 0xb7, 0x74, 0x78, 0x70, 0xb3, 0x88, 0xd0, 0xed, 0x22, 0x42, 0xbf, 0x16, - 0x11, 0xfa, 0xbc, 0x8c, 0xbc, 0xdb, 0x65, 0xe4, 0xfd, 0x58, 0x46, 0xde, 0xd9, 0x8b, 0x49, 0xa1, - 0xa7, 0xb3, 0x71, 0x92, 0xf1, 0x32, 0xe5, 0x95, 0xe2, 0x95, 0x4c, 0xcd, 0x72, 0x99, 0xb6, 0x01, - 0xf5, 0x95, 0x60, 0x6a, 0xec, 0x9b, 0x7f, 0xe1, 0xcd, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8a, - 0x01, 0xb7, 0x87, 0x6f, 0x03, 0x00, 0x00, -} - -func (this *Params) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Params) - if !ok { - that2, ok := that.(Params) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Methods.Equal(that1.Methods) { - return false - } - if !this.Scopes.Equal(that1.Scopes) { - return false - } - if !this.Caveats.Equal(that1.Caveats) { - return false - } - return true -} -func (this *Methods) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Methods) - if !ok { - that2, ok := that.(Methods) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Default != that1.Default { - return false - } - if len(this.Supported) != len(that1.Supported) { - return false - } - for i := range this.Supported { - if this.Supported[i] != that1.Supported[i] { - return false - } - } - return true -} -func (this *Scopes) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Scopes) - if !ok { - that2, ok := that.(Scopes) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Base != that1.Base { - return false - } - if len(this.Supported) != len(that1.Supported) { - return false - } - for i := range this.Supported { - if this.Supported[i] != that1.Supported[i] { - return false - } - } - return true -} -func (this *Caveats) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Caveats) - if !ok { - that2, ok := that.(Caveats) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.SupportedFirstParty) != len(that1.SupportedFirstParty) { - return false - } - for i := range this.SupportedFirstParty { - if !this.SupportedFirstParty[i].Equal(that1.SupportedFirstParty[i]) { - return false - } - } - if len(this.SupportedThirdParty) != len(that1.SupportedThirdParty) { - return false - } - for i := range this.SupportedThirdParty { - if !this.SupportedThirdParty[i].Equal(that1.SupportedThirdParty[i]) { - return false - } - } - return true -} -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Caveats != nil { - { - size, err := m.Caveats.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Scopes != nil { - { - size, err := m.Scopes.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Methods != nil { - { - size, err := m.Methods.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Methods) 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 *Methods) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Methods) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Supported) > 0 { - for iNdEx := len(m.Supported) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Supported[iNdEx]) - copy(dAtA[i:], m.Supported[iNdEx]) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Supported[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Default) > 0 { - i -= len(m.Default) - copy(dAtA[i:], m.Default) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Default))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Scopes) 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 *Scopes) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Scopes) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Supported) > 0 { - for iNdEx := len(m.Supported) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Supported[iNdEx]) - copy(dAtA[i:], m.Supported[iNdEx]) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Supported[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Base) > 0 { - i -= len(m.Base) - copy(dAtA[i:], m.Base) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Base))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Caveats) 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 *Caveats) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Caveats) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SupportedThirdParty) > 0 { - for iNdEx := len(m.SupportedThirdParty) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SupportedThirdParty[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.SupportedFirstParty) > 0 { - for iNdEx := len(m.SupportedFirstParty) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SupportedFirstParty[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Caveat) 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 *Caveat) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Caveat) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x1a - } - if len(m.Caveat) > 0 { - i -= len(m.Caveat) - copy(dAtA[i:], m.Caveat) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Caveat))) - i-- - dAtA[i] = 0x12 - } - if len(m.Scopes) > 0 { - for iNdEx := len(m.Scopes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Scopes[iNdEx]) - copy(dAtA[i:], m.Scopes[iNdEx]) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Scopes[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Methods != nil { - l = m.Methods.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.Scopes != nil { - l = m.Scopes.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - if m.Caveats != nil { - l = m.Caveats.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func (m *Methods) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Default) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.Supported) > 0 { - for _, s := range m.Supported { - l = len(s) - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *Scopes) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Base) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - if len(m.Supported) > 0 { - for _, s := range m.Supported { - l = len(s) - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *Caveats) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SupportedFirstParty) > 0 { - for _, e := range m.SupportedFirstParty { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.SupportedThirdParty) > 0 { - for _, e := range m.SupportedThirdParty { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - return n -} - -func (m *Caveat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Scopes) > 0 { - for _, s := range m.Scopes { - l = len(s) - n += 1 + l + sovGenesis(uint64(l)) - } - } - l = len(m.Caveat) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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 ErrIntOverflowGenesis - } - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) 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 ErrIntOverflowGenesis - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Methods == nil { - m.Methods = &Methods{} - } - if err := m.Methods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Scopes == nil { - m.Scopes = &Scopes{} - } - if err := m.Scopes.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Caveats", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Caveats == nil { - m.Caveats = &Caveats{} - } - if err := m.Caveats.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Methods) 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 ErrIntOverflowGenesis - } - 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: Methods: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Methods: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Default", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Default = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Supported = append(m.Supported, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Scopes) 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 ErrIntOverflowGenesis - } - 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: Scopes: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Scopes: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Base = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Supported = append(m.Supported, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Caveats) 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 ErrIntOverflowGenesis - } - 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: Caveats: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Caveats: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SupportedFirstParty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SupportedFirstParty = append(m.SupportedFirstParty, &Caveat{}) - if err := m.SupportedFirstParty[len(m.SupportedFirstParty)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SupportedThirdParty", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SupportedThirdParty = append(m.SupportedThirdParty, &Caveat{}) - if err := m.SupportedThirdParty[len(m.SupportedThirdParty)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Caveat) 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 ErrIntOverflowGenesis - } - 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: Caveat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Caveat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Scopes = append(m.Scopes, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Caveat", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Caveat = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - 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 ErrIntOverflowGenesis - } - 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 ErrInvalidLengthGenesis - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenesis - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/macaroon/types/genesis_test.go b/x/macaroon/types/genesis_test.go deleted file mode 100644 index 7219d04b0..000000000 --- a/x/macaroon/types/genesis_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/onsonr/sonr/x/macaroon/types" - - "github.com/stretchr/testify/require" -) - -func TestGenesisState_Validate(t *testing.T) { - tests := []struct { - desc string - genState *types.GenesisState - valid bool - }{ - { - desc: "default is valid", - genState: types.DefaultGenesis(), - valid: true, - }, - { - desc: "valid genesis state", - genState: &types.GenesisState{ - - // this line is used by starport scaffolding # types/genesis/validField - }, - valid: true, - }, - // this line is used by starport scaffolding # types/genesis/testcase - } - for _, tc := range tests { - t.Run(tc.desc, func(t *testing.T) { - err := tc.genState.Validate() - if tc.valid { - require.NoError(t, err) - } else { - require.Error(t, err) - } - }) - } -} diff --git a/x/macaroon/types/keys.go b/x/macaroon/types/keys.go deleted file mode 100644 index f858b29bb..000000000 --- a/x/macaroon/types/keys.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - "cosmossdk.io/collections" - - ormv1alpha1 "cosmossdk.io/api/cosmos/orm/v1alpha1" -) - -var ( - // ParamsKey saves the current module params. - ParamsKey = collections.NewPrefix(0) -) - -const ( - ModuleName = "macaroon" - - StoreKey = ModuleName - - QuerierRoute = ModuleName -) - -var ORMModuleSchema = ormv1alpha1.ModuleSchemaDescriptor{ - SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{ - {Id: 1, ProtoFileName: "macaroon/v1/state.proto"}, - }, - Prefix: []byte{0}, -} diff --git a/x/macaroon/types/msgs.go b/x/macaroon/types/msgs.go deleted file mode 100644 index df261d920..000000000 --- a/x/macaroon/types/msgs.go +++ /dev/null @@ -1,49 +0,0 @@ -package types - -import ( - "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var _ sdk.Msg = &MsgUpdateParams{} - -// ╭───────────────────────────────────────────────────────────╮ -// │ MsgUpdateParams type definition │ -// ╰───────────────────────────────────────────────────────────╯ - -// NewMsgUpdateParams creates new instance of MsgUpdateParams -func NewMsgUpdateParams( - sender sdk.Address, - someValue bool, -) *MsgUpdateParams { - return &MsgUpdateParams{ - Authority: sender.String(), - Params: Params{}, - } -} - -// Route returns the name of the module -func (msg MsgUpdateParams) Route() string { return ModuleName } - -// Type returns the the action -func (msg MsgUpdateParams) Type() string { return "update_params" } - -// GetSignBytes implements the LegacyMsg interface. -func (msg MsgUpdateParams) GetSignBytes() []byte { - return sdk.MustSortJSON(AminoCdc.MustMarshalJSON(&msg)) -} - -// GetSigners returns the expected signers for a MsgUpdateParams message. -func (msg *MsgUpdateParams) GetSigners() []sdk.AccAddress { - addr, _ := sdk.AccAddressFromBech32(msg.Authority) - return []sdk.AccAddress{addr} -} - -// ValidateBasic does a sanity check on the provided data. -func (msg *MsgUpdateParams) Validate() error { - if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { - return errors.Wrap(err, "invalid authority address") - } - - return msg.Params.Validate() -} diff --git a/x/macaroon/types/params.go b/x/macaroon/types/params.go deleted file mode 100644 index e0b75e9a7..000000000 --- a/x/macaroon/types/params.go +++ /dev/null @@ -1,111 +0,0 @@ -package types - -import ( - "encoding/json" -) - -// DefaultParams returns default module parameters. -func DefaultParams() Params { - return Params{ - Methods: DefaultMethods(), - Scopes: DefaultScopes(), - Caveats: DefaultCaveats(), - } -} - -// Stringer method for Params. -func (p Params) String() string { - bz, err := json.Marshal(p) - if err != nil { - panic(err) - } - - return string(bz) -} - -// Validate does the sanity check on the params. -func (p Params) Validate() error { - return nil -} - -func DefaultMethods() *Methods { - return &Methods{ - Default: "did:sonr", - Supported: []string{"did:key", "did:web", "did:sonr", "did:ipfs", "did:btcr", "did:ethr"}, - } -} - -func DefaultScopes() *Scopes { - return &Scopes{ - Base: "openid profile sonr.address", - Supported: []string{"create", "read", "update", "delete", "sign", "verify", "simulate", "execute", "broadcast", "admin"}, - } -} - -func DefaultCaveats() *Caveats { - return &Caveats{ - // First party - JWT Format - SupportedFirstParty: DefaultFirstPartyCaveats(), - // Third party - UCAN Format - SupportedThirdParty: DefaultThirdPartyCaveats(), - } -} - -func DefaultFirstPartyCaveats() []*Caveat { - return []*Caveat{ - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "aud", - Description: "Audience must be a valid DID", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "exp", - Description: "Expiration time must be a valid timestamp", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "iat", - Description: "Issued at time must be a valid timestamp", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "iss", - Description: "Issuer must be a valid DID", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "nbf", - Description: "Not before time must be a valid timestamp", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "nonce", - Description: "Nonce must be a valid string", - }, - { - Scopes: []string{"openid", "profile", "sonr.address"}, - Caveat: "sub", - Description: "Subject must be a valid DID", - }, - } -} - -func DefaultThirdPartyCaveats() []*Caveat { - return []*Caveat{ - { - Scopes: []string{"create", "read", "update", "delete", "sign", "verify", "simulate", "execute", "broadcast", "admin"}, - Caveat: "cap", - Description: "Capability must be a valid capability", - }, - { - Scopes: []string{"create", "read", "update", "delete", "sign", "verify", "simulate", "execute", "broadcast", "admin"}, - Caveat: "exp", - Description: "Expiration time must be a valid timestamp", - }, - } -} - -func (c *Caveat) Equal(other *Caveat) bool { - return c.Caveat == other.Caveat -} diff --git a/x/macaroon/types/query.pb.go b/x/macaroon/types/query.pb.go deleted file mode 100644 index 1fe7678e2..000000000 --- a/x/macaroon/types/query.pb.go +++ /dev/null @@ -1,1306 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: macaroon/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// QueryParamsRequest is the request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -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_ce46a74a5956a389, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.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 *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is the response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params defines the parameters of the module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -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_ce46a74a5956a389, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.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 *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - -// QueryRefreshTokenRequest is the request type for the Query/RefreshToken RPC -// method. -type QueryRefreshTokenRequest struct { - // The macaroon token to refresh - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *QueryRefreshTokenRequest) Reset() { *m = QueryRefreshTokenRequest{} } -func (m *QueryRefreshTokenRequest) String() string { return proto.CompactTextString(m) } -func (*QueryRefreshTokenRequest) ProtoMessage() {} -func (*QueryRefreshTokenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce46a74a5956a389, []int{2} -} -func (m *QueryRefreshTokenRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRefreshTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRefreshTokenRequest.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 *QueryRefreshTokenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRefreshTokenRequest.Merge(m, src) -} -func (m *QueryRefreshTokenRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryRefreshTokenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRefreshTokenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRefreshTokenRequest proto.InternalMessageInfo - -func (m *QueryRefreshTokenRequest) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -// QueryRefreshTokenResponse is the response type for the Query/RefreshToken -// RPC method. -type QueryRefreshTokenResponse struct { - // The macaroon token - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *QueryRefreshTokenResponse) Reset() { *m = QueryRefreshTokenResponse{} } -func (m *QueryRefreshTokenResponse) String() string { return proto.CompactTextString(m) } -func (*QueryRefreshTokenResponse) ProtoMessage() {} -func (*QueryRefreshTokenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce46a74a5956a389, []int{3} -} -func (m *QueryRefreshTokenResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryRefreshTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryRefreshTokenResponse.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 *QueryRefreshTokenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryRefreshTokenResponse.Merge(m, src) -} -func (m *QueryRefreshTokenResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryRefreshTokenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryRefreshTokenResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryRefreshTokenResponse proto.InternalMessageInfo - -func (m *QueryRefreshTokenResponse) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -// QueryValidateTokenRequest is the request type for the Query/ValidateToken -// RPC method. -type QueryValidateTokenRequest struct { - // The macaroon token to validate - Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *QueryValidateTokenRequest) Reset() { *m = QueryValidateTokenRequest{} } -func (m *QueryValidateTokenRequest) String() string { return proto.CompactTextString(m) } -func (*QueryValidateTokenRequest) ProtoMessage() {} -func (*QueryValidateTokenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_ce46a74a5956a389, []int{4} -} -func (m *QueryValidateTokenRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidateTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidateTokenRequest.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 *QueryValidateTokenRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidateTokenRequest.Merge(m, src) -} -func (m *QueryValidateTokenRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryValidateTokenRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidateTokenRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidateTokenRequest proto.InternalMessageInfo - -func (m *QueryValidateTokenRequest) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -// QueryValidateTokenResponse is the response type for the Query/ValidateToken -// RPC method. -type QueryValidateTokenResponse struct { - // The macaroon token - Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"` -} - -func (m *QueryValidateTokenResponse) Reset() { *m = QueryValidateTokenResponse{} } -func (m *QueryValidateTokenResponse) String() string { return proto.CompactTextString(m) } -func (*QueryValidateTokenResponse) ProtoMessage() {} -func (*QueryValidateTokenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_ce46a74a5956a389, []int{5} -} -func (m *QueryValidateTokenResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryValidateTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryValidateTokenResponse.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 *QueryValidateTokenResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryValidateTokenResponse.Merge(m, src) -} -func (m *QueryValidateTokenResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryValidateTokenResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryValidateTokenResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryValidateTokenResponse proto.InternalMessageInfo - -func (m *QueryValidateTokenResponse) GetValid() bool { - if m != nil { - return m.Valid - } - return false -} - -func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "macaroon.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "macaroon.v1.QueryParamsResponse") - proto.RegisterType((*QueryRefreshTokenRequest)(nil), "macaroon.v1.QueryRefreshTokenRequest") - proto.RegisterType((*QueryRefreshTokenResponse)(nil), "macaroon.v1.QueryRefreshTokenResponse") - proto.RegisterType((*QueryValidateTokenRequest)(nil), "macaroon.v1.QueryValidateTokenRequest") - proto.RegisterType((*QueryValidateTokenResponse)(nil), "macaroon.v1.QueryValidateTokenResponse") -} - -func init() { proto.RegisterFile("macaroon/v1/query.proto", fileDescriptor_ce46a74a5956a389) } - -var fileDescriptor_ce46a74a5956a389 = []byte{ - // 379 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4e, 0xc2, 0x30, - 0x1c, 0xc6, 0x19, 0x09, 0x44, 0x8b, 0x5e, 0x0a, 0x08, 0x4c, 0x9c, 0x64, 0x89, 0x62, 0x62, 0xb2, - 0x09, 0x3e, 0x81, 0x3c, 0x81, 0x2e, 0xc6, 0x83, 0xb7, 0x82, 0x75, 0x2c, 0x42, 0x3b, 0xda, 0xb2, - 0x48, 0x3c, 0x98, 0xf8, 0x04, 0x26, 0xbe, 0x94, 0x47, 0x12, 0x2f, 0x1e, 0x0d, 0x78, 0xf7, 0x15, - 0x0c, 0x6d, 0x0d, 0x5b, 0x98, 0xe2, 0x65, 0xc9, 0xbf, 0xff, 0xef, 0xfb, 0x7e, 0xeb, 0xb7, 0x81, - 0xca, 0x10, 0xf5, 0x10, 0xa3, 0x94, 0xb8, 0x51, 0xcb, 0x1d, 0x8d, 0x31, 0x9b, 0x38, 0x21, 0xa3, - 0x82, 0xc2, 0xc2, 0xcf, 0xc2, 0x89, 0x5a, 0x66, 0xdd, 0xa7, 0xd4, 0x1f, 0x60, 0x17, 0x85, 0x81, - 0x8b, 0x08, 0xa1, 0x02, 0x89, 0x80, 0x12, 0xae, 0xa4, 0x66, 0x2d, 0x9e, 0xe1, 0x63, 0x82, 0x79, - 0xa0, 0x57, 0x76, 0x09, 0xc0, 0x8b, 0x45, 0xe8, 0x39, 0x62, 0x68, 0xc8, 0x3d, 0x3c, 0x1a, 0x63, - 0x2e, 0xec, 0x0e, 0x28, 0x26, 0x4e, 0x79, 0x48, 0x09, 0xc7, 0xf0, 0x18, 0xe4, 0x43, 0x79, 0x52, - 0x35, 0x1a, 0xc6, 0x51, 0xa1, 0x5d, 0x74, 0x62, 0xef, 0xe0, 0x68, 0xb1, 0x96, 0xd8, 0x27, 0xa0, - 0x2a, 0x33, 0x3c, 0x7c, 0xcb, 0x30, 0xef, 0x5f, 0xd2, 0x3b, 0x4c, 0x74, 0x3e, 0x2c, 0x81, 0x9c, - 0x58, 0xcc, 0x32, 0x67, 0xd3, 0x53, 0x83, 0xdd, 0x02, 0xb5, 0x14, 0x87, 0x66, 0xff, 0x6d, 0xb9, - 0x42, 0x83, 0xe0, 0x06, 0x09, 0xfc, 0x0f, 0x4a, 0x1b, 0x98, 0x69, 0x96, 0x25, 0x26, 0x5a, 0x2c, - 0xa4, 0x67, 0xc3, 0x53, 0x43, 0xfb, 0x2b, 0x0b, 0x72, 0xd2, 0x04, 0xfb, 0x20, 0xaf, 0xee, 0x09, - 0xf7, 0x13, 0x97, 0x5f, 0x2d, 0xd1, 0x6c, 0xfc, 0x2e, 0x50, 0x30, 0x7b, 0xf7, 0xe9, 0xed, 0xf3, - 0x25, 0x5b, 0x86, 0x45, 0x37, 0xfe, 0x81, 0x54, 0x7f, 0xf0, 0x01, 0x6c, 0xc5, 0x8b, 0x80, 0x07, - 0xab, 0x71, 0x29, 0xd5, 0x9a, 0x87, 0xeb, 0x64, 0x9a, 0x5d, 0x97, 0xec, 0x1d, 0xbb, 0x94, 0x60, - 0x33, 0x25, 0x85, 0x8f, 0x60, 0x3b, 0xd1, 0x0f, 0x4c, 0x89, 0x4d, 0xeb, 0xdc, 0x6c, 0xae, 0xd5, - 0x69, 0xfe, 0x9e, 0xe4, 0x57, 0xec, 0x72, 0x82, 0x1f, 0x69, 0x6d, 0xe7, 0xec, 0x75, 0x66, 0x19, - 0xd3, 0x99, 0x65, 0x7c, 0xcc, 0x2c, 0xe3, 0x79, 0x6e, 0x65, 0xa6, 0x73, 0x2b, 0xf3, 0x3e, 0xb7, - 0x32, 0xd7, 0x4d, 0x3f, 0x10, 0xfd, 0x71, 0xd7, 0xe9, 0xd1, 0xa1, 0x4b, 0x09, 0xa7, 0x84, 0xb9, - 0xf2, 0x71, 0xbf, 0x0c, 0x12, 0x93, 0x10, 0xf3, 0x6e, 0x5e, 0xfe, 0xe1, 0xa7, 0xdf, 0x01, 0x00, - 0x00, 0xff, 0xff, 0xfd, 0x69, 0x19, 0xa1, 0x42, 0x03, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// 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 { - // Params queries all parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // RefreshToken refreshes a macaroon token as post authentication. - RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error) - // ValidateToken validates a macaroon token as pre authentication. - ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/macaroon.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) RefreshToken(ctx context.Context, in *QueryRefreshTokenRequest, opts ...grpc.CallOption) (*QueryRefreshTokenResponse, error) { - out := new(QueryRefreshTokenResponse) - err := c.cc.Invoke(ctx, "/macaroon.v1.Query/RefreshToken", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) ValidateToken(ctx context.Context, in *QueryValidateTokenRequest, opts ...grpc.CallOption) (*QueryValidateTokenResponse, error) { - out := new(QueryValidateTokenResponse) - err := c.cc.Invoke(ctx, "/macaroon.v1.Query/ValidateToken", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // Params queries all parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // RefreshToken refreshes a macaroon token as post authentication. - RefreshToken(context.Context, *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error) - // ValidateToken validates a macaroon token as pre authentication. - ValidateToken(context.Context, *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedQueryServer) RefreshToken(ctx context.Context, req *QueryRefreshTokenRequest) (*QueryRefreshTokenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RefreshToken not implemented") -} -func (*UnimplementedQueryServer) ValidateToken(ctx context.Context, req *QueryValidateTokenRequest) (*QueryValidateTokenResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ValidateToken not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/macaroon.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryRefreshTokenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).RefreshToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/macaroon.v1.Query/RefreshToken", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).RefreshToken(ctx, req.(*QueryRefreshTokenRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryValidateTokenRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).ValidateToken(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/macaroon.v1.Query/ValidateToken", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ValidateToken(ctx, req.(*QueryValidateTokenRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var Query_serviceDesc = _Query_serviceDesc -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "macaroon.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - { - MethodName: "RefreshToken", - Handler: _Query_RefreshToken_Handler, - }, - { - MethodName: "ValidateToken", - Handler: _Query_ValidateToken_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "macaroon/v1/query.proto", -} - -func (m *QueryParamsRequest) 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 *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) 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 *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRefreshTokenRequest) 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 *QueryRefreshTokenRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRefreshTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryRefreshTokenResponse) 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 *QueryRefreshTokenResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryRefreshTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidateTokenRequest) 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 *QueryValidateTokenRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidateTokenRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryValidateTokenResponse) 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 *QueryValidateTokenResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryValidateTokenResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Valid { - i-- - if m.Valid { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRefreshTokenRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Token) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryRefreshTokenResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Token) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidateTokenRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Token) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryValidateTokenResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Valid { - n += 2 - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryParamsRequest) 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: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - 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 *QueryParamsResponse) 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: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params == nil { - m.Params = &Params{} - } - if err := m.Params.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 *QueryRefreshTokenRequest) 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: QueryRefreshTokenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRefreshTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = 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 *QueryRefreshTokenResponse) 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: QueryRefreshTokenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryRefreshTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = 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 *QueryValidateTokenRequest) 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: QueryValidateTokenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidateTokenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = 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 *QueryValidateTokenResponse) 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: QueryValidateTokenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryValidateTokenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Valid", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Valid = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/macaroon/types/query.pb.gw.go b/x/macaroon/types/query.pb.gw.go deleted file mode 100644 index dd834f625..000000000 --- a/x/macaroon/types/query.pb.gw.go +++ /dev/null @@ -1,319 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: macaroon/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_RefreshToken_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_RefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRefreshTokenRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RefreshToken_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.RefreshToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_RefreshToken_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryRefreshTokenRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RefreshToken_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.RefreshToken(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_ValidateToken_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_ValidateToken_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryValidateTokenRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidateToken_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ValidateToken(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_ValidateToken_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryValidateTokenRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ValidateToken_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ValidateToken(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Query_RefreshToken_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_RefreshToken_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_RefreshToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Query_ValidateToken_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_ValidateToken_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_ValidateToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_Params_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_Params_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_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Query_RefreshToken_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_RefreshToken_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_RefreshToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("POST", pattern_Query_ValidateToken_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_ValidateToken_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_ValidateToken_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_RefreshToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "refresh"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_ValidateToken_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"macaroon", "v1", "validate"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - - forward_Query_RefreshToken_0 = runtime.ForwardResponseMessage - - forward_Query_ValidateToken_0 = runtime.ForwardResponseMessage -) diff --git a/x/macaroon/types/state.pb.go b/x/macaroon/types/state.pb.go deleted file mode 100644 index 83a29a928..000000000 --- a/x/macaroon/types/state.pb.go +++ /dev/null @@ -1,890 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: macaroon/v1/state.proto - -package types - -import ( - _ "cosmossdk.io/orm" - fmt "fmt" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Grant struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"` - Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"` - Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"` -} - -func (m *Grant) Reset() { *m = Grant{} } -func (m *Grant) String() string { return proto.CompactTextString(m) } -func (*Grant) ProtoMessage() {} -func (*Grant) Descriptor() ([]byte, []int) { - return fileDescriptor_2ade56339acadfd8, []int{0} -} -func (m *Grant) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Grant) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Grant.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 *Grant) XXX_Merge(src proto.Message) { - xxx_messageInfo_Grant.Merge(m, src) -} -func (m *Grant) XXX_Size() int { - return m.Size() -} -func (m *Grant) XXX_DiscardUnknown() { - xxx_messageInfo_Grant.DiscardUnknown(m) -} - -var xxx_messageInfo_Grant proto.InternalMessageInfo - -func (m *Grant) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *Grant) GetController() string { - if m != nil { - return m.Controller - } - return "" -} - -func (m *Grant) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *Grant) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *Grant) GetExpiryHeight() int64 { - if m != nil { - return m.ExpiryHeight - } - return 0 -} - -type Macaroon struct { - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"` - Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"` - Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"` - ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"` - Macaroon string `protobuf:"bytes,6,opt,name=macaroon,proto3" json:"macaroon,omitempty"` -} - -func (m *Macaroon) Reset() { *m = Macaroon{} } -func (m *Macaroon) String() string { return proto.CompactTextString(m) } -func (*Macaroon) ProtoMessage() {} -func (*Macaroon) Descriptor() ([]byte, []int) { - return fileDescriptor_2ade56339acadfd8, []int{1} -} -func (m *Macaroon) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Macaroon) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Macaroon.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 *Macaroon) XXX_Merge(src proto.Message) { - xxx_messageInfo_Macaroon.Merge(m, src) -} -func (m *Macaroon) XXX_Size() int { - return m.Size() -} -func (m *Macaroon) XXX_DiscardUnknown() { - xxx_messageInfo_Macaroon.DiscardUnknown(m) -} - -var xxx_messageInfo_Macaroon proto.InternalMessageInfo - -func (m *Macaroon) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *Macaroon) GetController() string { - if m != nil { - return m.Controller - } - return "" -} - -func (m *Macaroon) GetSubject() string { - if m != nil { - return m.Subject - } - return "" -} - -func (m *Macaroon) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *Macaroon) GetExpiryHeight() int64 { - if m != nil { - return m.ExpiryHeight - } - return 0 -} - -func (m *Macaroon) GetMacaroon() string { - if m != nil { - return m.Macaroon - } - return "" -} - -func init() { - proto.RegisterType((*Grant)(nil), "macaroon.v1.Grant") - proto.RegisterType((*Macaroon)(nil), "macaroon.v1.Macaroon") -} - -func init() { proto.RegisterFile("macaroon/v1/state.proto", fileDescriptor_2ade56339acadfd8) } - -var fileDescriptor_2ade56339acadfd8 = []byte{ - // 307 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e, - 0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28, - 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7, - 0xe6, 0x17, 0xeb, 0xe7, 0x17, 0xe5, 0x82, 0xd4, 0xe5, 0x17, 0xe5, 0x42, 0x54, 0x29, 0x6d, 0x63, - 0xe4, 0x62, 0x75, 0x2f, 0x4a, 0xcc, 0x2b, 0x11, 0xe2, 0xe3, 0x62, 0xca, 0x4c, 0x91, 0x60, 0x54, - 0x60, 0xd4, 0x60, 0x09, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe3, 0xe2, 0x4a, 0xce, 0xcf, 0x2b, 0x29, - 0xca, 0xcf, 0xc9, 0x49, 0x2d, 0x92, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x12, 0x11, 0x92, - 0xe0, 0x62, 0x2f, 0x2e, 0x4d, 0xca, 0x4a, 0x4d, 0x2e, 0x91, 0x60, 0x06, 0x4b, 0xc2, 0xb8, 0x42, - 0x62, 0x5c, 0x6c, 0xf9, 0x45, 0x99, 0xe9, 0x99, 0x79, 0x12, 0x2c, 0x60, 0x09, 0x28, 0x4f, 0x48, - 0x99, 0x8b, 0x37, 0xb5, 0xa2, 0x20, 0xb3, 0xa8, 0x32, 0x3e, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44, - 0x82, 0x55, 0x81, 0x51, 0x83, 0x39, 0x88, 0x07, 0x22, 0xe8, 0x01, 0x16, 0xb3, 0x52, 0xfb, 0x34, - 0xef, 0x72, 0x1f, 0xb3, 0x02, 0x17, 0x1b, 0xc8, 0x39, 0x02, 0x8c, 0x42, 0x22, 0x5c, 0x7c, 0x50, - 0x73, 0x75, 0x20, 0xc6, 0x08, 0x30, 0x4a, 0x30, 0x4a, 0x30, 0x2a, 0x5d, 0x65, 0xe4, 0xe2, 0xf0, - 0x85, 0xfa, 0x70, 0x90, 0xb8, 0x5d, 0x48, 0x8a, 0x8b, 0x03, 0x16, 0xe8, 0x12, 0x6c, 0x60, 0xed, - 0x70, 0x3e, 0x91, 0xfe, 0x62, 0x72, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, - 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, - 0x86, 0x28, 0xf5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xfc, 0xbc, - 0xe2, 0xfc, 0xbc, 0x22, 0x7d, 0x30, 0x51, 0xa1, 0x0f, 0x4f, 0x02, 0x25, 0x95, 0x05, 0xa9, 0xc5, - 0x49, 0x6c, 0xe0, 0xa8, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x46, 0x4a, 0xd1, 0x1b, - 0x02, 0x00, 0x00, -} - -func (m *Grant) 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 *Grant) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ExpiryHeight != 0 { - i = encodeVarintState(dAtA, i, uint64(m.ExpiryHeight)) - i-- - dAtA[i] = 0x28 - } - if len(m.Origin) > 0 { - i -= len(m.Origin) - copy(dAtA[i:], m.Origin) - i = encodeVarintState(dAtA, i, uint64(len(m.Origin))) - i-- - dAtA[i] = 0x22 - } - if len(m.Subject) > 0 { - i -= len(m.Subject) - copy(dAtA[i:], m.Subject) - i = encodeVarintState(dAtA, i, uint64(len(m.Subject))) - i-- - dAtA[i] = 0x1a - } - if len(m.Controller) > 0 { - i -= len(m.Controller) - copy(dAtA[i:], m.Controller) - i = encodeVarintState(dAtA, i, uint64(len(m.Controller))) - i-- - dAtA[i] = 0x12 - } - if m.Id != 0 { - i = encodeVarintState(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Macaroon) 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 *Macaroon) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Macaroon) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Macaroon) > 0 { - i -= len(m.Macaroon) - copy(dAtA[i:], m.Macaroon) - i = encodeVarintState(dAtA, i, uint64(len(m.Macaroon))) - i-- - dAtA[i] = 0x32 - } - if m.ExpiryHeight != 0 { - i = encodeVarintState(dAtA, i, uint64(m.ExpiryHeight)) - i-- - dAtA[i] = 0x28 - } - if len(m.Origin) > 0 { - i -= len(m.Origin) - copy(dAtA[i:], m.Origin) - i = encodeVarintState(dAtA, i, uint64(len(m.Origin))) - i-- - dAtA[i] = 0x22 - } - if len(m.Subject) > 0 { - i -= len(m.Subject) - copy(dAtA[i:], m.Subject) - i = encodeVarintState(dAtA, i, uint64(len(m.Subject))) - i-- - dAtA[i] = 0x1a - } - if len(m.Controller) > 0 { - i -= len(m.Controller) - copy(dAtA[i:], m.Controller) - i = encodeVarintState(dAtA, i, uint64(len(m.Controller))) - i-- - dAtA[i] = 0x12 - } - if m.Id != 0 { - i = encodeVarintState(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintState(dAtA []byte, offset int, v uint64) int { - offset -= sovState(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Grant) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovState(uint64(m.Id)) - } - l = len(m.Controller) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - l = len(m.Origin) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - if m.ExpiryHeight != 0 { - n += 1 + sovState(uint64(m.ExpiryHeight)) - } - return n -} - -func (m *Macaroon) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovState(uint64(m.Id)) - } - l = len(m.Controller) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - l = len(m.Subject) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - l = len(m.Origin) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - if m.ExpiryHeight != 0 { - n += 1 + sovState(uint64(m.ExpiryHeight)) - } - l = len(m.Macaroon) - if l > 0 { - n += 1 + l + sovState(uint64(l)) - } - return n -} - -func sovState(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozState(x uint64) (n int) { - return sovState(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Grant) 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 ErrIntOverflowState - } - 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: Grant: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Grant: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Controller = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Origin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType) - } - m.ExpiryHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpiryHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Macaroon) 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 ErrIntOverflowState - } - 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: Macaroon: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Macaroon: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Controller = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subject = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Origin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType) - } - m.ExpiryHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExpiryHeight |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Macaroon", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowState - } - 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 ErrInvalidLengthState - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthState - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Macaroon = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipState(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthState - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipState(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowState - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthState - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupState - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthState - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthState = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowState = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupState = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/macaroon/types/tx.pb.go b/x/macaroon/types/tx.pb.go deleted file mode 100644 index 8ea3e7d5a..000000000 --- a/x/macaroon/types/tx.pb.go +++ /dev/null @@ -1,1307 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: macaroon/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgUpdateParams is the Msg/UpdateParams request type. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParams struct { - // authority is the address of the governance account. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // params defines the parameters to update. - // - // NOTE: All parameters must be supplied. - Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` -} - -func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } -func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParams) ProtoMessage() {} -func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_68f908349d9da51a, []int{0} -} -func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParams.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 *MsgUpdateParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParams.Merge(m, src) -} -func (m *MsgUpdateParams) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo - -func (m *MsgUpdateParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// MsgUpdateParamsResponse defines the response structure for executing a -// MsgUpdateParams message. -// -// Since: cosmos-sdk 0.47 -type MsgUpdateParamsResponse struct { -} - -func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } -func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateParamsResponse) ProtoMessage() {} -func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_68f908349d9da51a, []int{1} -} -func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateParamsResponse.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 *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) -} -func (m *MsgUpdateParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo - -// MsgIssueMacaroon is the message type for the IssueMacaroon RPC. -type MsgIssueMacaroon struct { - // Controller is the address of the controller to authenticate. - Controller string `protobuf:"bytes,1,opt,name=controller,proto3" json:"controller,omitempty"` - // Origin is the origin of the request in wildcard form. - Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"` - // Permissions is the scope of the service. - Permissions map[string]string `protobuf:"bytes,3,rep,name=permissions,proto3" json:"permissions,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // token is the macron token to authenticate the operation. - Token string `protobuf:"bytes,4,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *MsgIssueMacaroon) Reset() { *m = MsgIssueMacaroon{} } -func (m *MsgIssueMacaroon) String() string { return proto.CompactTextString(m) } -func (*MsgIssueMacaroon) ProtoMessage() {} -func (*MsgIssueMacaroon) Descriptor() ([]byte, []int) { - return fileDescriptor_68f908349d9da51a, []int{2} -} -func (m *MsgIssueMacaroon) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgIssueMacaroon) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgIssueMacaroon.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 *MsgIssueMacaroon) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIssueMacaroon.Merge(m, src) -} -func (m *MsgIssueMacaroon) XXX_Size() int { - return m.Size() -} -func (m *MsgIssueMacaroon) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIssueMacaroon.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgIssueMacaroon proto.InternalMessageInfo - -func (m *MsgIssueMacaroon) GetController() string { - if m != nil { - return m.Controller - } - return "" -} - -func (m *MsgIssueMacaroon) GetOrigin() string { - if m != nil { - return m.Origin - } - return "" -} - -func (m *MsgIssueMacaroon) GetPermissions() map[string]string { - if m != nil { - return m.Permissions - } - return nil -} - -func (m *MsgIssueMacaroon) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -// MsgIssueMacaroonResponse is the response type for the IssueMacaroon -// RPC. -type MsgIssueMacaroonResponse struct { - Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` - Token string `protobuf:"bytes,2,opt,name=token,proto3" json:"token,omitempty"` -} - -func (m *MsgIssueMacaroonResponse) Reset() { *m = MsgIssueMacaroonResponse{} } -func (m *MsgIssueMacaroonResponse) String() string { return proto.CompactTextString(m) } -func (*MsgIssueMacaroonResponse) ProtoMessage() {} -func (*MsgIssueMacaroonResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_68f908349d9da51a, []int{3} -} -func (m *MsgIssueMacaroonResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgIssueMacaroonResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgIssueMacaroonResponse.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 *MsgIssueMacaroonResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgIssueMacaroonResponse.Merge(m, src) -} -func (m *MsgIssueMacaroonResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgIssueMacaroonResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgIssueMacaroonResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgIssueMacaroonResponse proto.InternalMessageInfo - -func (m *MsgIssueMacaroonResponse) GetSuccess() bool { - if m != nil { - return m.Success - } - return false -} - -func (m *MsgIssueMacaroonResponse) GetToken() string { - if m != nil { - return m.Token - } - return "" -} - -func init() { - proto.RegisterType((*MsgUpdateParams)(nil), "macaroon.v1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "macaroon.v1.MsgUpdateParamsResponse") - proto.RegisterType((*MsgIssueMacaroon)(nil), "macaroon.v1.MsgIssueMacaroon") - proto.RegisterMapType((map[string]string)(nil), "macaroon.v1.MsgIssueMacaroon.PermissionsEntry") - proto.RegisterType((*MsgIssueMacaroonResponse)(nil), "macaroon.v1.MsgIssueMacaroonResponse") -} - -func init() { proto.RegisterFile("macaroon/v1/tx.proto", fileDescriptor_68f908349d9da51a) } - -var fileDescriptor_68f908349d9da51a = []byte{ - // 497 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x53, 0xcf, 0x6b, 0x13, 0x41, - 0x14, 0xce, 0x24, 0x6d, 0x34, 0x13, 0xb5, 0x61, 0x0c, 0x76, 0xbb, 0xe8, 0x1a, 0x82, 0x62, 0x28, - 0xb8, 0x4b, 0x22, 0x48, 0xc9, 0x41, 0x68, 0xc0, 0x83, 0x42, 0x20, 0xac, 0xf4, 0xe2, 0x45, 0xb6, - 0x9b, 0x61, 0xba, 0x34, 0x3b, 0x6f, 0x99, 0x37, 0x09, 0xcd, 0x4d, 0x3c, 0x7b, 0xf0, 0x1f, 0xf0, - 0x7f, 0xe8, 0x41, 0xf0, 0x5f, 0xe8, 0xb1, 0x78, 0xf2, 0x24, 0x92, 0x1c, 0xfa, 0x6f, 0x48, 0xf6, - 0x47, 0xb3, 0xd9, 0x43, 0xbc, 0x84, 0xf9, 0xe6, 0xbd, 0xef, 0x7b, 0xdf, 0xfb, 0xb2, 0x43, 0x9b, - 0xa1, 0xe7, 0x7b, 0x0a, 0x40, 0x3a, 0xb3, 0xae, 0xa3, 0x2f, 0xec, 0x48, 0x81, 0x06, 0x56, 0xcf, - 0x6e, 0xed, 0x59, 0xd7, 0xdc, 0xf7, 0x01, 0x43, 0x40, 0x27, 0x44, 0xb1, 0x6a, 0x0a, 0x51, 0x24, - 0x5d, 0xe6, 0x41, 0x52, 0xf8, 0x14, 0x23, 0x27, 0x01, 0x69, 0xa9, 0x29, 0x40, 0x40, 0x72, 0xbf, - 0x3a, 0x65, 0x84, 0xfc, 0x30, 0xc1, 0x25, 0xc7, 0x20, 0x25, 0xb4, 0xbf, 0x12, 0xba, 0x37, 0x44, - 0x71, 0x12, 0x8d, 0x3d, 0xcd, 0x47, 0x9e, 0xf2, 0x42, 0x64, 0xaf, 0x69, 0xcd, 0x9b, 0xea, 0x33, - 0x50, 0x81, 0x9e, 0x1b, 0xa4, 0x45, 0x3a, 0xb5, 0x81, 0xf1, 0xeb, 0xc7, 0xcb, 0x66, 0x3a, 0xe9, - 0x78, 0x3c, 0x56, 0x1c, 0xf1, 0x83, 0x56, 0x81, 0x14, 0xee, 0xba, 0x95, 0x75, 0x69, 0x35, 0x8a, - 0x15, 0x8c, 0x72, 0x8b, 0x74, 0xea, 0xbd, 0x87, 0x76, 0x6e, 0x1d, 0x3b, 0x11, 0x1f, 0xec, 0x5c, - 0xfd, 0x79, 0x5a, 0x72, 0xd3, 0xc6, 0xfe, 0x83, 0x2f, 0x37, 0x97, 0x87, 0x6b, 0x89, 0xf6, 0x01, - 0xdd, 0x2f, 0xb8, 0x71, 0x39, 0x46, 0x20, 0x91, 0xb7, 0xbf, 0x97, 0x69, 0x63, 0x88, 0xe2, 0x1d, - 0xe2, 0x94, 0x0f, 0x53, 0x5d, 0x76, 0x44, 0xa9, 0x0f, 0x52, 0x2b, 0x98, 0x4c, 0xb8, 0xfa, 0xaf, - 0xd7, 0x5c, 0x2f, 0x7b, 0x44, 0xab, 0xa0, 0x02, 0x11, 0xc8, 0xd8, 0x6c, 0xcd, 0x4d, 0x11, 0x1b, - 0xd1, 0x7a, 0xc4, 0x55, 0x18, 0x20, 0x06, 0x20, 0xd1, 0xa8, 0xb4, 0x2a, 0x9d, 0x7a, 0xcf, 0xde, - 0xd8, 0xa4, 0xe8, 0xc2, 0x1e, 0xad, 0x09, 0x6f, 0xa5, 0x56, 0x73, 0x37, 0x2f, 0xc1, 0x9a, 0x74, - 0x57, 0xc3, 0x39, 0x97, 0xc6, 0x4e, 0x3c, 0x28, 0x01, 0xe6, 0x1b, 0xda, 0x28, 0xd2, 0x58, 0x83, - 0x56, 0xce, 0x79, 0x1a, 0xb9, 0xbb, 0x3a, 0xae, 0xb8, 0x33, 0x6f, 0x32, 0xe5, 0xa9, 0xc9, 0x04, - 0xf4, 0xcb, 0x47, 0xa4, 0xbf, 0xb7, 0x4a, 0x2e, 0xb7, 0x50, 0xfb, 0x3d, 0x35, 0x8a, 0xc6, 0xb2, - 0xec, 0x98, 0x41, 0xef, 0xe0, 0xd4, 0xf7, 0x39, 0x62, 0x2c, 0x7e, 0xd7, 0xcd, 0xe0, 0xda, 0x5c, - 0x39, 0x67, 0xae, 0xf7, 0x93, 0xd0, 0xca, 0x10, 0x05, 0x73, 0xe9, 0xbd, 0x8d, 0x2f, 0xe3, 0x71, - 0x31, 0x87, 0x7c, 0xd5, 0x7c, 0xb6, 0xad, 0x7a, 0xeb, 0xe5, 0x84, 0xde, 0xdf, 0xfc, 0x0f, 0x9f, - 0x6c, 0x0d, 0xd7, 0x7c, 0xbe, 0xb5, 0x9c, 0xc9, 0x9a, 0xbb, 0x9f, 0x6f, 0x2e, 0x0f, 0xc9, 0xe0, - 0xf8, 0x6a, 0x61, 0x91, 0xeb, 0x85, 0x45, 0xfe, 0x2e, 0x2c, 0xf2, 0x6d, 0x69, 0x95, 0xae, 0x97, - 0x56, 0xe9, 0xf7, 0xd2, 0x2a, 0x7d, 0x7c, 0x21, 0x02, 0x7d, 0x36, 0x3d, 0xb5, 0x7d, 0x08, 0x1d, - 0x90, 0x08, 0x52, 0x39, 0xf1, 0xcf, 0x85, 0x73, 0xfb, 0x3a, 0xf4, 0x3c, 0xe2, 0x78, 0x5a, 0x8d, - 0x5f, 0xc6, 0xab, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x0f, 0x46, 0xf7, 0xa3, 0x03, 0x00, - 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) - // IssueMacaroon asserts the given controller is the owner of the given - // address. - IssueMacaroon(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { - out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/macaroon.v1.Msg/UpdateParams", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) IssueMacaroon(ctx context.Context, in *MsgIssueMacaroon, opts ...grpc.CallOption) (*MsgIssueMacaroonResponse, error) { - out := new(MsgIssueMacaroonResponse) - err := c.cc.Invoke(ctx, "/macaroon.v1.Msg/IssueMacaroon", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // UpdateParams defines a governance operation for updating the parameters. - // - // Since: cosmos-sdk 0.47 - UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) - // IssueMacaroon asserts the given controller is the owner of the given - // address. - IssueMacaroon(context.Context, *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") -} -func (*UnimplementedMsgServer) IssueMacaroon(ctx context.Context, req *MsgIssueMacaroon) (*MsgIssueMacaroonResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method IssueMacaroon not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateParams(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/macaroon.v1.Msg/UpdateParams", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_IssueMacaroon_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgIssueMacaroon) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).IssueMacaroon(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/macaroon.v1.Msg/IssueMacaroon", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).IssueMacaroon(ctx, req.(*MsgIssueMacaroon)) - } - return interceptor(ctx, in, info, handler) -} - -var Msg_serviceDesc = _Msg_serviceDesc -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "macaroon.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "UpdateParams", - Handler: _Msg_UpdateParams_Handler, - }, - { - MethodName: "IssueMacaroon", - Handler: _Msg_IssueMacaroon_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "macaroon/v1/tx.proto", -} - -func (m *MsgUpdateParams) 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 *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateParamsResponse) 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 *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgIssueMacaroon) 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 *MsgIssueMacaroon) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgIssueMacaroon) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintTx(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0x22 - } - if len(m.Permissions) > 0 { - for k := range m.Permissions { - v := m.Permissions[k] - baseI := i - i -= len(v) - copy(dAtA[i:], v) - i = encodeVarintTx(dAtA, i, uint64(len(v))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintTx(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintTx(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Origin) > 0 { - i -= len(m.Origin) - copy(dAtA[i:], m.Origin) - i = encodeVarintTx(dAtA, i, uint64(len(m.Origin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Controller) > 0 { - i -= len(m.Controller) - copy(dAtA[i:], m.Controller) - i = encodeVarintTx(dAtA, i, uint64(len(m.Controller))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgIssueMacaroonResponse) 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 *MsgIssueMacaroonResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgIssueMacaroonResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Token) > 0 { - i -= len(m.Token) - copy(dAtA[i:], m.Token) - i = encodeVarintTx(dAtA, i, uint64(len(m.Token))) - i-- - dAtA[i] = 0x12 - } - if m.Success { - i-- - if m.Success { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgUpdateParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - return n -} - -func (m *MsgUpdateParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgIssueMacaroon) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Controller) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Origin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Permissions) > 0 { - for k, v := range m.Permissions { - _ = k - _ = v - mapEntrySize := 1 + len(k) + sovTx(uint64(len(k))) + 1 + len(v) + sovTx(uint64(len(v))) - n += mapEntrySize + 1 + sovTx(uint64(mapEntrySize)) - } - } - l = len(m.Token) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgIssueMacaroonResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Success { - n += 2 - } - l = len(m.Token) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", 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.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgIssueMacaroon) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgIssueMacaroon: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIssueMacaroon: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Controller", 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.Controller = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Origin", 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.Origin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Permissions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Permissions == nil { - m.Permissions = make(map[string]string) - } - var mapkey string - var mapvalue string - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthTx - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthTx - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var stringLenmapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapvalue |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapvalue := int(stringLenmapvalue) - if intStringLenmapvalue < 0 { - return ErrInvalidLengthTx - } - postStringIndexmapvalue := iNdEx + intStringLenmapvalue - if postStringIndexmapvalue < 0 { - return ErrInvalidLengthTx - } - if postStringIndexmapvalue > l { - return io.ErrUnexpectedEOF - } - mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) - iNdEx = postStringIndexmapvalue - } else { - iNdEx = entryPreIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Permissions[mapkey] = mapvalue - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgIssueMacaroonResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgIssueMacaroonResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgIssueMacaroonResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Success", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Success = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Token", 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.Token = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/service/depinject.go b/x/service/depinject.go index 8f0ddad6a..d535caf81 100644 --- a/x/service/depinject.go +++ b/x/service/depinject.go @@ -18,7 +18,6 @@ import ( modulev1 "github.com/onsonr/sonr/api/service/module/v1" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/service/keeper" vaultkeeper "github.com/onsonr/sonr/x/vault/keeper" ) @@ -47,7 +46,6 @@ type ModuleInputs struct { DidKeeper didkeeper.Keeper GroupKeeper groupkeeper.Keeper - MacaroonKeeper macaroonkeeper.Keeper NFTKeeper nftkeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper @@ -64,8 +62,8 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper, in.GroupKeeper, in.MacaroonKeeper, in.NFTKeeper, in.VaultKeeper) - m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper) + k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper, in.GroupKeeper, in.NFTKeeper, in.VaultKeeper) + m := NewAppModule(in.Cdc, k, in.DidKeeper) return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}} } diff --git a/x/service/keeper/keeper.go b/x/service/keeper/keeper.go index bc19097fa..4af26fc5a 100644 --- a/x/service/keeper/keeper.go +++ b/x/service/keeper/keeper.go @@ -13,7 +13,6 @@ import ( apiv1 "github.com/onsonr/sonr/api/service/v1" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/service/types" vaultkeeper "github.com/onsonr/sonr/x/vault/keeper" ) @@ -30,11 +29,10 @@ type Keeper struct { authority string - DidKeeper didkeeper.Keeper - GroupKeeper groupkeeper.Keeper - MacaroonKeeper macaroonkeeper.Keeper - NFTKeeper nftkeeper.Keeper - VaultKeeper vaultkeeper.Keeper + DidKeeper didkeeper.Keeper + GroupKeeper groupkeeper.Keeper + NFTKeeper nftkeeper.Keeper + VaultKeeper vaultkeeper.Keeper } // NewKeeper creates a new Keeper instance @@ -45,7 +43,6 @@ func NewKeeper( authority string, didKeeper didkeeper.Keeper, groupKeeper groupkeeper.Keeper, - macaroonKeeper macaroonkeeper.Keeper, nftKeeper nftkeeper.Keeper, vaultKeeper vaultkeeper.Keeper, ) Keeper { @@ -76,10 +73,9 @@ func NewKeeper( authority: authority, - DidKeeper: didKeeper, - GroupKeeper: groupKeeper, - MacaroonKeeper: macaroonKeeper, - NFTKeeper: nftKeeper, + DidKeeper: didKeeper, + GroupKeeper: groupKeeper, + NFTKeeper: nftKeeper, } schema, err := sb.Build() diff --git a/x/service/keeper/keeper_test.go b/x/service/keeper/keeper_test.go index 49f51f847..a3212777f 100644 --- a/x/service/keeper/keeper_test.go +++ b/x/service/keeper/keeper_test.go @@ -26,7 +26,6 @@ import ( "github.com/stretchr/testify/suite" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" module "github.com/onsonr/sonr/x/service" "github.com/onsonr/sonr/x/service/keeper" "github.com/onsonr/sonr/x/service/types" @@ -54,7 +53,6 @@ type testFixture struct { bankkeeper bankkeeper.BaseKeeper didkeeper didkeeper.Keeper groupkeeper groupkeeper.Keeper - mack macaroonkeeper.Keeper stakingKeeper *stakingkeeper.Keeper mintkeeper mintkeeper.Keeper nftkeeper nftkeeper.Keeper @@ -86,10 +84,10 @@ func SetupTest(t *testing.T) *testFixture { registerBaseSDKModules(f, encCfg, storeService, logger, require) // Setup Keeper. - f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didkeeper, f.groupkeeper, f.mack, f.nftkeeper, f.vaultkeeper) + f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didkeeper, f.groupkeeper, f.nftkeeper, f.vaultkeeper) f.msgServer = keeper.NewMsgServerImpl(f.k) f.queryServer = keeper.NewQuerier(f.k) - f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack) + f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper) return f } diff --git a/x/service/module.go b/x/service/module.go index fde54eb7b..5442d22d3 100644 --- a/x/service/module.go +++ b/x/service/module.go @@ -16,7 +16,6 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/service/keeper" "github.com/onsonr/sonr/x/service/types" ) @@ -46,7 +45,6 @@ type AppModule struct { keeper keeper.Keeper didk didkeeper.Keeper - mack macaroonkeeper.Keeper } // NewAppModule constructor @@ -54,13 +52,11 @@ func NewAppModule( cdc codec.Codec, keeper keeper.Keeper, didkeeper didkeeper.Keeper, - macaroonkeeper macaroonkeeper.Keeper, ) *AppModule { return &AppModule{ AppModuleBasic: AppModuleBasic{cdc: cdc}, keeper: keeper, didk: didkeeper, - mack: macaroonkeeper, } } diff --git a/x/vault/depinject.go b/x/vault/depinject.go index d4b879cd7..163a4c607 100644 --- a/x/vault/depinject.go +++ b/x/vault/depinject.go @@ -14,7 +14,6 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" modulev1 "github.com/onsonr/sonr/api/vault/module/v1" didkeeper "github.com/onsonr/sonr/x/did/keeper" @@ -45,7 +44,6 @@ type ModuleInputs struct { AccountKeeper authkeeper.AccountKeeper DidKeeper didkeeper.Keeper - MacaroonKeeper macaroonkeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper } @@ -60,7 +58,7 @@ type ModuleOutputs struct { func ProvideModule(in ModuleInputs) ModuleOutputs { govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() - k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper, in.MacaroonKeeper) + k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper) m := NewAppModule(in.Cdc, k, in.DidKeeper) return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}} diff --git a/x/vault/keeper/keeper.go b/x/vault/keeper/keeper.go index 6e88921bf..99ed90406 100644 --- a/x/vault/keeper/keeper.go +++ b/x/vault/keeper/keeper.go @@ -17,7 +17,6 @@ import ( apiv1 "github.com/onsonr/sonr/api/vault/v1" dwngen "github.com/onsonr/sonr/internal/dwn/gen" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" "github.com/onsonr/sonr/x/vault/types" ) @@ -36,9 +35,8 @@ type Keeper struct { ipfsClient *rpc.HttpApi hasIpfsConn bool - AccountKeeper authkeeper.AccountKeeper - DIDKeeper didkeeper.Keeper - MacaroonKeeper macaroonkeeper.Keeper + AccountKeeper authkeeper.AccountKeeper + DIDKeeper didkeeper.Keeper } // NewKeeper creates a new Keeper instance @@ -49,7 +47,6 @@ func NewKeeper( authority string, authKeeper authkeeper.AccountKeeper, didKeeper didkeeper.Keeper, - macaroonKeeper macaroonkeeper.Keeper, ) Keeper { var hasIpfs bool logger = logger.With(log.ModuleKey, "x/"+types.ModuleName) @@ -80,13 +77,12 @@ func NewKeeper( } k := Keeper{ - cdc: cdc, - logger: logger, - DIDKeeper: didKeeper, - MacaroonKeeper: macaroonKeeper, - AccountKeeper: authKeeper, - Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), - OrmDB: store, + cdc: cdc, + logger: logger, + DIDKeeper: didKeeper, + AccountKeeper: authKeeper, + Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), + OrmDB: store, ipfsClient: ipfsClient, hasIpfsConn: hasIpfs, diff --git a/x/vault/keeper/keeper_test.go b/x/vault/keeper/keeper_test.go index 000b67273..313bd65be 100644 --- a/x/vault/keeper/keeper_test.go +++ b/x/vault/keeper/keeper_test.go @@ -24,7 +24,6 @@ import ( "github.com/stretchr/testify/suite" didkeeper "github.com/onsonr/sonr/x/did/keeper" - macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper" module "github.com/onsonr/sonr/x/vault" "github.com/onsonr/sonr/x/vault/keeper" "github.com/onsonr/sonr/x/vault/types" @@ -52,7 +51,6 @@ type testFixture struct { stakingKeeper *stakingkeeper.Keeper mintkeeper mintkeeper.Keeper didk didkeeper.Keeper - mack macaroonkeeper.Keeper addrs []sdk.AccAddress govModAddr string @@ -80,7 +78,7 @@ func SetupTest(t *testing.T) *testFixture { registerBaseSDKModules(f, encCfg, storeService, logger, require) // Setup Keeper. - f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk, f.mack) + f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk) f.msgServer = keeper.NewMsgServerImpl(f.k) f.queryServer = keeper.NewQuerier(f.k) f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)