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 StateMetadataOutput's constructor not setting the stateMetadata field #1535

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
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