@@ -5,18 +5,19 @@ import (
55 "crypto/rand"
66 "crypto/tls"
77 "fmt"
8- "github.com/ethereum/go-ethereum/accounts/keystore"
9- "github.com/ethereum/go-ethereum/crypto"
10- "github.com/pkg/errors"
11- "github.com/smartcontractkit/chainlink-testing-framework/framework"
12- "github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode"
138 "math/big"
149 "net/http"
1510 "os"
1611 "strings"
1712 "sync"
1813 "time"
1914
15+ "github.com/ethereum/go-ethereum/accounts/keystore"
16+ "github.com/ethereum/go-ethereum/crypto"
17+ "github.com/pkg/errors"
18+ "github.com/smartcontractkit/chainlink-testing-framework/framework"
19+ "github.com/smartcontractkit/chainlink-testing-framework/framework/components/clnode"
20+
2021 "github.com/ethereum/go-ethereum/common"
2122 "github.com/go-resty/resty/v2"
2223 "github.com/rs/zerolog/log"
@@ -1239,19 +1240,21 @@ func (c *ChainlinkClient) GetForwarders() (*Forwarders, *http.Response, error) {
12391240 return response , resp .RawResponse , err
12401241}
12411242
1242- func NewETHKey (password string ) ([]byte , error ) {
1243+ func NewETHKey (password string ) ([]byte , common. Address , error ) {
12431244 privateKey , err := ecdsa .GenerateKey (crypto .S256 (), rand .Reader )
1245+ var address common.Address
12441246 if err != nil {
1245- return nil , errors .Wrap (err , "failed to generate private key" )
1247+ return nil , address , errors .Wrap (err , "failed to generate private key" )
12461248 }
1249+ address = crypto .PubkeyToAddress (privateKey .PublicKey )
12471250 jsonKey , err := keystore .EncryptKey (& keystore.Key {
12481251 PrivateKey : privateKey ,
1249- Address : crypto . PubkeyToAddress ( privateKey . PublicKey ) ,
1252+ Address : address ,
12501253 }, password , keystore .StandardScryptN , keystore .StandardScryptP )
12511254 if err != nil {
1252- return nil , errors .Wrap (err , "failed to encrypt the keystore" )
1255+ return nil , address , errors .Wrap (err , "failed to encrypt the keystore" )
12531256 }
1254- return jsonKey , nil
1257+ return jsonKey , address , nil
12551258}
12561259
12571260// ImportEVMKey imports EVM key to the node (encrypted go-ethereum JSON wallet format)
0 commit comments