fix: SetSignerPublicKey return address with 0x prefix (#4193)

This commit is contained in:
Mykhailo Prakhov 2023-10-24 22:17:02 +02:00 committed by GitHub
parent 23f71c1125
commit b08125890e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -39,3 +39,8 @@ func Hex2Bytes(str string) []byte {
h, _ := hex.DecodeString(str) h, _ := hex.DecodeString(str)
return h return h
} }
// ToHex returns the hex string representation of bytes with 0x prefix.
func ToHex(bytes []byte) string {
return "0x" + Bytes2Hex(bytes)
}

View File

@ -13,6 +13,7 @@ import (
"github.com/status-im/status-go/account" "github.com/status-im/status-go/account"
"github.com/status-im/status-go/contracts/community-tokens/ownertoken" "github.com/status-im/status-go/contracts/community-tokens/ownertoken"
communityownertokenregistry "github.com/status-im/status-go/contracts/community-tokens/registry" communityownertokenregistry "github.com/status-im/status-go/contracts/community-tokens/registry"
"github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
"github.com/status-im/status-go/rpc" "github.com/status-im/status-go/rpc"
"github.com/status-im/status-go/services/utils" "github.com/status-im/status-go/services/utils"
@ -104,7 +105,8 @@ func (s *Service) GetSignerPubKey(ctx context.Context, chainID uint64, contractA
if err != nil { if err != nil {
return "", err return "", err
} }
return common.Bytes2Hex(signerPubKey), nil
return types.ToHex(signerPubKey), nil
} }
func (s *Service) SafeGetSignerPubKey(ctx context.Context, chainID uint64, communityID string) (string, error) { func (s *Service) SafeGetSignerPubKey(ctx context.Context, chainID uint64, communityID string) (string, error) {