accounts/abi/bind: allow specifying signer on transactOpts (#21356)
This commit enables users to specify which signer they want to use while creating their transactOpts. Previously all contract interactions used the homestead signer. Now a user can specify whether they want to sign with homestead or EIP155 and specify the chainID which adds another layer of security. Closes #16484
This commit is contained in:
committed by
GitHub
parent
6a4e730003
commit
ed0670cb17
@@ -112,7 +112,8 @@ func prepare(n int, backend *backends.SimulatedBackend) {
|
||||
switch i {
|
||||
case 0:
|
||||
// deploy checkpoint contract
|
||||
registrarAddr, _, _, _ = contract.DeployCheckpointOracle(bind.NewKeyedTransactor(bankKey), backend, []common.Address{signerAddr}, sectionSize, processConfirms, big.NewInt(1))
|
||||
auth, _ := bind.NewKeyedTransactorWithChainID(bankKey, big.NewInt(1337))
|
||||
registrarAddr, _, _, _ = contract.DeployCheckpointOracle(auth, backend, []common.Address{signerAddr}, sectionSize, processConfirms, big.NewInt(1))
|
||||
// bankUser transfers some ether to user1
|
||||
nonce, _ := backend.PendingNonceAt(ctx, bankAddr)
|
||||
tx, _ := types.SignTx(types.NewTransaction(nonce, userAddr1, big.NewInt(10000), params.TxGas, nil, nil), signer, bankKey)
|
||||
|
Reference in New Issue
Block a user