From f4afdc6609212e9179be01ac7ce8f2d78f087bdf Mon Sep 17 00:00:00 2001 From: cryptoannavan <42225124+cryptoannavan@users.noreply.github.com> Date: Wed, 8 Aug 2018 18:17:42 -0700 Subject: [PATCH] [method] Add method for sender --- quarkchain-ethereum-tx.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/quarkchain-ethereum-tx.js b/quarkchain-ethereum-tx.js index 6adc9d0..1eb449e 100644 --- a/quarkchain-ethereum-tx.js +++ b/quarkchain-ethereum-tx.js @@ -307,6 +307,15 @@ class Transaction { .imul(new BN(this.gasPrice)) .iadd(new BN(this.value)); } + + getSenderAddress() { + if (this._from) { + return this._from; + } + const pubkey = this.getSenderPublicKey(); + this._from = ethUtil.publicToAddress(pubkey); + return this._from; + } /** * validates the signature and checks to see if it has enough gas