@keetanetwork/keetanet-client 0.16.0 → 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/builder.d.ts +3 -3
- package/client/client_common_tests.d.ts +23 -4
- package/client/index-browser.d.ts +15 -13
- package/client/index-browser.js +878 -351
- package/client/index.d.ts +15 -13
- package/client/index.js +737 -253
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +10 -10
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +34 -31
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.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 +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +7 -7
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.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 +4 -4
- 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 +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +3 -3
- 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 +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +11 -11
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.UserClient.html +20 -20
- package/docs/documents/GETTING-STARTED.html +1 -1
- package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +8 -8
- 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 +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +12 -0
- 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 +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +2 -2
- 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.BlockV1JSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BuilderBlockOptions.html +2 -2
- 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 +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +10 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndToken.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +2 -2
- 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.LedgerConfig.html +4 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +5 -5
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +14 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.NetworkAccountInfo.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +4 -4
- 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.PendingOperations.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +3 -10
- 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 +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +14 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- 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/types/KeetaNetSDK.Referenced.AccountInfo.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoForType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoResponse.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.AccountInfoWithoutAccount.html +1 -0
- package/docs/types/{KeetaNetSDK.Referenced.src_lib_utils_helper.DistributiveOmit.html → KeetaNetSDK.Referenced.DistributiveOmit.html} +1 -1
- package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFormatted.html +5 -12
- package/docs/types/KeetaNetSDK.Referenced.KeyPairAccountInfo.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyPairKeyAlgorithm.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NetworkAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.StorageAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TokenAddress.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TokenOrPending.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.UserEditableAccountInfo.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_initial.BaseNetworkInfo.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.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 +39 -1
- package/lib/block/index.d.ts +126 -108
- package/lib/block/operations.d.ts +11 -0
- package/lib/error/account.d.ts +2 -2
- package/lib/error/index.d.ts +1 -1
- package/lib/error/vote.d.ts +2 -2
- package/lib/index.d.ts +4 -2
- package/lib/ledger/common.d.ts +15 -3
- package/lib/ledger/db_dynamodb.d.ts +6 -6
- package/lib/ledger/db_postgres.d.ts +3 -3
- package/lib/ledger/db_spanner.d.ts +4 -4
- package/lib/ledger/db_spanner_helper.d.ts +2 -2
- package/lib/ledger/db_sqlite.d.ts +3 -3
- package/lib/ledger/effects.d.ts +3 -1
- package/lib/ledger/index.d.ts +9 -9
- package/lib/ledger/types.d.ts +43 -9
- package/lib/log/target_gcp.js +3 -0
- package/lib/log/target_https.js +7 -0
- package/lib/utils/certificate.d.ts +13 -12
- package/lib/utils/conversion.d.ts +12 -3
- 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/lib/utils/initial.d.ts +3 -2
- package/lib/utils/never.d.ts +4 -0
- package/lib/vote.d.ts +96 -89
- package/npm-shrinkwrap.json +30 -12
- package/package.json +2 -2
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.AccountInfo.html +0 -14
package/client/index-browser.js
CHANGED
|
@@ -101235,6 +101235,7 @@ __webpack_require__.d(client_helper_namespaceObject, {
|
|
|
101235
101235
|
crypto: () => (client_helper_crypto),
|
|
101236
101236
|
debugPrintableObject: () => (client_debugPrintableObject),
|
|
101237
101237
|
env: () => (client_env),
|
|
101238
|
+
getTypedObjectEntries: () => (client_getTypedObjectEntries),
|
|
101238
101239
|
isBuffer: () => (client_isBuffer),
|
|
101239
101240
|
isIntegerOrBigInt: () => (client_isIntegerOrBigInt),
|
|
101240
101241
|
nonNullable: () => (client_nonNullable),
|
|
@@ -101332,6 +101333,16 @@ __webpack_require__.d(client_utils_asn1_namespaceObject, {
|
|
|
101332
101333
|
isValidSequenceSchema: () => (client_isValidSequenceSchema)
|
|
101333
101334
|
});
|
|
101334
101335
|
|
|
101336
|
+
// NAMESPACE OBJECT: ./src/lib/utils/domain-separation.ts
|
|
101337
|
+
var client_domain_separation_namespaceObject = {};
|
|
101338
|
+
__webpack_require__.r(client_domain_separation_namespaceObject);
|
|
101339
|
+
__webpack_require__.d(client_domain_separation_namespaceObject, {
|
|
101340
|
+
KeetaNamespaceVersion: () => (client_KeetaNamespaceVersion),
|
|
101341
|
+
MaxNamespaceLength: () => (client_MaxNamespaceLength),
|
|
101342
|
+
applyNamespace: () => (client_applyNamespace),
|
|
101343
|
+
namespacePrefixSchema: () => (client_namespacePrefixSchema)
|
|
101344
|
+
});
|
|
101345
|
+
|
|
101335
101346
|
// NAMESPACE OBJECT: ./src/lib/utils/conversion.ts
|
|
101336
101347
|
var client_conversion_namespaceObject = {};
|
|
101337
101348
|
__webpack_require__.r(client_conversion_namespaceObject);
|
|
@@ -105460,6 +105471,12 @@ function src_client_assertClassBrand(e, t, n) { if ("function" == typeof e ? e =
|
|
|
105460
105471
|
|
|
105461
105472
|
|
|
105462
105473
|
|
|
105474
|
+
|
|
105475
|
+
// Helper to get properly typed entries from an object
|
|
105476
|
+
function client_getTypedObjectEntries(obj) {
|
|
105477
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
105478
|
+
return Object.entries(obj);
|
|
105479
|
+
}
|
|
105463
105480
|
const client_helper_randomBytes = client_crypto_default().randomBytes.bind((client_crypto_default()));
|
|
105464
105481
|
const client_helper_randomUUID = (client_crypto_default()).randomUUID ? client_crypto_default().randomUUID.bind((client_crypto_default())) : function () {
|
|
105465
105482
|
return client_esm_browser_v4();
|
|
@@ -106337,6 +106354,58 @@ class src_client_BufferStorage {
|
|
|
106337
106354
|
client_BufferStorage = src_client_BufferStorage;
|
|
106338
106355
|
client_buffer_defineProperty(src_client_BufferStorage, "isInstance", client_checkableGenerator(client_BufferStorage));
|
|
106339
106356
|
|
|
106357
|
+
;// ./src/lib/error/base.ts
|
|
106358
|
+
var client_KeetaNetErrorBase;
|
|
106359
|
+
function client_base_defineProperty(e, r, t) { return (r = client_base_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
106360
|
+
function client_base_toPropertyKey(t) { var i = client_base_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
106361
|
+
function client_base_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
106362
|
+
|
|
106363
|
+
class src_client_KeetaNetErrorBase extends Error {
|
|
106364
|
+
constructor(code, message, validation) {
|
|
106365
|
+
super(message);
|
|
106366
|
+
const type = (validation === null || validation === void 0 ? void 0 : validation.type) || 'GENERIC';
|
|
106367
|
+
if (validation !== undefined) {
|
|
106368
|
+
const prefix = `${validation.type}_`;
|
|
106369
|
+
const validPrefix = code.startsWith(prefix);
|
|
106370
|
+
const withoutPrefix = code.substring(prefix.length);
|
|
106371
|
+
const validCode = validation.codes.includes(withoutPrefix);
|
|
106372
|
+
if (!validPrefix || !validCode) {
|
|
106373
|
+
throw new Error(`Invalid construction of KeetaNetError Type: ${validation.type} Code: ${code}, prefix ${prefix} valid ${validPrefix} valid code: ${validCode}`);
|
|
106374
|
+
}
|
|
106375
|
+
}
|
|
106376
|
+
this.code = code;
|
|
106377
|
+
this.type = type;
|
|
106378
|
+
}
|
|
106379
|
+
toJSON() {
|
|
106380
|
+
return {
|
|
106381
|
+
type: this.type,
|
|
106382
|
+
code: this.code,
|
|
106383
|
+
message: this.message
|
|
106384
|
+
};
|
|
106385
|
+
}
|
|
106386
|
+
}
|
|
106387
|
+
client_KeetaNetErrorBase = src_client_KeetaNetErrorBase;
|
|
106388
|
+
client_base_defineProperty(src_client_KeetaNetErrorBase, "isInstance", client_checkableGenerator(client_KeetaNetErrorBase, false));
|
|
106389
|
+
;// ./src/lib/error/account.ts
|
|
106390
|
+
var client_KeetaNetAccountError;
|
|
106391
|
+
function client_account_defineProperty(e, r, t) { return (r = client_account_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
106392
|
+
function client_account_toPropertyKey(t) { var i = client_account_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
106393
|
+
function client_account_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
106394
|
+
|
|
106395
|
+
|
|
106396
|
+
const client_AccountErrorType = 'ACCOUNT';
|
|
106397
|
+
const client_AccountErrorCodes = ['INVALID_PREFIX', 'INVALID_KEYTYPE', 'INVALID_KEYTYPE_EXTERNAL', 'PASSPHRASE_WEAK', 'INVALID_CONSTRUCTION', 'NO_IDENTIFIER_SIGN', 'NO_IDENTIFIER_VERIFY', 'NOT_ACCOUNT', 'NOT_IDENTIFIER', 'INVALID_IDENTIFIER_CONSTRUCTION', 'SEED_INDEX_UNDEFINED', 'SEED_INDEX_NEGATIVE', 'SEED_INDEX_NOT_INT', 'SEED_INDEX_TOO_LARGE', 'ENCRYPTION_NOT_SUPPORTED', 'NAMESPACE_EMPTY', 'NAMESPACE_TOO_LONG'];
|
|
106398
|
+
const client_FullAccountErrorCodes = client_AccountErrorCodes.map(code => `${client_AccountErrorType}_${code}`);
|
|
106399
|
+
class src_client_KeetaNetAccountError extends src_client_KeetaNetErrorBase {
|
|
106400
|
+
constructor(code, message) {
|
|
106401
|
+
super(code, message, {
|
|
106402
|
+
type: client_AccountErrorType,
|
|
106403
|
+
codes: client_AccountErrorCodes
|
|
106404
|
+
});
|
|
106405
|
+
}
|
|
106406
|
+
}
|
|
106407
|
+
client_KeetaNetAccountError = src_client_KeetaNetAccountError;
|
|
106408
|
+
client_account_defineProperty(src_client_KeetaNetAccountError, "isInstance", client_checkableGenerator(client_KeetaNetAccountError));
|
|
106340
106409
|
;// ./node_modules/pvutils/build/utils.es.js
|
|
106341
106410
|
/*!
|
|
106342
106411
|
Copyright (c) Peculiar Ventures, LLC
|
|
@@ -113123,6 +113192,10 @@ function client_assertNever(value) {
|
|
|
113123
113192
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
113124
113193
|
throw new Error(`Unexpected value: ${value}`);
|
|
113125
113194
|
}
|
|
113195
|
+
|
|
113196
|
+
/**
|
|
113197
|
+
* Asserts that the provided type is never.
|
|
113198
|
+
*/
|
|
113126
113199
|
;// ./src/lib/utils/asn1.ts
|
|
113127
113200
|
/* provided dependency */ var client_asn1_process = __webpack_require__(5606);
|
|
113128
113201
|
/* provided dependency */ var client_asn1_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -115200,6 +115273,58 @@ const client_Testing = {
|
|
|
115200
115273
|
ASN1IntegerToBigInt: client_jsIntegerToBigInt
|
|
115201
115274
|
}
|
|
115202
115275
|
};
|
|
115276
|
+
;// ./src/lib/utils/domain-separation.ts
|
|
115277
|
+
/* provided dependency */ var client_domain_separation_Buffer = __webpack_require__(8287)["Buffer"];
|
|
115278
|
+
|
|
115279
|
+
|
|
115280
|
+
|
|
115281
|
+
/**
|
|
115282
|
+
* Version for Keeta's domain separation namespace schema, encoded as the
|
|
115283
|
+
* `INTEGER` field of `namespacePrefixSchema`.
|
|
115284
|
+
*/
|
|
115285
|
+
const client_KeetaNamespaceVersion = 0;
|
|
115286
|
+
|
|
115287
|
+
/**
|
|
115288
|
+
* Maximum domain separation namespace length in bytes (for strings,
|
|
115289
|
+
* this is the UTF-8 byte length, not the character count).
|
|
115290
|
+
*/
|
|
115291
|
+
const client_MaxNamespaceLength = 255;
|
|
115292
|
+
|
|
115293
|
+
/**
|
|
115294
|
+
* Schema for the namespace prefix:
|
|
115295
|
+
*
|
|
115296
|
+
* ```asn1
|
|
115297
|
+
* NamespacePrefix ::= SEQUENCE {
|
|
115298
|
+
* version INTEGER,
|
|
115299
|
+
* namespace OCTET STRING,
|
|
115300
|
+
* data OCTET STRING
|
|
115301
|
+
* }
|
|
115302
|
+
* ```
|
|
115303
|
+
*/
|
|
115304
|
+
const client_namespacePrefixSchema = [client_ValidateASN1.IsInteger, client_ValidateASN1.IsOctetString, client_ValidateASN1.IsOctetString];
|
|
115305
|
+
|
|
115306
|
+
/**
|
|
115307
|
+
* Apply the `NamespacePrefix` domain separator to `data`.
|
|
115308
|
+
*
|
|
115309
|
+
* String namespaces are UTF-8 encoded; ArrayBuffer namespaces are used
|
|
115310
|
+
* verbatim. Namespace length MUST be 1-`MaxNamespaceLength` bytes after
|
|
115311
|
+
* encoding.
|
|
115312
|
+
*/
|
|
115313
|
+
function client_applyNamespace(namespace, data) {
|
|
115314
|
+
let namespaceBytes;
|
|
115315
|
+
if (typeof namespace === 'string') {
|
|
115316
|
+
namespaceBytes = new TextEncoder().encode(namespace);
|
|
115317
|
+
} else {
|
|
115318
|
+
namespaceBytes = new Uint8Array(namespace);
|
|
115319
|
+
}
|
|
115320
|
+
if (namespaceBytes.length === 0) {
|
|
115321
|
+
throw new src_client_KeetaNetAccountError('ACCOUNT_NAMESPACE_EMPTY', 'Domain separation namespace must not be empty');
|
|
115322
|
+
}
|
|
115323
|
+
if (namespaceBytes.length > client_MaxNamespaceLength) {
|
|
115324
|
+
throw new src_client_KeetaNetAccountError('ACCOUNT_NAMESPACE_TOO_LONG', `Domain separation namespace must be 1-${client_MaxNamespaceLength} bytes, got: ${namespaceBytes.length}`);
|
|
115325
|
+
}
|
|
115326
|
+
return client_JStoASN1([client_KeetaNamespaceVersion, client_domain_separation_Buffer.from(namespaceBytes), client_domain_separation_Buffer.from(data)]).toBER(false);
|
|
115327
|
+
}
|
|
115203
115328
|
;// ./src/lib/utils/conversion.ts
|
|
115204
115329
|
/* provided dependency */ var client_conversion_Buffer = __webpack_require__(8287)["Buffer"];
|
|
115205
115330
|
|
|
@@ -115271,6 +115396,9 @@ function client_convertSingleValue(value) {
|
|
|
115271
115396
|
return checkPrefix(out, prefix, opts);
|
|
115272
115397
|
}
|
|
115273
115398
|
function client_toJSONSerializable(data, opts) {
|
|
115399
|
+
if (data === undefined) {
|
|
115400
|
+
throw new Error('undefined is not JSON serializable');
|
|
115401
|
+
}
|
|
115274
115402
|
return JSON.parse(JSON.stringify(client_convertSingleValue(data, opts)));
|
|
115275
115403
|
}
|
|
115276
115404
|
function client_conversion_objectToBuffer(data) {
|
|
@@ -115554,38 +115682,6 @@ function client_fromOffsetArray(setOffsets) {
|
|
|
115554
115682
|
return val;
|
|
115555
115683
|
}
|
|
115556
115684
|
client_bitfield_defineProperty(src_client_BitField, "isInstance", client_checkableGenerator(client_BitField));
|
|
115557
|
-
;// ./src/lib/error/base.ts
|
|
115558
|
-
var client_KeetaNetErrorBase;
|
|
115559
|
-
function client_base_defineProperty(e, r, t) { return (r = client_base_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
115560
|
-
function client_base_toPropertyKey(t) { var i = client_base_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
115561
|
-
function client_base_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
115562
|
-
|
|
115563
|
-
class src_client_KeetaNetErrorBase extends Error {
|
|
115564
|
-
constructor(code, message, validation) {
|
|
115565
|
-
super(message);
|
|
115566
|
-
const type = (validation === null || validation === void 0 ? void 0 : validation.type) || 'GENERIC';
|
|
115567
|
-
if (validation !== undefined) {
|
|
115568
|
-
const prefix = `${validation.type}_`;
|
|
115569
|
-
const validPrefix = code.startsWith(prefix);
|
|
115570
|
-
const withoutPrefix = code.substring(prefix.length);
|
|
115571
|
-
const validCode = validation.codes.includes(withoutPrefix);
|
|
115572
|
-
if (!validPrefix || !validCode) {
|
|
115573
|
-
throw new Error(`Invalid construction of KeetaNetError Type: ${validation.type} Code: ${code}, prefix ${prefix} valid ${validPrefix} valid code: ${validCode}`);
|
|
115574
|
-
}
|
|
115575
|
-
}
|
|
115576
|
-
this.code = code;
|
|
115577
|
-
this.type = type;
|
|
115578
|
-
}
|
|
115579
|
-
toJSON() {
|
|
115580
|
-
return {
|
|
115581
|
-
type: this.type,
|
|
115582
|
-
code: this.code,
|
|
115583
|
-
message: this.message
|
|
115584
|
-
};
|
|
115585
|
-
}
|
|
115586
|
-
}
|
|
115587
|
-
client_KeetaNetErrorBase = src_client_KeetaNetErrorBase;
|
|
115588
|
-
client_base_defineProperty(src_client_KeetaNetErrorBase, "isInstance", client_checkableGenerator(client_KeetaNetErrorBase, false));
|
|
115589
115685
|
;// ./src/lib/error/permissions.ts
|
|
115590
115686
|
var client_KeetaNetPermissionsError;
|
|
115591
115687
|
function client_permissions_defineProperty(e, r, t) { return (r = client_permissions_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
@@ -118005,6 +118101,32 @@ function client_validateBlockSignerDepth(depth, network) {
|
|
|
118005
118101
|
}
|
|
118006
118102
|
}
|
|
118007
118103
|
|
|
118104
|
+
/**
|
|
118105
|
+
* Determines if an account type can delegate voting weight via SET_REP.
|
|
118106
|
+
*
|
|
118107
|
+
* Regular accounts (ECDSA_SECP256K1, ED25519, ECDSA_SECP256R1) can always delegate.
|
|
118108
|
+
* Among identifier accounts, only STORAGE accounts can delegate.
|
|
118109
|
+
* TOKEN, NETWORK, and MULTISIG identifier accounts cannot delegate.
|
|
118110
|
+
*
|
|
118111
|
+
* @param keyType - The account key algorithm type to check
|
|
118112
|
+
* @returns true if the account type can use SET_REP to delegate, false otherwise
|
|
118113
|
+
*
|
|
118114
|
+
*/
|
|
118115
|
+
function client_canDelegate(keyType) {
|
|
118116
|
+
// Regular accounts (non-identifiers) can always delegate
|
|
118117
|
+
if (!client_lib_account.isIdentifierKeyType(keyType)) {
|
|
118118
|
+
return true;
|
|
118119
|
+
}
|
|
118120
|
+
|
|
118121
|
+
// Among identifiers, only STORAGE can delegate
|
|
118122
|
+
if (keyType === client_AccountKeyAlgorithm.STORAGE) {
|
|
118123
|
+
return true;
|
|
118124
|
+
}
|
|
118125
|
+
|
|
118126
|
+
// Other identifier accounts cannot delegate
|
|
118127
|
+
return false;
|
|
118128
|
+
}
|
|
118129
|
+
|
|
118008
118130
|
/**
|
|
118009
118131
|
* Compute effects on the ledger from block effects
|
|
118010
118132
|
*/
|
|
@@ -118054,7 +118176,11 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118054
118176
|
if (getAccountInfoPromises[accountPubKey] === undefined) {
|
|
118055
118177
|
getAccountInfoPromises[accountPubKey] = storageProvider.getAccountInfo(transaction, account);
|
|
118056
118178
|
}
|
|
118057
|
-
|
|
118179
|
+
|
|
118180
|
+
// We know this is correct as we are accessing the object via the account's public key
|
|
118181
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118182
|
+
const resolved = await getAccountInfoPromises[accountPubKey];
|
|
118183
|
+
return resolved;
|
|
118058
118184
|
};
|
|
118059
118185
|
const getPermissionPromises = {};
|
|
118060
118186
|
const getPermissions = async (account, entityList) => {
|
|
@@ -118094,7 +118220,7 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118094
118220
|
const delegationField = (_effects$accountPubKe = effects[accountPubKey]) === null || _effects$accountPubKe === void 0 ? void 0 : _effects$accountPubKe.fields.delegation;
|
|
118095
118221
|
const isDelegating = delegationField !== undefined;
|
|
118096
118222
|
let requestedRep = false;
|
|
118097
|
-
if (isDelegating && computeWeights && getFinalNumericValues && account.
|
|
118223
|
+
if (isDelegating && computeWeights && getFinalNumericValues && client_canDelegate(account.keyType)) {
|
|
118098
118224
|
requestedRep = true;
|
|
118099
118225
|
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
118100
118226
|
prefetchPromises.push(getWeight(delegationField.delegateTo));
|
|
@@ -118126,7 +118252,7 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118126
118252
|
if (possibleNegative && checkRangeConstraints || set || getFinalNumericValues || isDelegating && computeWeights) {
|
|
118127
118253
|
prefetchPromises.push(getPreviousBalance(account, token));
|
|
118128
118254
|
}
|
|
118129
|
-
if (computeWeights && isBaseToken && account.
|
|
118255
|
+
if (computeWeights && isBaseToken && client_canDelegate(account.keyType) && !requestedRep) {
|
|
118130
118256
|
requestedRep = true;
|
|
118131
118257
|
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
118132
118258
|
}
|
|
@@ -118276,7 +118402,7 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118276
118402
|
}
|
|
118277
118403
|
const delegationField = (_effects$accountPubKe2 = effects[accountPubKey]) === null || _effects$accountPubKe2 === void 0 ? void 0 : _effects$accountPubKe2.fields.delegation;
|
|
118278
118404
|
const isDelegating = delegationField !== undefined;
|
|
118279
|
-
if (isDelegating && account.
|
|
118405
|
+
if (isDelegating && client_canDelegate(account.keyType) && computeWeights) {
|
|
118280
118406
|
const currentDelegation = await getRep(account, getFinalNumericValues);
|
|
118281
118407
|
const previousBalance = await getPreviousBalance(account, baseToken);
|
|
118282
118408
|
await modifyWeight(delegationField.delegateTo, previousBalance);
|
|
@@ -118337,7 +118463,7 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118337
118463
|
receivable[otherAccountPubKey][tokenPubKey] += balanceChange;
|
|
118338
118464
|
}
|
|
118339
118465
|
const isBaseToken = baseToken.comparePublicKey(tokenAcct);
|
|
118340
|
-
if (isBaseToken && account.
|
|
118466
|
+
if (isBaseToken && client_canDelegate(account.keyType) && computeWeights) {
|
|
118341
118467
|
if (isDelegating) {
|
|
118342
118468
|
await modifyWeight(delegationField.delegateTo, balanceChange);
|
|
118343
118469
|
} else {
|
|
@@ -118552,7 +118678,8 @@ class client_LedgerStorageBase {
|
|
|
118552
118678
|
_formatAccountInfoFromRow(account) {
|
|
118553
118679
|
var _row$name, _row$description, _row$metadata;
|
|
118554
118680
|
let row = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
118555
|
-
const
|
|
118681
|
+
const shared = {
|
|
118682
|
+
account: account,
|
|
118556
118683
|
name: (_row$name = row.name) !== null && _row$name !== void 0 ? _row$name : '',
|
|
118557
118684
|
description: (_row$description = row.description) !== null && _row$description !== void 0 ? _row$description : '',
|
|
118558
118685
|
metadata: (_row$metadata = row.metadata) !== null && _row$metadata !== void 0 ? _row$metadata : ''
|
|
@@ -118567,16 +118694,46 @@ class client_LedgerStorageBase {
|
|
|
118567
118694
|
if (!Permissions.ExternalSet.isInstance(externalSet)) {
|
|
118568
118695
|
externalSet = BigInt(externalSet);
|
|
118569
118696
|
}
|
|
118570
|
-
|
|
118571
|
-
|
|
118572
|
-
|
|
118573
|
-
|
|
118574
|
-
|
|
118575
|
-
|
|
118576
|
-
|
|
118577
|
-
|
|
118697
|
+
const identifierShared = {
|
|
118698
|
+
...shared,
|
|
118699
|
+
defaultPermission: new Permissions(baseSet, externalSet)
|
|
118700
|
+
};
|
|
118701
|
+
if (account.isToken()) {
|
|
118702
|
+
var _row$supply;
|
|
118703
|
+
return {
|
|
118704
|
+
...identifierShared,
|
|
118705
|
+
account: account,
|
|
118706
|
+
supply: BigInt((_row$supply = row.supply) !== null && _row$supply !== void 0 ? _row$supply : 0)
|
|
118707
|
+
};
|
|
118708
|
+
} else if (account.isMultisig()) {
|
|
118709
|
+
return {
|
|
118710
|
+
...identifierShared,
|
|
118711
|
+
account: account,
|
|
118712
|
+
multisigQuorum: row.multisigQuorum ? BigInt(row.multisigQuorum) : null
|
|
118713
|
+
};
|
|
118714
|
+
} else if (account.isNetwork()) {
|
|
118715
|
+
return {
|
|
118716
|
+
...identifierShared,
|
|
118717
|
+
account
|
|
118718
|
+
};
|
|
118719
|
+
} else if (account.isStorage()) {
|
|
118720
|
+
return {
|
|
118721
|
+
...identifierShared,
|
|
118722
|
+
account
|
|
118723
|
+
};
|
|
118724
|
+
} else {
|
|
118725
|
+
throw new Error('Unsupported identifier account type for AccountInfo');
|
|
118726
|
+
}
|
|
118727
|
+
} else if (account.isAccount()) {
|
|
118728
|
+
// We know that this type is correct, the only way to avoid this assertion is to have an if statement for every single account type which would be unwieldy
|
|
118729
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118730
|
+
return {
|
|
118731
|
+
...shared,
|
|
118732
|
+
account: account
|
|
118733
|
+
};
|
|
118734
|
+
} else {
|
|
118735
|
+
throw new Error('Unsupported account type for AccountInfo');
|
|
118578
118736
|
}
|
|
118579
|
-
return ret;
|
|
118580
118737
|
}
|
|
118581
118738
|
_validateAccountInfoKeys(account, info) {
|
|
118582
118739
|
const validKeys = ['name', 'description', 'metadata'];
|
|
@@ -118591,6 +118748,7 @@ class client_LedgerStorageBase {
|
|
|
118591
118748
|
}
|
|
118592
118749
|
const keys = Object.keys(info);
|
|
118593
118750
|
const foundBannedKey = keys.find(function (key) {
|
|
118751
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
118594
118752
|
return validKeys.includes(key) === false;
|
|
118595
118753
|
});
|
|
118596
118754
|
if (foundBannedKey !== undefined) {
|
|
@@ -118731,6 +118889,30 @@ function client_operationTypeToNumber(str) {
|
|
|
118731
118889
|
}
|
|
118732
118890
|
return type;
|
|
118733
118891
|
}
|
|
118892
|
+
function client_makeEncodeDecodePermission(emptyValue) {
|
|
118893
|
+
return {
|
|
118894
|
+
encode: data => {
|
|
118895
|
+
if (!data) {
|
|
118896
|
+
return emptyValue;
|
|
118897
|
+
}
|
|
118898
|
+
const encoded = client_permissions_Permissions.FromAcceptedTypes(data);
|
|
118899
|
+
return [encoded.base.bigint, encoded.external.bigint];
|
|
118900
|
+
},
|
|
118901
|
+
decode: data => {
|
|
118902
|
+
if (!data) {
|
|
118903
|
+
return emptyValue;
|
|
118904
|
+
}
|
|
118905
|
+
if (!Array.isArray(data) || data.length !== 2) {
|
|
118906
|
+
throw new Error('Invalid permissions data');
|
|
118907
|
+
}
|
|
118908
|
+
if (typeof data[0] !== 'bigint' || typeof data[1] !== 'bigint') {
|
|
118909
|
+
throw new Error('Invalid permissions data types');
|
|
118910
|
+
}
|
|
118911
|
+
return new client_permissions_Permissions(data[0], data[1]);
|
|
118912
|
+
}
|
|
118913
|
+
};
|
|
118914
|
+
}
|
|
118915
|
+
|
|
118734
118916
|
/**
|
|
118735
118917
|
* Schema for each operation as well as names of each field within the block operations
|
|
118736
118918
|
*/
|
|
@@ -118797,7 +118979,8 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118797
118979
|
name: 'defaultPermission',
|
|
118798
118980
|
schema: {
|
|
118799
118981
|
optional: [client_ValidateASN1.IsInteger, client_ValidateASN1.IsInteger]
|
|
118800
|
-
}
|
|
118982
|
+
},
|
|
118983
|
+
...client_makeEncodeDecodePermission(undefined)
|
|
118801
118984
|
}],
|
|
118802
118985
|
'MODIFY_PERMISSIONS': [{
|
|
118803
118986
|
name: 'principal',
|
|
@@ -118809,7 +118992,8 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118809
118992
|
name: 'permissions',
|
|
118810
118993
|
schema: {
|
|
118811
118994
|
choice: [client_ValidateASN1.IsNull, [client_ValidateASN1.IsInteger, client_ValidateASN1.IsInteger]]
|
|
118812
|
-
}
|
|
118995
|
+
},
|
|
118996
|
+
...client_makeEncodeDecodePermission(null)
|
|
118813
118997
|
}, {
|
|
118814
118998
|
name: 'target',
|
|
118815
118999
|
schema: {
|
|
@@ -118832,6 +119016,56 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118832
119016
|
}, client_ValidateASN1.IsInteger]
|
|
118833
119017
|
}]
|
|
118834
119018
|
}
|
|
119019
|
+
},
|
|
119020
|
+
encode: data => {
|
|
119021
|
+
if (!data) {
|
|
119022
|
+
return null;
|
|
119023
|
+
}
|
|
119024
|
+
if (data.type === client_AccountKeyAlgorithm.MULTISIG) {
|
|
119025
|
+
return {
|
|
119026
|
+
type: 'context',
|
|
119027
|
+
kind: 'explicit',
|
|
119028
|
+
value: data.type,
|
|
119029
|
+
contains: [data.signers.map(function (signer) {
|
|
119030
|
+
return signer.publicKeyAndType;
|
|
119031
|
+
}), data.quorum]
|
|
119032
|
+
};
|
|
119033
|
+
} else {
|
|
119034
|
+
throw new Error(`Unrecognized createArguments type for CREATE_IDENTIFIER operation`);
|
|
119035
|
+
}
|
|
119036
|
+
},
|
|
119037
|
+
decode: data => {
|
|
119038
|
+
if (!data) {
|
|
119039
|
+
return undefined;
|
|
119040
|
+
}
|
|
119041
|
+
if (!client_ASN1CheckUtilities.isASN1ContextTag(data, 'explicit')) {
|
|
119042
|
+
throw new Error('Invalid createArgs type for CREATE_IDENTIFIER operation');
|
|
119043
|
+
}
|
|
119044
|
+
if (data.value === client_AccountKeyAlgorithm.MULTISIG) {
|
|
119045
|
+
if (!Array.isArray(data.contains) || data.contains.length !== 2) {
|
|
119046
|
+
throw new Error('Invalid createArgs container');
|
|
119047
|
+
}
|
|
119048
|
+
if (!Array.isArray(data.contains[0]) || typeof data.contains[1] !== 'bigint') {
|
|
119049
|
+
throw new Error('Invalid createArgs container');
|
|
119050
|
+
}
|
|
119051
|
+
return {
|
|
119052
|
+
type: data.value,
|
|
119053
|
+
signers: data.contains[0].map(function (value) {
|
|
119054
|
+
if (!client_operations_Buffer.isBuffer(value)) {
|
|
119055
|
+
throw new Error(`Invalid signer value, expected Buffer, got ${typeof value}`);
|
|
119056
|
+
}
|
|
119057
|
+
const account = client_lib_account.fromPublicKeyAndType(value);
|
|
119058
|
+
if (account.isAccount() || account.isMultisig()) {
|
|
119059
|
+
return account;
|
|
119060
|
+
} else {
|
|
119061
|
+
throw new Error('Signer for multisig must be an account or another multisig');
|
|
119062
|
+
}
|
|
119063
|
+
}),
|
|
119064
|
+
quorum: BigInt(data.contains[1])
|
|
119065
|
+
};
|
|
119066
|
+
} else {
|
|
119067
|
+
throw new Error('unrecognized type for multisig create arguments');
|
|
119068
|
+
}
|
|
118835
119069
|
}
|
|
118836
119070
|
}],
|
|
118837
119071
|
'TOKEN_ADMIN_SUPPLY': [{
|
|
@@ -118856,7 +119090,26 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118856
119090
|
schema: client_ValidateASN1.IsInteger
|
|
118857
119091
|
}, {
|
|
118858
119092
|
name: 'certificateOrHash',
|
|
118859
|
-
schema: client_ValidateASN1.IsOctetString
|
|
119093
|
+
schema: client_ValidateASN1.IsOctetString,
|
|
119094
|
+
encode: data => {
|
|
119095
|
+
if (src_client_Certificate.isCertificate(data)) {
|
|
119096
|
+
return client_operations_Buffer.from(data.toDER());
|
|
119097
|
+
} else if (src_client_CertificateHash.isInstance(data)) {
|
|
119098
|
+
return data.getBuffer();
|
|
119099
|
+
} else {
|
|
119100
|
+
throw new Error('Invalid certificate or hash data type');
|
|
119101
|
+
}
|
|
119102
|
+
},
|
|
119103
|
+
decode: data => {
|
|
119104
|
+
if (!client_isBuffer(data)) {
|
|
119105
|
+
throw new Error('Invalid certificate or hash data type');
|
|
119106
|
+
}
|
|
119107
|
+
if (data.length === 32) {
|
|
119108
|
+
return new src_client_CertificateHash(data.toString('hex'));
|
|
119109
|
+
} else {
|
|
119110
|
+
return new src_client_Certificate(data);
|
|
119111
|
+
}
|
|
119112
|
+
}
|
|
118860
119113
|
}, {
|
|
118861
119114
|
name: 'intermediateCertificates',
|
|
118862
119115
|
schema: {
|
|
@@ -118865,6 +119118,28 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118865
119118
|
sequenceOf: client_ValidateASN1.IsOctetString
|
|
118866
119119
|
}]
|
|
118867
119120
|
}
|
|
119121
|
+
},
|
|
119122
|
+
decode: data => {
|
|
119123
|
+
if (!data) {
|
|
119124
|
+
return null;
|
|
119125
|
+
}
|
|
119126
|
+
if (!Array.isArray(data)) {
|
|
119127
|
+
throw new Error('Invalid intermediate certificates data');
|
|
119128
|
+
}
|
|
119129
|
+
return new src_client_CertificateBundle(data.map(function (certificate) {
|
|
119130
|
+
if (!client_isBuffer(certificate)) {
|
|
119131
|
+
throw new Error('Invalid intermediate certificate data type');
|
|
119132
|
+
}
|
|
119133
|
+
return new src_client_Certificate(certificate);
|
|
119134
|
+
}));
|
|
119135
|
+
},
|
|
119136
|
+
encode: data => {
|
|
119137
|
+
if (!data) {
|
|
119138
|
+
return null;
|
|
119139
|
+
}
|
|
119140
|
+
return data.getCertificates().map(function (certificate) {
|
|
119141
|
+
return client_operations_Buffer.from(certificate.toDER());
|
|
119142
|
+
});
|
|
118868
119143
|
}
|
|
118869
119144
|
}]
|
|
118870
119145
|
};
|
|
@@ -119210,8 +119485,8 @@ class src_client_BlockOperationSET_REP extends src_client_BlockOperation {
|
|
|
119210
119485
|
const {
|
|
119211
119486
|
block
|
|
119212
119487
|
} = context;
|
|
119213
|
-
if (block.account.
|
|
119214
|
-
throw new src_client_KeetaNetBlockError('BLOCK_NO_IDENTIFIER_OP',
|
|
119488
|
+
if (!client_canDelegate(block.account.keyType)) {
|
|
119489
|
+
throw new src_client_KeetaNetBlockError('BLOCK_NO_IDENTIFIER_OP', `${client_AccountKeyAlgorithm[block.account.keyType]} accounts cannot use SET_REP`);
|
|
119215
119490
|
}
|
|
119216
119491
|
if (this.to.isIdentifier()) {
|
|
119217
119492
|
throw new src_client_KeetaNetBlockError('BLOCK_NO_IDENTIFIER_OP', 'Cannot delegate to an identifier');
|
|
@@ -119859,35 +120134,26 @@ function client_ExportBlockOperations(operations) {
|
|
|
119859
120134
|
for (const entry of operations) {
|
|
119860
120135
|
const operationContainer = [];
|
|
119861
120136
|
const typeStr = client_operationTypeToString(entry.type);
|
|
119862
|
-
const
|
|
119863
|
-
if (!typeStr || !
|
|
120137
|
+
const operationSchemas = client_BlockOperationASN1SchemaBase[typeStr];
|
|
120138
|
+
if (!typeStr || !operationSchemas) {
|
|
119864
120139
|
throw new Error(`Unable to serialize operation with type ${entry.type} ${client_toJSONSerializable(entry)}`);
|
|
119865
120140
|
}
|
|
119866
120141
|
|
|
119867
120142
|
// We want to be able to read any key on the operation, so we need to cast it to any
|
|
119868
120143
|
const unTypedEntry = entry;
|
|
119869
|
-
for (const {
|
|
119870
|
-
|
|
119871
|
-
|
|
119872
|
-
|
|
120144
|
+
for (const operationSchema of operationSchemas) {
|
|
120145
|
+
const {
|
|
120146
|
+
name: key,
|
|
120147
|
+
schema
|
|
120148
|
+
} = operationSchema;
|
|
119873
120149
|
let valueToWrite = unTypedEntry[key];
|
|
119874
120150
|
if (valueToWrite === undefined) {
|
|
119875
120151
|
if (typeof schema === 'object' && schema && !('optional' in schema)) {
|
|
119876
120152
|
throw new Error(`Key ${key} for operation ${typeStr} is not optional but undefined value provided`);
|
|
119877
120153
|
}
|
|
119878
120154
|
continue;
|
|
119879
|
-
} else if (
|
|
119880
|
-
|
|
119881
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
119882
|
-
const typedValue = valueToWrite;
|
|
119883
|
-
valueToWrite = {
|
|
119884
|
-
type: 'context',
|
|
119885
|
-
kind: 'explicit',
|
|
119886
|
-
value: valueToWrite.type,
|
|
119887
|
-
contains: [typedValue.signers.map(function (signer) {
|
|
119888
|
-
return signer.publicKeyAndType;
|
|
119889
|
-
}), typedValue.quorum]
|
|
119890
|
-
};
|
|
120155
|
+
} else if ('encode' in operationSchema) {
|
|
120156
|
+
valueToWrite = operationSchema.encode(valueToWrite);
|
|
119891
120157
|
} else if (typeof valueToWrite === 'string') {
|
|
119892
120158
|
valueToWrite = {
|
|
119893
120159
|
type: 'string',
|
|
@@ -119896,16 +120162,10 @@ function client_ExportBlockOperations(operations) {
|
|
|
119896
120162
|
};
|
|
119897
120163
|
} else if (client_lib_account.isInstance(valueToWrite)) {
|
|
119898
120164
|
valueToWrite = valueToWrite.publicKeyAndType;
|
|
119899
|
-
} else if (client_permissions_Permissions.isInstance(valueToWrite)) {
|
|
119900
|
-
valueToWrite = [valueToWrite.base.bigint, valueToWrite.external.bigint];
|
|
119901
120165
|
} else if (src_client_Certificate.isCertificate(valueToWrite)) {
|
|
119902
120166
|
valueToWrite = client_operations_Buffer.from(valueToWrite.toDER());
|
|
119903
120167
|
} else if (src_client_CertificateHash.isInstance(valueToWrite)) {
|
|
119904
120168
|
valueToWrite = valueToWrite.getBuffer();
|
|
119905
|
-
} else if (src_client_CertificateBundle.isInstance(valueToWrite)) {
|
|
119906
|
-
valueToWrite = valueToWrite.getCertificates().map(function (certificate) {
|
|
119907
|
-
return client_operations_Buffer.from(certificate.toDER());
|
|
119908
|
-
});
|
|
119909
120169
|
}
|
|
119910
120170
|
operationContainer.push(valueToWrite);
|
|
119911
120171
|
}
|
|
@@ -119933,72 +120193,29 @@ function client_ImportOperationsASN1(input, network) {
|
|
|
119933
120193
|
throw new Error(`Found entry which is not a Sequence ${typeof entry}`);
|
|
119934
120194
|
}
|
|
119935
120195
|
const typeStr = client_operationTypeToString(type);
|
|
119936
|
-
const
|
|
119937
|
-
if (!
|
|
120196
|
+
const operationSchemas = client_BlockOperationASN1SchemaBase[typeStr];
|
|
120197
|
+
if (!operationSchemas) {
|
|
119938
120198
|
throw new Error(`Found valid operation ${typeStr} with invalid keys`);
|
|
119939
120199
|
}
|
|
119940
120200
|
operation.type = type;
|
|
119941
120201
|
let keyIndex = -1;
|
|
119942
|
-
for (const {
|
|
119943
|
-
|
|
119944
|
-
} of operationSchema) {
|
|
120202
|
+
for (const operationSchema of operationSchemas) {
|
|
120203
|
+
const key = operationSchema.name;
|
|
119945
120204
|
keyIndex++;
|
|
119946
120205
|
const keyValueIn = entry[keyIndex];
|
|
119947
120206
|
let keyValueOut = undefined;
|
|
119948
120207
|
if (keyValueIn === undefined) {
|
|
119949
120208
|
break;
|
|
120209
|
+
} else if ('decode' in operationSchema) {
|
|
120210
|
+
keyValueOut = operationSchema.decode(keyValueIn);
|
|
119950
120211
|
} else if (['bigint', 'string', 'boolean'].includes(typeof keyValueIn)) {
|
|
119951
120212
|
keyValueOut = keyValueIn;
|
|
119952
120213
|
} else if (typeof keyValueIn === 'number') {
|
|
119953
120214
|
keyValueOut = client_ASN1IntegerToBigInt(keyValueIn);
|
|
119954
120215
|
} else if (keyValueIn === null) {
|
|
119955
120216
|
keyValueOut = null;
|
|
119956
|
-
} else if (Array.isArray(keyValueIn) && key.toLowerCase().includes('permission')) {
|
|
119957
|
-
// We are parsing a Permission
|
|
119958
|
-
const [base, external] = keyValueIn;
|
|
119959
|
-
const newKeyValue = new client_permissions_Permissions(base, external);
|
|
119960
|
-
newKeyValue.validate(network);
|
|
119961
|
-
keyValueOut = newKeyValue;
|
|
119962
|
-
} else if (key === 'createArguments' && typeStr === 'CREATE_IDENTIFIER') {
|
|
119963
|
-
if (!client_ASN1CheckUtilities.isASN1ContextTag(keyValueIn, 'explicit')) {
|
|
119964
|
-
throw new Error('Invalid createArgs type for CREATE_IDENTIFIER operation');
|
|
119965
|
-
}
|
|
119966
|
-
if (keyValueIn.value !== client_AccountKeyAlgorithm.MULTISIG) {
|
|
119967
|
-
throw new Error('unrecognized type for multisig create arguments');
|
|
119968
|
-
}
|
|
119969
|
-
if (!Array.isArray(keyValueIn.contains) || keyValueIn.contains.length !== 2) {
|
|
119970
|
-
throw new Error('Invalid createArgs container');
|
|
119971
|
-
}
|
|
119972
|
-
if (!Array.isArray(keyValueIn.contains[0])) {
|
|
119973
|
-
throw new Error('Invalid createArgs container');
|
|
119974
|
-
}
|
|
119975
|
-
keyValueOut = {
|
|
119976
|
-
type: keyValueIn.value,
|
|
119977
|
-
signers: keyValueIn.contains[0].map(function (value) {
|
|
119978
|
-
if (!client_operations_Buffer.isBuffer(value)) {
|
|
119979
|
-
throw new Error(`Invalid signer value, expected Buffer, got ${typeof value}`);
|
|
119980
|
-
}
|
|
119981
|
-
return client_lib_account.fromPublicKeyAndType(value);
|
|
119982
|
-
}),
|
|
119983
|
-
quorum: keyValueIn.contains[1]
|
|
119984
|
-
};
|
|
119985
|
-
} else if (Array.isArray(keyValueIn) && key === 'intermediateCertificates') {
|
|
119986
|
-
keyValueOut = new src_client_CertificateBundle(keyValueIn.map(function (certificate) {
|
|
119987
|
-
return new src_client_Certificate(certificate);
|
|
119988
|
-
}));
|
|
119989
120217
|
} else if (client_isBuffer(keyValueIn)) {
|
|
119990
|
-
|
|
119991
|
-
const method = client_toAdjustMethod(operation['method']);
|
|
119992
|
-
if (method === client_AdjustMethod.SUBTRACT) {
|
|
119993
|
-
keyValueOut = new src_client_CertificateHash(keyValueIn);
|
|
119994
|
-
} else if (method === client_AdjustMethod.ADD) {
|
|
119995
|
-
keyValueOut = new src_client_Certificate(keyValueIn);
|
|
119996
|
-
} else {
|
|
119997
|
-
throw new Error(`Unrecognized method for MANAGE_CERTIFICATE operation: ${method}`);
|
|
119998
|
-
}
|
|
119999
|
-
} else {
|
|
120000
|
-
keyValueOut = client_lib_account.fromPublicKeyAndType(keyValueIn);
|
|
120001
|
-
}
|
|
120218
|
+
keyValueOut = client_lib_account.fromPublicKeyAndType(keyValueIn);
|
|
120002
120219
|
} else if (typeof keyValueIn === 'object' && keyValueIn !== null) {
|
|
120003
120220
|
if ('type' in keyValueIn && 'kind' in keyValueIn && 'value' in keyValueIn) {
|
|
120004
120221
|
if (keyValueIn.type === 'string' && keyValueIn.kind === 'utf8') {
|
|
@@ -120943,7 +121160,7 @@ function client_validateRecalculatedBytes() {
|
|
|
120943
121160
|
if (!recalculatedBytesBuffer.equals(existingBytesBuffer)) {
|
|
120944
121161
|
const existingBytesHash = client_block_Buffer.from(client_hash_Hash(existingBytesBuffer)).toString('hex').toUpperCase();
|
|
120945
121162
|
const recalculatedBytesHash = client_block_Buffer.from(client_hash_Hash(recalculatedBytesBuffer)).toString('hex').toUpperCase();
|
|
120946
|
-
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_SIGNATURE', `Block signed bytes (${existingBytesHash}) do not match calculated bytes (${recalculatedBytesHash})`);
|
|
121163
|
+
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_SIGNATURE', `Block signed bytes (${existingBytesHash}) do not match calculated bytes (${recalculatedBytesHash}) for block with hash ${this.hash.toString()}`);
|
|
120947
121164
|
}
|
|
120948
121165
|
}
|
|
120949
121166
|
function client_validateOperationsPurpose() {
|
|
@@ -121113,8 +121330,11 @@ class src_client_UnsignedBlock extends src_client_PossiblyUnsignedBlock {
|
|
|
121113
121330
|
async seal() {
|
|
121114
121331
|
const signers = src_client_UnsignedBlock.getSortedRequiredSigners(this.signer);
|
|
121115
121332
|
const hash = this.hash;
|
|
121333
|
+
const ancillaryData = this.toBytes(false);
|
|
121116
121334
|
const signatures = await Promise.all(signers.map(async function (signer) {
|
|
121117
|
-
const signature = await signer.sign(hash.getBuffer()
|
|
121335
|
+
const signature = await signer.sign(hash.getBuffer(), {
|
|
121336
|
+
ancillaryData
|
|
121337
|
+
});
|
|
121118
121338
|
return signature.getBuffer();
|
|
121119
121339
|
}));
|
|
121120
121340
|
const shared = {
|
|
@@ -121538,26 +121758,6 @@ client_lib_block_defineProperty(src_client_BlockBuilder, "Operation", src_client
|
|
|
121538
121758
|
client_lib_block_defineProperty(src_client_BlockBuilder, "NO_PREVIOUS", src_client_Block.NO_PREVIOUS);
|
|
121539
121759
|
src_client_Block.Builder = src_client_BlockBuilder;
|
|
121540
121760
|
/* harmony default export */ const client_lib_block = (src_client_Block);
|
|
121541
|
-
;// ./src/lib/error/account.ts
|
|
121542
|
-
var client_KeetaNetAccountError;
|
|
121543
|
-
function client_account_defineProperty(e, r, t) { return (r = client_account_toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
121544
|
-
function client_account_toPropertyKey(t) { var i = client_account_toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
121545
|
-
function client_account_toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
121546
|
-
|
|
121547
|
-
|
|
121548
|
-
const client_AccountErrorType = 'ACCOUNT';
|
|
121549
|
-
const client_AccountErrorCodes = ['INVALID_PREFIX', 'INVALID_KEYTYPE', 'INVALID_KEYTYPE_EXTERNAL', 'PASSPHRASE_WEAK', 'INVALID_CONSTRUCTION', 'NO_IDENTIFIER_SIGN', 'NO_IDENTIFIER_VERIFY', 'INVALID_IDENTIFIER_CONSTRUCTION', 'SEED_INDEX_UNDEFINED', 'SEED_INDEX_NEGATIVE', 'SEED_INDEX_NOT_INT', 'SEED_INDEX_TOO_LARGE', 'ENCRYPTION_NOT_SUPPORTED'];
|
|
121550
|
-
const client_FullAccountErrorCodes = client_AccountErrorCodes.map(code => `${client_AccountErrorType}_${code}`);
|
|
121551
|
-
class src_client_KeetaNetAccountError extends src_client_KeetaNetErrorBase {
|
|
121552
|
-
constructor(code, message) {
|
|
121553
|
-
super(code, message, {
|
|
121554
|
-
type: client_AccountErrorType,
|
|
121555
|
-
codes: client_AccountErrorCodes
|
|
121556
|
-
});
|
|
121557
|
-
}
|
|
121558
|
-
}
|
|
121559
|
-
client_KeetaNetAccountError = src_client_KeetaNetAccountError;
|
|
121560
|
-
client_account_defineProperty(src_client_KeetaNetAccountError, "isInstance", client_checkableGenerator(client_KeetaNetAccountError));
|
|
121561
121761
|
;// ./src/lib/utils/ed2curve.ts
|
|
121562
121762
|
// https://raw.githubusercontent.com/jjavery/ed25519-to-x25519/main/src/ed2curve.js
|
|
121563
121763
|
|
|
@@ -122328,7 +122528,7 @@ class src_client_ExternalKeyPair extends client_KeyInterface {
|
|
|
122328
122528
|
return client_account_classPrivateFieldGet(client_functions, this).decrypt(...arguments);
|
|
122329
122529
|
}
|
|
122330
122530
|
get supportsEncryption() {
|
|
122331
|
-
return
|
|
122531
|
+
return client_account_classPrivateFieldGet(client_functions, this).supportsEncryption;
|
|
122332
122532
|
}
|
|
122333
122533
|
get keyType() {
|
|
122334
122534
|
return client_account_classPrivateFieldGet(client_keyType, this);
|
|
@@ -123019,10 +123219,8 @@ function client_derivePublicKeyStringFromPublicKey(key, keyType) {
|
|
|
123019
123219
|
}
|
|
123020
123220
|
|
|
123021
123221
|
/**
|
|
123022
|
-
*
|
|
123023
|
-
*
|
|
123024
|
-
*
|
|
123025
|
-
* @template T - The type of the key algorithm used for this account.
|
|
123222
|
+
* Statically validate that the KeyPairClassesByAlgorithm type has
|
|
123223
|
+
* every AccountKeyAlgorithm as a key
|
|
123026
123224
|
*/
|
|
123027
123225
|
var client_privateKeyPair = /*#__PURE__*/new WeakMap();
|
|
123028
123226
|
var client_publicKeyPair2 = /*#__PURE__*/new WeakMap();
|
|
@@ -123030,6 +123228,12 @@ var client_keyType4 = /*#__PURE__*/new WeakMap();
|
|
|
123030
123228
|
var client_keyPairHandlesHashing = /*#__PURE__*/new WeakMap();
|
|
123031
123229
|
var client_publicKeyString2 = /*#__PURE__*/new WeakMap();
|
|
123032
123230
|
var client_publicKeyAndTypeString = /*#__PURE__*/new WeakMap();
|
|
123231
|
+
/**
|
|
123232
|
+
* Account class, which is used to represent a key pair or an identifier
|
|
123233
|
+
* account (which have no private key) such as tokens.
|
|
123234
|
+
*
|
|
123235
|
+
* @template T - The type of the key algorithm used for this account.
|
|
123236
|
+
*/
|
|
123033
123237
|
class src_client_Account {
|
|
123034
123238
|
/**
|
|
123035
123239
|
* Construct an account from a public key string. The public key
|
|
@@ -123399,6 +123603,9 @@ class src_client_Account {
|
|
|
123399
123603
|
if (client_account_classPrivateFieldGet(client_privateKeyPair, this) === null) {
|
|
123400
123604
|
throw new Error('May not sign unless a private key is available');
|
|
123401
123605
|
}
|
|
123606
|
+
if (options.namespace !== undefined) {
|
|
123607
|
+
data = client_applyNamespace(options.namespace, data);
|
|
123608
|
+
}
|
|
123402
123609
|
if (!client_account_classPrivateFieldGet(client_keyPairHandlesHashing, this) && !options.raw) {
|
|
123403
123610
|
data = client_hash_Hash(client_account_Buffer.from(data));
|
|
123404
123611
|
}
|
|
@@ -123414,6 +123621,9 @@ class src_client_Account {
|
|
|
123414
123621
|
forCert: false,
|
|
123415
123622
|
...options
|
|
123416
123623
|
};
|
|
123624
|
+
if (options.namespace !== undefined) {
|
|
123625
|
+
data = client_applyNamespace(options.namespace, data);
|
|
123626
|
+
}
|
|
123417
123627
|
if (!client_account_classPrivateFieldGet(client_keyPairHandlesHashing, this) && !options.raw) {
|
|
123418
123628
|
data = client_hash_Hash(client_account_Buffer.from(data));
|
|
123419
123629
|
}
|
|
@@ -123556,10 +123766,12 @@ class src_client_Account {
|
|
|
123556
123766
|
* Determine if an account is an identifier
|
|
123557
123767
|
*/
|
|
123558
123768
|
isIdentifier() {
|
|
123559
|
-
|
|
123560
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
123561
|
-
return client_identifierKeyTypes.includes(this.keyType);
|
|
123769
|
+
return src_client_Account.isIdentifierKeyType(client_account_classPrivateFieldGet(client_keyType4, this));
|
|
123562
123770
|
}
|
|
123771
|
+
|
|
123772
|
+
/**
|
|
123773
|
+
* Determine if an account is a regular (non-identifier)
|
|
123774
|
+
*/
|
|
123563
123775
|
isAccount() {
|
|
123564
123776
|
return !this.isIdentifier();
|
|
123565
123777
|
}
|
|
@@ -123593,7 +123805,7 @@ class src_client_Account {
|
|
|
123593
123805
|
}
|
|
123594
123806
|
assertAccount() {
|
|
123595
123807
|
if (this.isIdentifier() !== false) {
|
|
123596
|
-
throw new
|
|
123808
|
+
throw new src_client_KeetaNetAccountError('ACCOUNT_NOT_ACCOUNT', 'Required Account but got Identifier');
|
|
123597
123809
|
}
|
|
123598
123810
|
|
|
123599
123811
|
// We need to assert this type because we are changing what the constructed type is
|
|
@@ -123602,7 +123814,7 @@ class src_client_Account {
|
|
|
123602
123814
|
}
|
|
123603
123815
|
assertIdentifier() {
|
|
123604
123816
|
if (this.isIdentifier() !== true) {
|
|
123605
|
-
throw new
|
|
123817
|
+
throw new src_client_KeetaNetAccountError('ACCOUNT_NOT_IDENTIFIER', `Required Identifier but got Account, ${this.keyType}`);
|
|
123606
123818
|
}
|
|
123607
123819
|
|
|
123608
123820
|
// We need to assert this type because we are changing what the constructed type is
|
|
@@ -123619,6 +123831,18 @@ client_Account = src_client_Account;
|
|
|
123619
123831
|
*/
|
|
123620
123832
|
client_lib_account_defineProperty(src_client_Account, "AccountKeyAlgorithm", client_AccountKeyAlgorithm);
|
|
123621
123833
|
client_lib_account_defineProperty(src_client_Account, "ExternalKeyPair", src_client_ExternalKeyPair);
|
|
123834
|
+
/**
|
|
123835
|
+
* Access to the underlying Key Pair classes for advanced use cases.
|
|
123836
|
+
*/
|
|
123837
|
+
client_lib_account_defineProperty(src_client_Account, "KeyPairs", {
|
|
123838
|
+
[client_AccountKeyAlgorithm.ECDSA_SECP256K1]: src_client_ECDSASECP256K1KeyPair,
|
|
123839
|
+
[client_AccountKeyAlgorithm.ECDSA_SECP256R1]: src_client_ECDSASECP256R1KeyPair,
|
|
123840
|
+
[client_AccountKeyAlgorithm.ED25519]: src_client_ED25519KeyPair,
|
|
123841
|
+
[client_AccountKeyAlgorithm.NETWORK]: src_client_IdentifierKeyPair,
|
|
123842
|
+
[client_AccountKeyAlgorithm.TOKEN]: src_client_IdentifierKeyPair,
|
|
123843
|
+
[client_AccountKeyAlgorithm.STORAGE]: src_client_IdentifierKeyPair,
|
|
123844
|
+
[client_AccountKeyAlgorithm.MULTISIG]: src_client_IdentifierKeyPair
|
|
123845
|
+
});
|
|
123622
123846
|
client_lib_account_defineProperty(src_client_Account, "isInstance", client_checkableGenerator(client_Account));
|
|
123623
123847
|
client_lib_account_defineProperty(src_client_Account, "Set", client_setGenerator(client_Account, function (account) {
|
|
123624
123848
|
const retval = account.publicKeyAndTypeString;
|
|
@@ -123662,7 +123886,7 @@ const client_VoteErrorCodes = [
|
|
|
123662
123886
|
// Errors related to VoteStaple
|
|
123663
123887
|
'STAPLE_INVALID_CONSTRUCTION', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_COUNT', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_MISSING', 'STAPLE_ALL_VOTES_MUST_HAVE_SAME_BLOCKS_ORDER', 'STAPLE_DUPLICATE_VOTE_ISSUER', 'STAPLE_PERMANENCE_MISMATCH',
|
|
123664
123888
|
// Errors related to VoteBuilder
|
|
123665
|
-
'BUILDER_INVALID_CONSTRUCTION', 'BUILDER_INVALID_BLOCK_TYPE', 'BUILDER_INVALID_SERIAL', 'BUILDER_INVALID_VALID_TO_FROM',
|
|
123889
|
+
'BUILDER_INVALID_CONSTRUCTION', 'BUILDER_INVALID_BLOCK_TYPE', 'BUILDER_INVALID_SERIAL', 'BUILDER_INVALID_VALID_TO_FROM', 'BUILDER_INVALID_FEE',
|
|
123666
123890
|
/**
|
|
123667
123891
|
* Malformed ASN.1 Errors
|
|
123668
123892
|
*/
|
|
@@ -123676,7 +123900,7 @@ const client_VoteErrorCodes = [
|
|
|
123676
123900
|
// Errors from the blockHashesFromVote function
|
|
123677
123901
|
'MALFORMED_HASHES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_HASHES_FROM_VOTE_INVALID_TYPE', 'MALFORMED_HASHES_FROM_VOTE_INVALID_CONTEXT_SPECIFIC', 'MALFORMED_HASHES_FROM_VOTE_DATA_NEEDS_OID', 'MALFORMED_HASHES_FROM_VOTE_DATA_HASH_DATA_MUST_BE_SEQUENCE', 'MALFORMED_HASHES_FROM_VOTE_DATA_NOT_TWO_ITEMS', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_FUNC', 'MALFORMED_HASHES_FROM_VOTE_DATA_UNSUPPORTED_HASH_TYPE', 'MALFORMED_HASHES_FROM_VOTE_DATA_SECOND_MUST_BE_SEQUENCE',
|
|
123678
123902
|
// Errors from the feesFromVote function
|
|
123679
|
-
'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN',
|
|
123903
|
+
'MALFORMED_FEES_AMOUNT', 'MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'MALFORMED_FEES_IN_PERMANENT_VOTE', 'MALFORMED_FEES_INVALID_QUOTE_VALUE', 'MALFORMED_FEES_MULTIPLE_FEE_EMPTY', 'MALFORMED_FEES_PAY_TO_INVALID', 'MALFORMED_FEES_TOKEN_NOT_TOKEN',
|
|
123680
123904
|
// Fee Quote Errors
|
|
123681
123905
|
'FEE_IS_QUOTE', 'FEE_QUOTE_MISSING_FEES', 'FEE_NOT_QUOTE', 'MALFORMED_FEES_KIND_MISSING', 'MALFORMED_FEES_QUOTE_INVALID'];
|
|
123682
123906
|
const client_FullVoteErrorCodes = client_VoteErrorCodes.map(code => `${client_VoteErrorType}_${code}`);
|
|
@@ -123836,7 +124060,7 @@ function client_addPermissionRequirement(state, requirement) {
|
|
|
123836
124060
|
}
|
|
123837
124061
|
if (state.accounts[entityPubKey] !== undefined) {
|
|
123838
124062
|
const entityInfo = state.accounts[entityPubKey].fields.info;
|
|
123839
|
-
if (entityInfo !== undefined) {
|
|
124063
|
+
if (entityInfo !== undefined && 'defaultPermission' in entityInfo) {
|
|
123840
124064
|
const defaultPermission = entityInfo.defaultPermission;
|
|
123841
124065
|
if (defaultPermission !== undefined) {
|
|
123842
124066
|
if (requirement.permissions === null || defaultPermission.has(requirement.permissions)) {
|
|
@@ -123915,17 +124139,25 @@ function client_modifyBalanceInState(balanceState) {
|
|
|
123915
124139
|
}
|
|
123916
124140
|
function client_updateAccountInfoInState(state, account, info) {
|
|
123917
124141
|
const accountPubKey = account.publicKeyString.get();
|
|
123918
|
-
|
|
124142
|
+
let toUpdate = {
|
|
123919
124143
|
name: info.name,
|
|
123920
124144
|
description: info.description,
|
|
123921
124145
|
metadata: info.metadata
|
|
123922
124146
|
};
|
|
123923
124147
|
if (account.isIdentifier()) {
|
|
123924
|
-
if (info.defaultPermission !== undefined) {
|
|
123925
|
-
toUpdate
|
|
124148
|
+
if ('defaultPermission' in info && info.defaultPermission !== undefined) {
|
|
124149
|
+
toUpdate = {
|
|
124150
|
+
...toUpdate,
|
|
124151
|
+
defaultPermission: info.defaultPermission
|
|
124152
|
+
};
|
|
123926
124153
|
}
|
|
123927
|
-
if (account.isMultisig()
|
|
123928
|
-
|
|
124154
|
+
if (account.isMultisig()) {
|
|
124155
|
+
if ('multisigQuorum' in info && info.multisigQuorum !== undefined) {
|
|
124156
|
+
toUpdate = {
|
|
124157
|
+
...toUpdate,
|
|
124158
|
+
multisigQuorum: info.multisigQuorum
|
|
124159
|
+
};
|
|
124160
|
+
}
|
|
123929
124161
|
}
|
|
123930
124162
|
} else {
|
|
123931
124163
|
state.possibleNewAccounts.add(account);
|
|
@@ -124594,24 +124826,49 @@ class src_client_VoteHash extends src_client_BufferStorage {
|
|
|
124594
124826
|
}
|
|
124595
124827
|
client_VoteHash = src_client_VoteHash;
|
|
124596
124828
|
client_lib_vote_defineProperty(src_client_VoteHash, "isInstance", client_checkableGenerator(client_VoteHash));
|
|
124829
|
+
const client_singleFeeEntrySchema = [client_ValidateASN1.IsBoolean, client_ValidateASN1.IsInteger, {
|
|
124830
|
+
optional: {
|
|
124831
|
+
type: 'context',
|
|
124832
|
+
value: 0,
|
|
124833
|
+
kind: 'implicit',
|
|
124834
|
+
contains: client_ValidateASN1.IsOctetString
|
|
124835
|
+
}
|
|
124836
|
+
}, {
|
|
124837
|
+
optional: {
|
|
124838
|
+
type: 'context',
|
|
124839
|
+
value: 1,
|
|
124840
|
+
kind: 'implicit',
|
|
124841
|
+
contains: client_ValidateASN1.IsOctetString
|
|
124842
|
+
}
|
|
124843
|
+
}];
|
|
124844
|
+
const client_multipleFeeEntrySchema = {
|
|
124845
|
+
type: 'context',
|
|
124846
|
+
value: 0,
|
|
124847
|
+
kind: 'explicit',
|
|
124848
|
+
contains: {
|
|
124849
|
+
sequenceOf: client_singleFeeEntrySchema
|
|
124850
|
+
}
|
|
124851
|
+
};
|
|
124597
124852
|
const client_feeExtensionSchema = {
|
|
124598
124853
|
type: 'context',
|
|
124599
124854
|
value: 0,
|
|
124600
124855
|
kind: 'explicit',
|
|
124601
|
-
contains:
|
|
124602
|
-
|
|
124603
|
-
|
|
124604
|
-
|
|
124605
|
-
|
|
124606
|
-
|
|
124607
|
-
|
|
124608
|
-
|
|
124609
|
-
|
|
124610
|
-
|
|
124611
|
-
|
|
124612
|
-
|
|
124613
|
-
|
|
124614
|
-
|
|
124856
|
+
contains: {
|
|
124857
|
+
choice: [client_singleFeeEntrySchema, client_multipleFeeEntrySchema]
|
|
124858
|
+
}
|
|
124859
|
+
};
|
|
124860
|
+
|
|
124861
|
+
/**
|
|
124862
|
+
* Exported to use in tests but not needed externally
|
|
124863
|
+
* @internal
|
|
124864
|
+
*/
|
|
124865
|
+
|
|
124866
|
+
const client_hashDataSchema = {
|
|
124867
|
+
type: 'context',
|
|
124868
|
+
value: 0,
|
|
124869
|
+
kind: 'explicit',
|
|
124870
|
+
contains: [client_ValidateASN1.IsOID, {
|
|
124871
|
+
sequenceOf: client_ValidateASN1.IsOctetString
|
|
124615
124872
|
}]
|
|
124616
124873
|
};
|
|
124617
124874
|
/**
|
|
@@ -124693,36 +124950,21 @@ function client_blockHashesFromVote(input) {
|
|
|
124693
124950
|
}
|
|
124694
124951
|
return output;
|
|
124695
124952
|
}
|
|
124696
|
-
function
|
|
124697
|
-
const
|
|
124698
|
-
|
|
124699
|
-
const feeInformation = function () {
|
|
124700
|
-
try {
|
|
124701
|
-
return feeSchemaChecker.validate(feeInformationAnyJS);
|
|
124702
|
-
} catch (asn1ValidateError) {
|
|
124703
|
-
let message = 'internal error: fee asn1 schema is not the right format';
|
|
124704
|
-
if (asn1ValidateError instanceof Error) {
|
|
124705
|
-
message = `${message}: ${asn1ValidateError.message}`;
|
|
124706
|
-
}
|
|
124707
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message);
|
|
124708
|
-
}
|
|
124709
|
-
}();
|
|
124710
|
-
const feeData = feeInformation.contains;
|
|
124711
|
-
const quote = feeData[0];
|
|
124712
|
-
const retval = {
|
|
124713
|
-
quote: quote,
|
|
124714
|
-
fee: {
|
|
124715
|
-
amount: feeData[1]
|
|
124716
|
-
}
|
|
124953
|
+
function client_parseSingleFeeEntry(feeData) {
|
|
124954
|
+
const fee = {
|
|
124955
|
+
amount: feeData[1]
|
|
124717
124956
|
};
|
|
124957
|
+
if (fee.amount < 0n) {
|
|
124958
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_AMOUNT', 'internal error: fee amount cannot be negative');
|
|
124959
|
+
}
|
|
124718
124960
|
const payToAsn1 = feeData[2];
|
|
124719
124961
|
if (payToAsn1 !== undefined) {
|
|
124720
124962
|
const payTo = client_lib_account.fromPublicKeyAndType(client_vote_Buffer.from(payToAsn1.contains));
|
|
124721
124963
|
if (payTo.isStorage()) {
|
|
124722
|
-
|
|
124964
|
+
fee.payTo = payTo;
|
|
124723
124965
|
} else {
|
|
124724
124966
|
try {
|
|
124725
|
-
|
|
124967
|
+
fee.payTo = payTo.assertAccount();
|
|
124726
124968
|
} catch {
|
|
124727
124969
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_PAY_TO_INVALID', 'internal error: payTo is not an Account or Storage Address');
|
|
124728
124970
|
}
|
|
@@ -124734,9 +124976,66 @@ function client_feeFromVote(input) {
|
|
|
124734
124976
|
if (!token.isToken()) {
|
|
124735
124977
|
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'internal error: fees extension token is not a valid token');
|
|
124736
124978
|
}
|
|
124737
|
-
|
|
124979
|
+
fee.token = token;
|
|
124980
|
+
}
|
|
124981
|
+
return fee;
|
|
124982
|
+
}
|
|
124983
|
+
function client_feeFromVote(input) {
|
|
124984
|
+
const feeInformationAnyJS = client_ASN1toJS(client_bufferToArrayBuffer(input));
|
|
124985
|
+
const feeSchemaChecker = new client_ValidateASN1(client_feeExtensionSchema);
|
|
124986
|
+
const feeInformation = function () {
|
|
124987
|
+
try {
|
|
124988
|
+
return feeSchemaChecker.validate(feeInformationAnyJS);
|
|
124989
|
+
} catch (asn1ValidateError) {
|
|
124990
|
+
let message = 'internal error: fee asn1 schema is not the right format';
|
|
124991
|
+
if (asn1ValidateError instanceof Error) {
|
|
124992
|
+
message = `${message}: ${asn1ValidateError.message}`;
|
|
124993
|
+
}
|
|
124994
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', message);
|
|
124995
|
+
}
|
|
124996
|
+
}();
|
|
124997
|
+
const feeData = feeInformation.contains;
|
|
124998
|
+
|
|
124999
|
+
/**
|
|
125000
|
+
* Detect format: check if single fee entry (array of attributes) or multiple fee format (context object)
|
|
125001
|
+
* We've already validated the object against the schema so we know it's one or the other
|
|
125002
|
+
*/
|
|
125003
|
+
if (Array.isArray(feeData)) {
|
|
125004
|
+
const quote = feeData[0];
|
|
125005
|
+
const fee = client_parseSingleFeeEntry(feeData);
|
|
125006
|
+
return {
|
|
125007
|
+
quote: quote,
|
|
125008
|
+
fee: fee
|
|
125009
|
+
};
|
|
125010
|
+
} else {
|
|
125011
|
+
// New array format - explicit sequence of fee entries
|
|
125012
|
+
const multiFeeData = feeData.contains;
|
|
125013
|
+
if (multiFeeData.length === 0) {
|
|
125014
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_MULTIPLE_FEE_EMPTY', 'internal error: multiple fee entries must not be an empty array');
|
|
125015
|
+
}
|
|
125016
|
+
const feeList = [];
|
|
125017
|
+
let quote;
|
|
125018
|
+
for (const entry of multiFeeData) {
|
|
125019
|
+
// Schema already validated, but need to narrow the type
|
|
125020
|
+
if (!Array.isArray(entry)) {
|
|
125021
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_FROM_VOTE_INVALID_INPUT', 'internal error: each fee entry must be a Sequence');
|
|
125022
|
+
}
|
|
125023
|
+
const entryQuote = entry[0];
|
|
125024
|
+
if (quote === undefined) {
|
|
125025
|
+
quote = entryQuote;
|
|
125026
|
+
} else if (quote !== entryQuote) {
|
|
125027
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_INVALID_QUOTE_VALUE', 'internal error: all fee entries must have the same quote value');
|
|
125028
|
+
}
|
|
125029
|
+
feeList.push(client_parseSingleFeeEntry(entry));
|
|
125030
|
+
}
|
|
125031
|
+
if (quote === undefined) {
|
|
125032
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_INVALID_QUOTE_VALUE', 'internal error: quote value should not be undefined');
|
|
125033
|
+
}
|
|
125034
|
+
return {
|
|
125035
|
+
quote: quote,
|
|
125036
|
+
fee: feeList
|
|
125037
|
+
};
|
|
124738
125038
|
}
|
|
124739
|
-
return retval;
|
|
124740
125039
|
}
|
|
124741
125040
|
|
|
124742
125041
|
/**
|
|
@@ -124900,14 +125199,22 @@ class src_client_VoteLikeBase {
|
|
|
124900
125199
|
if (fee === undefined) {
|
|
124901
125200
|
return false;
|
|
124902
125201
|
}
|
|
124903
|
-
|
|
125202
|
+
// Handle both single fee and list of fee choices
|
|
125203
|
+
const feeList = Array.isArray(fee) ? fee : [fee];
|
|
125204
|
+
// Reject empty fee arrays to avoid downstream encoding/decoding issues
|
|
125205
|
+
if (feeList.length === 0) {
|
|
124904
125206
|
return false;
|
|
124905
125207
|
}
|
|
124906
|
-
|
|
124907
|
-
|
|
124908
|
-
|
|
124909
|
-
|
|
124910
|
-
|
|
125208
|
+
for (const feeEntry of feeList) {
|
|
125209
|
+
if (feeEntry['amount'] === undefined) {
|
|
125210
|
+
return false;
|
|
125211
|
+
}
|
|
125212
|
+
if ('payTo' in feeEntry && feeEntry['payTo'] === undefined) {
|
|
125213
|
+
return false;
|
|
125214
|
+
}
|
|
125215
|
+
if ('token' in feeEntry && feeEntry['token'] === undefined) {
|
|
125216
|
+
return false;
|
|
125217
|
+
}
|
|
124911
125218
|
}
|
|
124912
125219
|
}
|
|
124913
125220
|
if ('quote' in voteJSON) {
|
|
@@ -124920,7 +125227,7 @@ class src_client_VoteLikeBase {
|
|
|
124920
125227
|
static fromJSON(voteJSON) {
|
|
124921
125228
|
var _voteJSON$quote;
|
|
124922
125229
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
124923
|
-
if (!
|
|
125230
|
+
if (!this.isValidJSON(voteJSON)) {
|
|
124924
125231
|
throw new src_client_KeetaNetVoteError('VOTE_INVALID_CONSTRUCTION_JSON', 'Cannot construct vote, it is not a valid vote JSON object');
|
|
124925
125232
|
}
|
|
124926
125233
|
const issuer = client_lib_account.toAccount(voteJSON.issuer);
|
|
@@ -124995,8 +125302,8 @@ class src_client_VoteLikeBase {
|
|
|
124995
125302
|
vote = client_bufferToArrayBuffer(vote);
|
|
124996
125303
|
}
|
|
124997
125304
|
if (!client_util.types.isArrayBuffer(vote)) {
|
|
124998
|
-
if (
|
|
124999
|
-
vote =
|
|
125305
|
+
if (this.getClass().isValidJSON(vote)) {
|
|
125306
|
+
vote = this.getClass().fromJSON(vote).toBytes();
|
|
125000
125307
|
} else {
|
|
125001
125308
|
throw new src_client_KeetaNetVoteError('VOTE_INVALID_CONSTRUCTION', 'internal error: invalid vote constructor argument in VoteLikeBase');
|
|
125002
125309
|
}
|
|
@@ -125115,14 +125422,14 @@ class src_client_VoteLikeBase {
|
|
|
125115
125422
|
* Votes must not be expired
|
|
125116
125423
|
*/
|
|
125117
125424
|
const expirationCheckMomentISO = new Date(expirationCheckMoment).toISOString();
|
|
125118
|
-
if (expirationCheckMoment < this.validityFrom.valueOf() -
|
|
125425
|
+
if (expirationCheckMoment < this.validityFrom.valueOf() - this.getClass().allowedSlop) {
|
|
125119
125426
|
throw new src_client_KeetaNetVoteError('VOTE_MOMENT_BEFORE_VALIDITY_FROM', `Vote was issued in the future (issued on ${validFrom.toISOString()}; moment: ${expirationCheckMomentISO})`);
|
|
125120
125427
|
}
|
|
125121
125428
|
|
|
125122
125429
|
/**
|
|
125123
125430
|
* If the vote is forever viable, it is a permanent vote
|
|
125124
125431
|
*/
|
|
125125
|
-
if (this.validityTo.valueOf() > expirationCheckMoment +
|
|
125432
|
+
if (this.validityTo.valueOf() > expirationCheckMoment + this.getClass().permanentVoteThreshold) {
|
|
125126
125433
|
this.$permanent = true;
|
|
125127
125434
|
}
|
|
125128
125435
|
|
|
@@ -125397,7 +125704,7 @@ class src_client_VoteLikeBase {
|
|
|
125397
125704
|
const now = this.expirationCheckMoment();
|
|
125398
125705
|
const from = this.validityFrom.valueOf();
|
|
125399
125706
|
const to = this.validityTo.valueOf();
|
|
125400
|
-
if (now +
|
|
125707
|
+
if (now + this.getClass().allowedSlop < from || now - this.getClass().allowedSlop > to) {
|
|
125401
125708
|
return true;
|
|
125402
125709
|
}
|
|
125403
125710
|
return false;
|
|
@@ -126053,10 +126360,12 @@ client_lib_vote_defineProperty(src_client_VoteStaple, "isInstance", client_check
|
|
|
126053
126360
|
var client_account = /*#__PURE__*/new WeakMap();
|
|
126054
126361
|
var client_blocks2 = /*#__PURE__*/new WeakMap();
|
|
126055
126362
|
var client_fee = /*#__PURE__*/new WeakMap();
|
|
126363
|
+
var client_BaseVoteBuilder_brand = /*#__PURE__*/new WeakSet();
|
|
126056
126364
|
class src_client_BaseVoteBuilder {
|
|
126057
126365
|
constructor(account) {
|
|
126058
126366
|
let blocks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
126059
126367
|
let options = arguments.length > 2 ? arguments[2] : undefined;
|
|
126368
|
+
client_vote_classPrivateMethodInitSpec(this, client_BaseVoteBuilder_brand);
|
|
126060
126369
|
client_vote_classPrivateFieldInitSpec(this, client_account, void 0);
|
|
126061
126370
|
client_vote_classPrivateFieldInitSpec(this, client_blocks2, void 0);
|
|
126062
126371
|
client_vote_classPrivateFieldInitSpec(this, client_fee, undefined);
|
|
@@ -126089,26 +126398,21 @@ class src_client_BaseVoteBuilder {
|
|
|
126089
126398
|
this.addBlocks([block]);
|
|
126090
126399
|
}
|
|
126091
126400
|
addFee(feeInput) {
|
|
126092
|
-
|
|
126093
|
-
|
|
126094
|
-
|
|
126095
|
-
const payTo = client_lib_account.toAccount(feeInput.payTo);
|
|
126096
|
-
if (payTo !== undefined) {
|
|
126097
|
-
if (payTo.isStorage()) {
|
|
126098
|
-
fee.payTo = payTo;
|
|
126099
|
-
} else {
|
|
126100
|
-
fee.payTo = payTo.assertAccount();
|
|
126401
|
+
if (Array.isArray(feeInput)) {
|
|
126402
|
+
if (feeInput.length === 0) {
|
|
126403
|
+
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_FEE', 'Fee array cannot be empty');
|
|
126101
126404
|
}
|
|
126102
|
-
|
|
126103
|
-
|
|
126104
|
-
|
|
126105
|
-
|
|
126106
|
-
fee.token = token;
|
|
126107
|
-
} else {
|
|
126108
|
-
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN');
|
|
126405
|
+
// List of fee choices format (array)
|
|
126406
|
+
const feeList = [];
|
|
126407
|
+
for (const feeEntry of feeInput) {
|
|
126408
|
+
feeList.push(client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntry).call(this, feeEntry));
|
|
126109
126409
|
}
|
|
126410
|
+
client_vote_classPrivateFieldSet(client_fee, this, feeList);
|
|
126411
|
+
} else {
|
|
126412
|
+
// Single fee
|
|
126413
|
+
const fee = client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntry).call(this, feeInput);
|
|
126414
|
+
client_vote_classPrivateFieldSet(client_fee, this, fee);
|
|
126110
126415
|
}
|
|
126111
|
-
client_vote_classPrivateFieldSet(client_fee, this, fee);
|
|
126112
126416
|
}
|
|
126113
126417
|
generateVoteData(serial, validTo, validFrom) {
|
|
126114
126418
|
/**
|
|
@@ -126154,30 +126458,22 @@ class src_client_BaseVoteBuilder {
|
|
|
126154
126458
|
}];
|
|
126155
126459
|
let feeExtension = undefined;
|
|
126156
126460
|
if (client_vote_classPrivateFieldGet(client_fee, this) !== undefined) {
|
|
126157
|
-
|
|
126158
|
-
|
|
126159
|
-
|
|
126160
|
-
|
|
126161
|
-
|
|
126162
|
-
|
|
126163
|
-
|
|
126164
|
-
|
|
126461
|
+
let feeDataContent;
|
|
126462
|
+
if (Array.isArray(client_vote_classPrivateFieldGet(client_fee, this))) {
|
|
126463
|
+
// List of fee choices format (array)
|
|
126464
|
+
const feeDataArray = [];
|
|
126465
|
+
for (const fee of client_vote_classPrivateFieldGet(client_fee, this)) {
|
|
126466
|
+
feeDataArray.push(client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntryData).call(this, fee));
|
|
126467
|
+
}
|
|
126468
|
+
feeDataContent = {
|
|
126165
126469
|
type: 'context',
|
|
126166
126470
|
value: 0,
|
|
126167
|
-
kind: '
|
|
126168
|
-
contains:
|
|
126169
|
-
}
|
|
126170
|
-
}
|
|
126171
|
-
|
|
126172
|
-
|
|
126173
|
-
const tokenPublicKey = (_classPrivateFieldGet4 = client_vote_classPrivateFieldGet(client_fee, this).token) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.publicKeyAndType;
|
|
126174
|
-
if (tokenPublicKey !== undefined) {
|
|
126175
|
-
feeData.push({
|
|
126176
|
-
type: 'context',
|
|
126177
|
-
value: 1,
|
|
126178
|
-
kind: 'implicit',
|
|
126179
|
-
contains: tokenPublicKey
|
|
126180
|
-
});
|
|
126471
|
+
kind: 'explicit',
|
|
126472
|
+
contains: feeDataArray
|
|
126473
|
+
};
|
|
126474
|
+
} else {
|
|
126475
|
+
// Single fee format
|
|
126476
|
+
feeDataContent = client_vote_assertClassBrand(client_BaseVoteBuilder_brand, this, client_formatSingleFeeEntryData).call(this, client_vote_classPrivateFieldGet(client_fee, this));
|
|
126181
126477
|
}
|
|
126182
126478
|
feeExtension = [{
|
|
126183
126479
|
type: 'oid',
|
|
@@ -126188,7 +126484,7 @@ class src_client_BaseVoteBuilder {
|
|
|
126188
126484
|
type: 'context',
|
|
126189
126485
|
value: 0,
|
|
126190
126486
|
kind: 'explicit',
|
|
126191
|
-
contains:
|
|
126487
|
+
contains: feeDataContent
|
|
126192
126488
|
}).toBER(false))];
|
|
126193
126489
|
}
|
|
126194
126490
|
|
|
@@ -126348,6 +126644,59 @@ class src_client_BaseVoteBuilder {
|
|
|
126348
126644
|
}
|
|
126349
126645
|
}
|
|
126350
126646
|
client_BaseVoteBuilder = src_client_BaseVoteBuilder;
|
|
126647
|
+
function client_formatSingleFeeEntry(feeInput) {
|
|
126648
|
+
if (feeInput.amount === undefined) {
|
|
126649
|
+
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_FEE', 'Fee amount is required');
|
|
126650
|
+
}
|
|
126651
|
+
if (BigInt(feeInput.amount) < 0n) {
|
|
126652
|
+
throw new src_client_KeetaNetVoteError('VOTE_BUILDER_INVALID_FEE', 'Fee amount cannot be negative');
|
|
126653
|
+
}
|
|
126654
|
+
const fee = {
|
|
126655
|
+
amount: BigInt(feeInput.amount)
|
|
126656
|
+
};
|
|
126657
|
+
const payTo = client_lib_account.toAccount(feeInput.payTo);
|
|
126658
|
+
if (payTo !== undefined) {
|
|
126659
|
+
if (payTo.isStorage()) {
|
|
126660
|
+
fee.payTo = payTo;
|
|
126661
|
+
} else {
|
|
126662
|
+
fee.payTo = payTo.assertAccount();
|
|
126663
|
+
}
|
|
126664
|
+
}
|
|
126665
|
+
const token = client_lib_account.toAccount(feeInput.token);
|
|
126666
|
+
if (token !== undefined) {
|
|
126667
|
+
if (token.isToken()) {
|
|
126668
|
+
fee.token = token;
|
|
126669
|
+
} else {
|
|
126670
|
+
throw new src_client_KeetaNetVoteError('VOTE_MALFORMED_FEES_TOKEN_NOT_TOKEN', 'Fee Token should be of type TOKEN');
|
|
126671
|
+
}
|
|
126672
|
+
}
|
|
126673
|
+
return fee;
|
|
126674
|
+
}
|
|
126675
|
+
function client_formatSingleFeeEntryData(feeInput) {
|
|
126676
|
+
var _feeInput$payTo, _feeInput$token;
|
|
126677
|
+
/** Account to pay the fee too */
|
|
126678
|
+
let payToData = undefined;
|
|
126679
|
+
if (((_feeInput$payTo = feeInput.payTo) === null || _feeInput$payTo === void 0 ? void 0 : _feeInput$payTo.publicKeyAndType) !== undefined) {
|
|
126680
|
+
payToData = {
|
|
126681
|
+
type: 'context',
|
|
126682
|
+
value: 0,
|
|
126683
|
+
kind: 'implicit',
|
|
126684
|
+
contains: feeInput.payTo.publicKeyAndType
|
|
126685
|
+
};
|
|
126686
|
+
}
|
|
126687
|
+
|
|
126688
|
+
/** Token in which to pay the fee */
|
|
126689
|
+
let tokenData = undefined;
|
|
126690
|
+
if (((_feeInput$token = feeInput.token) === null || _feeInput$token === void 0 ? void 0 : _feeInput$token.publicKeyAndType) !== undefined) {
|
|
126691
|
+
tokenData = {
|
|
126692
|
+
type: 'context',
|
|
126693
|
+
value: 1,
|
|
126694
|
+
kind: 'implicit',
|
|
126695
|
+
contains: feeInput.token.publicKeyAndType
|
|
126696
|
+
};
|
|
126697
|
+
}
|
|
126698
|
+
return [this.quote, feeInput.amount, payToData, tokenData];
|
|
126699
|
+
}
|
|
126351
126700
|
client_lib_vote_defineProperty(src_client_BaseVoteBuilder, "isInstance", client_checkableGenerator(client_BaseVoteBuilder));
|
|
126352
126701
|
class src_client_VoteBuilder extends src_client_BaseVoteBuilder {
|
|
126353
126702
|
async seal(serial, validTo, validFrom) {
|
|
@@ -126385,8 +126734,63 @@ src_client_Vote.Quote = src_client_VoteQuote;
|
|
|
126385
126734
|
const src_client_Testing = {
|
|
126386
126735
|
findRDN: client_findRDN,
|
|
126387
126736
|
blockHashesFromVote: client_blockHashesFromVote,
|
|
126388
|
-
feeFromVote: client_feeFromVote
|
|
126737
|
+
feeFromVote: client_feeFromVote,
|
|
126738
|
+
hashDataSchema: client_hashDataSchema,
|
|
126739
|
+
feeExtensionSchema: client_feeExtensionSchema
|
|
126389
126740
|
};
|
|
126741
|
+
;// ./src/lib/ledger/types.ts
|
|
126742
|
+
/**
|
|
126743
|
+
* Account info entry
|
|
126744
|
+
*/
|
|
126745
|
+
|
|
126746
|
+
// For some reason, if we do not have these types for each key pair type, TypeScript does not properly discriminate the union when we use Extract
|
|
126747
|
+
// Ex: KeyPairAccountInfo extends BaseAccountInfo<KeyPairKeyAlgorithm> {} does not work, we have to declare each individually
|
|
126748
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126749
|
+
|
|
126750
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126751
|
+
|
|
126752
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126753
|
+
|
|
126754
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126755
|
+
|
|
126756
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126757
|
+
|
|
126758
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
126759
|
+
|
|
126760
|
+
// This is a type-level check to ensure that we have defined AccountInfoForType for all AccountKeyAlgorithm types, so that the type guard function works properly
|
|
126761
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
126762
|
+
|
|
126763
|
+
function client_isIdentifierAccountInfo(info) {
|
|
126764
|
+
return info.account.isIdentifier();
|
|
126765
|
+
}
|
|
126766
|
+
function client_isKeyPairAccountInfo(info) {
|
|
126767
|
+
return info.account.isAccount();
|
|
126768
|
+
}
|
|
126769
|
+
function client_isAccountInfoOfType(info, type) {
|
|
126770
|
+
return info.account.isKeyType(type);
|
|
126771
|
+
}
|
|
126772
|
+
|
|
126773
|
+
/**
|
|
126774
|
+
* Permissions types
|
|
126775
|
+
*/
|
|
126776
|
+
|
|
126777
|
+
/**
|
|
126778
|
+
* An entry for the ACL
|
|
126779
|
+
* @expandType ACLRow
|
|
126780
|
+
*/
|
|
126781
|
+
|
|
126782
|
+
/**
|
|
126783
|
+
* Update an ACL for an account
|
|
126784
|
+
* @expandType ACLEntry
|
|
126785
|
+
*/
|
|
126786
|
+
|
|
126787
|
+
/**
|
|
126788
|
+
* All balances for each token on an account
|
|
126789
|
+
*/
|
|
126790
|
+
|
|
126791
|
+
/**
|
|
126792
|
+
* Ledger statistics
|
|
126793
|
+
*/
|
|
126390
126794
|
;// ./src/lib/ledger/cache.ts
|
|
126391
126795
|
/* provided dependency */ var client_cache_Buffer = __webpack_require__(8287)["Buffer"];
|
|
126392
126796
|
function client_cache_classPrivateFieldInitSpec(e, t, a) { client_cache_checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
@@ -127697,6 +128101,7 @@ function client_lib_ledger_toPrimitive(t, r) { if ("object" != typeof t || !t) r
|
|
|
127697
128101
|
|
|
127698
128102
|
|
|
127699
128103
|
|
|
128104
|
+
|
|
127700
128105
|
/**
|
|
127701
128106
|
* Kind of ledger
|
|
127702
128107
|
*/
|
|
@@ -127897,6 +128302,14 @@ class client_LedgerAtomicInterface {
|
|
|
127897
128302
|
if (!quote.issuer.comparePublicKey(ledgerPubKey)) {
|
|
127898
128303
|
throw new client_ledger_KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match issuer public key');
|
|
127899
128304
|
}
|
|
128305
|
+
if (quote.blocks.length !== blocks.length) {
|
|
128306
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match blocks length');
|
|
128307
|
+
}
|
|
128308
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex++) {
|
|
128309
|
+
if (!blocks[blockIndex].hash.compareHexString(quote.blocks[blockIndex])) {
|
|
128310
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_QUOTE_MISMATCH', 'Provided quote does not match blocks content');
|
|
128311
|
+
}
|
|
128312
|
+
}
|
|
127900
128313
|
}
|
|
127901
128314
|
|
|
127902
128315
|
/**
|
|
@@ -127924,6 +128337,7 @@ class client_LedgerAtomicInterface {
|
|
|
127924
128337
|
}
|
|
127925
128338
|
}
|
|
127926
128339
|
const requiredFees = new Map();
|
|
128340
|
+
const optionalFees = new Map();
|
|
127927
128341
|
for (const checkVote of otherVotes) {
|
|
127928
128342
|
if (checkVote.quote === true) {
|
|
127929
128343
|
throw new client_ledger_KeetaNetLedgerError('LEDGER_VOTE_WITH_QUOTE', 'Cannot request votes with quote as supporting votes');
|
|
@@ -127937,7 +128351,18 @@ class client_LedgerAtomicInterface {
|
|
|
127937
128351
|
seenVoteIssuers.add(checkVote.issuer);
|
|
127938
128352
|
seenVoteUIDs.add(checkVote.$id);
|
|
127939
128353
|
if (checkVote.fee !== undefined) {
|
|
127940
|
-
|
|
128354
|
+
const checkVoteFee = Array.isArray(checkVote.fee) ? checkVote.fee : [checkVote.fee];
|
|
128355
|
+
|
|
128356
|
+
// Check if user has the option to pay zero (any fee with amount === 0)
|
|
128357
|
+
// If a zero-amount option exists, fee block is optional; otherwise required
|
|
128358
|
+
const hasZeroFeeOption = checkVoteFee.some(fee => fee.amount === 0n);
|
|
128359
|
+
if (hasZeroFeeOption) {
|
|
128360
|
+
// At least one fee option is zero amount - fee block is optional, but if included should match one of the provided options
|
|
128361
|
+
optionalFees.set(checkVote.issuer, checkVote.fee);
|
|
128362
|
+
} else if (checkVoteFee.length > 0) {
|
|
128363
|
+
// All fee options require payment (no zero option) - fee block MUST be present and operation should match at least one fee option
|
|
128364
|
+
requiredFees.set(checkVote.issuer, checkVote.fee);
|
|
128365
|
+
}
|
|
127941
128366
|
}
|
|
127942
128367
|
|
|
127943
128368
|
/*
|
|
@@ -127965,42 +128390,74 @@ class client_LedgerAtomicInterface {
|
|
|
127965
128390
|
foundOurVote = true;
|
|
127966
128391
|
}
|
|
127967
128392
|
}
|
|
127968
|
-
|
|
128393
|
+
let finalRequiredFees = requiredFees;
|
|
127969
128394
|
/*
|
|
127970
128395
|
* We only care about fees if we are issuing a permanent vote,
|
|
127971
128396
|
* if we are issuing a temporary vote the fees will be checked
|
|
127972
128397
|
* when the permanent vote is requested
|
|
127973
128398
|
*/
|
|
127974
128399
|
if (outcome === 'permanent') {
|
|
127975
|
-
if (requiredFees.size > 0) {
|
|
127976
|
-
|
|
127977
|
-
|
|
128400
|
+
if (requiredFees.size > 0 || optionalFees.size > 0) {
|
|
128401
|
+
// If fees are required then a fee block should have been provided
|
|
128402
|
+
if (requiredFees.size > 0) {
|
|
128403
|
+
if (!hasFeeBlock) {
|
|
128404
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_MISSING_REQUIRED_FEE_BLOCK', 'Missing fee block but votes require it');
|
|
128405
|
+
}
|
|
127978
128406
|
}
|
|
127979
|
-
|
|
127980
|
-
|
|
128407
|
+
|
|
128408
|
+
// We can only validate operations match if we have a fee block
|
|
128409
|
+
if (hasFeeBlock) {
|
|
128410
|
+
// Each vote requires exactly one fee payment, regardless of array size
|
|
128411
|
+
// Optional fees may or may not be included in the operations but if they are they should match
|
|
128412
|
+
if (optionalFees.size > 0) {
|
|
128413
|
+
if ((possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length) !== requiredFees.size && (possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length) !== requiredFees.size + optionalFees.size) {
|
|
128414
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees or required and optional fees');
|
|
128415
|
+
}
|
|
128416
|
+
// If user provided optional fees then we should validate they match
|
|
128417
|
+
if ((possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length) === requiredFees.size + optionalFees.size) {
|
|
128418
|
+
finalRequiredFees = new Map([...requiredFees, ...optionalFees]);
|
|
128419
|
+
}
|
|
128420
|
+
} else {
|
|
128421
|
+
if (requiredFees.size !== (possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.length)) {
|
|
128422
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_REQUIRED_FEE_MISMATCH', 'Fee Block Operations do not match required fees');
|
|
128423
|
+
}
|
|
128424
|
+
}
|
|
127981
128425
|
}
|
|
127982
128426
|
}
|
|
127983
128427
|
|
|
127984
|
-
// Verify that
|
|
127985
|
-
for (const [issuer,
|
|
127986
|
-
|
|
128428
|
+
// Verify that at least one required fee option has been satisfied for each vote
|
|
128429
|
+
for (const [issuer, feeOrFees] of finalRequiredFees) {
|
|
128430
|
+
// Handle both single fee and array of fees
|
|
128431
|
+
const fees = Array.isArray(feeOrFees) ? feeOrFees : [feeOrFees];
|
|
128432
|
+
|
|
128433
|
+
// Check if at least one fee option is satisfied
|
|
128434
|
+
let foundMatchingFee = false;
|
|
128435
|
+
for (const fee of fees) {
|
|
127987
128436
|
var _fee$payTo, _fee$token;
|
|
127988
128437
|
const expectedPayTo = (_fee$payTo = fee.payTo) !== null && _fee$payTo !== void 0 ? _fee$payTo : issuer;
|
|
127989
128438
|
const expectedToken = (_fee$token = fee.token) !== null && _fee$token !== void 0 ? _fee$token : client_ledger_classPrivateFieldGet(client_ledger, this).baseToken;
|
|
127990
|
-
|
|
127991
|
-
if (operation.
|
|
127992
|
-
|
|
127993
|
-
|
|
127994
|
-
|
|
127995
|
-
throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_TOKEN_MISMATCH', `Fee Token Mismatch, found: ${operation.token.publicKeyString.get()} expected: ${expectedToken.publicKeyString.get()}`);
|
|
128439
|
+
const foundFee = possibleFeeBlock === null || possibleFeeBlock === void 0 ? void 0 : possibleFeeBlock.operations.find(operation => {
|
|
128440
|
+
if (operation.type === client_OperationType.SEND && operation.to.comparePublicKey(expectedPayTo)) {
|
|
128441
|
+
if (operation.amount === fee.amount && operation.token.comparePublicKey(expectedToken)) {
|
|
128442
|
+
return true;
|
|
128443
|
+
}
|
|
127996
128444
|
}
|
|
127997
|
-
return
|
|
128445
|
+
return false;
|
|
128446
|
+
});
|
|
128447
|
+
if (foundFee !== undefined) {
|
|
128448
|
+
foundMatchingFee = true;
|
|
128449
|
+
break; // Found a matching fee, no need to check others
|
|
127998
128450
|
}
|
|
127999
|
-
|
|
128000
|
-
|
|
128001
|
-
|
|
128002
|
-
|
|
128003
|
-
|
|
128451
|
+
}
|
|
128452
|
+
if (!foundMatchingFee) {
|
|
128453
|
+
// Build helpful error message showing what fees were expected
|
|
128454
|
+
const feeOptions = fees.map(fee => {
|
|
128455
|
+
var _fee$payTo2, _fee$token2;
|
|
128456
|
+
const payTo = (_fee$payTo2 = fee.payTo) !== null && _fee$payTo2 !== void 0 ? _fee$payTo2 : issuer;
|
|
128457
|
+
const token = (_fee$token2 = fee.token) !== null && _fee$token2 !== void 0 ? _fee$token2 : client_ledger_classPrivateFieldGet(client_ledger, this).baseToken;
|
|
128458
|
+
return `${fee.amount} ${token.publicKeyString.get()} to ${payTo.publicKeyString.get()}`;
|
|
128459
|
+
}).join(' OR ');
|
|
128460
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_FEE_MISSING', `Missing Required Fee for ${issuer.publicKeyString.get()}. Expected one of: ${feeOptions}`);
|
|
128004
128461
|
}
|
|
128005
128462
|
}
|
|
128006
128463
|
} else if (outcome === 'temporary') {
|
|
@@ -128300,6 +128757,10 @@ class client_LedgerAtomicInterface {
|
|
|
128300
128757
|
return retval;
|
|
128301
128758
|
}
|
|
128302
128759
|
async getAccountRep(account) {
|
|
128760
|
+
const acct = client_lib_account.toAccount(account);
|
|
128761
|
+
if (!client_canDelegate(acct.keyType)) {
|
|
128762
|
+
return null;
|
|
128763
|
+
}
|
|
128303
128764
|
const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
|
|
128304
128765
|
const retval = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).getAccountRep(transaction, account);
|
|
128305
128766
|
return retval;
|
|
@@ -128612,14 +129073,14 @@ async function client_checkSingleAccountPermissions(account, requirements, accou
|
|
|
128612
129073
|
const entityAccounts = new client_lib_account.Set(unfilteredEntity).toArray();
|
|
128613
129074
|
const gotPermissions = await this.listACLsByPrincipal(account, entityAccounts);
|
|
128614
129075
|
for (const requirement of requirements) {
|
|
128615
|
-
var _accountInfos$reqEnti;
|
|
128616
129076
|
const reqEntityKey = requirement.entity.publicKeyString.get();
|
|
128617
129077
|
const foundACLRow = client_findPermissionMatch(requirement, gotPermissions);
|
|
129078
|
+
const foundAccountInfo = accountInfos[reqEntityKey];
|
|
128618
129079
|
let foundPermission;
|
|
128619
129080
|
if (foundACLRow !== null && foundACLRow !== void 0 && foundACLRow.permissions) {
|
|
128620
129081
|
foundPermission = foundACLRow === null || foundACLRow === void 0 ? void 0 : foundACLRow.permissions;
|
|
128621
|
-
} else if (
|
|
128622
|
-
foundPermission =
|
|
129082
|
+
} else if (foundAccountInfo && client_isIdentifierAccountInfo(foundAccountInfo) && foundAccountInfo.defaultPermission) {
|
|
129083
|
+
foundPermission = foundAccountInfo.defaultPermission;
|
|
128623
129084
|
} else {
|
|
128624
129085
|
foundPermission = new client_permissions_Permissions();
|
|
128625
129086
|
}
|
|
@@ -128688,7 +129149,7 @@ async function client_checkPermissionRequirements(effects) {
|
|
|
128688
129149
|
for (const [multisig, foundSingerLength] of foundMultisigSignerLengths) {
|
|
128689
129150
|
const multisigPubKey = multisig.publicKeyString.get();
|
|
128690
129151
|
const foundInfo = foundAccountInfo[multisigPubKey];
|
|
128691
|
-
if (!(foundInfo !== null && foundInfo !== void 0 && foundInfo.multisigQuorum)) {
|
|
129152
|
+
if (!('multisigQuorum' in foundInfo) || !(foundInfo !== null && foundInfo !== void 0 && foundInfo.multisigQuorum)) {
|
|
128692
129153
|
throw new Error(`Multisig quorum not found for ${multisigPubKey}`);
|
|
128693
129154
|
}
|
|
128694
129155
|
if (foundInfo.multisigQuorum > foundSingerLength) {
|
|
@@ -129010,7 +129471,13 @@ async function client_voteOrQuoteWithFees(blocks, type, quote, options) {
|
|
|
129010
129471
|
if (requireBlockTimestampCheck) {
|
|
129011
129472
|
var _quote$fee;
|
|
129012
129473
|
const fee = (_quote$fee = quote === null || quote === void 0 ? void 0 : quote.fee) !== null && _quote$fee !== void 0 ? _quote$fee : await this.getFee(blocks, effects);
|
|
129013
|
-
|
|
129474
|
+
// We add an explicit fee of 0 if one is not provided.
|
|
129475
|
+
// Since the quote identifier is in the fee data and needs to be parsed correctly.
|
|
129476
|
+
if (fee === null || Array.isArray(fee) && fee.length === 0) {
|
|
129477
|
+
builder.addFee({
|
|
129478
|
+
amount: 0n
|
|
129479
|
+
});
|
|
129480
|
+
} else {
|
|
129014
129481
|
builder.addFee(fee);
|
|
129015
129482
|
}
|
|
129016
129483
|
}
|
|
@@ -129318,97 +129785,94 @@ class src_client_Ledger {
|
|
|
129318
129785
|
return await transaction.getAccountRep(...args);
|
|
129319
129786
|
});
|
|
129320
129787
|
}
|
|
129321
|
-
async getAccountInfo() {
|
|
129322
|
-
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
129323
|
-
args[_key15] = arguments[_key15];
|
|
129324
|
-
}
|
|
129788
|
+
async getAccountInfo(account) {
|
|
129325
129789
|
return await this.runReadOnly('db-getAccountInfo', async function (transaction) {
|
|
129326
|
-
return await transaction.getAccountInfo(
|
|
129790
|
+
return await transaction.getAccountInfo(account);
|
|
129327
129791
|
});
|
|
129328
129792
|
}
|
|
129329
129793
|
async getBlock() {
|
|
129330
|
-
for (var
|
|
129331
|
-
args[
|
|
129794
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
|
129795
|
+
args[_key15] = arguments[_key15];
|
|
129332
129796
|
}
|
|
129333
129797
|
return await this.runReadOnly('db-getBlock', async function (transaction) {
|
|
129334
129798
|
return await transaction.getBlock(...args);
|
|
129335
129799
|
});
|
|
129336
129800
|
}
|
|
129337
129801
|
async getAccountsBlockHeightInfo() {
|
|
129338
|
-
for (var
|
|
129339
|
-
args[
|
|
129802
|
+
for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {
|
|
129803
|
+
args[_key16] = arguments[_key16];
|
|
129340
129804
|
}
|
|
129341
129805
|
return await this.runReadOnly('db-getAccountsBlockHeightInfo', async function (transaction) {
|
|
129342
129806
|
return await transaction.getAccountsBlockHeightInfo(...args);
|
|
129343
129807
|
});
|
|
129344
129808
|
}
|
|
129345
129809
|
async getVoteStaple() {
|
|
129346
|
-
for (var
|
|
129347
|
-
args[
|
|
129810
|
+
for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {
|
|
129811
|
+
args[_key17] = arguments[_key17];
|
|
129348
129812
|
}
|
|
129349
129813
|
return await this.runReadOnly('db-getVoteStaple', async function (transaction) {
|
|
129350
129814
|
return await transaction.getVoteStaple(...args);
|
|
129351
129815
|
});
|
|
129352
129816
|
}
|
|
129353
129817
|
async getVoteStaples() {
|
|
129354
|
-
for (var
|
|
129355
|
-
args[
|
|
129818
|
+
for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {
|
|
129819
|
+
args[_key18] = arguments[_key18];
|
|
129356
129820
|
}
|
|
129357
129821
|
return await this.runReadOnly('db-getVoteStaples', async function (transaction) {
|
|
129358
129822
|
return await transaction.getVoteStaples(...args);
|
|
129359
129823
|
});
|
|
129360
129824
|
}
|
|
129361
129825
|
async getHistory() {
|
|
129362
|
-
for (var
|
|
129363
|
-
args[
|
|
129826
|
+
for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {
|
|
129827
|
+
args[_key19] = arguments[_key19];
|
|
129364
129828
|
}
|
|
129365
129829
|
return await this.runReadOnly('db-getHistory', async function (transaction) {
|
|
129366
129830
|
return await transaction.getHistory(...args);
|
|
129367
129831
|
});
|
|
129368
129832
|
}
|
|
129369
129833
|
async getStaplesFromBlockHashes() {
|
|
129370
|
-
for (var
|
|
129371
|
-
args[
|
|
129834
|
+
for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {
|
|
129835
|
+
args[_key20] = arguments[_key20];
|
|
129372
129836
|
}
|
|
129373
129837
|
return await this.runReadOnly('db-getStaplesFromBlockHashes', async function (transaction) {
|
|
129374
129838
|
return await transaction.getStaplesFromBlockHashes(...args);
|
|
129375
129839
|
});
|
|
129376
129840
|
}
|
|
129377
129841
|
async getVoteStaplesAfter() {
|
|
129378
|
-
for (var
|
|
129379
|
-
args[
|
|
129842
|
+
for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {
|
|
129843
|
+
args[_key21] = arguments[_key21];
|
|
129380
129844
|
}
|
|
129381
129845
|
return await this.runReadOnly('db-getVoteStaplesAfter', async function (transaction) {
|
|
129382
129846
|
return await transaction.getVoteStaplesAfter(...args);
|
|
129383
129847
|
});
|
|
129384
129848
|
}
|
|
129385
129849
|
async gc() {
|
|
129386
|
-
for (var
|
|
129387
|
-
args[
|
|
129850
|
+
for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {
|
|
129851
|
+
args[_key22] = arguments[_key22];
|
|
129388
129852
|
}
|
|
129389
129853
|
return await this.run('db-gc', async function (transaction) {
|
|
129390
129854
|
return await transaction.gc(...args);
|
|
129391
129855
|
});
|
|
129392
129856
|
}
|
|
129393
129857
|
async getFee() {
|
|
129394
|
-
for (var
|
|
129395
|
-
args[
|
|
129858
|
+
for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
|
|
129859
|
+
args[_key23] = arguments[_key23];
|
|
129396
129860
|
}
|
|
129397
129861
|
return await this.runReadOnly('db-getFee', async function (transaction) {
|
|
129398
129862
|
return await transaction.getFee(...args);
|
|
129399
129863
|
});
|
|
129400
129864
|
}
|
|
129401
129865
|
async getIdempotentBlockHash() {
|
|
129402
|
-
for (var
|
|
129403
|
-
args[
|
|
129866
|
+
for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
|
|
129867
|
+
args[_key24] = arguments[_key24];
|
|
129404
129868
|
}
|
|
129405
129869
|
return await this.runReadOnly('db-getIdempotentBlockHash', async function (transaction) {
|
|
129406
129870
|
return await transaction.getIdempotentBlockHash(...args);
|
|
129407
129871
|
});
|
|
129408
129872
|
}
|
|
129409
129873
|
async getBlockFromIdempotent() {
|
|
129410
|
-
for (var
|
|
129411
|
-
args[
|
|
129874
|
+
for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {
|
|
129875
|
+
args[_key25] = arguments[_key25];
|
|
129412
129876
|
}
|
|
129413
129877
|
return await this.runReadOnly('db-getBlockFromIdempotent', async function (transaction) {
|
|
129414
129878
|
return await transaction.getBlockFromIdempotent(...args);
|
|
@@ -129440,7 +129904,7 @@ client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkab
|
|
|
129440
129904
|
// EXTERNAL MODULE: ws (ignored)
|
|
129441
129905
|
var client_ws_ignored_ = __webpack_require__(4708);
|
|
129442
129906
|
;// ./src/version.ts
|
|
129443
|
-
const client_version = '0.16.
|
|
129907
|
+
const client_version = '0.16.2+g2c1441eed2a1c71a895d0fb5166c431799b3d3ca';
|
|
129444
129908
|
/* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
|
|
129445
129909
|
;// ./src/lib/p2p.ts
|
|
129446
129910
|
/* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -132074,6 +132538,7 @@ async function client_generateInitialVoteStaple(options) {
|
|
|
132074
132538
|
|
|
132075
132539
|
|
|
132076
132540
|
|
|
132541
|
+
|
|
132077
132542
|
/* harmony default export */ const client_src_lib = ({
|
|
132078
132543
|
/**
|
|
132079
132544
|
* The `Account` module provides functionality for managing key pairs
|
|
@@ -132093,11 +132558,12 @@ async function client_generateInitialVoteStaple(options) {
|
|
|
132093
132558
|
ASN1: client_utils_asn1_namespaceObject,
|
|
132094
132559
|
Bloom: client_bloom_namespaceObject,
|
|
132095
132560
|
Buffer: client_utils_buffer_namespaceObject,
|
|
132561
|
+
Certificate: client_utils_certificate_namespaceObject,
|
|
132562
|
+
Conversion: client_conversion_namespaceObject,
|
|
132563
|
+
DomainSeparation: client_domain_separation_namespaceObject,
|
|
132096
132564
|
Hash: client_hash_namespaceObject,
|
|
132097
132565
|
Helper: client_helper_namespaceObject,
|
|
132098
|
-
Initial: client_initial_namespaceObject
|
|
132099
|
-
Conversion: client_conversion_namespaceObject,
|
|
132100
|
-
Certificate: client_utils_certificate_namespaceObject
|
|
132566
|
+
Initial: client_initial_namespaceObject
|
|
132101
132567
|
}
|
|
132102
132568
|
});
|
|
132103
132569
|
;// ./src/client/builder.ts
|
|
@@ -132246,6 +132712,9 @@ class src_client_UserClientBuilder {
|
|
|
132246
132712
|
const [base, external] = operations.info.defaultPermission.map(function (intString) {
|
|
132247
132713
|
return BigInt(intString);
|
|
132248
132714
|
});
|
|
132715
|
+
|
|
132716
|
+
// This is correct as we are constructing this from data that was only set if it was valid
|
|
132717
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
132249
132718
|
newInfo.defaultPermission = new client_permissions_Permissions(base, external);
|
|
132250
132719
|
}
|
|
132251
132720
|
pendingOperations.info = newInfo;
|
|
@@ -132535,12 +133004,38 @@ class src_client_UserClientBuilder {
|
|
|
132535
133004
|
const operations = [];
|
|
132536
133005
|
for (const vote of staple.votes) {
|
|
132537
133006
|
if (vote.fee !== undefined) {
|
|
132538
|
-
var
|
|
133007
|
+
var _selectedFee$payTo, _selectedFee$token;
|
|
133008
|
+
// Handle both single fee and array of fees
|
|
133009
|
+
// Select one fee: prefer one with undefined token (baseToken) or matching baseToken
|
|
133010
|
+
const fees = Array.isArray(vote.fee) ? vote.fee : [vote.fee];
|
|
133011
|
+
|
|
133012
|
+
// If there are no fees, skip this vote
|
|
133013
|
+
if (fees.length === 0) {
|
|
133014
|
+
continue;
|
|
133015
|
+
}
|
|
133016
|
+
|
|
133017
|
+
// If fee options contains an amount of 0, skip this vote
|
|
133018
|
+
if (fees.some(fee => fee.amount === 0n)) {
|
|
133019
|
+
continue;
|
|
133020
|
+
}
|
|
133021
|
+
|
|
133022
|
+
// Find fee with undefined token or matching baseToken
|
|
133023
|
+
let selectedFee = fees.find(fee => {
|
|
133024
|
+
if (fee.token === undefined || fee.token.comparePublicKey(baseToken)) {
|
|
133025
|
+
return true;
|
|
133026
|
+
}
|
|
133027
|
+
return false;
|
|
133028
|
+
});
|
|
133029
|
+
|
|
133030
|
+
// If no matching fee, use the first one
|
|
133031
|
+
if (!selectedFee) {
|
|
133032
|
+
selectedFee = fees[0];
|
|
133033
|
+
}
|
|
132539
133034
|
operations.push({
|
|
132540
133035
|
type: client_OperationType.SEND,
|
|
132541
|
-
amount:
|
|
132542
|
-
to: (
|
|
132543
|
-
token: (
|
|
133036
|
+
amount: selectedFee.amount,
|
|
133037
|
+
to: (_selectedFee$payTo = selectedFee.payTo) !== null && _selectedFee$payTo !== void 0 ? _selectedFee$payTo : vote.issuer,
|
|
133038
|
+
token: (_selectedFee$token = selectedFee.token) !== null && _selectedFee$token !== void 0 ? _selectedFee$token : baseToken
|
|
132544
133039
|
});
|
|
132545
133040
|
}
|
|
132546
133041
|
}
|
|
@@ -132683,12 +133178,16 @@ class src_client_UserClientBuilder {
|
|
|
132683
133178
|
}
|
|
132684
133179
|
operations.push(...receiveOperations);
|
|
132685
133180
|
if (pending.info) {
|
|
133181
|
+
let defaultPermission;
|
|
133182
|
+
if ('defaultPermission' in pending.info) {
|
|
133183
|
+
defaultPermission = pending.info.defaultPermission;
|
|
133184
|
+
}
|
|
132686
133185
|
operations.push({
|
|
132687
133186
|
type: src_client_Block.OperationType.SET_INFO,
|
|
132688
133187
|
name: pending.info.name,
|
|
132689
133188
|
description: pending.info.description,
|
|
132690
133189
|
metadata: pending.info.metadata,
|
|
132691
|
-
defaultPermission:
|
|
133190
|
+
defaultPermission: defaultPermission
|
|
132692
133191
|
});
|
|
132693
133192
|
}
|
|
132694
133193
|
if (pending.setRep) {
|
|
@@ -133395,6 +133894,15 @@ class src_client_Client {
|
|
|
133395
133894
|
return await this.transmit(blocks.blocks, options);
|
|
133396
133895
|
}
|
|
133397
133896
|
|
|
133897
|
+
/**
|
|
133898
|
+
* Check if the provided votes require a fee block. This is true if any vote has only non zero-amount options available.
|
|
133899
|
+
* If a vote has at least one zero-amount fee option, the user can satisfy the fee requirement without payment.
|
|
133900
|
+
* This is used to determine if we need to generate a fee block before transmitting the blocks.
|
|
133901
|
+
*
|
|
133902
|
+
* @param tempVotes
|
|
133903
|
+
* @returns boolean true if provided votes require a fee block
|
|
133904
|
+
*/
|
|
133905
|
+
|
|
133398
133906
|
/**
|
|
133399
133907
|
* Transmit a set of blocks to the network. This will request short
|
|
133400
133908
|
* votes and permanent votes for the blocks and then publish them to
|
|
@@ -133407,13 +133915,7 @@ class src_client_Client {
|
|
|
133407
133915
|
*/
|
|
133408
133916
|
async transmit(blocks, options) {
|
|
133409
133917
|
const tempVotes = await client_client_assertClassBrand(client_Client_brand, this, client_requestVotes).call(this, blocks, undefined, undefined, options === null || options === void 0 ? void 0 : options.quotes);
|
|
133410
|
-
|
|
133411
|
-
for (const vote of tempVotes) {
|
|
133412
|
-
if (vote.fee !== undefined) {
|
|
133413
|
-
requiresFee = true;
|
|
133414
|
-
}
|
|
133415
|
-
}
|
|
133416
|
-
if (requiresFee) {
|
|
133918
|
+
if (client_client_assertClassBrand(client_Client_brand, this, client_votesRequireFees).call(this, tempVotes)) {
|
|
133417
133919
|
if ((options === null || options === void 0 ? void 0 : options.generateFeeBlock) === undefined) {
|
|
133418
133920
|
throw new Error('Votes require fees but generateFeeBlock was not defined');
|
|
133419
133921
|
}
|
|
@@ -133596,9 +134098,10 @@ class src_client_Client {
|
|
|
133596
134098
|
}
|
|
133597
134099
|
});
|
|
133598
134100
|
const parsed = response.access.map(entry => {
|
|
134101
|
+
const entity = client_src_lib.Account.fromPublicKeyString(entry.entity);
|
|
133599
134102
|
return {
|
|
133600
|
-
entity:
|
|
133601
|
-
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, entry.info),
|
|
134103
|
+
entity: entity,
|
|
134104
|
+
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, entry.info, entity),
|
|
133602
134105
|
balances: client_client_assertClassBrand(client_Client_brand, this, client_formatAllBalances).call(this, entry.balances),
|
|
133603
134106
|
principals: client_client_assertClassBrand(client_Client_brand, this, client_parsePermissionEntries).call(this, entry.principals)
|
|
133604
134107
|
};
|
|
@@ -134441,16 +134944,9 @@ class src_client_Client {
|
|
|
134441
134944
|
tempVotes = [...tempVotes, ...newTempVotes];
|
|
134442
134945
|
}
|
|
134443
134946
|
const missingPermReps = client_client_classPrivateFieldGet(client_reps, this).filter(rep => !permReps.includes(rep));
|
|
134444
|
-
// If any of the temporary votes require a fee, we need to generate a fee block
|
|
134445
|
-
let requiresFee = false;
|
|
134446
|
-
for (const vote of tempVotes) {
|
|
134447
|
-
if (vote.fee !== undefined) {
|
|
134448
|
-
requiresFee = true;
|
|
134449
|
-
}
|
|
134450
|
-
}
|
|
134451
134947
|
|
|
134452
134948
|
// If we need a fee block and don't have any permanent votes, we need to generate a fee block
|
|
134453
|
-
if (
|
|
134949
|
+
if (client_client_assertClassBrand(client_Client_brand, this, client_votesRequireFees).call(this, tempVotes) && permVotes.length === 0) {
|
|
134454
134950
|
if ((options === null || options === void 0 ? void 0 : options.generateFeeBlock) === undefined) {
|
|
134455
134951
|
throw new Error('Votes require fees but generateFeeBlock was not defined');
|
|
134456
134952
|
}
|
|
@@ -134971,6 +135467,25 @@ function client_getBuilderRenderOptions(network) {
|
|
|
134971
135467
|
}
|
|
134972
135468
|
};
|
|
134973
135469
|
}
|
|
135470
|
+
function client_votesRequireFees(tempVotes) {
|
|
135471
|
+
let requiresFees = false;
|
|
135472
|
+
for (const vote of tempVotes) {
|
|
135473
|
+
if (vote.fee !== undefined) {
|
|
135474
|
+
const voteFee = Array.isArray(vote.fee) ? vote.fee : [vote.fee];
|
|
135475
|
+
|
|
135476
|
+
// Check if user has the option to pay zero (any fee with amount === 0)
|
|
135477
|
+
// If a zero-amount option exists, fee block is optional for this vote
|
|
135478
|
+
const hasZeroFeeOption = voteFee.some(fee => fee.amount === 0n);
|
|
135479
|
+
|
|
135480
|
+
// If no zero option exists (requires payment), fee block is required
|
|
135481
|
+
if (!hasZeroFeeOption) {
|
|
135482
|
+
requiresFees = true;
|
|
135483
|
+
break;
|
|
135484
|
+
}
|
|
135485
|
+
}
|
|
135486
|
+
}
|
|
135487
|
+
return requiresFees;
|
|
135488
|
+
}
|
|
134974
135489
|
function client_urlSeparatedAccounts(accounts) {
|
|
134975
135490
|
const pubKeys = accounts.map(account => client_lib_account.toPublicKeyString(account));
|
|
134976
135491
|
return pubKeys.join(',');
|
|
@@ -134987,22 +135502,34 @@ function client_parseResponsePermissions(permissions) {
|
|
|
134987
135502
|
const [base, external] = permissions.map(val => BigInt(val));
|
|
134988
135503
|
return new client_src_lib.Permissions(base, external);
|
|
134989
135504
|
}
|
|
134990
|
-
function client_formatAccountInfo(raw) {
|
|
134991
|
-
|
|
135505
|
+
function client_formatAccountInfo(raw, account) {
|
|
135506
|
+
let ret = {
|
|
134992
135507
|
name: raw.name,
|
|
134993
135508
|
description: raw.description,
|
|
134994
135509
|
metadata: raw.metadata
|
|
134995
135510
|
};
|
|
134996
|
-
if (
|
|
134997
|
-
|
|
134998
|
-
|
|
134999
|
-
|
|
135000
|
-
|
|
135001
|
-
|
|
135002
|
-
|
|
135003
|
-
|
|
135511
|
+
if (account.isIdentifier()) {
|
|
135512
|
+
ret = {
|
|
135513
|
+
...ret,
|
|
135514
|
+
defaultPermission: raw.defaultPermission !== undefined ? client_client_assertClassBrand(client_Client_brand, this, client_parseResponsePermissions).call(this, raw.defaultPermission) : undefined
|
|
135515
|
+
};
|
|
135516
|
+
if (account.isMultisig()) {
|
|
135517
|
+
if (raw.multisigQuorum !== undefined) {
|
|
135518
|
+
ret = {
|
|
135519
|
+
...ret,
|
|
135520
|
+
multisigQuorum: raw.multisigQuorum !== null ? BigInt(raw.multisigQuorum) : null
|
|
135521
|
+
};
|
|
135522
|
+
}
|
|
135523
|
+
} else if (account.isToken()) {
|
|
135524
|
+
if (raw.supply !== undefined) {
|
|
135525
|
+
ret = {
|
|
135526
|
+
...ret,
|
|
135527
|
+
supply: BigInt(raw.supply)
|
|
135528
|
+
};
|
|
135529
|
+
}
|
|
135530
|
+
}
|
|
135004
135531
|
}
|
|
135005
|
-
return
|
|
135532
|
+
return ret;
|
|
135006
135533
|
}
|
|
135007
135534
|
function client_parseAccountInfo(account, accountInfo) {
|
|
135008
135535
|
account = client_lib_account.toAccount(account);
|
|
@@ -135021,11 +135548,11 @@ function client_parseAccountInfo(account, accountInfo) {
|
|
|
135021
135548
|
currentRepresentative = client_src_lib.Account.fromPublicKeyString(accountInfo.representative).assertAccount();
|
|
135022
135549
|
}
|
|
135023
135550
|
return {
|
|
135024
|
-
account: client_src_lib.Account.fromPublicKeyString(accountInfo.account),
|
|
135551
|
+
account: client_src_lib.Account.fromPublicKeyString(accountInfo.account).assertKeyType(account.keyType),
|
|
135025
135552
|
currentHeadBlock: currentHeadBlock,
|
|
135026
135553
|
currentHeadBlockHeight: accountInfo.currentHeadBlockHeight,
|
|
135027
135554
|
representative: currentRepresentative,
|
|
135028
|
-
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, accountInfo.info),
|
|
135555
|
+
info: client_client_assertClassBrand(client_Client_brand, this, client_formatAccountInfo).call(this, accountInfo.info, account),
|
|
135029
135556
|
balances: client_client_assertClassBrand(client_Client_brand, this, client_formatAllBalances).call(this, accountInfo.balances)
|
|
135030
135557
|
};
|
|
135031
135558
|
}
|