github.com/smartcontractkit/chainlink-testing-framework/libs@v0.0.0-20240227141906-ec710b4eb1a3/blockchain/wallet_test.go (about)

     1  package blockchain_test
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/require"
     8  
     9  	"github.com/smartcontractkit/chainlink-testing-framework/libs/blockchain"
    10  	"github.com/smartcontractkit/chainlink-testing-framework/libs/logging"
    11  )
    12  
    13  // Publicly available private key that is used as default in hardhat, geth, etc...
    14  // #nosec G101
    15  var key = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
    16  
    17  // Address of the key above
    18  var address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
    19  
    20  func TestMain(m *testing.M) {
    21  	logging.Init()
    22  	os.Exit(m.Run())
    23  }
    24  
    25  func TestWallet(t *testing.T) {
    26  	t.Parallel()
    27  	wallet, err := blockchain.NewEthereumWallet(key)
    28  	require.NoError(t, err)
    29  
    30  	require.Equal(t, address, wallet.Address(), "Address of key '%s' not as expected", key)
    31  	require.Equal(t, key, wallet.PrivateKey(), "Private key not as expected")
    32  	require.Equal(t, key, wallet.RawPrivateKey(), "Private key not as expected")
    33  }