Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 1874 Transaction.getTransactionHash(sender) rename #1876

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/diagrams/architecture/transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ classDiagram
+Address origin
+Uint8Array signature?
+Transaction decode(Uint8Array rawTransaction, boolean isSigned)$
+Blake2b256 getTransactionHash(Address gasPayer?)
+Blake2b256 getTransactionHash(Address sender?)
+VTHO intrinsicGas(TransactionClause[] clauses)$
+boolean isValidBody(TransactionBody body)$
+Transaction of(TransactionBody: body, Uint8Array signature?)$
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/transaction/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,20 +380,20 @@ class Transaction {
/**
* Computes the transaction hash, optionally incorporating a gas payer's address.
*
* @param {Address} [gasPayer] - Optional gas payer's address to include in the hash computation.
* @param {Address} [sender] - Optional transaction origin's address to include in the hash computation.
* @return {Blake2b256} - The computed transaction hash.
*
* @remarks
* `gasPayer` is used to sign a transaction on behalf of another account.
* `sender` is used to sign a transaction on behalf of another account.
*
* @remarks Security auditable method, depends on
* - {@link Blake2b256.of}.
*/
public getTransactionHash(gasPayer?: Address): Blake2b256 {
public getTransactionHash(sender?: Address): Blake2b256 {
const txHash = Blake2b256.of(this.encode(false));
if (gasPayer !== undefined) {
if (sender !== undefined) {
return Blake2b256.of(
nc_utils.concatBytes(txHash.bytes, gasPayer.bytes)
nc_utils.concatBytes(txHash.bytes, sender.bytes)
);
}
return txHash;
Expand Down
Loading