Skip to content

Commit

Permalink
Fix StateMetadataOutput's constructor not setting the `stateMetadat…
Browse files Browse the repository at this point in the history
…a` field (#1535)

* Fix `StateMetadataOutput`'s constructor not setting the `stateMetadata` field

* Fmt
  • Loading branch information
thibault-martinez committed Oct 30, 2023
1 parent f923f3f commit e0d6841
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bindings/nodejs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -251,15 +257,17 @@ 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[],
amount: bigint,
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;
Expand Down

0 comments on commit e0d6841

Please sign in to comment.