mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-05 02:41:41 +00:00
feat: add automated production release workflow
This commit is contained in:
+13
-16
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"cosmossdk.io/log"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/ipfs/boxo/path"
|
||||
|
||||
"github.com/onsonr/sonr/x/did/types"
|
||||
)
|
||||
@@ -21,7 +22,6 @@ func (k *Keeper) InitGenesis(ctx context.Context, data *types.GenesisState) erro
|
||||
if err := data.Params.Validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return k.Params.Set(ctx, data.Params)
|
||||
}
|
||||
|
||||
@@ -55,22 +55,19 @@ func (k Keeper) CheckValidatorExists(ctx sdk.Context, addr string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetAverageBlockTime returns the average block time in seconds
|
||||
func (k Keeper) GetAverageBlockTime(ctx sdk.Context) float64 {
|
||||
return float64(ctx.BlockTime().Sub(ctx.BlockTime()).Seconds())
|
||||
}
|
||||
|
||||
// GetParams returns the module parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) *types.Params {
|
||||
p, err := k.Params.Get(ctx)
|
||||
// HasPathInIPFS checks if a file is in the local IPFS node
|
||||
func (k Keeper) HasPathInIPFS(ctx sdk.Context, cid string) (bool, error) {
|
||||
path, err := path.NewPath(cid)
|
||||
if err != nil {
|
||||
p = types.DefaultParams()
|
||||
return false, err
|
||||
}
|
||||
v, err := k.ipfsClient.Unixfs().Get(ctx, path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
params := p.ActiveParams(k.HasIPFSConnection())
|
||||
return ¶ms
|
||||
}
|
||||
|
||||
// GetExpirationBlockHeight returns the block height at which the given duration will have passed
|
||||
func (k Keeper) GetExpirationBlockHeight(ctx sdk.Context, duration time.Duration) int64 {
|
||||
return ctx.BlockHeight() + int64(duration.Seconds()/k.GetAverageBlockTime(ctx))
|
||||
if v == nil {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user