Skip to content

Commit

Permalink
reorg 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex6323 committed Mar 12, 2024
1 parent 0b75056 commit 72baff9
Show file tree
Hide file tree
Showing 30 changed files with 375 additions and 445 deletions.
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/node/routes-response';

import { plainToInstance } from 'class-transformer';
import { ManaRewardsResponse } from '../types/models/api/rewards';
import {
RoutesResponse,
TransactionMetadataResponse,
UtxoChangesFullResponse,
UtxoChangesResponse,
ValidatorResponse,
ValidatorsResponse,
} from '../types/models/api/validators';
} 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/node/info-response';
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/node/info-response';
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { SlotIndex } from '../../../block/slot';
import { u64 } from '../../../utils';
import { SlotIndex } from '../../block/slot';
import { u64 } from '../../utils';

/**
* Provides the cost and readiness to issue estimates.
Expand Down
4 changes: 0 additions & 4 deletions bindings/nodejs/lib/types/models/api/accounts/index.ts

This file was deleted.

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

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

/**
* Information that is used to attach a block in the network.
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;
}
33 changes: 0 additions & 33 deletions bindings/nodejs/lib/types/models/api/blocks/block-response.ts

This file was deleted.

5 changes: 0 additions & 5 deletions bindings/nodejs/lib/types/models/api/blocks/index.ts

This file was deleted.

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
4 changes: 0 additions & 4 deletions bindings/nodejs/lib/types/models/api/commitments/index.ts

This file was deleted.

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

import { Bech32Address, EpochIndex } from '../../../block';
import { NumericString } from '../../../utils';
import { Bech32Address, EpochIndex } from '../../block';
import { NumericString } from '../../utils';

/**
* Returns information of a validator (committee member).
Expand Down
4 changes: 0 additions & 4 deletions bindings/nodejs/lib/types/models/api/committee/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion bindings/nodejs/lib/types/models/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export * from './node';
export * from './plugins';
export * from './rewards';
export * from './utxo';
export * from './response';
export * from './validators';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import type { StorageScoreParameters } from '../../storage-score';
import { SlotIndex, EpochIndex } from '../../../block/slot';
import { NumericString } from '../../../utils';
import type { StorageScoreParameters } from '../storage-score';
import { SlotIndex, EpochIndex } from '../../block/slot';
import { NumericString } from '../../utils';

/**
* Response from the /info endpoint.
Expand Down Expand Up @@ -402,3 +402,31 @@ export interface InfoResponse {
*/
baseToken: BaseTokenResponse;
}

/**
* Metrics information about the network.
*/
export interface NetworkMetricsResponse {
/**
* The current rate of new blocks per second.
*/
blocksPerSecond: string;
/**
* The current rate of confirmed blocks per second.
*/
confirmedBlocksPerSecond: string;
/**
* The ratio of confirmed blocks to new blocks of the last confirmed slot.
*/
confirmationRate: string;
}

/**
* Response from the /routes endpoint.
*/
export interface RoutesResponse {
/**
* The routes the node exposes.
*/
routes: string[];
}
6 changes: 0 additions & 6 deletions bindings/nodejs/lib/types/models/api/node/index.ts

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions bindings/nodejs/lib/types/models/api/node/routes-response.ts

This file was deleted.

37 changes: 19 additions & 18 deletions bindings/nodejs/lib/types/models/api/response.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
// Copyright 2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

/**
* Base response data.
*/
export interface Response {
/**
* Optional error in the response.
*/
error?: {
/**
* The code for the error response.
*/
code: string;
/**
* A more descriptive version of the error.
*/
message: string;
};
}
// TODO: can this be removed? Nothing seems to require it :thinking:
// /**
// * Base response data.
// */
// export interface Response {
// /**
// * Optional error in the response.
// */
// error?: {
// /**
// * The code for the error response.
// */
// code: string;
// /**
// * A more descriptive version of the error.
// */
// message: string;
// };
// }
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { EpochIndex } from '../../../block/slot';
import { u64 } from '../../../utils';
import { EpochIndex } from '../../block/slot';
import { u64 } from '../../utils';

/**
* The mana rewards of an account or delegation output.
Expand Down
4 changes: 0 additions & 4 deletions bindings/nodejs/lib/types/models/api/rewards/index.ts

This file was deleted.

Loading

0 comments on commit 72baff9

Please sign in to comment.