forked from cerc-io/laconicd-deprecated
lint: fix many broken lint issues (#49)
* lint: fix many broken lint issues * more lint issues resolved * more lint issues resolved * all actions issues fixed * pin variables for websocket * Update .github/workflows/lint.yml * more fixes * fix lint issues in pubsub, rpc, types * fix lint issues in statedb, journal, pubsub, cli * fix comment Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
Federico Kunze
parent
fcb7c114d0
commit
e3270aee5d
@@ -45,20 +45,3 @@ func formatKeyToHash(key string) string {
|
||||
|
||||
return ethkey.Hex()
|
||||
}
|
||||
|
||||
// nolint: deadcode
|
||||
func cosmosAddressFromArg(addr string) (sdk.AccAddress, error) {
|
||||
if strings.HasPrefix(addr, sdk.GetConfig().GetBech32AccountAddrPrefix()) {
|
||||
// Check to see if address is Cosmos bech32 formatted
|
||||
toAddr, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "invalid bech32 formatted address")
|
||||
}
|
||||
return toAddr, nil
|
||||
}
|
||||
|
||||
// Strip 0x prefix if exists
|
||||
addr = strings.TrimPrefix(addr, "0x")
|
||||
|
||||
return sdk.AccAddressFromHex(addr)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
@@ -10,6 +12,22 @@ import (
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
func cosmosAddressFromArg(addr string) (sdk.AccAddress, error) {
|
||||
if strings.HasPrefix(addr, sdk.GetConfig().GetBech32AccountAddrPrefix()) {
|
||||
// Check to see if address is Cosmos bech32 formatted
|
||||
toAddr, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "invalid bech32 formatted address")
|
||||
}
|
||||
return toAddr, nil
|
||||
}
|
||||
|
||||
// Strip 0x prefix if exists
|
||||
addr = strings.TrimPrefix(addr, "0x")
|
||||
|
||||
return sdk.AccAddressFromHex(addr)
|
||||
}
|
||||
|
||||
func TestAddressFormats(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user