@hiero-ledger/sdk 2.73.2 → 2.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd.js +368 -202
- package/dist/umd.min.js +3 -3
- package/lib/MirrorNode.cjs +46 -0
- package/lib/MirrorNode.d.ts +16 -0
- package/lib/MirrorNode.js +1 -1
- package/lib/MirrorNode.js.map +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.cjs +11 -5
- package/lib/account/AccountAllowanceApproveTransaction.d.ts +4 -5
- package/lib/account/AccountAllowanceApproveTransaction.js +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
- package/lib/account/TokenAllowance.cjs +4 -2
- package/lib/account/TokenAllowance.d.ts +4 -2
- package/lib/account/TokenAllowance.js +1 -1
- package/lib/account/TokenAllowance.js.map +1 -1
- package/lib/account/TokenTransferMap.cjs +7 -2
- package/lib/account/TokenTransferMap.d.ts +6 -2
- package/lib/account/TokenTransferMap.js +1 -1
- package/lib/account/TokenTransferMap.js.map +1 -1
- package/lib/client/Client.cjs +13 -44
- package/lib/client/Client.d.ts +12 -12
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/MirrorNetwork.cjs +16 -0
- package/lib/client/MirrorNetwork.d.ts +7 -0
- package/lib/client/MirrorNetwork.js +1 -1
- package/lib/client/MirrorNetwork.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/constants/ClientConstants.cjs +4 -1
- package/lib/constants/ClientConstants.d.ts +2 -0
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.js.map +1 -1
- package/lib/contract/ContractId.cjs +2 -5
- package/lib/contract/ContractId.js +1 -1
- package/lib/contract/ContractId.js.map +1 -1
- package/lib/network/AddressBookQueryWeb.cjs +88 -60
- package/lib/network/AddressBookQueryWeb.d.ts +7 -37
- package/lib/network/AddressBookQueryWeb.js +1 -1
- package/lib/network/AddressBookQueryWeb.js.map +1 -1
- package/lib/query/MirrorNodeContractQuery.cjs +2 -1
- package/lib/query/MirrorNodeContractQuery.js.map +1 -1
- package/lib/token/AbstractTokenTransferTransaction.cjs +12 -8
- package/lib/token/AbstractTokenTransferTransaction.d.ts +14 -11
- package/lib/token/AbstractTokenTransferTransaction.js +1 -1
- package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
- package/lib/token/AssessedCustomFee.cjs +8 -4
- package/lib/token/AssessedCustomFee.d.ts +8 -5
- package/lib/token/AssessedCustomFee.js +1 -1
- package/lib/token/AssessedCustomFee.js.map +1 -1
- package/lib/token/CustomFixedFee.cjs +8 -4
- package/lib/token/CustomFixedFee.d.ts +8 -5
- package/lib/token/CustomFixedFee.js +1 -1
- package/lib/token/CustomFixedFee.js.map +1 -1
- package/lib/token/PendingAirdropRecord.cjs +7 -2
- package/lib/token/PendingAirdropRecord.d.ts +6 -2
- package/lib/token/PendingAirdropRecord.js +1 -1
- package/lib/token/PendingAirdropRecord.js.map +1 -1
- package/lib/token/TokenAirdropTransaction.cjs +2 -1
- package/lib/token/TokenAirdropTransaction.d.ts +4 -2
- package/lib/token/TokenAirdropTransaction.js.map +1 -1
- package/lib/token/TokenBurnTransaction.cjs +5 -3
- package/lib/token/TokenBurnTransaction.d.ts +6 -4
- package/lib/token/TokenBurnTransaction.js +1 -1
- package/lib/token/TokenBurnTransaction.js.map +1 -1
- package/lib/token/TokenCreateTransaction.cjs +7 -6
- package/lib/token/TokenCreateTransaction.d.ts +8 -8
- package/lib/token/TokenCreateTransaction.js +1 -1
- package/lib/token/TokenCreateTransaction.js.map +1 -1
- package/lib/token/TokenMintTransaction.cjs +5 -4
- package/lib/token/TokenMintTransaction.d.ts +6 -5
- package/lib/token/TokenMintTransaction.js +1 -1
- package/lib/token/TokenMintTransaction.js.map +1 -1
- package/lib/token/TokenTransfer.cjs +3 -2
- package/lib/token/TokenTransfer.d.ts +2 -2
- package/lib/token/TokenTransfer.js +1 -1
- package/lib/token/TokenTransfer.js.map +1 -1
- package/lib/token/TokenWipeTransaction.cjs +5 -3
- package/lib/token/TokenWipeTransaction.d.ts +6 -4
- package/lib/token/TokenWipeTransaction.js +1 -1
- package/lib/token/TokenWipeTransaction.js.map +1 -1
- package/lib/transaction/Transaction.cjs +54 -0
- package/lib/transaction/Transaction.d.ts +10 -0
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/util.cjs +25 -0
- package/lib/util.d.ts +8 -0
- package/lib/util.js +1 -1
- package/lib/util.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +16 -12
- package/src/MirrorNode.js +49 -0
- package/src/account/AccountAllowanceApproveTransaction.js +11 -11
- package/src/account/TokenAllowance.js +5 -2
- package/src/account/TokenTransferMap.js +7 -2
- package/src/client/Client.js +13 -51
- package/src/client/MirrorNetwork.js +18 -0
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/constants/ClientConstants.js +3 -0
- package/src/contract/ContractId.js +2 -10
- package/src/network/AddressBookQueryWeb.js +122 -91
- package/src/query/MirrorNodeContractQuery.js +2 -1
- package/src/token/AbstractTokenTransferTransaction.js +12 -8
- package/src/token/AssessedCustomFee.js +8 -5
- package/src/token/CustomFixedFee.js +8 -5
- package/src/token/PendingAirdropRecord.js +7 -2
- package/src/token/TokenAirdropTransaction.js +2 -1
- package/src/token/TokenBurnTransaction.js +5 -3
- package/src/token/TokenCreateTransaction.js +7 -9
- package/src/token/TokenMintTransaction.js +5 -4
- package/src/token/TokenTransfer.js +3 -2
- package/src/token/TokenWipeTransaction.js +5 -3
- package/src/transaction/Transaction.js +63 -0
- package/src/util.js +26 -0
|
@@ -1291,6 +1291,65 @@ export default class Transaction extends Executable {
|
|
|
1291
1291
|
);
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
|
+
/**
|
|
1295
|
+
* Apply maxNodesPerTransaction limit to an already frozen transaction.
|
|
1296
|
+
* This trims the node list to the first N nodes while preserving existing signatures.
|
|
1297
|
+
*
|
|
1298
|
+
* Note: This method assumes the caller has already verified that trimming is needed.
|
|
1299
|
+
*
|
|
1300
|
+
* @private
|
|
1301
|
+
* @param {import("../client/Client.js").default<Channel, *>} client
|
|
1302
|
+
*/
|
|
1303
|
+
_applyMaxNodesPerTransactionLimit(client) {
|
|
1304
|
+
const maxNodes = client.maxNodesPerTransaction;
|
|
1305
|
+
|
|
1306
|
+
if (maxNodes <= 0 || this._nodeAccountIds.length <= maxNodes) {
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
if (this._logger) {
|
|
1311
|
+
this._logger.debug(
|
|
1312
|
+
`Trimming frozen transaction from ${this._nodeAccountIds.length} nodes to ${maxNodes} nodes based on maxNodesPerTransaction setting`,
|
|
1313
|
+
);
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
// Trim the node account IDs to the first N nodes
|
|
1317
|
+
const trimmedNodeIds = this._nodeAccountIds.list.slice(0, maxNodes);
|
|
1318
|
+
|
|
1319
|
+
// Trim the signed transactions to match the trimmed node list
|
|
1320
|
+
// Each chunk has transactions for all nodes, so we need to trim each chunk
|
|
1321
|
+
const nodeCount = this._nodeAccountIds.length;
|
|
1322
|
+
const chunkCount = this._transactionIds.length;
|
|
1323
|
+
const trimmedSignedTransactions = [];
|
|
1324
|
+
|
|
1325
|
+
for (let chunkIndex = 0; chunkIndex < chunkCount; chunkIndex++) {
|
|
1326
|
+
const chunkStart = chunkIndex * nodeCount;
|
|
1327
|
+
|
|
1328
|
+
// Add the first maxNodes transactions from this chunk
|
|
1329
|
+
for (let nodeIndex = 0; nodeIndex < maxNodes; nodeIndex++) {
|
|
1330
|
+
const transactionIndex = chunkStart + nodeIndex;
|
|
1331
|
+
if (transactionIndex < this._signedTransactions.length) {
|
|
1332
|
+
trimmedSignedTransactions.push(
|
|
1333
|
+
this._signedTransactions.get(transactionIndex),
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// Clear and rebuild the transactions list since it's derived from signed transactions
|
|
1340
|
+
this._transactions.clear();
|
|
1341
|
+
|
|
1342
|
+
// Update the node account IDs (we need to unlock, update, and relock)
|
|
1343
|
+
this._nodeAccountIds.locked = false;
|
|
1344
|
+
|
|
1345
|
+
this._nodeAccountIds.setList(trimmedNodeIds);
|
|
1346
|
+
|
|
1347
|
+
this._nodeAccountIds.locked = true;
|
|
1348
|
+
|
|
1349
|
+
// Update the signed transactions
|
|
1350
|
+
this._signedTransactions.setList(trimmedSignedTransactions);
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1294
1353
|
/**
|
|
1295
1354
|
* @description Set the key that will sign the batch of which this Transaction is a part of.
|
|
1296
1355
|
* @param {Key} batchKey
|
|
@@ -1667,6 +1726,10 @@ export default class Transaction extends Executable {
|
|
|
1667
1726
|
this.freezeWith(client);
|
|
1668
1727
|
}
|
|
1669
1728
|
|
|
1729
|
+
// Apply maxNodesPerTransaction limit to already frozen transaction
|
|
1730
|
+
// This allows changing the node count even after freezing while preserving signatures
|
|
1731
|
+
this._applyMaxNodesPerTransactionLimit(client);
|
|
1732
|
+
|
|
1670
1733
|
// Valid checksums if the option is enabled
|
|
1671
1734
|
if (client.isAutoValidateChecksumsEnabled()) {
|
|
1672
1735
|
this._validateChecksums(client);
|
package/src/util.js
CHANGED
|
@@ -291,6 +291,32 @@ export function convertToBigNumber(variable) {
|
|
|
291
291
|
throw new Error(FUNCTION_CONVERT_TO_BIGNUMBER_ERROR);
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Converts amount (number, Long, BigNumber, or bigint) to Long.
|
|
296
|
+
* This utility ensures consistent amount handling across the SDK.
|
|
297
|
+
*
|
|
298
|
+
* @param {number | Long | BigNumber | bigint} amount
|
|
299
|
+
* @returns {Long}
|
|
300
|
+
*/
|
|
301
|
+
export function convertAmountToLong(amount) {
|
|
302
|
+
requireNonNull(amount);
|
|
303
|
+
|
|
304
|
+
// Preserve exact original behavior for existing types
|
|
305
|
+
if (Long.isLong(amount)) {
|
|
306
|
+
return amount;
|
|
307
|
+
} else if (typeof amount === "number") {
|
|
308
|
+
return Long.fromNumber(amount);
|
|
309
|
+
} else if (BigNumber.isBigNumber(amount)) {
|
|
310
|
+
return Long.fromValue(
|
|
311
|
+
amount.integerValue(BigNumber.ROUND_DOWN).toString(),
|
|
312
|
+
);
|
|
313
|
+
} else if (typeof amount === "bigint") {
|
|
314
|
+
return Long.fromValue(amount.toString());
|
|
315
|
+
} else {
|
|
316
|
+
// Handle other types that can be converted to string
|
|
317
|
+
return Long.fromValue(String(amount));
|
|
318
|
+
}
|
|
319
|
+
}
|
|
294
320
|
/**
|
|
295
321
|
* Converts Array of Numbers or Strings to Array of BigNumbers.
|
|
296
322
|
*
|