File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
modules/sdk-coin-tempo/src/lib Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,24 @@ export class Tip20Transaction extends BaseTransaction {
211211 return this . _signature ;
212212 }
213213
214+ /**
215+ * Recover the signer address from the transaction signature.
216+ * @returns Checksummed sender address, or undefined if unsigned
217+ */
218+ getSenderAddress ( ) : string | undefined {
219+ if ( ! this . _signature ) {
220+ return undefined ;
221+ }
222+
223+ const unsignedHex = this . serializeTransaction ( ) ;
224+ const msgHash = ethers . utils . keccak256 ( ethers . utils . arrayify ( unsignedHex ) ) ;
225+ return ethers . utils . recoverAddress ( msgHash , {
226+ r : this . _signature . r ,
227+ s : this . _signature . s ,
228+ recoveryParam : this . _signature . yParity ,
229+ } ) ;
230+ }
231+
214232 toJson ( ) : TxData {
215233 return {
216234 type : this . txRequest . type ,
You can’t perform that action at this time.
0 commit comments