-
Notifications
You must be signed in to change notification settings - Fork 84
fix: make serializeForEntryFunction backward-compatible with older Serializers (DVR-143) #861
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
base: main
Are you sure you want to change the base?
Changes from all commits
16f0dd1
e4606fa
b8edbdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { bytesToHex, hexToBytes } from "@noble/hashes/utils"; | ||
| import { Serializable, Serializer } from "../bcs/serializer"; | ||
| import { Serializable, Serializer, serializeEntryFunctionBytesCompat } from "../bcs/serializer"; | ||
| import { Deserializer } from "../bcs/deserializer"; | ||
| import { ParsingError, ParsingResult } from "./common"; | ||
| import { TransactionArgument } from "../transactions/instances/transactionArgument"; | ||
|
|
@@ -240,14 +240,14 @@ export class AccountAddress extends Serializable implements TransactionArgument | |
| /** | ||
| * Serializes the current instance into a byte sequence suitable for entry functions. | ||
| * This allows for the proper encoding of data when interacting with entry functions in the blockchain. | ||
| * Uses the optimized serializeAsBytes method to reduce allocations. | ||
| * Uses serializeAsBytes when available, with a fallback for older Serializer versions. | ||
| * | ||
| * @param serializer - The serializer instance used to convert the data into bytes. | ||
| * @group Implementation | ||
| * @category Serialization | ||
| */ | ||
| serializeForEntryFunction(serializer: Serializer): void { | ||
| serializer.serializeAsBytes(this); | ||
| serializeEntryFunctionBytesCompat(serializer, this); | ||
|
Comment on lines
248
to
+250
|
||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSDoc here states this path “Uses the optimized serializeAsBytes method”, but the implementation now calls
serializeEntryFunctionBytesCompat()which may useserializeAsBytesor a compatibility fallback depending on the Serializer instance. Please adjust the comment to describe the compatibility behavior so it stays accurate.