Skip to content

Commit

Permalink
Remove StateMetadataOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez committed Oct 30, 2023
1 parent 8281b00 commit 8444328
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,30 +225,10 @@ class AccountOutput extends ImmutableFeaturesOutput {
}
}

/**
* Base class for state metadata outputs.
*/
abstract class StateMetadataOutput extends ImmutableFeaturesOutput {
readonly stateMetadata?: HexEncodedString;

/**
* @param type The type of output.
* @param amount The amount of the output.
* @param unlockConditions The unlock conditions for the output.
*/
constructor(
type: OutputType,
amount: u64,
unlockConditions: UnlockCondition[],
) {
super(type, amount, unlockConditions);
}
}

/**
* An Anchor output.
*/
class AnchorOutput extends StateMetadataOutput {
class AnchorOutput extends ImmutableFeaturesOutput {
/**
* Unique identifier of the anchor, which is the BLAKE2b-256 hash of the Output ID that created it.
* Unless its a newly created anchor, then the id is zeroed.
Expand All @@ -262,25 +242,32 @@ class AnchorOutput extends StateMetadataOutput {
* The amount of (stored) Mana held by the output.
*/
readonly mana: u64;
/**
* Metadata that can only be changed by the state controller.
*/
readonly stateMetadata?: HexEncodedString;

/**
* @param amount The amount of the output.
* @param mana The amount of stored mana.
* @param anchorId The anchor ID as hex-encoded string.
* @param stateIndex A counter that must increase by 1 every time the anchor output is state transitioned.
* @param unlockConditions The unlock conditions of the output.
* @param stateMetadata Metadata that can only be changed by the state controller.
*/
constructor(
amount: u64,
mana: u64,
anchorId: AnchorId,
stateIndex: number,
unlockConditions: UnlockCondition[],
stateMetadata?: HexEncodedString,
) {
super(OutputType.Account, amount, unlockConditions);
this.anchorId = anchorId;
this.stateIndex = stateIndex;
this.mana = mana;
this.stateMetadata = stateMetadata;
}
}

Expand Down

0 comments on commit 8444328

Please sign in to comment.