aboutsummaryrefslogtreecommitdiffstats
path: root/mobile/ethclient.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-10-01 17:03:28 +0800
committerGitHub <noreply@github.com>2017-10-01 17:03:28 +0800
commitd78ad226c26c84635c60fad233de9e6e438a5599 (patch)
treec78572046e8d95dfa50a48b0d980e2ee1727f18b /mobile/ethclient.go
parenta660685746db17a41cd67b05c614cdb29e49340c (diff)
downloaddexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar.gz
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar.bz2
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar.lz
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar.xz
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.tar.zst
dexon-d78ad226c26c84635c60fad233de9e6e438a5599.zip
ethclient, mobile: add TransactionSender (#15127)
* core/types: make Signer derive address instead of public key There are two reasons to do this now: The upcoming ethclient signer doesn't know the public key, just the address. EIP 208 will introduce a new signer which derives the 'entry point' address for transactions with zero signature. The entry point has no public key. Other changes to the interface ease the path make to moving signature crypto out of core/types later. * ethclient, mobile: add TransactionSender The new method can get the right signer without any crypto, and without knowledge of the signature scheme that was used when the transaction was included.
Diffstat (limited to 'mobile/ethclient.go')
-rw-r--r--mobile/ethclient.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/mobile/ethclient.go b/mobile/ethclient.go
index 4e8328501..7f31a8998 100644
--- a/mobile/ethclient.go
+++ b/mobile/ethclient.go
@@ -77,6 +77,13 @@ func (ec *EthereumClient) GetTransactionByHash(ctx *Context, hash *Hash) (tx *Tr
return &Transaction{rawTx}, err
}
+// GetTransactionSender returns the sender address of a transaction. The transaction must
+// be included in blockchain at the given block and index.
+func (ec *EthereumClient) GetTransactionSender(ctx *Context, tx *Transaction, blockhash *Hash, index int) (sender *Address, _ error) {
+ addr, err := ec.client.TransactionSender(ctx.context, tx.tx, blockhash.hash, uint(index))
+ return &Address{addr}, err
+}
+
// GetTransactionCount returns the total number of transactions in the given block.
func (ec *EthereumClient) GetTransactionCount(ctx *Context, hash *Hash) (count int, _ error) {
rawCount, err := ec.client.TransactionCount(ctx.context, hash.hash)