@keetanetwork/keetanet-client 0.16.1 → 0.16.2
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/client/index-browser.d.ts +3 -2
- package/client/index-browser.js +296 -98
- package/client/index.d.ts +3 -2
- package/client/index.js +232 -43
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +6 -3
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.applyNamespace.html +5 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.getTypedObjectEntries.html +1 -0
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256K1AccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NetworkAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.StorageAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.signOptionsType.html +16 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Struct.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.html +1 -0
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.KeetaNamespaceVersion.html +3 -0
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.MaxNamespaceLength.html +3 -0
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_domain-separation.namespacePrefixSchema.html +9 -0
- package/docs/variables/KeetaNetSDK.lib.html +2 -2
- package/lib/account.d.ts +37 -0
- package/lib/error/account.d.ts +2 -2
- package/lib/error/index.d.ts +1 -1
- package/lib/error/vote.d.ts +1 -1
- package/lib/index.d.ts +4 -2
- package/lib/ledger/common.d.ts +12 -0
- package/lib/ledger/db_dynamodb.d.ts +2 -2
- package/lib/ledger/db_postgres.d.ts +1 -1
- package/lib/ledger/db_spanner.d.ts +1 -1
- package/lib/ledger/db_spanner_helper.d.ts +1 -1
- package/lib/ledger/db_sqlite.d.ts +1 -1
- package/lib/ledger/index.d.ts +2 -2
- package/lib/utils/domain-separation.d.ts +31 -0
- package/lib/utils/external-keys/gcp-kms.d.ts +53 -0
- package/lib/utils/external-keys/gcp-kms.js +328 -0
- package/lib/utils/external-keys/passkey-prf.d.ts +1 -3
- package/lib/utils/external-keys/passkey-prf.js +6 -0
- package/lib/utils/helper.d.ts +1 -0
- package/npm-shrinkwrap.json +27 -9
- package/package.json +1 -1
- package/version.d.ts +1 -1
package/client/index.d.ts
CHANGED
|
@@ -1446,11 +1446,12 @@ export declare const lib: {
|
|
|
1446
1446
|
ASN1: typeof import("../lib/utils/asn1");
|
|
1447
1447
|
Bloom: typeof import("../lib/utils/bloom");
|
|
1448
1448
|
Buffer: typeof import("../lib/utils/buffer");
|
|
1449
|
+
Certificate: typeof import("../lib/utils/certificate");
|
|
1450
|
+
Conversion: typeof import("../lib/utils/conversion");
|
|
1451
|
+
DomainSeparation: typeof import("../lib/utils/domain-separation");
|
|
1449
1452
|
Hash: typeof import("../lib/utils/hash");
|
|
1450
1453
|
Helper: typeof import("../lib/utils/helper");
|
|
1451
1454
|
Initial: typeof import("../lib/utils/initial");
|
|
1452
|
-
Conversion: typeof import("../lib/utils/conversion");
|
|
1453
|
-
Certificate: typeof import("../lib/utils/certificate");
|
|
1454
1455
|
};
|
|
1455
1456
|
};
|
|
1456
1457
|
export {};
|
package/client/index.js
CHANGED
|
@@ -57597,6 +57597,10 @@ class UserClientBuilder {
|
|
|
57597
57597
|
if (fees.length === 0) {
|
|
57598
57598
|
continue;
|
|
57599
57599
|
}
|
|
57600
|
+
// If fee options contains an amount of 0, skip this vote
|
|
57601
|
+
if (fees.some(fee => fee.amount === 0n)) {
|
|
57602
|
+
continue;
|
|
57603
|
+
}
|
|
57600
57604
|
// Find fee with undefined token or matching baseToken
|
|
57601
57605
|
let selectedFee = fees.find((fee) => {
|
|
57602
57606
|
if (fee.token === undefined || fee.token.comparePublicKey(baseToken)) {
|
|
@@ -58130,7 +58134,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
58130
58134
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58131
58135
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
58132
58136
|
};
|
|
58133
|
-
var _Client_instances, _Client_reps, _Client_weightOrderedReps, _Client_intervals, _Client_updateRepsPromise, _Client_apiRaw, _Client_api, _Client_requestVoteOrQuote, _Client_requestQuotes, _Client_requestVotes, _Client_getVotes, _Client_getBuilderRenderOptions, _Client_urlSeparatedAccounts, _Client_formatAllBalances, _Client_parseResponsePermissions, _Client_formatAccountInfo, _Client_parseAccountInfo, _Client_parsePermissionEntries, _Client_mapCertificateWithBundleResult, _Client_parseRepInfo, _UserClient_instances, _UserClient_config, _UserClient_client, _UserClient_listeners, _UserClient_intervals, _UserClient_previousAccountChangeData, _UserClient_socketPromise, _UserClient_filteredWebSocket, _UserClient_changePromise, _UserClient_reconnectAttempts, _UserClient_RECONNECT_TIMEOUT, _UserClient_transientUserClients, _UserClient_getAccount, _UserClient_publishAidURL_get, _UserClient_publishWithPublishAid, _UserClient_reconnectWebSocket, _UserClient_setupFilteredWebSocket, _UserClient_emit, _UserClient_emitAccountInfoIfChanged;
|
|
58137
|
+
var _Client_instances, _Client_reps, _Client_weightOrderedReps, _Client_intervals, _Client_updateRepsPromise, _Client_apiRaw, _Client_api, _Client_requestVoteOrQuote, _Client_requestQuotes, _Client_requestVotes, _Client_getVotes, _Client_getBuilderRenderOptions, _Client_votesRequireFees, _Client_urlSeparatedAccounts, _Client_formatAllBalances, _Client_parseResponsePermissions, _Client_formatAccountInfo, _Client_parseAccountInfo, _Client_parsePermissionEntries, _Client_mapCertificateWithBundleResult, _Client_parseRepInfo, _UserClient_instances, _UserClient_config, _UserClient_client, _UserClient_listeners, _UserClient_intervals, _UserClient_previousAccountChangeData, _UserClient_socketPromise, _UserClient_filteredWebSocket, _UserClient_changePromise, _UserClient_reconnectAttempts, _UserClient_RECONNECT_TIMEOUT, _UserClient_transientUserClients, _UserClient_getAccount, _UserClient_publishAidURL_get, _UserClient_publishWithPublishAid, _UserClient_reconnectWebSocket, _UserClient_setupFilteredWebSocket, _UserClient_emit, _UserClient_emitAccountInfoIfChanged;
|
|
58134
58138
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
58135
58139
|
exports.lib = exports.UserClient = exports.Client = void 0;
|
|
58136
58140
|
exports.blockGenerator = blockGenerator;
|
|
@@ -58374,13 +58378,7 @@ class Client {
|
|
|
58374
58378
|
*/
|
|
58375
58379
|
async transmit(blocks, options) {
|
|
58376
58380
|
const tempVotes = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_requestVotes).call(this, blocks, undefined, undefined, options?.quotes);
|
|
58377
|
-
|
|
58378
|
-
for (const vote of tempVotes) {
|
|
58379
|
-
if (vote.fee !== undefined) {
|
|
58380
|
-
requiresFee = true;
|
|
58381
|
-
}
|
|
58382
|
-
}
|
|
58383
|
-
if (requiresFee) {
|
|
58381
|
+
if (__classPrivateFieldGet(this, _Client_instances, "m", _Client_votesRequireFees).call(this, tempVotes)) {
|
|
58384
58382
|
if (options?.generateFeeBlock === undefined) {
|
|
58385
58383
|
throw (new Error('Votes require fees but generateFeeBlock was not defined'));
|
|
58386
58384
|
}
|
|
@@ -59320,15 +59318,8 @@ class Client {
|
|
|
59320
59318
|
tempVotes = [...tempVotes, ...newTempVotes];
|
|
59321
59319
|
}
|
|
59322
59320
|
const missingPermReps = __classPrivateFieldGet(this, _Client_reps, "f").filter(rep => !permReps.includes(rep));
|
|
59323
|
-
// If any of the temporary votes require a fee, we need to generate a fee block
|
|
59324
|
-
let requiresFee = false;
|
|
59325
|
-
for (const vote of tempVotes) {
|
|
59326
|
-
if (vote.fee !== undefined) {
|
|
59327
|
-
requiresFee = true;
|
|
59328
|
-
}
|
|
59329
|
-
}
|
|
59330
59321
|
// If we need a fee block and don't have any permanent votes, we need to generate a fee block
|
|
59331
|
-
if (
|
|
59322
|
+
if (__classPrivateFieldGet(this, _Client_instances, "m", _Client_votesRequireFees).call(this, tempVotes) && permVotes.length === 0) {
|
|
59332
59323
|
if (options?.generateFeeBlock === undefined) {
|
|
59333
59324
|
throw (new Error('Votes require fees but generateFeeBlock was not defined'));
|
|
59334
59325
|
}
|
|
@@ -59823,6 +59814,22 @@ async function _Client_apiRaw(rep, api, method, options = {}) {
|
|
|
59823
59814
|
return (currentHeadBlock);
|
|
59824
59815
|
}
|
|
59825
59816
|
});
|
|
59817
|
+
}, _Client_votesRequireFees = function _Client_votesRequireFees(tempVotes) {
|
|
59818
|
+
let requiresFees = false;
|
|
59819
|
+
for (const vote of tempVotes) {
|
|
59820
|
+
if (vote.fee !== undefined) {
|
|
59821
|
+
const voteFee = Array.isArray(vote.fee) ? vote.fee : [vote.fee];
|
|
59822
|
+
// Check if user has the option to pay zero (any fee with amount === 0)
|
|
59823
|
+
// If a zero-amount option exists, fee block is optional for this vote
|
|
59824
|
+
const hasZeroFeeOption = voteFee.some(fee => fee.amount === 0n);
|
|
59825
|
+
// If no zero option exists (requires payment), fee block is required
|
|
59826
|
+
if (!hasZeroFeeOption) {
|
|
59827
|
+
requiresFees = true;
|
|
59828
|
+
break;
|
|
59829
|
+
}
|
|
59830
|
+
}
|
|
59831
|
+
}
|
|
59832
|
+
return (requiresFees);
|
|
59826
59833
|
}, _Client_urlSeparatedAccounts = function _Client_urlSeparatedAccounts(accounts) {
|
|
59827
59834
|
const pubKeys = accounts.map(account => account_1.default.toPublicKeyString(account));
|
|
59828
59835
|
return (pubKeys.join(','));
|
|
@@ -61369,6 +61376,7 @@ const p256_1 = __webpack_require__(5897);
|
|
|
61369
61376
|
const buffer_1 = __webpack_require__(3310);
|
|
61370
61377
|
const helper_1 = __webpack_require__(3208);
|
|
61371
61378
|
const hash_1 = __webpack_require__(7908);
|
|
61379
|
+
const domain_separation_1 = __webpack_require__(9061);
|
|
61372
61380
|
const asn1_1 = __webpack_require__(6045);
|
|
61373
61381
|
const block_1 = __importStar(__webpack_require__(6158));
|
|
61374
61382
|
const account_1 = __importDefault(__webpack_require__(4642));
|
|
@@ -61639,7 +61647,7 @@ class ExternalKeyPair extends KeyInterface {
|
|
|
61639
61647
|
return (__classPrivateFieldGet(this, _ExternalKeyPair_functions, "f").decrypt(...parameters));
|
|
61640
61648
|
}
|
|
61641
61649
|
get supportsEncryption() {
|
|
61642
|
-
return (
|
|
61650
|
+
return (__classPrivateFieldGet(this, _ExternalKeyPair_functions, "f").supportsEncryption);
|
|
61643
61651
|
}
|
|
61644
61652
|
get keyType() {
|
|
61645
61653
|
return (__classPrivateFieldGet(this, _ExternalKeyPair_keyType, "f"));
|
|
@@ -62645,6 +62653,9 @@ class Account {
|
|
|
62645
62653
|
if (__classPrivateFieldGet(this, _Account_privateKeyPair, "f") === null) {
|
|
62646
62654
|
throw (new Error('May not sign unless a private key is available'));
|
|
62647
62655
|
}
|
|
62656
|
+
if (options.namespace !== undefined) {
|
|
62657
|
+
data = (0, domain_separation_1.applyNamespace)(options.namespace, data);
|
|
62658
|
+
}
|
|
62648
62659
|
if (!__classPrivateFieldGet(this, _Account_keyPairHandlesHashing, "f") && !options.raw) {
|
|
62649
62660
|
data = (0, hash_1.Hash)(Buffer.from(data));
|
|
62650
62661
|
}
|
|
@@ -62659,6 +62670,9 @@ class Account {
|
|
|
62659
62670
|
forCert: false,
|
|
62660
62671
|
...options
|
|
62661
62672
|
};
|
|
62673
|
+
if (options.namespace !== undefined) {
|
|
62674
|
+
data = (0, domain_separation_1.applyNamespace)(options.namespace, data);
|
|
62675
|
+
}
|
|
62662
62676
|
if (!__classPrivateFieldGet(this, _Account_keyPairHandlesHashing, "f") && !options.raw) {
|
|
62663
62677
|
data = (0, hash_1.Hash)(Buffer.from(data));
|
|
62664
62678
|
}
|
|
@@ -62791,10 +62805,11 @@ class Account {
|
|
|
62791
62805
|
* Determine if an account is an identifier
|
|
62792
62806
|
*/
|
|
62793
62807
|
isIdentifier() {
|
|
62794
|
-
|
|
62795
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
62796
|
-
return (identifierKeyTypes.includes(this.keyType));
|
|
62808
|
+
return (Account.isIdentifierKeyType(__classPrivateFieldGet(this, _Account_keyType, "f")));
|
|
62797
62809
|
}
|
|
62810
|
+
/**
|
|
62811
|
+
* Determine if an account is a regular (non-identifier)
|
|
62812
|
+
*/
|
|
62798
62813
|
isAccount() {
|
|
62799
62814
|
return (!this.isIdentifier());
|
|
62800
62815
|
}
|
|
@@ -62827,7 +62842,7 @@ class Account {
|
|
|
62827
62842
|
}
|
|
62828
62843
|
assertAccount() {
|
|
62829
62844
|
if (this.isIdentifier() !== false) {
|
|
62830
|
-
throw (new
|
|
62845
|
+
throw (new account_1.default('ACCOUNT_NOT_ACCOUNT', 'Required Account but got Identifier'));
|
|
62831
62846
|
}
|
|
62832
62847
|
// We need to assert this type because we are changing what the constructed type is
|
|
62833
62848
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
@@ -62835,7 +62850,7 @@ class Account {
|
|
|
62835
62850
|
}
|
|
62836
62851
|
assertIdentifier() {
|
|
62837
62852
|
if (this.isIdentifier() !== true) {
|
|
62838
|
-
throw (new
|
|
62853
|
+
throw (new account_1.default('ACCOUNT_NOT_IDENTIFIER', `Required Identifier but got Account, ${this.keyType}`));
|
|
62839
62854
|
}
|
|
62840
62855
|
// We need to assert this type because we are changing what the constructed type is
|
|
62841
62856
|
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
@@ -62852,6 +62867,18 @@ _Account_privateKeyPair = new WeakMap(), _Account_publicKeyPair = new WeakMap(),
|
|
|
62852
62867
|
*/
|
|
62853
62868
|
Account.AccountKeyAlgorithm = AccountKeyAlgorithm;
|
|
62854
62869
|
Account.ExternalKeyPair = ExternalKeyPair;
|
|
62870
|
+
/**
|
|
62871
|
+
* Access to the underlying Key Pair classes for advanced use cases.
|
|
62872
|
+
*/
|
|
62873
|
+
Account.KeyPairs = {
|
|
62874
|
+
[AccountKeyAlgorithm.ECDSA_SECP256K1]: ECDSASECP256K1KeyPair,
|
|
62875
|
+
[AccountKeyAlgorithm.ECDSA_SECP256R1]: ECDSASECP256R1KeyPair,
|
|
62876
|
+
[AccountKeyAlgorithm.ED25519]: ED25519KeyPair,
|
|
62877
|
+
[AccountKeyAlgorithm.NETWORK]: IdentifierKeyPair,
|
|
62878
|
+
[AccountKeyAlgorithm.TOKEN]: IdentifierKeyPair,
|
|
62879
|
+
[AccountKeyAlgorithm.STORAGE]: IdentifierKeyPair,
|
|
62880
|
+
[AccountKeyAlgorithm.MULTISIG]: IdentifierKeyPair
|
|
62881
|
+
};
|
|
62855
62882
|
Account.isInstance = (0, helper_2.checkableGenerator)(Account);
|
|
62856
62883
|
Account.Set = (0, helper_1.setGenerator)(Account, function (account) {
|
|
62857
62884
|
const retval = account.publicKeyAndTypeString;
|
|
@@ -63952,8 +63979,9 @@ class UnsignedBlock extends PossiblyUnsignedBlock {
|
|
|
63952
63979
|
async seal() {
|
|
63953
63980
|
const signers = UnsignedBlock.getSortedRequiredSigners(this.signer);
|
|
63954
63981
|
const hash = this.hash;
|
|
63982
|
+
const ancillaryData = this.toBytes(false);
|
|
63955
63983
|
const signatures = await Promise.all(signers.map(async function (signer) {
|
|
63956
|
-
const signature = await signer.sign(hash.getBuffer());
|
|
63984
|
+
const signature = await signer.sign(hash.getBuffer(), { ancillaryData });
|
|
63957
63985
|
return (signature.getBuffer());
|
|
63958
63986
|
}));
|
|
63959
63987
|
const shared = {
|
|
@@ -64993,8 +65021,8 @@ class BlockOperationSET_REP extends BlockOperation {
|
|
|
64993
65021
|
}
|
|
64994
65022
|
validate(context) {
|
|
64995
65023
|
const { block } = context;
|
|
64996
|
-
if (block.account.
|
|
64997
|
-
throw (new block_1.default('BLOCK_NO_IDENTIFIER_OP',
|
|
65024
|
+
if (!(0, common_1.canDelegate)(block.account.keyType)) {
|
|
65025
|
+
throw (new block_1.default('BLOCK_NO_IDENTIFIER_OP', `${account_1.AccountKeyAlgorithm[block.account.keyType]} accounts cannot use SET_REP`));
|
|
64998
65026
|
}
|
|
64999
65027
|
if (this.to.isIdentifier()) {
|
|
65000
65028
|
throw (new block_1.default('BLOCK_NO_IDENTIFIER_OP', 'Cannot delegate to an identifier'));
|
|
@@ -65698,12 +65726,16 @@ exports.AccountErrorCodes = [
|
|
|
65698
65726
|
'INVALID_CONSTRUCTION',
|
|
65699
65727
|
'NO_IDENTIFIER_SIGN',
|
|
65700
65728
|
'NO_IDENTIFIER_VERIFY',
|
|
65729
|
+
'NOT_ACCOUNT',
|
|
65730
|
+
'NOT_IDENTIFIER',
|
|
65701
65731
|
'INVALID_IDENTIFIER_CONSTRUCTION',
|
|
65702
65732
|
'SEED_INDEX_UNDEFINED',
|
|
65703
65733
|
'SEED_INDEX_NEGATIVE',
|
|
65704
65734
|
'SEED_INDEX_NOT_INT',
|
|
65705
65735
|
'SEED_INDEX_TOO_LARGE',
|
|
65706
|
-
'ENCRYPTION_NOT_SUPPORTED'
|
|
65736
|
+
'ENCRYPTION_NOT_SUPPORTED',
|
|
65737
|
+
'NAMESPACE_EMPTY',
|
|
65738
|
+
'NAMESPACE_TOO_LONG'
|
|
65707
65739
|
];
|
|
65708
65740
|
exports.FullAccountErrorCodes = exports.AccountErrorCodes.map(code => `${AccountErrorType}_${code}`);
|
|
65709
65741
|
class KeetaNetAccountError extends base_1.KeetaNetErrorBase {
|
|
@@ -66452,6 +66484,7 @@ const error_1 = __webpack_require__(5390);
|
|
|
66452
66484
|
const ASN1 = __importStar(__webpack_require__(6045));
|
|
66453
66485
|
const Bloom = __importStar(__webpack_require__(7313));
|
|
66454
66486
|
const Buffer = __importStar(__webpack_require__(3310));
|
|
66487
|
+
const DomainSeparation = __importStar(__webpack_require__(9061));
|
|
66455
66488
|
const Hash = __importStar(__webpack_require__(7908));
|
|
66456
66489
|
const Helper = __importStar(__webpack_require__(3208));
|
|
66457
66490
|
const Initial = __importStar(__webpack_require__(3750));
|
|
@@ -66476,11 +66509,12 @@ exports["default"] = {
|
|
|
66476
66509
|
ASN1,
|
|
66477
66510
|
Bloom,
|
|
66478
66511
|
Buffer,
|
|
66512
|
+
Certificate,
|
|
66513
|
+
Conversion,
|
|
66514
|
+
DomainSeparation,
|
|
66479
66515
|
Hash,
|
|
66480
66516
|
Helper,
|
|
66481
|
-
Initial
|
|
66482
|
-
Conversion,
|
|
66483
|
-
Certificate
|
|
66517
|
+
Initial
|
|
66484
66518
|
}
|
|
66485
66519
|
};
|
|
66486
66520
|
|
|
@@ -66755,6 +66789,7 @@ exports.validateSupply = validateSupply;
|
|
|
66755
66789
|
exports.validateNumericValue = validateNumericValue;
|
|
66756
66790
|
exports.validateBlockSignerCount = validateBlockSignerCount;
|
|
66757
66791
|
exports.validateBlockSignerDepth = validateBlockSignerDepth;
|
|
66792
|
+
exports.canDelegate = canDelegate;
|
|
66758
66793
|
exports.computeLedgerEffect = computeLedgerEffect;
|
|
66759
66794
|
exports.addTimeStatistic = addTimeStatistic;
|
|
66760
66795
|
exports.assertLedgerStorage = assertLedgerStorage;
|
|
@@ -66816,6 +66851,29 @@ function validateBlockSignerDepth(depth, network) {
|
|
|
66816
66851
|
throw (new block_2.default('BLOCK_INVALID_MULTISIG_SIGNER_DEPTH', `signer depth does not fit proper format -- GOT: '${depth}' MaxValue: ${maxValue}`));
|
|
66817
66852
|
}
|
|
66818
66853
|
}
|
|
66854
|
+
/**
|
|
66855
|
+
* Determines if an account type can delegate voting weight via SET_REP.
|
|
66856
|
+
*
|
|
66857
|
+
* Regular accounts (ECDSA_SECP256K1, ED25519, ECDSA_SECP256R1) can always delegate.
|
|
66858
|
+
* Among identifier accounts, only STORAGE accounts can delegate.
|
|
66859
|
+
* TOKEN, NETWORK, and MULTISIG identifier accounts cannot delegate.
|
|
66860
|
+
*
|
|
66861
|
+
* @param keyType - The account key algorithm type to check
|
|
66862
|
+
* @returns true if the account type can use SET_REP to delegate, false otherwise
|
|
66863
|
+
*
|
|
66864
|
+
*/
|
|
66865
|
+
function canDelegate(keyType) {
|
|
66866
|
+
// Regular accounts (non-identifiers) can always delegate
|
|
66867
|
+
if (!account_1.default.isIdentifierKeyType(keyType)) {
|
|
66868
|
+
return (true);
|
|
66869
|
+
}
|
|
66870
|
+
// Among identifiers, only STORAGE can delegate
|
|
66871
|
+
if (keyType === account_1.AccountKeyAlgorithm.STORAGE) {
|
|
66872
|
+
return (true);
|
|
66873
|
+
}
|
|
66874
|
+
// Other identifier accounts cannot delegate
|
|
66875
|
+
return (false);
|
|
66876
|
+
}
|
|
66819
66877
|
/**
|
|
66820
66878
|
* Compute effects on the ledger from block effects
|
|
66821
66879
|
*/
|
|
@@ -66897,7 +66955,7 @@ async function computeLedgerEffect(options, effects, storageProvider, network, t
|
|
|
66897
66955
|
const delegationField = effects[accountPubKey]?.fields.delegation;
|
|
66898
66956
|
const isDelegating = delegationField !== undefined;
|
|
66899
66957
|
let requestedRep = false;
|
|
66900
|
-
if (isDelegating && computeWeights && getFinalNumericValues && account.
|
|
66958
|
+
if (isDelegating && computeWeights && getFinalNumericValues && canDelegate(account.keyType)) {
|
|
66901
66959
|
requestedRep = true;
|
|
66902
66960
|
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
66903
66961
|
prefetchPromises.push(getWeight(delegationField.delegateTo));
|
|
@@ -66925,7 +66983,7 @@ async function computeLedgerEffect(options, effects, storageProvider, network, t
|
|
|
66925
66983
|
if ((possibleNegative && checkRangeConstraints) || set || getFinalNumericValues || (isDelegating && computeWeights)) {
|
|
66926
66984
|
prefetchPromises.push(getPreviousBalance(account, token));
|
|
66927
66985
|
}
|
|
66928
|
-
if (computeWeights && isBaseToken && account.
|
|
66986
|
+
if (computeWeights && isBaseToken && canDelegate(account.keyType) && !requestedRep) {
|
|
66929
66987
|
requestedRep = true;
|
|
66930
66988
|
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
66931
66989
|
}
|
|
@@ -67061,7 +67119,7 @@ async function computeLedgerEffect(options, effects, storageProvider, network, t
|
|
|
67061
67119
|
}
|
|
67062
67120
|
const delegationField = effects[accountPubKey]?.fields.delegation;
|
|
67063
67121
|
const isDelegating = delegationField !== undefined;
|
|
67064
|
-
if (isDelegating && account.
|
|
67122
|
+
if (isDelegating && canDelegate(account.keyType) && computeWeights) {
|
|
67065
67123
|
const currentDelegation = await getRep(account, getFinalNumericValues);
|
|
67066
67124
|
const previousBalance = await getPreviousBalance(account, baseToken);
|
|
67067
67125
|
await modifyWeight(delegationField.delegateTo, previousBalance);
|
|
@@ -67115,7 +67173,7 @@ async function computeLedgerEffect(options, effects, storageProvider, network, t
|
|
|
67115
67173
|
receivable[otherAccountPubKey][tokenPubKey] += balanceChange;
|
|
67116
67174
|
}
|
|
67117
67175
|
const isBaseToken = baseToken.comparePublicKey(tokenAcct);
|
|
67118
|
-
if (isBaseToken && account.
|
|
67176
|
+
if (isBaseToken && canDelegate(account.keyType) && computeWeights) {
|
|
67119
67177
|
if (isDelegating) {
|
|
67120
67178
|
await modifyWeight(delegationField.delegateTo, balanceChange);
|
|
67121
67179
|
}
|
|
@@ -68528,6 +68586,14 @@ class LedgerAtomicInterface {
|
|
|
68528
68586
|
if (!quote.issuer.comparePublicKey(ledgerPubKey)) {
|
|
68529
68587
|
throw (new ledger_1.KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match issuer public key'));
|
|
68530
68588
|
}
|
|
68589
|
+
if (quote.blocks.length !== blocks.length) {
|
|
68590
|
+
throw (new ledger_1.KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match blocks length'));
|
|
68591
|
+
}
|
|
68592
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex++) {
|
|
68593
|
+
if (!blocks[blockIndex].hash.compareHexString(quote.blocks[blockIndex])) {
|
|
68594
|
+
throw (new ledger_1.KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match blocks content'));
|
|
68595
|
+
}
|
|
68596
|
+
}
|
|
68531
68597
|
}
|
|
68532
68598
|
/**
|
|
68533
68599
|
* Verify some attributes about the other votes if they are provided
|
|
@@ -68552,6 +68618,7 @@ class LedgerAtomicInterface {
|
|
|
68552
68618
|
}
|
|
68553
68619
|
}
|
|
68554
68620
|
const requiredFees = new Map();
|
|
68621
|
+
const optionalFees = new Map();
|
|
68555
68622
|
for (const checkVote of otherVotes) {
|
|
68556
68623
|
if (checkVote.quote === true) {
|
|
68557
68624
|
throw (new ledger_1.KeetaNetLedgerError('LEDGER_VOTE_WITH_QUOTE', 'Cannot request votes with quote as supporting votes'));
|
|
@@ -68565,7 +68632,18 @@ class LedgerAtomicInterface {
|
|
|
68565
68632
|
seenVoteIssuers.add(checkVote.issuer);
|
|
68566
68633
|
seenVoteUIDs.add(checkVote.$id);
|
|
68567
68634
|
if (checkVote.fee !== undefined) {
|
|
68568
|
-
|
|
68635
|
+
const checkVoteFee = Array.isArray(checkVote.fee) ? checkVote.fee : [checkVote.fee];
|
|
68636
|
+
// Check if user has the option to pay zero (any fee with amount === 0)
|
|
68637
|
+
// If a zero-amount option exists, fee block is optional; otherwise required
|
|
68638
|
+
const hasZeroFeeOption = checkVoteFee.some(fee => fee.amount === 0n);
|
|
68639
|
+
if (hasZeroFeeOption) {
|
|
68640
|
+
// At least one fee option is zero amount - fee block is optional, but if included should match one of the provided options
|
|
68641
|
+
optionalFees.set(checkVote.issuer, checkVote.fee);
|
|
68642
|
+
}
|
|
68643
|
+
else if (checkVoteFee.length > 0) {
|
|
68644
|
+
// All fee options require payment (no zero option) - fee block MUST be present and operation should match at least one fee option
|
|
68645
|
+
requiredFees.set(checkVote.issuer, checkVote.fee);
|
|
68646
|
+
}
|
|
68569
68647
|
}
|
|
68570
68648
|
/*
|
|
68571
68649
|
* Handle errors specific to requesting a permanent vote
|
|
@@ -68592,23 +68670,43 @@ class LedgerAtomicInterface {
|
|
|
68592
68670
|
foundOurVote = true;
|
|
68593
68671
|
}
|
|
68594
68672
|
}
|
|
68673
|
+
let finalRequiredFees = requiredFees;
|
|
68595
68674
|
/*
|
|
68596
68675
|
* We only care about fees if we are issuing a permanent vote,
|
|
68597
68676
|
* if we are issuing a temporary vote the fees will be checked
|
|
68598
68677
|
* when the permanent vote is requested
|
|
68599
68678
|
*/
|
|
68600
68679
|
if (outcome === 'permanent') {
|
|
68601
|
-
if (requiredFees.size > 0) {
|
|
68602
|
-
|
|
68603
|
-
|
|
68680
|
+
if (requiredFees.size > 0 || optionalFees.size > 0) {
|
|
68681
|
+
// If fees are required then a fee block should have been provided
|
|
68682
|
+
if (requiredFees.size > 0) {
|
|
68683
|
+
if (!hasFeeBlock) {
|
|
68684
|
+
throw (new ledger_1.KeetaNetLedgerError('LEDGER_MISSING_REQUIRED_FEE_BLOCK', 'Missing fee block but votes require it'));
|
|
68685
|
+
}
|
|
68604
68686
|
}
|
|
68605
|
-
//
|
|
68606
|
-
if (
|
|
68607
|
-
|
|
68687
|
+
// We can only validate operations match if we have a fee block
|
|
68688
|
+
if (hasFeeBlock) {
|
|
68689
|
+
// Each vote requires exactly one fee payment, regardless of array size
|
|
68690
|
+
// Optional fees may or may not be included in the operations but if they are they should match
|
|
68691
|
+
if (optionalFees.size > 0) {
|
|
68692
|
+
if (possibleFeeBlock?.operations.length !== requiredFees.size &&
|
|
68693
|
+
possibleFeeBlock?.operations.length !== (requiredFees.size + optionalFees.size)) {
|
|
68694
|
+
throw (new ledger_1.KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees or required and optional fees'));
|
|
68695
|
+
}
|
|
68696
|
+
// If user provided optional fees then we should validate they match
|
|
68697
|
+
if (possibleFeeBlock?.operations.length === (requiredFees.size + optionalFees.size)) {
|
|
68698
|
+
finalRequiredFees = new Map([...requiredFees, ...optionalFees]);
|
|
68699
|
+
}
|
|
68700
|
+
}
|
|
68701
|
+
else {
|
|
68702
|
+
if (requiredFees.size !== possibleFeeBlock?.operations.length) {
|
|
68703
|
+
throw (new ledger_1.KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees'));
|
|
68704
|
+
}
|
|
68705
|
+
}
|
|
68608
68706
|
}
|
|
68609
68707
|
}
|
|
68610
68708
|
// Verify that at least one required fee option has been satisfied for each vote
|
|
68611
|
-
for (const [issuer, feeOrFees] of
|
|
68709
|
+
for (const [issuer, feeOrFees] of finalRequiredFees) {
|
|
68612
68710
|
// Handle both single fee and array of fees
|
|
68613
68711
|
const fees = Array.isArray(feeOrFees) ? feeOrFees : [feeOrFees];
|
|
68614
68712
|
// Check if at least one fee option is satisfied
|
|
@@ -68913,6 +69011,10 @@ class LedgerAtomicInterface {
|
|
|
68913
69011
|
return (retval);
|
|
68914
69012
|
}
|
|
68915
69013
|
async getAccountRep(account) {
|
|
69014
|
+
const acct = account_1.default.toAccount(account);
|
|
69015
|
+
if (!(0, common_1.canDelegate)(acct.keyType)) {
|
|
69016
|
+
return (null);
|
|
69017
|
+
}
|
|
68916
69018
|
const transaction = __classPrivateFieldGet(this, _LedgerAtomicInterface_instances, "m", _LedgerAtomicInterface_assertTransaction).call(this);
|
|
68917
69019
|
const retval = await __classPrivateFieldGet(this, _LedgerAtomicInterface_storage, "f").getAccountRep(transaction, account);
|
|
68918
69020
|
return (retval);
|
|
@@ -69543,7 +69645,12 @@ async function _LedgerAtomicInterface_validateLedgerOutcome(blocks) {
|
|
|
69543
69645
|
*/
|
|
69544
69646
|
if (requireBlockTimestampCheck) {
|
|
69545
69647
|
const fee = quote?.fee ?? await this.getFee(blocks, effects);
|
|
69546
|
-
|
|
69648
|
+
// We add an explicit fee of 0 if one is not provided.
|
|
69649
|
+
// Since the quote identifier is in the fee data and needs to be parsed correctly.
|
|
69650
|
+
if (fee === null || (Array.isArray(fee) && fee.length === 0)) {
|
|
69651
|
+
builder.addFee({ amount: 0n });
|
|
69652
|
+
}
|
|
69653
|
+
else {
|
|
69547
69654
|
builder.addFee(fee);
|
|
69548
69655
|
}
|
|
69549
69656
|
}
|
|
@@ -77668,6 +77775,76 @@ function parseHexBigIntString(input) {
|
|
|
77668
77775
|
}
|
|
77669
77776
|
|
|
77670
77777
|
|
|
77778
|
+
/***/ }),
|
|
77779
|
+
|
|
77780
|
+
/***/ 9061:
|
|
77781
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
77782
|
+
|
|
77783
|
+
"use strict";
|
|
77784
|
+
|
|
77785
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
77786
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
77787
|
+
};
|
|
77788
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
77789
|
+
exports.namespacePrefixSchema = exports.MaxNamespaceLength = exports.KeetaNamespaceVersion = void 0;
|
|
77790
|
+
exports.applyNamespace = applyNamespace;
|
|
77791
|
+
const account_1 = __importDefault(__webpack_require__(4642));
|
|
77792
|
+
const asn1_1 = __webpack_require__(6045);
|
|
77793
|
+
/**
|
|
77794
|
+
* Version for Keeta's domain separation namespace schema, encoded as the
|
|
77795
|
+
* `INTEGER` field of `namespacePrefixSchema`.
|
|
77796
|
+
*/
|
|
77797
|
+
exports.KeetaNamespaceVersion = 0;
|
|
77798
|
+
/**
|
|
77799
|
+
* Maximum domain separation namespace length in bytes (for strings,
|
|
77800
|
+
* this is the UTF-8 byte length, not the character count).
|
|
77801
|
+
*/
|
|
77802
|
+
exports.MaxNamespaceLength = 255;
|
|
77803
|
+
/**
|
|
77804
|
+
* Schema for the namespace prefix:
|
|
77805
|
+
*
|
|
77806
|
+
* ```asn1
|
|
77807
|
+
* NamespacePrefix ::= SEQUENCE {
|
|
77808
|
+
* version INTEGER,
|
|
77809
|
+
* namespace OCTET STRING,
|
|
77810
|
+
* data OCTET STRING
|
|
77811
|
+
* }
|
|
77812
|
+
* ```
|
|
77813
|
+
*/
|
|
77814
|
+
exports.namespacePrefixSchema = [
|
|
77815
|
+
asn1_1.ValidateASN1.IsInteger,
|
|
77816
|
+
asn1_1.ValidateASN1.IsOctetString,
|
|
77817
|
+
asn1_1.ValidateASN1.IsOctetString
|
|
77818
|
+
];
|
|
77819
|
+
/**
|
|
77820
|
+
* Apply the `NamespacePrefix` domain separator to `data`.
|
|
77821
|
+
*
|
|
77822
|
+
* String namespaces are UTF-8 encoded; ArrayBuffer namespaces are used
|
|
77823
|
+
* verbatim. Namespace length MUST be 1-`MaxNamespaceLength` bytes after
|
|
77824
|
+
* encoding.
|
|
77825
|
+
*/
|
|
77826
|
+
function applyNamespace(namespace, data) {
|
|
77827
|
+
let namespaceBytes;
|
|
77828
|
+
if (typeof namespace === 'string') {
|
|
77829
|
+
namespaceBytes = new TextEncoder().encode(namespace);
|
|
77830
|
+
}
|
|
77831
|
+
else {
|
|
77832
|
+
namespaceBytes = new Uint8Array(namespace);
|
|
77833
|
+
}
|
|
77834
|
+
if (namespaceBytes.length === 0) {
|
|
77835
|
+
throw (new account_1.default('ACCOUNT_NAMESPACE_EMPTY', 'Domain separation namespace must not be empty'));
|
|
77836
|
+
}
|
|
77837
|
+
if (namespaceBytes.length > exports.MaxNamespaceLength) {
|
|
77838
|
+
throw (new account_1.default('ACCOUNT_NAMESPACE_TOO_LONG', `Domain separation namespace must be 1-${exports.MaxNamespaceLength} bytes, got: ${namespaceBytes.length}`));
|
|
77839
|
+
}
|
|
77840
|
+
return ((0, asn1_1.JStoASN1)([
|
|
77841
|
+
exports.KeetaNamespaceVersion,
|
|
77842
|
+
Buffer.from(namespaceBytes),
|
|
77843
|
+
Buffer.from(data)
|
|
77844
|
+
]).toBER(false));
|
|
77845
|
+
}
|
|
77846
|
+
|
|
77847
|
+
|
|
77671
77848
|
/***/ }),
|
|
77672
77849
|
|
|
77673
77850
|
/***/ 9240:
|
|
@@ -78156,6 +78333,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
78156
78333
|
var _AsyncDisposableStackPolyfill_instances, _AsyncDisposableStackPolyfill_toDispose, _AsyncDisposableStackPolyfill_validateNotDisposed, _a;
|
|
78157
78334
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78158
78335
|
exports.util = exports.crypto = exports.AsyncDisposableStack = void 0;
|
|
78336
|
+
exports.getTypedObjectEntries = getTypedObjectEntries;
|
|
78159
78337
|
exports.validateBase64ToBuffer = validateBase64ToBuffer;
|
|
78160
78338
|
exports.bufferToArrayBuffer = bufferToArrayBuffer;
|
|
78161
78339
|
exports.bufferToBigInt = bufferToBigInt;
|
|
@@ -78178,6 +78356,11 @@ const crypto_1 = __importDefault(__webpack_require__(6982));
|
|
|
78178
78356
|
const util_1 = __webpack_require__(9023);
|
|
78179
78357
|
const hash_1 = __webpack_require__(7908);
|
|
78180
78358
|
const uuid = __importStar(__webpack_require__(5827));
|
|
78359
|
+
// Helper to get properly typed entries from an object
|
|
78360
|
+
function getTypedObjectEntries(obj) {
|
|
78361
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
78362
|
+
return Object.entries(obj);
|
|
78363
|
+
}
|
|
78181
78364
|
const randomBytes = crypto_1.default.randomBytes.bind(crypto_1.default);
|
|
78182
78365
|
const randomUUID = crypto_1.default.randomUUID ? crypto_1.default.randomUUID.bind(crypto_1.default) : function () {
|
|
78183
78366
|
return (uuid.v4());
|
|
@@ -80587,6 +80770,12 @@ class BaseVoteBuilder {
|
|
|
80587
80770
|
}
|
|
80588
80771
|
exports.BaseVoteBuilder = BaseVoteBuilder;
|
|
80589
80772
|
_BaseVoteBuilder_account = new WeakMap(), _BaseVoteBuilder_blocks = new WeakMap(), _BaseVoteBuilder_fee = new WeakMap(), _BaseVoteBuilder_instances = new WeakSet(), _BaseVoteBuilder_formatSingleFeeEntry = function _BaseVoteBuilder_formatSingleFeeEntry(feeInput) {
|
|
80773
|
+
if (feeInput.amount === undefined) {
|
|
80774
|
+
throw (new vote_1.default('VOTE_BUILDER_INVALID_FEE', 'Fee amount is required'));
|
|
80775
|
+
}
|
|
80776
|
+
if (BigInt(feeInput.amount) < 0n) {
|
|
80777
|
+
throw (new vote_1.default('VOTE_BUILDER_INVALID_FEE', 'Fee amount cannot be negative'));
|
|
80778
|
+
}
|
|
80590
80779
|
const fee = { amount: BigInt(feeInput.amount) };
|
|
80591
80780
|
const payTo = account_1.default.toAccount(feeInput.payTo);
|
|
80592
80781
|
if (payTo !== undefined) {
|
|
@@ -80667,7 +80856,7 @@ exports.Testing = { findRDN, blockHashesFromVote, feeFromVote, hashDataSchema, f
|
|
|
80667
80856
|
|
|
80668
80857
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
80669
80858
|
exports.version = void 0;
|
|
80670
|
-
exports.version = '0.16.
|
|
80859
|
+
exports.version = '0.16.2+g2c1441eed2a1c71a895d0fb5166c431799b3d3ca';
|
|
80671
80860
|
exports["default"] = exports.version;
|
|
80672
80861
|
|
|
80673
80862
|
|
package/docs/assets/hierarchy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.hierarchyData = "
|
|
1
|
+
window.hierarchyData = "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"
|