mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
* refactor: update model proto * feat: add status field to Controller * feat: add Verification.Kind field to state protobuf to support different verification types * fix: remove QueryService and QueryResolve RPCs from query.proto
44 lines
761 B
Go
44 lines
761 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/onsonr/sonr/x/did/types"
|
|
"google.golang.org/grpc/peer"
|
|
)
|
|
|
|
type Context struct {
|
|
SDKCtx sdk.Context
|
|
Keeper Keeper
|
|
Peer *peer.Peer
|
|
}
|
|
|
|
func (k Keeper) CurrentCtx(goCtx context.Context) Context {
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
peer, _ := peer.FromContext(goCtx)
|
|
return Context{SDKCtx: ctx, Peer: peer, Keeper: k}
|
|
}
|
|
|
|
func (c Context) Params() *types.Params {
|
|
return c.Keeper.GetParams(c.SDK())
|
|
}
|
|
|
|
func (c Context) SDK() sdk.Context {
|
|
return c.SDKCtx
|
|
}
|
|
|
|
func (c Context) IsAnonymous() bool {
|
|
if c.Peer == nil {
|
|
return true
|
|
}
|
|
return c.Peer.Addr == nil
|
|
}
|
|
|
|
func (c Context) PeerID() string {
|
|
if c.Peer == nil {
|
|
return ""
|
|
}
|
|
return c.Peer.Addr.String()
|
|
}
|