Skip to content

Commit

Permalink
Nodes: fix getNetworkId() and types (#1230)
Browse files Browse the repository at this point in the history
* Fix getNetworkId()

* Bump version + wasm changelog

* More fixes

* Update bindings/nodejs/CHANGELOG.md

Co-authored-by: Thibault Martinez <[email protected]>

* Update bindings/nodejs/CHANGELOG.md

Co-authored-by: Thibault Martinez <[email protected]>

---------

Co-authored-by: Thibault Martinez <[email protected]>
  • Loading branch information
Thoralf-M and thibault-martinez authored Sep 14, 2023
1 parent d772a9e commit 17d698d
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion bindings/core/src/method_handler/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ pub(crate) async fn call_client_method_internal(client: &Client, method: ClientM
}
ClientMethod::GetNode => Response::Node(client.get_node().await?),
ClientMethod::GetNetworkInfo => Response::NetworkInfo(client.get_network_info().await?),
ClientMethod::GetNetworkId => Response::NetworkId(client.get_network_id().await?),
ClientMethod::GetNetworkId => Response::NetworkId(client.get_network_id().await?.to_string()),
ClientMethod::GetBech32Hrp => Response::Bech32Hrp(client.get_bech32_hrp().await?),
ClientMethod::GetMinPowScore => Response::MinPowScore(client.get_min_pow_score().await?),
ClientMethod::GetTipsInterval => Response::TipsInterval(client.get_tips_interval().await),
Expand Down
2 changes: 1 addition & 1 deletion bindings/core/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub enum Response {
NetworkInfo(NetworkInfo),
/// Response for:
/// - [`GetNetworkId`](crate::method::ClientMethod::GetNetworkId)
NetworkId(u64),
NetworkId(String),
/// Response for:
/// - [`GetBech32Hrp`](crate::method::ClientMethod::GetBech32Hrp)
Bech32Hrp(Hrp),
Expand Down
8 changes: 8 additions & 0 deletions bindings/nodejs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security -->

## 1.0.11 - 2023-09-14

### Fixed

- `Client::getNetworkId()` return type;
- `RegularTransactionEssence::networkId` type;
- `FilterOptions::outputTypes` type;

## 1.0.10 - 2023-09-12

### Changed
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class Client {
/**
* Get the ID of the network the node is connected to.
*/
async getNetworkId(): Promise<number> {
async getNetworkId(): Promise<string> {
const response = await this.methodHandler.callMethod({
name: 'getNetworkId',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class TransactionEssence {
*/
class RegularTransactionEssence extends TransactionEssence {
/// The unique value denoting whether the block was meant for mainnet, testnet, or a private network.
networkId: number;
networkId: string;
inputsCommitment: HexEncodedString;

@Type(() => Input, {
Expand All @@ -71,7 +71,7 @@ class RegularTransactionEssence extends TransactionEssence {
*
*/
constructor(
networkId: number,
networkId: string,
inputsCommitment: HexEncodedString,
inputs: Input[],
outputs: Output[],
Expand Down
2 changes: 1 addition & 1 deletion bindings/nodejs/lib/types/wallet/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export interface FilterOptions {
/** Filter all outputs where the booked milestone index is above the specified timestamp */
upperBoundBookedTimestamp?: number;
/** Filter all outputs for the provided types (Basic = 3, Alias = 4, Foundry = 5, NFT = 6) */
outputTypes?: Uint8Array;
outputTypes?: number[];
/** Return all alias outputs matching these IDs. */
aliasIds?: AliasId[];
/** Return all foundry outputs matching these IDs. */
Expand Down
18 changes: 10 additions & 8 deletions bindings/nodejs/lib/types/wallet/transaction-options.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright 2021-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { AliasId } from '../block';
import { TaggedDataPayload } from '../block/payload/tagged';
import { Burn } from '../client';
import { HexEncodedString } from '../utils';
import { AccountAddress } from './address';

/** Options for creating a transaction. */
Expand Down Expand Up @@ -63,13 +65,13 @@ export type CustomAddress = {
/** Options for creating Native Tokens. */
export interface CreateNativeTokenParams {
/** The Alias ID of the corresponding Foundry. */
aliasId?: string;
aliasId?: AliasId;
/** Hex encoded number */
circulatingSupply: bigint;
/** Hex encoded number */
maximumSupply: bigint;
/** Hex encoded bytes */
foundryMetadata?: string;
foundryMetadata?: HexEncodedString;
}

/** Options for minting NFTs. */
Expand All @@ -81,13 +83,13 @@ export interface MintNftParams {
/** Bech32 encoded sender address **/
sender?: string;
/** Hex encoded bytes */
metadata?: string;
metadata?: HexEncodedString;
/** Hex encoded bytes */
tag?: string;
tag?: HexEncodedString;
/** Bech32 encoded issuer address **/
issuer?: string;
/** Hex encoded bytes */
immutableMetadata?: string;
immutableMetadata?: HexEncodedString;
}

/** Options for the alias output creation */
Expand All @@ -97,9 +99,9 @@ export interface AliasOutputParams {
*/
address?: string;
/** Hex encoded bytes */
immutableMetadata?: string;
immutableMetadata?: HexEncodedString;
/** Hex encoded bytes */
metadata?: string;
metadata?: HexEncodedString;
/** Hex encoded bytes */
stateMetadata?: string;
stateMetadata?: HexEncodedString;
}
2 changes: 1 addition & 1 deletion bindings/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iota/sdk",
"version": "1.0.10",
"version": "1.0.11",
"description": "Node.js binding to the IOTA SDK library",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security -->

## 1.0.6 - 2023-MM-DD
## 1.0.6 - 2023-09-14

Same changes as https://github.com/iotaledger/iota-sdk/blob/develop/bindings/nodejs/CHANGELOG.md.

Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iota/sdk-wasm",
"version": "1.0.5",
"version": "1.0.6",
"description": "WebAssembly bindings for the IOTA SDK library",
"repository": {
"type": "git",
Expand Down

0 comments on commit 17d698d

Please sign in to comment.