- Add nitro server and x/nitro module
- wire go-nitro p2p through cometbft
- Add distsig server, currently WIP
- integrate DKG and DSS schemes into ABCI methods
- Remove deprecated features
- crisis module
- module invariants
- Update to use newer SDK patterns
- upgrade sdk to v0.53.x
- custom address codec
- expand use of depinject
- migrate e2e tests to system tests
- use depinject to set up integration tests
- change reserved protobuf field name `cerc.registry.v1.Record.type`
- Revise & add documentation
- TransferCoinsToModuleAccount: clarify function
- Update init.sh script
19 lines
372 B
Go
19 lines
372 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
func GetFromContext[T any](ctx context.Context, key string) (*T, error) {
|
|
if v := ctx.Value(key); v != nil {
|
|
val, ok := v.(*T)
|
|
if !ok {
|
|
return nil, fmt.Errorf("context value of wrong type; expected %T, got %T", new(T), v)
|
|
}
|
|
return val, nil
|
|
}
|
|
return nil, errors.New("key not found in context: " + key)
|
|
}
|