Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
yongkangc committed Aug 24, 2023
1 parent 690133b commit a1e7d63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions pkg/cosmos/txmgr/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos"

txmgrtypes "github.com/smartcontractkit/chainlink-relay/pkg/txmgr/types"
)

Expand Down Expand Up @@ -49,7 +50,6 @@ func EncodePayload(msg sdk.Msg) ([]byte, error) {
return raw, nil
}

// Decodes bytes into cosmos native txn type
func DecodePayload(msgType string, raw []byte) (msg sdk.Msg, err error) {
switch msgType {
case typeMsgSend:
Expand All @@ -75,13 +75,14 @@ func DecodePayload(msgType string, raw []byte) (msg sdk.Msg, err error) {
// https://docs.cosmos.network/v0.46/basics/accounts.html#keys-accounts-addresses-and-signatures
type Address [32]byte

// Create a new Address from a sdk.Address
// Create a new generic txmgr Address from a sdk.Address
func NewAddress(addr sdk.AccAddress) Address {
var a Address
copy(a[:], addr[:])
return a
}

// Convert a generic txmgr Address to a Cosmos sdk.AccAddress
func ToCosmosAddress(addr Address) sdk.AccAddress {
return sdk.AccAddress(bytes.TrimRight(addr[:], "\x00"))
}
Expand Down
1 change: 0 additions & 1 deletion pkg/cosmos/txmgr/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func TestAddress(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, 20, len(addr20.Bytes()))

// Test cases
testCases := []struct {
name string
accAddress sdk.AccAddress
Expand Down

0 comments on commit a1e7d63

Please sign in to comment.