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: en_1 recommendations #1746

Merged
merged 1 commit into from
Jan 24, 2025
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
15 changes: 9 additions & 6 deletions packages/core/src/transaction/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,10 @@ class Transaction {
*/
public get isSigned(): boolean {
if (this.signature !== undefined) {
return Transaction.isSignatureValid(this.body, this.signature);
return Transaction.isSignatureLengthValid(
this.body,
this.signature
);
}
return false;
}
Expand Down Expand Up @@ -856,13 +859,13 @@ class Transaction {
}

/**
* Return Returns true if the signature is valid, otherwise false.
* Validates the length of a given signature against the expected length.
*
* @param {TransactionBody} body - The transaction body to be checked.
* @param {Uint8Array} signature - The signature to validate.
* @return {boolean} - Returns true if the signature is valid, otherwise false.
* @param {TransactionBody} body - The body of the transaction being validated.
* @param {Uint8Array} signature - The signature to verify the length of.
* @return {boolean} Returns true if the signature length matches the expected length, otherwise false.
*/
private static isSignatureValid(
private static isSignatureLengthValid(
body: TransactionBody,
signature: Uint8Array
): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/vcdm/hash/Keccak256.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HexUInt } from '../HexUInt';
*/
class Keccak256 extends HexUInt {
/**
* Generates the [SHA-3](https://en.wikipedia.org/wiki/SHA-3) [KECCAK 256](https://keccak.team/keccak.html) hash of the given input.
* Generates the [KECCAK 256](https://eth-hash.readthedocs.io/en/stable/) hash of the given input.
*
* @param {bigint | number | string | Uint8Array | Hex} exp - The input value to hash.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,14 @@ class VeChainPrivateKeySigner extends VeChainAbstractSigner {
}

/**
* Sends %%transactionToSend%% to the Network. The ``signer.populateTransaction(transactionToSend)``
* is called first to ensure all necessary properties for the
* transaction to be valid have been populated first.
* Sends a transaction to the blockchain.
*
* @param transactionToSend - The transaction to send
* @returns The transaction response
* @throws {JSONRPCInvalidParams}
* @param {TransactionRequestInput} transactionToSend - The transaction object to be sent.
* This includes all the necessary details such as `to`, `value`, `data`, `gasLimit`, etc.
* @return {Promise<string>} A promise that resolves to the transaction hash as a string
* once the transaction is successfully sent.
* @throws {JSONRPCInvalidParams} Throws an error if the provider is not attached
* to the signer, indicating the signer's inability to send the transaction.
*/
async sendTransaction(
transactionToSend: TransactionRequestInput
Expand Down
Loading