aboutsummaryrefslogtreecommitdiffstats
path: root/accounts/abi/bind/auth.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-03-21 20:34:49 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-03-24 23:09:45 +0800
commit73308dbe0e08db015a7c461b5be1755dc3fcc737 (patch)
treeaa6d4c875884f20fc96f055f99f867f779500980 /accounts/abi/bind/auth.go
parent86cfc22c79594bd0d9625650dcbfb60c3e6ba9fe (diff)
downloadgo-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar.gz
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar.bz2
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar.lz
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar.xz
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.tar.zst
go-tangerine-73308dbe0e08db015a7c461b5be1755dc3fcc737.zip
accounts/abi/bind, cmd/abigen: port to templates, bind to solidity
Diffstat (limited to 'accounts/abi/bind/auth.go')
-rw-r--r--accounts/abi/bind/auth.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/accounts/abi/bind/auth.go b/accounts/abi/bind/auth.go
index e0491497c..624f995b0 100644
--- a/accounts/abi/bind/auth.go
+++ b/accounts/abi/bind/auth.go
@@ -18,6 +18,8 @@ package bind
import (
"errors"
+ "io"
+ "io/ioutil"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
@@ -25,9 +27,13 @@ import (
)
// NewTransactor is a utility method to easily create a transaction signer from
-// an encrypted json key file and the associated passphrase.
-func NewTransactor(keyjson string, passphrase string) (*TransactOpts, error) {
- key, err := crypto.DecryptKey([]byte(keyjson), passphrase)
+// an encrypted json key stream and the associated passphrase.
+func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) {
+ json, err := ioutil.ReadAll(keyin)
+ if err != nil {
+ return nil, err
+ }
+ key, err := crypto.DecryptKey(json, passphrase)
if err != nil {
return nil, err
}
@@ -38,7 +44,7 @@ func NewTransactor(keyjson string, passphrase string) (*TransactOpts, error) {
// from a plain go-ethereum crypto key.
func NewKeyedTransactor(key *crypto.Key) *TransactOpts {
return &TransactOpts{
- Account: key.Address,
+ From: key.Address,
Signer: func(address common.Address, tx *types.Transaction) (*types.Transaction, error) {
if address != key.Address {
return nil, errors.New("not authorized to sign this account")