Skip to content

feat: update module resolution to node16 #3027

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions packages/cryptography/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "1.6.0-beta.1",
"description": "Cryptographic utilities and primitives for the Hiero SDK",
"main": "./lib/index.cjs",
"types": "./lib/index.d.ts",
"module": "./src/index.js",
"react-native": {
"./lib/index.cjs": "./src/index.native.js",
Expand All @@ -29,7 +28,8 @@
"./package.json": "./package.json",
".": {
"import": "./src/index.js",
"require": "./lib/index.cjs"
"require": "./lib/index.cjs",
"types": "./lib/index.d.ts"
}
},
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/cryptography/src/BadKeyError.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export default class BadKeyError extends Error {
);

this.name = "BadKeyError";

this.stack = "";
if (messageOrCause instanceof Error) {
/** @type {Error=} */
this.cause = messageOrCause;
this.stack = messageOrCause.stack;
this.stack = messageOrCause.stack || this.stack || "";
}
}
}
4 changes: 4 additions & 0 deletions src/BadEntityIdError.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// SPDX-License-Identifier: Apache-2.0

/**
* @typedef {import("long").default} Long
*/

export default class BadEntityIdError extends Error {
/**
* @param {Long} shard
Expand Down
2 changes: 1 addition & 1 deletion src/EthereumFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import * as hex from "./encoding/hex.js";
* @typedef {import("./Timestamp.js").default} Timestamp
* @typedef {import("./transaction/TransactionId.js").default} TransactionId
* @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/EthereumTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Transaction, {
* @typedef {import("./client/Client.js").default<*, *>} Client
* @typedef {import("./Timestamp.js").default} Timestamp
* @typedef {import("./transaction/TransactionId.js").default} TransactionId
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
8 changes: 2 additions & 6 deletions src/Hbar.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
// SPDX-License-Identifier: Apache-2.0

import BigNumber from "bignumber.js";
import { BigNumber } from "bignumber.js";
import { valueToLong } from "./long.js";
import HbarUnit from "./HbarUnit.js";

import Long from "long";

/**
* @typedef {import("./long.js").LongObject} LongObject
*/

/**
* Represents a quantity of hbar (ℏ), the native currency of the Hedera network.
* Provides utilities for handling different hbar denominations and conversions.
*/
export default class Hbar {
/**
* @param {number | string | Long | LongObject | BigNumber} amount
* @param {number | string | Long | BigNumber} amount
* @param {HbarUnit=} unit
*/
constructor(amount, unit = HbarUnit.Hbar) {
Expand Down
2 changes: 1 addition & 1 deletion src/HbarUnit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

import BigNumber from "bignumber.js";
import { BigNumber } from "bignumber.js";

/**
* Represents a unit of HBAR currency measurement in the Hedera network.
Expand Down
2 changes: 1 addition & 1 deletion src/RecordStatusError.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import StatusError from "./StatusError.js";
/**
* @typedef {import("./Status.js").default} Status
* @typedef {import("./transaction/TransactionId.js").default} TransactionId
* @typedef {import("./transaction/TransactionRecord").default} TransactionRecord
* @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord
*/

export default class RecordStatusError extends StatusError {
Expand Down
2 changes: 1 addition & 1 deletion src/StakingInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Timestamp from "./Timestamp.js";
import * as HieroProto from "@hashgraph/proto";

/**
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Hbar from "./Hbar.js";

/**
* @typedef {import("bignumber.js").default} BigNumber
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
7 changes: 3 additions & 4 deletions src/account/AccountAllowanceAdjustTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import * as util from "../util.js";
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("bignumber.js").default} BigNumber
* @typedef {import("../long.js").LongObject} LongObject
*/

/**
Expand Down Expand Up @@ -77,7 +76,7 @@ export default class AccountAllowanceAdjustTransaction extends Transaction {
/**
* @deprecated
* @param {AccountId | string} spenderAccountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {AccountAllowanceAdjustTransaction}
*/
addHbarAllowance(spenderAccountId, amount) {
Expand Down Expand Up @@ -131,7 +130,7 @@ export default class AccountAllowanceAdjustTransaction extends Transaction {
* @deprecated
* @param {AccountId | string} ownerAccountId
* @param {AccountId | string} spenderAccountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {AccountAllowanceAdjustTransaction}
*/
grantHbarAllowance(ownerAccountId, spenderAccountId, amount) {
Expand All @@ -147,7 +146,7 @@ export default class AccountAllowanceAdjustTransaction extends Transaction {
* @deprecated
* @param {AccountId | string} ownerAccountId
* @param {AccountId | string} spenderAccountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {AccountAllowanceAdjustTransaction}
*/
revokeHbarAllowance(ownerAccountId, spenderAccountId, amount) {
Expand Down
5 changes: 2 additions & 3 deletions src/account/AccountAllowanceApproveTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import TokenNftAllowance from "./TokenNftAllowance.js";
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("bignumber.js").default} BigNumber
* @typedef {import("../long.js").LongObject} LongObject
*/

/**
Expand Down Expand Up @@ -123,7 +122,7 @@ export default class AccountAllowanceApproveTransaction extends Transaction {
/**
* @param {AccountId | string} ownerAccountId
* @param {AccountId | ContractId | string} spenderAccountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {AccountAllowanceApproveTransaction}
*/
approveHbarAllowance(ownerAccountId, spenderAccountId, amount) {
Expand Down Expand Up @@ -161,7 +160,7 @@ export default class AccountAllowanceApproveTransaction extends Transaction {
/**
* @deprecated - Use `approveHbarAllowance()` instead
* @param {AccountId | string} spenderAccountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {AccountAllowanceApproveTransaction}
*/
addHbarAllowance(spenderAccountId, amount) {
Expand Down
1 change: 0 additions & 1 deletion src/account/AccountAllowanceDeleteTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import TokenNftAllowance from "./TokenNftAllowance.js";
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("bignumber.js").default} BigNumber
* @typedef {import("../long.js").LongObject} LongObject
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/account/AccountId.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { isLongZeroAddress } from "../util.js";
*/
export default class AccountId {
/**
* @param {number | Long | import("../EntityIdHelper").IEntityId} props
* @param {number | Long | import("../EntityIdHelper.js").IEntityId} props
* @param {(number | Long)=} realm
* @param {(number | Long)=} num
* @param {(PublicKey)=} aliasKey
Expand Down
2 changes: 1 addition & 1 deletion src/account/HbarAllowance.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Hbar from "../Hbar.js";
*/

/**
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
1 change: 0 additions & 1 deletion src/account/HbarTransferMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import ObjectMap from "../ObjectMap.js";
*/

/**
* @typedef {import("../long.js").LongObject} LongObject
* @typedef {import("bignumber.js").default} BigNumber
*/

Expand Down
1 change: 1 addition & 0 deletions src/account/LiveHashAddTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import KeyList from "../KeyList.js";
* @typedef {import("../channel/Channel.js").default} Channel
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/account/TokenBalanceMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ObjectMap from "../ObjectMap.js";
*/

/**
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/account/TokenRelationshipMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ObjectMap from "../ObjectMap.js";
*/

/**
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
4 changes: 4 additions & 0 deletions src/account/TokenTransferAccountMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import AccountId from "../account/AccountId.js";
import ObjectMap from "../ObjectMap.js";

/**
* @typedef {import("long").default} Long
*/

/**
* @augments {ObjectMap<AccountId, Long>}
*/
Expand Down
7 changes: 3 additions & 4 deletions src/account/TransferTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import NftId from "../token/NftId.js";
import AbstractTokenTransferTransaction from "../token/AbstractTokenTransferTransaction.js";

/**
* @typedef {import("../long.js").LongObject} LongObject
* @typedef {import("bignumber.js").default} BigNumber
*/

Expand Down Expand Up @@ -167,7 +166,7 @@ export default class TransferTransaction extends AbstractTokenTransferTransactio
/**
* @internal
* @param {AccountId | string} accountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @param {boolean} isApproved
* @returns {TransferTransaction}
*/
Expand Down Expand Up @@ -203,7 +202,7 @@ export default class TransferTransaction extends AbstractTokenTransferTransactio
/**
* @internal
* @param {AccountId | string} accountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {TransferTransaction}
*/
addHbarTransfer(accountId, amount) {
Expand All @@ -213,7 +212,7 @@ export default class TransferTransaction extends AbstractTokenTransferTransactio
/**
* @internal
* @param {AccountId | string} accountId
* @param {number | string | Long | LongObject | BigNumber | Hbar} amount
* @param {number | string | Long | BigNumber | Hbar} amount
* @returns {TransferTransaction}
*/
addApprovedHbarTransfer(accountId, amount) {
Expand Down
2 changes: 1 addition & 1 deletion src/address_book/NodeAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as utf8 from "../encoding/utf8.js";

/**
* @typedef {import("./Endpoint.js").EndPointJson} EndpointJson
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/contract/ContractCreateFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import PublicKey from "../PublicKey.js";

/**
* @typedef {import("bignumber.js").BigNumber} BigNumber
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion src/contract/ContractFunctionParameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ContractFunctionSelector, {
import * as utf8 from "../encoding/utf8.js";
import * as hex from "../encoding/hex.js";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import BigNumber from "bignumber.js";
import { BigNumber } from "bignumber.js";
import * as util from "../util.js";
import { defaultAbiCoder } from "@ethersproject/abi";
import { arrayify } from "@ethersproject/bytes";
Expand Down
2 changes: 1 addition & 1 deletion src/contract/ContractFunctionResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ContractLogInfo from "./ContractLogInfo.js";
import ContractId from "./ContractId.js";
import AccountId from "../account/AccountId.js";
import BigNumber from "bignumber.js";
import { BigNumber } from "bignumber.js";
import * as hex from "../encoding/hex.js";
import * as utf8 from "../encoding/utf8.js";
import * as util from "../util.js";
Expand Down
2 changes: 1 addition & 1 deletion src/contract/ContractId.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { isLongZeroAddress } from "../util.js";
*/
export default class ContractId extends Key {
/**
* @param {number | Long | import("../EntityIdHelper").IEntityId} props
* @param {number | Long | import("../EntityIdHelper.js").IEntityId} props
* @param {(number | Long)=} realm
* @param {(number | Long)=} num
* @param {Uint8Array=} evmAddress
Expand Down
4 changes: 2 additions & 2 deletions src/contract/DelegateContractId.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as hex from "../encoding/hex.js";
*/

/**
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
* @typedef {import("../client/Client.js").default<*, *>} Client
*/

Expand All @@ -21,7 +21,7 @@ import * as hex from "../encoding/hex.js";
*/
export default class DelegateContractId extends ContractId {
/**
* @param {number | Long | import("../EntityIdHelper").IEntityId} props
* @param {number | Long | import("../EntityIdHelper.js").IEntityId} props
* @param {(number | Long)=} realm
* @param {(number | Long)=} num
* @param {Uint8Array=} evmAddress
Expand Down
2 changes: 1 addition & 1 deletion src/file/FileId.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Long from "long";
*/
export default class FileId {
/**
* @param {number | Long | import("../EntityIdHelper").IEntityId} props
* @param {number | Long | import("../EntityIdHelper.js").IEntityId} props
* @param {(number | Long)=} realm
* @param {(number | Long)=} num
*/
Expand Down
2 changes: 1 addition & 1 deletion src/logger/Logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
import pino from "pino";
import { pino } from "pino";
import LogLevel from "./LogLevel.js";

/**
Expand Down
7 changes: 3 additions & 4 deletions src/long.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// SPDX-License-Identifier: Apache-2.0

import BigNumber from "bignumber.js";
import { BigNumber } from "bignumber.js";

/**
* @typedef {{low: number, high: number, unsigned: boolean}} LongObject
* @typedef {import("long")} Long
* @typedef {import("long").default} Long
*/

/**
* @param {Long | number | string | LongObject | BigNumber} value
* @param {Long | number | string | BigNumber} value
* @returns {BigNumber}
*/
export function valueToLong(value) {
Expand Down
1 change: 1 addition & 0 deletions src/node/NodeDeleteTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Transaction, {
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("../account/AccountId.js").default} AccountId
* @typedef {import("long").default} Long
*/

/**
Expand Down
1 change: 1 addition & 0 deletions src/node/NodeUpdateTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const SERVICE_ENDPOINTS_MAX_LENGTH = 8;
* @typedef {import("../channel/Channel.js").default} Channel
* @typedef {import("../transaction/TransactionId.js").default} TransactionId
* @typedef {import("../client/Client.js").default<*, *>} Client
* @typedef {import("long").default} Long
*/

/**
Expand Down
Loading
Loading