diff --git a/bindings/nodejs/lib/types/wallet/event.ts b/bindings/nodejs/lib/types/wallet/event.ts index b1f8b489d7..d8a666d73a 100644 --- a/bindings/nodejs/lib/types/wallet/event.ts +++ b/bindings/nodejs/lib/types/wallet/event.ts @@ -1,7 +1,7 @@ // Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { OutputWithExtendedMetadata } from './output'; +import type { OutputData } from './output'; import { InclusionState } from './transaction'; import { InputSigningData, Remainder } from '../client'; import { Transaction, SignedTransactionPayload, TransactionId } from '../block'; @@ -57,7 +57,7 @@ class LedgerAddressGenerationWalletEvent extends WalletEvent { * A 'new output' wallet event. */ class NewOutputWalletEvent extends WalletEvent { - output: OutputWithExtendedMetadata; + output: OutputData; transaction?: SignedTransactionPayload; transactionInputs?: OutputWithMetadata[]; @@ -67,7 +67,7 @@ class NewOutputWalletEvent extends WalletEvent { * @param transactionInputs The inputs for the transaction that created the output. Might be pruned and not available. */ constructor( - output: OutputWithExtendedMetadata, + output: OutputData, transaction?: SignedTransactionPayload, transactionInputs?: OutputWithMetadata[], ) { @@ -82,12 +82,12 @@ class NewOutputWalletEvent extends WalletEvent { * A 'spent output' wallet event. */ class SpentOutputWalletEvent extends WalletEvent { - output: OutputWithExtendedMetadata; + output: OutputData; /** * @param output The spent output. */ - constructor(output: OutputWithExtendedMetadata) { + constructor(output: OutputData) { super(WalletEventType.SpentOutput); this.output = output; } diff --git a/bindings/nodejs/lib/types/wallet/output.ts b/bindings/nodejs/lib/types/wallet/output.ts index d907a2d5c0..7bacc000ad 100644 --- a/bindings/nodejs/lib/types/wallet/output.ts +++ b/bindings/nodejs/lib/types/wallet/output.ts @@ -15,7 +15,7 @@ export enum OutputsToClaim { } /** An output with extended metadata */ -export class OutputWithExtendedMetadata { +export class OutputData { /** The output itself */ @Type(() => Output, { discriminator: OutputDiscriminator, diff --git a/bindings/nodejs/lib/wallet/wallet.ts b/bindings/nodejs/lib/wallet/wallet.ts index 816c693aca..8f5f33e3dd 100644 --- a/bindings/nodejs/lib/wallet/wallet.ts +++ b/bindings/nodejs/lib/wallet/wallet.ts @@ -12,7 +12,7 @@ import { FilterOptions, CreateNativeTokenParams, MintNftParams, - OutputWithExtendedMetadata, + OutputData, OutputParams, OutputsToClaim, TransactionWithMetadata, @@ -303,15 +303,13 @@ export class Wallet { * * @returns The accounts of the wallet. */ - async accounts(): Promise { + async accounts(): Promise { const response = await this.methodHandler.callMethod({ name: 'accounts', }); - const parsed = JSON.parse(response) as Response< - OutputWithExtendedMetadata[] - >; - return plainToInstance(OutputWithExtendedMetadata, parsed.payload); + const parsed = JSON.parse(response) as Response; + return plainToInstance(OutputData, parsed.payload); } /** @@ -703,19 +701,17 @@ export class Wallet { /** * Get the data for an output. * @param outputId The output to get. - * @returns The `OutputWithExtendedMetadata`. + * @returns The `OutputData`. */ - async getOutput(outputId: OutputId): Promise { + async getOutput(outputId: OutputId): Promise { const response = await this.methodHandler.callMethod({ name: 'getOutput', data: { outputId, }, }); - const parsed = JSON.parse( - response, - ) as Response; - return plainToInstance(OutputWithExtendedMetadata, parsed.payload); + const parsed = JSON.parse(response) as Response; + return plainToInstance(OutputData, parsed.payload); } /** @@ -877,18 +873,14 @@ export class Wallet { * @param filterOptions Options to filter the to be returned outputs. * @returns The outputs with metadata. */ - async outputs( - filterOptions?: FilterOptions, - ): Promise { + async outputs(filterOptions?: FilterOptions): Promise { const response = await this.methodHandler.callMethod({ name: 'outputs', data: { filterOptions }, }); - const parsed = JSON.parse(response) as Response< - OutputWithExtendedMetadata[] - >; - return plainToInstance(OutputWithExtendedMetadata, parsed.payload); + const parsed = JSON.parse(response) as Response; + return plainToInstance(OutputData, parsed.payload); } /** @@ -959,15 +951,13 @@ export class Wallet { * * @returns The implicit accounts of the wallet. */ - async implicitAccounts(): Promise { + async implicitAccounts(): Promise { const response = await this.methodHandler.callMethod({ name: 'implicitAccounts', }); - const parsed = JSON.parse(response) as Response< - OutputWithExtendedMetadata[] - >; - return plainToInstance(OutputWithExtendedMetadata, parsed.payload); + const parsed = JSON.parse(response) as Response; + return plainToInstance(OutputData, parsed.payload); } /** @@ -1006,17 +996,13 @@ export class Wallet { * @param filterOptions Options to filter the to be returned outputs. * @returns The outputs with metadata. */ - async unspentOutputs( - filterOptions?: FilterOptions, - ): Promise { + async unspentOutputs(filterOptions?: FilterOptions): Promise { const response = await this.methodHandler.callMethod({ name: 'unspentOutputs', data: { filterOptions }, }); - const parsed = JSON.parse(response) as Response< - OutputWithExtendedMetadata[] - >; - return plainToInstance(OutputWithExtendedMetadata, parsed.payload); + const parsed = JSON.parse(response) as Response; + return plainToInstance(OutputData, parsed.payload); } /**