From e0d6841dc79c2d3c88b3db94fb37b7ca97c9d922 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 30 Oct 2023 12:26:16 +0100 Subject: [PATCH] Fix `StateMetadataOutput`'s constructor not setting the `stateMetadata` field (#1535) * Fix `StateMetadataOutput`'s constructor not setting the `stateMetadata` field * Fmt --- bindings/nodejs/CHANGELOG.md | 6 ++++++ bindings/nodejs/lib/types/block/output/output.ts | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bindings/nodejs/CHANGELOG.md b/bindings/nodejs/CHANGELOG.md index 11938f9b15..20f8b39bf0 100644 --- a/bindings/nodejs/CHANGELOG.md +++ b/bindings/nodejs/CHANGELOG.md @@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security --> +## 1.1.4 - 2023-MM-DD + +### Fixed + +- `StateMetadataOutput`'s constructor not setting the `stateMetadata` field; + ## 1.1.3 - 2023-10-27 ### Fixed diff --git a/bindings/nodejs/lib/types/block/output/output.ts b/bindings/nodejs/lib/types/block/output/output.ts index 15d9e1c26b..dfc6f6d214 100644 --- a/bindings/nodejs/lib/types/block/output/output.ts +++ b/bindings/nodejs/lib/types/block/output/output.ts @@ -205,19 +205,25 @@ abstract class ImmutableFeaturesOutput extends CommonOutput { * Base class for state metadata outputs. */ abstract class StateMetadataOutput extends ImmutableFeaturesOutput /*implements IBasicOutput*/ { + /** + * Metadata that can only be changed by the state controller. + */ readonly stateMetadata?: HexEncodedString; /** * @param type The type of output. * @param amount The amount of the output. * @param unlockConditions The unlock conditions for the output. + * @param stateMetadata Metadata that can only be changed by the state controller. */ constructor( type: OutputType, amount: bigint, unlockConditions: UnlockCondition[], + stateMetadata?: HexEncodedString, ) { super(type, amount, unlockConditions); + this.stateMetadata = stateMetadata; } /** * Metadata that can only be changed by the state controller. @@ -251,6 +257,7 @@ class AliasOutput extends StateMetadataOutput /*implements IAliasOutput*/ { * @param aliasId The Alias ID as hex-encoded string. * @param stateIndex A counter that must increase by 1 every time the alias is state transitioned. * @param foundryCounter A counter that denotes the number of foundries created by this alias account. + * @param stateMetadata Metadata that can only be changed by the state controller. */ constructor( unlockConditions: UnlockCondition[], @@ -258,8 +265,9 @@ class AliasOutput extends StateMetadataOutput /*implements IAliasOutput*/ { aliasId: HexEncodedString, stateIndex: number, foundryCounter: number, + stateMetadata?: HexEncodedString, ) { - super(OutputType.Alias, amount, unlockConditions); + super(OutputType.Alias, amount, unlockConditions, stateMetadata); this.aliasId = aliasId; this.stateIndex = stateIndex; this.foundryCounter = foundryCounter;