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

NodeJs: reorg api response type files #2169

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
37 changes: 17 additions & 20 deletions bindings/nodejs/lib/client/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright 2021-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { plainToInstance } from 'class-transformer';
import { ClientMethodHandler } from './client-method-handler';
import { Response } from '../types';
import {
ClientOptions,
Node,
Expand All @@ -18,7 +20,6 @@ import {
NftOutputQueryParameters,
OutputQueryParameters,
} from '../types/client';
import type { NodeInfoResponse } from '../types/client/nodeInfo';
import {
AccountOutput,
BasicOutput,
Expand All @@ -42,39 +43,35 @@ import {
EpochIndex,
Address,
} from '../types/block';
import type { NodeInfoResponse } from '../types/client/nodeInfo';
import {
BlockMetadataResponse,
InfoResponse,
UTXOInput,
Response,
OutputId,
ProtocolParameters,
u64,
TransactionId,
Bech32Address,
BlockWithMetadataResponse,
TransactionMetadataResponse,
} from '../types';
import {
OutputResponse,
OutputsResponse,
CongestionResponse,
UtxoChangesResponse,
UtxoChangesFullResponse,
CommitteeResponse,
BlockMetadataResponse,
BlockWithMetadataResponse,
InfoResponse,
IssuanceBlockHeaderResponse,
CommitteeResponse,
CongestionResponse,
ManaRewardsResponse,
NetworkMetricsResponse,
OutputMetadataResponse,
OutputResponse,
OutputsResponse,
OutputWithMetadataResponse,
NetworkMetricsResponse,
} from '../types/models/api';
import { RoutesResponse } from '../types/models/api/routes-response';

import { plainToInstance } from 'class-transformer';
import { ManaRewardsResponse } from '../types/models/api/mana-rewards-response';
import {
RoutesResponse,
TransactionMetadataResponse,
UtxoChangesFullResponse,
UtxoChangesResponse,
ValidatorResponse,
ValidatorsResponse,
} from '../types/models/api/validators-response';
} from '../types/models/api';

/** The Client to interact with nodes. */
export class Client {
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/types/client/client-options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021-2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { ProtocolParameters } from '../models/api/info/node-info-protocol';
import { ProtocolParameters } from '../models/api';
import type { MqttBrokerOptions, Node } from './network';

/** Options for the client builder */
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/types/client/nodeInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2021-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { InfoResponse } from '../models/api/info';
import { InfoResponse } from '../models/api';

/** NodeInfo wrapper which contains the node info and the url from the node (useful when multiple nodes are used) */
export interface NodeInfoResponse {
Expand Down
33 changes: 0 additions & 33 deletions bindings/nodejs/lib/types/models/api/block-response.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { BlockId, SlotCommitment, SlotIndex } from '../../block';
import { BlockState } from '../state';
import { Block, BlockId, SlotCommitment, SlotIndex } from '../../block';
import { NumericString } from '../../utils';

/**
Expand Down Expand Up @@ -34,3 +35,31 @@ export interface IssuanceBlockHeaderResponse {
*/
shallowLikeParents?: BlockId[];
}

/**
* Response from the metadata endpoint.
*/
export interface BlockMetadataResponse {
/**
* The block id.
*/
blockId: BlockId;
/**
* The block state.
*/
blockState: BlockState;
}

/**
* Response from the full endpoint.
*/
export interface BlockWithMetadataResponse {
/**
* The block.
*/
block: Block;
/**
* The block metadata.
*/
metadata: BlockMetadataResponse;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { OutputId } from '../../block/output';
import { SlotCommitmentId } from '../../block';
import { Output, OutputDiscriminator } from '../../block/output';
import { Type } from 'class-transformer';
import { SlotCommitmentId } from '../../block';
import { Output, OutputId, OutputDiscriminator } from '../../block/output';

/**
* All UTXO changes that happened at a specific slot.
Expand Down
26 changes: 9 additions & 17 deletions bindings/nodejs/lib/types/models/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
// Copyright 2023 IOTA Stiftung
// Copyright 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

export * from './info';
export * from './accounts';
export * from './blocks';
export * from './commitments';
export * from './committee';
export * from './node';
export * from './plugins';
export * from './block-response';
export * from './committee-response';
export * from './congestion-response';
export * from './issuance-response';
export * from './mana-rewards-response';
export * from './network-metrics';
export * from './output-id-proof';
export * from './output-metadata-response';
export * from './output-response';
export * from './response';
export * from './routes-response';
export * from './transaction-failure-reason';
export * from './transaction-response';
export * from './utxo-changes-response';
export * from './validators-response';
export * from './rewards';
export * from './utxo';
export * from './validators';
7 changes: 0 additions & 7 deletions bindings/nodejs/lib/types/models/api/info/index.ts

This file was deleted.

32 changes: 0 additions & 32 deletions bindings/nodejs/lib/types/models/api/info/node-info-base-token.ts

This file was deleted.

50 changes: 0 additions & 50 deletions bindings/nodejs/lib/types/models/api/info/node-info-status.ts

This file was deleted.

31 changes: 0 additions & 31 deletions bindings/nodejs/lib/types/models/api/info/node-info.ts

This file was deleted.

20 changes: 0 additions & 20 deletions bindings/nodejs/lib/types/models/api/network-metrics.ts

This file was deleted.

Loading
Loading