mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-14 20:15:18 +00:00
22 lines
607 B
Go
22 lines
607 B
Go
package util_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/0glabs/0g-chain/chaincfg"
|
|
"github.com/0glabs/0g-chain/tests/util"
|
|
)
|
|
|
|
func TestAddressConversion(t *testing.T) {
|
|
chaincfg.SetSDKConfig()
|
|
bech32Addr := sdk.MustAccAddressFromBech32("0g17d2wax0zhjrrecvaszuyxdf5wcu5a0p4qlx3t5")
|
|
hexAddr := common.HexToAddress("0xf354ee99e2bc863cE19d80b843353476394EbC35")
|
|
require.Equal(t, bech32Addr, util.EvmToSdkAddress(hexAddr))
|
|
require.Equal(t, hexAddr, util.SdkToEvmAddress(bech32Addr))
|
|
}
|