Skip to content

Commit

Permalink
Nodejs: fix NativeTokenFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M committed Mar 14, 2024
1 parent 0ac4ff4 commit 5ccdd98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions bindings/nodejs/lib/types/block/output/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { SlotIndex } from '../slot';
import { Type } from 'class-transformer';
import { Transform, Type } from 'class-transformer';
import { Address, AddressDiscriminator } from '../address';
import {
BlockIssuerKey,
Expand All @@ -11,7 +11,7 @@ import {
import { u256, u64 } from '../../utils/type-aliases';
import { EpochIndex } from '../../block/slot';
import { NativeToken } from '../../models/native-token';
import { HexEncodedString } from '../../utils/hex-encoding';
import { HexEncodedString, hexToBigInt } from '../../utils/hex-encoding';

/**
* Printable ASCII characters.
Expand Down Expand Up @@ -147,16 +147,18 @@ class NativeTokenFeature extends Feature {
/**
* Amount of native tokens of the given Token ID.
*/
@Transform((value) => hexToBigInt(value.value))
readonly amount: u256;

/**
* Creates a new `NativeTokenFeature`.
* @param nativeToken The native token stored with the feature.
* @param id The identifier of the native token.
* @param amount The native token amount.
*/
constructor(nativeToken: NativeToken) {
constructor(id: HexEncodedString, amount: u256) {
super(FeatureType.NativeToken);
this.id = nativeToken.id;
this.amount = nativeToken.amount;
this.id = id;
this.amount = amount;
}

/**
Expand Down
1 change: 1 addition & 0 deletions bindings/nodejs/lib/types/block/output/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class BasicOutput extends CommonOutput {

/**
* @param amount The amount of the output.
* @param mana The mana of the output.
* @param unlockConditions The unlock conditions for the output.
*/
constructor(amount: u64, mana: u64, unlockConditions: UnlockCondition[]) {
Expand Down

0 comments on commit 5ccdd98

Please sign in to comment.