@keetanetwork/keetanet-client 0.16.2 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/index-browser.js +509 -159
- package/client/index.js +511 -137
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +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 +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Ledger.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +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.Vote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +2 -2
- 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 +4 -4
- package/docs/hierarchy.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.AccountACLRow.html +11 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.AccountComputedEffect.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseACLRow.html +9 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateACLPrincipal.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateACLRow.html +11 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateComputedEffect.html +5 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.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 +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ECDSA_SECP256R1AccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ED25519AccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.ListACLsByEntityFilters.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NetworkAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +2 -7
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.StorageAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenAccountInfo.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- 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/types/KeetaNetSDK.Referenced.ACLEntryUnparsed.html +1 -5
- package/docs/types/KeetaNetSDK.Referenced.ACLPermissionRequirement.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ACLPrincipalType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.ACLRow.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ACLUpdate.html +5 -0
- package/docs/types/KeetaNetSDK.Referenced.ComputedBlockEffect.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocksByEntity.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ModifyPermissionsPrincipal.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.ModifyPermissionsPrincipalInput.html +1 -0
- package/docs/variables/KeetaNetSDK.Referenced.BlockOperationASN1Schema.html +2 -2
- package/docs/variables/KeetaNetSDK.Referenced.FullLedgerBaseErrorCode.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.aclPrincipalType.html +1 -0
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/lib/block/index.d.ts +14 -2
- package/lib/block/operations.d.ts +40 -4
- package/lib/error/block.d.ts +2 -2
- package/lib/error/index.d.ts +1 -1
- package/lib/error/ledger.d.ts +3 -3
- package/lib/ledger/common.d.ts +7 -5
- package/lib/ledger/db_dynamodb.d.ts +2 -2
- package/lib/ledger/db_postgres.d.ts +3 -3
- package/lib/ledger/db_spanner.d.ts +3 -3
- package/lib/ledger/db_spanner_helper.d.ts +23 -3
- package/lib/ledger/db_sqlite.d.ts +3 -3
- package/lib/ledger/effects.d.ts +17 -9
- package/lib/ledger/index.d.ts +14 -5
- package/lib/ledger/types.d.ts +38 -14
- package/lib/log/target_gcp.js +19 -17
- package/lib/utils/external-keys/gcp-kms-wrapped.d.ts +85 -0
- package/lib/utils/external-keys/gcp-kms-wrapped.js +453 -0
- package/lib/utils/external-keys/gcp-kms.common.d.ts +17 -0
- package/lib/utils/external-keys/gcp-kms.d.ts +4 -9
- package/lib/utils/external-keys/gcp-kms.js +52 -39
- package/lib/utils/external-keys/passkey-prf.d.ts +42 -1
- package/lib/utils/external-keys/passkey-prf.js +107 -13
- package/lib/vote.d.ts +7 -1
- package/npm-shrinkwrap.json +24 -24
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +0 -10
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLRow.html +0 -10
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +0 -12
- package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlockEffect.html +0 -4
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocksByAccount.html +0 -2
package/client/index-browser.js
CHANGED
|
@@ -115473,7 +115473,7 @@ const client_baseValidationConfig = {
|
|
|
115473
115473
|
},
|
|
115474
115474
|
blockOperations: {
|
|
115475
115475
|
external: {
|
|
115476
|
-
maxLength:
|
|
115476
|
+
maxLength: 1024,
|
|
115477
115477
|
regex: /^[-_A-Za-z0-9+/= ]+$/,
|
|
115478
115478
|
canBeEmpty: true
|
|
115479
115479
|
},
|
|
@@ -116297,7 +116297,7 @@ function client_block_toPrimitive(t, r) { if ("object" != typeof t || !t) return
|
|
|
116297
116297
|
|
|
116298
116298
|
|
|
116299
116299
|
const client_BlockErrorType = 'BLOCK';
|
|
116300
|
-
const client_BlockErrorCodes = ['AMOUNT_BELOW_ZERO', 'CANNOT_FORWARD_TO_SELF', 'CANNOT_SEND_NON_TOKEN', 'CERTIFICATE_SUBJECT_MISMATCH', 'EXACT_TRUE_WHEN_FORWARDING', 'EXTERNAL_INVALID', 'EXTERNAL_MISSING', 'EXTERNAL_TOO_LONG', 'GENERAL_FIELD_INVALID', 'IDENTIFIER_INVALID', 'IDENTIFIER_NEED_DEFAULT_PERMISSIONS', 'INTERMEDIATE_CERTIFICATES_ONLY_ADD', 'INVALID_ACCOUNT_TYPE', 'INVALID_CERTIFICATE_VALUE', 'INVALID_CREATE_IDENTIFIER_ARGS', 'INVALID_IDEMPOTENT_FORMAT', 'INVALID_IDEMPOTENT_LENGTH', 'INVALID_MULTISIG_QUORUM', 'INVALID_MULTISIG_SIGNER_COUNT', 'INVALID_MULTISIG_SIGNER_DEPTH', 'INVALID_MULTISIG_SIGNER_DUPLICATE', 'INVALID_PURPOSE_VALIDATION', 'INVALID_SIGNATURE', 'INVALID_SIGNER', 'INVALID_TYPE', 'INVALID_VERSION', 'NO_ADMIN_ON_TARGET', 'NO_DELEGATE_ADMIN', 'NO_DUPLICATE_CERTIFICATE_OPERATION', 'NO_IDENTIFIER_OP', 'NO_MODIFY_PERMISSION_DUPE', 'NO_MULTIPLE_SET_REP', 'NO_MULTISIG_OP', 'NO_TOKEN_OP', 'ONLY_IDENTIFIER_OP', 'ONLY_TOKEN_OP', 'PERMISSIONS_INVALID_DEFAULT', 'PERMISSIONS_INVALID_ENTITY', 'PERMISSIONS_INVALID_PRINCIPAL', 'PERMISSIONS_INVALID_TARGET', 'PREVIOUS_SELF', 'SUPPLY_INVALID', 'TOKEN_RECEIVE_DIFFERS', 'SIGNATURE_REQUIRED', 'SIGNATURE_PARAMETER_DIFFERS'];
|
|
116300
|
+
const client_BlockErrorCodes = ['AMOUNT_BELOW_ZERO', 'CANNOT_FORWARD_TO_SELF', 'CANNOT_SEND_NON_TOKEN', 'CERTIFICATE_SUBJECT_MISMATCH', 'EXACT_TRUE_WHEN_FORWARDING', 'EXTERNAL_INVALID', 'EXTERNAL_MISSING', 'EXTERNAL_TOO_LONG', 'GENERAL_FIELD_INVALID', 'IDENTIFIER_INVALID', 'IDENTIFIER_NEED_DEFAULT_PERMISSIONS', 'INTERMEDIATE_CERTIFICATES_ONLY_ADD', 'INVALID_ACCOUNT_TYPE', 'INVALID_CERTIFICATE_VALUE', 'INVALID_CREATE_IDENTIFIER_ARGS', 'INVALID_IDEMPOTENT_FORMAT', 'INVALID_IDEMPOTENT_LENGTH', 'INVALID_MULTISIG_QUORUM', 'INVALID_MULTISIG_SIGNER_COUNT', 'INVALID_MULTISIG_SIGNER_DEPTH', 'INVALID_MULTISIG_SIGNER_DUPLICATE', 'INVALID_PURPOSE_VALIDATION', 'INVALID_SIGNATURE', 'INVALID_SIGNER', 'INVALID_TYPE', 'INVALID_VERSION', 'INVALID_PRINCIPAL', 'NO_ADMIN_ON_TARGET', 'NO_DELEGATE_ADMIN', 'NO_DUPLICATE_CERTIFICATE_OPERATION', 'NO_IDENTIFIER_OP', 'NO_MODIFY_PERMISSION_DUPE', 'NO_MULTIPLE_SET_REP', 'NO_MULTISIG_OP', 'NO_TOKEN_OP', 'ONLY_IDENTIFIER_OP', 'ONLY_TOKEN_OP', 'PERMISSIONS_INVALID_DEFAULT', 'PERMISSIONS_INVALID_ENTITY', 'PERMISSIONS_INVALID_PRINCIPAL', 'PERMISSIONS_INVALID_TARGET', 'PREVIOUS_SELF', 'SUPPLY_INVALID', 'TOKEN_RECEIVE_DIFFERS', 'SIGNATURE_REQUIRED', 'SIGNATURE_PARAMETER_DIFFERS'];
|
|
116301
116301
|
const client_FullBlockErrorCodes = client_BlockErrorCodes.map(code => `${client_BlockErrorType}_${code}`);
|
|
116302
116302
|
class src_client_KeetaNetBlockError extends src_client_KeetaNetErrorBase {
|
|
116303
116303
|
constructor(code, message) {
|
|
@@ -117915,7 +117915,7 @@ function client_ledger_toPrimitive(t, r) { if ("object" != typeof t || !t) retur
|
|
|
117915
117915
|
|
|
117916
117916
|
|
|
117917
117917
|
const client_LedgerErrorType = 'LEDGER';
|
|
117918
|
-
const client_LedgerBaseErrorCodes = ['BLOCK_ALREADY_EXISTS', 'BLOCK_EXPIRED', 'TRANSACTION_ABORTED', 'INVALID_CHAIN', 'INVALID_NETWORK', 'INVALID_SUBNET', 'INVALID_PERMISSIONS', 'INVALID_OWNER_COUNT', 'INVALID_BALANCE', 'INVALID_SET_REP', 'OPERATION_NOT_SUPPORTED', 'NOT_EMPTY', 'PREVIOUS_ALREADY_USED', 'PREVIOUS_NOT_SEEN', 'SUCCESSOR_VOTE_EXISTS', 'INSUFFICIENT_VOTING_WEIGHT', 'INVALID_ACCOUNT_INFO_KEY', 'RECEIVE_NOT_MET', 'DUPLICATE_VOTE_FOUND', 'CANNOT_EXCHANGE_PERM_VOTE', 'TEMP_VOTE_INCLUDES_SELF', 'BLOCKS_DIFFER_FROM_VOTED_ON', 'NO_PERM_WITHOUT_SELF_TEMP', 'DUPLICATE_VOTE_ISSUER_FOUND', 'OTHER', 'MISSING_BLOCKS',
|
|
117918
|
+
const client_LedgerBaseErrorCodes = ['BLOCK_ALREADY_EXISTS', 'BLOCK_EXPIRED', 'TRANSACTION_ABORTED', 'INVALID_CHAIN', 'INVALID_NETWORK', 'INVALID_SUBNET', 'INVALID_PERMISSIONS', 'INVALID_OWNER_COUNT', 'INVALID_BALANCE', 'INVALID_SET_REP', 'INVALID_ACL_ROW_TYPE', 'OPERATION_NOT_SUPPORTED', 'NOT_EMPTY', 'PREVIOUS_ALREADY_USED', 'PREVIOUS_NOT_SEEN', 'SUCCESSOR_VOTE_EXISTS', 'INSUFFICIENT_VOTING_WEIGHT', 'INVALID_ACCOUNT_INFO_KEY', 'RECEIVE_NOT_MET', 'DUPLICATE_VOTE_FOUND', 'CANNOT_EXCHANGE_PERM_VOTE', 'TEMP_VOTE_INCLUDES_SELF', 'BLOCKS_DIFFER_FROM_VOTED_ON', 'NO_PERM_WITHOUT_SELF_TEMP', 'DUPLICATE_VOTE_ISSUER_FOUND', 'OTHER', 'MISSING_BLOCKS', 'CERTIFICATE_NOT_FOUND',
|
|
117919
117919
|
// Fee Errors
|
|
117920
117920
|
'FEE_AMOUNT_MISMATCH', 'FEE_TOKEN_MISMATCH', 'FEE_MISSING', 'MISSING_REQUIRED_FEE_BLOCK', 'MULTIPLE_FEE_BLOCK', 'VOTE_WITH_QUOTE', 'QUOTE_MISMATCH', 'REQUIRED_FEE_MISMATCH'];
|
|
117921
117921
|
|
|
@@ -118036,6 +118036,16 @@ function client_common_assertClassBrand(e, t, n) { if ("function" == typeof e ?
|
|
|
118036
118036
|
|
|
118037
118037
|
|
|
118038
118038
|
|
|
118039
|
+
function client_areACLPrincipalEqual(a, b) {
|
|
118040
|
+
if (client_lib_account.isInstance(a) || client_lib_account.isInstance(b)) {
|
|
118041
|
+
if (!client_lib_account.isInstance(a) || !client_lib_account.isInstance(b)) {
|
|
118042
|
+
return false;
|
|
118043
|
+
}
|
|
118044
|
+
return a.comparePublicKey(b);
|
|
118045
|
+
} else {
|
|
118046
|
+
return a.certificate.compareHexString(b.certificate) && a.certificateAccount.comparePublicKey(b.certificateAccount);
|
|
118047
|
+
}
|
|
118048
|
+
}
|
|
118039
118049
|
function client_findPermissionMatch(lookingFor, entries) {
|
|
118040
118050
|
const {
|
|
118041
118051
|
principal,
|
|
@@ -118044,7 +118054,8 @@ function client_findPermissionMatch(lookingFor, entries) {
|
|
|
118044
118054
|
} = lookingFor;
|
|
118045
118055
|
let foundRow;
|
|
118046
118056
|
for (const entry of entries) {
|
|
118047
|
-
|
|
118057
|
+
// If principals do not match, we can skip
|
|
118058
|
+
if (!client_areACLPrincipalEqual(principal, entry.principal)) {
|
|
118048
118059
|
continue;
|
|
118049
118060
|
}
|
|
118050
118061
|
|
|
@@ -118182,79 +118193,111 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118182
118193
|
const resolved = await getAccountInfoPromises[accountPubKey];
|
|
118183
118194
|
return resolved;
|
|
118184
118195
|
};
|
|
118196
|
+
const getCertificatePromises = {};
|
|
118197
|
+
const getCertificate = async (certificateHash, account) => {
|
|
118198
|
+
const promiseKey = `${certificateHash.toString()}-${account.publicKeyString.get()}`;
|
|
118199
|
+
if (getCertificatePromises[promiseKey] === undefined) {
|
|
118200
|
+
getCertificatePromises[promiseKey] = storageProvider.getAccountCertificateByHash(transaction, account, certificateHash);
|
|
118201
|
+
}
|
|
118202
|
+
return await getCertificatePromises[promiseKey];
|
|
118203
|
+
};
|
|
118185
118204
|
const getPermissionPromises = {};
|
|
118186
|
-
const getPermissions = async (
|
|
118187
|
-
|
|
118205
|
+
const getPermissions = async (principal, entityList) => {
|
|
118206
|
+
let promiseKey;
|
|
118207
|
+
if (client_lib_account.isInstance(principal)) {
|
|
118208
|
+
promiseKey = `account-${principal.publicKeyString.get()}`;
|
|
118209
|
+
} else {
|
|
118210
|
+
promiseKey = `certificate-${principal.certificate.toString()}-${principal.certificateAccount.publicKeyString.get()}`;
|
|
118211
|
+
}
|
|
118188
118212
|
if (!entityList) {
|
|
118189
|
-
return await getPermissionPromises[
|
|
118213
|
+
return await getPermissionPromises[promiseKey];
|
|
118190
118214
|
}
|
|
118191
|
-
if (getPermissionPromises[
|
|
118215
|
+
if (getPermissionPromises[promiseKey] !== undefined) {
|
|
118192
118216
|
throw new Error('getPermissions() can only be called once per account');
|
|
118193
118217
|
}
|
|
118194
|
-
getPermissionPromises[
|
|
118195
|
-
return await getPermissionPromises[
|
|
118218
|
+
getPermissionPromises[promiseKey] = storageProvider.listACLsByPrincipal(transaction, principal, entityList);
|
|
118219
|
+
return await getPermissionPromises[promiseKey];
|
|
118196
118220
|
};
|
|
118197
118221
|
const prefetchPromises = [];
|
|
118198
|
-
for (const {
|
|
118199
|
-
|
|
118200
|
-
|
|
118201
|
-
|
|
118202
|
-
|
|
118203
|
-
|
|
118204
|
-
|
|
118205
|
-
|
|
118206
|
-
|
|
118207
|
-
|
|
118208
|
-
|
|
118209
|
-
const toReadEntity = new client_lib_account.Set();
|
|
118210
|
-
for (const permUpdate of (_fields$permissions = fields.permissions) !== null && _fields$permissions !== void 0 ? _fields$permissions : []) {
|
|
118211
|
-
var _fields$permissions;
|
|
118212
|
-
if (permUpdate.method === src_client_Block.AdjustMethod.SET || permUpdate.permissions === null) {
|
|
118213
|
-
toReadEntity.delete(permUpdate.entity);
|
|
118214
|
-
continue;
|
|
118215
|
-
}
|
|
118216
|
-
toReadEntity.add(permUpdate.entity);
|
|
118222
|
+
for (const effect of Object.values(effects)) {
|
|
118223
|
+
const fields = effect.fields;
|
|
118224
|
+
const toReadEntity = new client_lib_account.Set();
|
|
118225
|
+
for (const permUpdate of (_fields$permissions = fields.permissions) !== null && _fields$permissions !== void 0 ? _fields$permissions : []) {
|
|
118226
|
+
var _fields$permissions;
|
|
118227
|
+
if ((permUpdate.method === src_client_Block.AdjustMethod.ADD || permUpdate.method === src_client_Block.AdjustMethod.SET) && permUpdate.principalType === 'CERTIFICATE') {
|
|
118228
|
+
prefetchPromises.push(getCertificate(permUpdate.principal.certificate, permUpdate.principal.certificateAccount));
|
|
118229
|
+
}
|
|
118230
|
+
if (permUpdate.method === src_client_Block.AdjustMethod.SET || permUpdate.permissions === null) {
|
|
118231
|
+
toReadEntity.delete(permUpdate.entity);
|
|
118232
|
+
continue;
|
|
118217
118233
|
}
|
|
118218
|
-
|
|
118234
|
+
toReadEntity.add(permUpdate.entity);
|
|
118219
118235
|
}
|
|
118220
|
-
|
|
118221
|
-
|
|
118222
|
-
|
|
118223
|
-
|
|
118224
|
-
|
|
118225
|
-
|
|
118226
|
-
|
|
118236
|
+
let principal;
|
|
118237
|
+
if (effect.type === 'ACCOUNT') {
|
|
118238
|
+
principal = effect.account;
|
|
118239
|
+
} else {
|
|
118240
|
+
principal = {
|
|
118241
|
+
usingCertificate: true,
|
|
118242
|
+
certificate: effect.certificateHash,
|
|
118243
|
+
certificateAccount: effect.certificateAccount
|
|
118244
|
+
};
|
|
118227
118245
|
}
|
|
118228
|
-
|
|
118229
|
-
|
|
118230
|
-
|
|
118231
|
-
|
|
118232
|
-
|
|
118233
|
-
|
|
118234
|
-
|
|
118235
|
-
|
|
118236
|
-
|
|
118237
|
-
|
|
118238
|
-
|
|
118239
|
-
|
|
118240
|
-
|
|
118241
|
-
|
|
118242
|
-
|
|
118243
|
-
|
|
118244
|
-
|
|
118245
|
-
|
|
118246
|
-
|
|
118247
|
-
|
|
118248
|
-
|
|
118249
|
-
|
|
118250
|
-
|
|
118251
|
-
|
|
118252
|
-
|
|
118253
|
-
|
|
118254
|
-
|
|
118255
|
-
|
|
118256
|
-
|
|
118257
|
-
|
|
118246
|
+
|
|
118247
|
+
// Only prefetch the permissions if we are computing the permissions
|
|
118248
|
+
if (computePermissions) {
|
|
118249
|
+
prefetchPromises.push(getPermissions(principal, toReadEntity.toArray()));
|
|
118250
|
+
}
|
|
118251
|
+
if (effect.type !== 'CERTIFICATE') {
|
|
118252
|
+
var _fields$supply, _effects$accountPubKe;
|
|
118253
|
+
const {
|
|
118254
|
+
account
|
|
118255
|
+
} = effect;
|
|
118256
|
+
|
|
118257
|
+
// Always fetch the supply from accountInfo if it's changing so we can validate the effect
|
|
118258
|
+
if (((_fields$supply = fields.supply) !== null && _fields$supply !== void 0 ? _fields$supply : []).length > 0 && (checkRangeConstraints || getFinalNumericValues)) {
|
|
118259
|
+
prefetchPromises.push(getAccountInfo(account));
|
|
118260
|
+
}
|
|
118261
|
+
const accountPubKey = account.publicKeyString.get();
|
|
118262
|
+
const delegationField = (_effects$accountPubKe = effects[accountPubKey]) === null || _effects$accountPubKe === void 0 ? void 0 : _effects$accountPubKe.fields.delegation;
|
|
118263
|
+
const isDelegating = delegationField !== undefined;
|
|
118264
|
+
let requestedRep = false;
|
|
118265
|
+
if (isDelegating && computeWeights && getFinalNumericValues && client_canDelegate(account.keyType)) {
|
|
118266
|
+
requestedRep = true;
|
|
118267
|
+
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
118268
|
+
prefetchPromises.push(getWeight(delegationField.delegateTo));
|
|
118269
|
+
}
|
|
118270
|
+
const rollingChanges = {};
|
|
118271
|
+
for (const tokenPubKey in (_fields$balance = fields.balance) !== null && _fields$balance !== void 0 ? _fields$balance : {}) {
|
|
118272
|
+
var _fields$balance;
|
|
118273
|
+
for (const balanceUpdate of ((_fields$balance2 = fields.balance) !== null && _fields$balance2 !== void 0 ? _fields$balance2 : {})[tokenPubKey]) {
|
|
118274
|
+
var _fields$balance2;
|
|
118275
|
+
if (balanceUpdate.isReceive) {
|
|
118276
|
+
continue;
|
|
118277
|
+
}
|
|
118278
|
+
const {
|
|
118279
|
+
set,
|
|
118280
|
+
value
|
|
118281
|
+
} = balanceUpdate;
|
|
118282
|
+
const token = client_lib_account.fromPublicKeyString(tokenPubKey).assertKeyType(client_AccountKeyAlgorithm.TOKEN);
|
|
118283
|
+
if (rollingChanges[tokenPubKey] === undefined) {
|
|
118284
|
+
rollingChanges[tokenPubKey] = 0n;
|
|
118285
|
+
}
|
|
118286
|
+
if (set) {
|
|
118287
|
+
prefetchPromises.push(getPreviousBalance(token, token));
|
|
118288
|
+
rollingChanges[tokenPubKey] = value;
|
|
118289
|
+
} else {
|
|
118290
|
+
rollingChanges[tokenPubKey] += value;
|
|
118291
|
+
}
|
|
118292
|
+
const isBaseToken = baseToken.comparePublicKey(tokenPubKey);
|
|
118293
|
+
const possibleNegative = rollingChanges[tokenPubKey] < 0n && checkRangeConstraints;
|
|
118294
|
+
if (possibleNegative && checkRangeConstraints || set || getFinalNumericValues || isDelegating && computeWeights) {
|
|
118295
|
+
prefetchPromises.push(getPreviousBalance(account, token));
|
|
118296
|
+
}
|
|
118297
|
+
if (computeWeights && isBaseToken && client_canDelegate(account.keyType) && !requestedRep) {
|
|
118298
|
+
requestedRep = true;
|
|
118299
|
+
prefetchPromises.push(getRep(account, getFinalNumericValues));
|
|
118300
|
+
}
|
|
118258
118301
|
}
|
|
118259
118302
|
}
|
|
118260
118303
|
}
|
|
@@ -118357,34 +118400,56 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118357
118400
|
newEntry.change += change;
|
|
118358
118401
|
supplies[tokenPubKey] = newEntry;
|
|
118359
118402
|
};
|
|
118360
|
-
for (const {
|
|
118361
|
-
|
|
118362
|
-
fields
|
|
118363
|
-
} of Object.values(effects)) {
|
|
118364
|
-
var _effects$accountPubKe2;
|
|
118365
|
-
const accountPubKey = account.publicKeyString.get();
|
|
118403
|
+
for (const effect of Object.values(effects)) {
|
|
118404
|
+
const fields = effect.fields;
|
|
118366
118405
|
for (const supplyChange of (_fields$supply2 = fields.supply) !== null && _fields$supply2 !== void 0 ? _fields$supply2 : []) {
|
|
118367
118406
|
var _fields$supply2;
|
|
118368
|
-
if (!account.isToken()) {
|
|
118407
|
+
if (effect.type !== 'ACCOUNT' || !effect.account.isToken()) {
|
|
118369
118408
|
throw new Error('Cannot modify supply of non-token account');
|
|
118370
118409
|
}
|
|
118371
|
-
await modifySupply(account, supplyChange.value);
|
|
118372
|
-
}
|
|
118373
|
-
let permissionUpdates = [];
|
|
118374
|
-
if (computePermissions && fields.permissions) {
|
|
118375
|
-
permissionUpdates = fields.permissions;
|
|
118410
|
+
await modifySupply(effect.account, supplyChange.value);
|
|
118376
118411
|
}
|
|
118377
|
-
for (const permUpdate of
|
|
118378
|
-
var _previousEntry$permis;
|
|
118379
|
-
|
|
118380
|
-
|
|
118412
|
+
for (const permUpdate of (_fields$permissions2 = fields.permissions) !== null && _fields$permissions2 !== void 0 ? _fields$permissions2 : []) {
|
|
118413
|
+
var _fields$permissions2, _previousEntry$permis;
|
|
118414
|
+
let principal;
|
|
118415
|
+
if (effect.type === 'ACCOUNT') {
|
|
118416
|
+
principal = effect.account;
|
|
118417
|
+
if (!client_lib_account.isInstance(permUpdate.principal)) {
|
|
118418
|
+
throw new Error('permUpdate.principal should be an account for ACCOUNT type effects');
|
|
118419
|
+
}
|
|
118420
|
+
if (!permUpdate.principal.comparePublicKey(effect.account)) {
|
|
118421
|
+
throw new Error('permUpdate.principal should not differ current account');
|
|
118422
|
+
}
|
|
118423
|
+
} else {
|
|
118424
|
+
if (client_lib_account.isInstance(permUpdate.principal)) {
|
|
118425
|
+
throw new Error('permUpdate.principal should be a certificate for CERTIFICATE type effects');
|
|
118426
|
+
}
|
|
118427
|
+
if (!permUpdate.principal.certificate.compareHexString(effect.certificateHash)) {
|
|
118428
|
+
throw new Error('permUpdate.principal should not differ current certificate');
|
|
118429
|
+
}
|
|
118430
|
+
principal = {
|
|
118431
|
+
usingCertificate: true,
|
|
118432
|
+
certificate: effect.certificateHash,
|
|
118433
|
+
certificateAccount: effect.certificateAccount
|
|
118434
|
+
};
|
|
118435
|
+
if (permUpdate.method === src_client_Block.AdjustMethod.ADD || permUpdate.method === src_client_Block.AdjustMethod.SET) {
|
|
118436
|
+
const certificate = await getCertificate(permUpdate.principal.certificate, permUpdate.principal.certificateAccount);
|
|
118437
|
+
if (!certificate) {
|
|
118438
|
+
throw new client_ledger_KeetaNetLedgerError('LEDGER_CERTIFICATE_NOT_FOUND', `Certificate with hash ${permUpdate.principal.certificate.toString()} for account ${permUpdate.principal.certificateAccount.publicKeyString.get()} not found`);
|
|
118439
|
+
}
|
|
118440
|
+
}
|
|
118441
|
+
}
|
|
118442
|
+
|
|
118443
|
+
// If not computing permissions, we only need to validate certificate existence
|
|
118444
|
+
if (!computePermissions) {
|
|
118445
|
+
continue;
|
|
118381
118446
|
}
|
|
118382
118447
|
if (permUpdate.method === src_client_Block.AdjustMethod.SET || permUpdate.permissions === null) {
|
|
118383
118448
|
permissions.push(permUpdate);
|
|
118384
118449
|
continue;
|
|
118385
118450
|
}
|
|
118386
118451
|
let newPermissions;
|
|
118387
|
-
const previousEntry = client_findPermissionMatch(permUpdate, await getPermissions(
|
|
118452
|
+
const previousEntry = client_findPermissionMatch(permUpdate, await getPermissions(principal));
|
|
118388
118453
|
const previousPermissions = (_previousEntry$permis = previousEntry === null || previousEntry === void 0 ? void 0 : previousEntry.permissions) !== null && _previousEntry$permis !== void 0 ? _previousEntry$permis : new client_permissions_Permissions();
|
|
118389
118454
|
switch (permUpdate.method) {
|
|
118390
118455
|
case src_client_Block.AdjustMethod.ADD:
|
|
@@ -118400,14 +118465,19 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118400
118465
|
permissions: newPermissions
|
|
118401
118466
|
});
|
|
118402
118467
|
}
|
|
118403
|
-
|
|
118404
|
-
|
|
118405
|
-
if (
|
|
118406
|
-
|
|
118407
|
-
|
|
118408
|
-
|
|
118409
|
-
if (
|
|
118410
|
-
await
|
|
118468
|
+
let isDelegating;
|
|
118469
|
+
let delegationField;
|
|
118470
|
+
if (effect.type === 'ACCOUNT') {
|
|
118471
|
+
var _effects$effect$accou;
|
|
118472
|
+
delegationField = (_effects$effect$accou = effects[effect.account.publicKeyString.get()]) === null || _effects$effect$accou === void 0 ? void 0 : _effects$effect$accou.fields.delegation;
|
|
118473
|
+
isDelegating = delegationField !== undefined;
|
|
118474
|
+
if (isDelegating && delegationField && client_canDelegate(effect.account.keyType) && computeWeights) {
|
|
118475
|
+
const currentDelegation = await getRep(effect.account, getFinalNumericValues);
|
|
118476
|
+
const previousBalance = await getPreviousBalance(effect.account, baseToken);
|
|
118477
|
+
await modifyWeight(delegationField.delegateTo, previousBalance);
|
|
118478
|
+
if (currentDelegation) {
|
|
118479
|
+
await modifyWeight(currentDelegation, -1n * previousBalance);
|
|
118480
|
+
}
|
|
118411
118481
|
}
|
|
118412
118482
|
}
|
|
118413
118483
|
const receivable = {};
|
|
@@ -118416,6 +118486,9 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118416
118486
|
const tokenAcct = client_lib_account.fromPublicKeyString(tokenPubKey).assertKeyType(client_AccountKeyAlgorithm.TOKEN);
|
|
118417
118487
|
for (const balanceUpdate of ((_fields$balance4 = fields.balance) !== null && _fields$balance4 !== void 0 ? _fields$balance4 : {})[tokenPubKey]) {
|
|
118418
118488
|
var _fields$balance4;
|
|
118489
|
+
if (effect.type !== 'ACCOUNT') {
|
|
118490
|
+
throw new Error('Only accounts can have balance changes');
|
|
118491
|
+
}
|
|
118419
118492
|
const {
|
|
118420
118493
|
isReceive,
|
|
118421
118494
|
value,
|
|
@@ -118423,7 +118496,7 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118423
118496
|
} = balanceUpdate;
|
|
118424
118497
|
if (isReceive) {
|
|
118425
118498
|
const receiveFromPubKey = otherAccount.publicKeyString.get();
|
|
118426
|
-
const previousEntry = getBalanceEntry(account, tokenAcct);
|
|
118499
|
+
const previousEntry = getBalanceEntry(effect.account, tokenAcct);
|
|
118427
118500
|
if (previousEntry.receiveValidated === false) {
|
|
118428
118501
|
continue;
|
|
118429
118502
|
}
|
|
@@ -118440,15 +118513,15 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118440
118513
|
} else {
|
|
118441
118514
|
receiveValid = value <= receivableAmount;
|
|
118442
118515
|
}
|
|
118443
|
-
balances[
|
|
118516
|
+
balances[effect.account.publicKeyString.get()][tokenPubKey].receiveValidated = receiveValid;
|
|
118444
118517
|
continue;
|
|
118445
118518
|
}
|
|
118446
118519
|
let balanceChange;
|
|
118447
118520
|
if (balanceUpdate.set) {
|
|
118448
|
-
balanceChange = await modifyBalance(account, tokenAcct, value, true);
|
|
118521
|
+
balanceChange = await modifyBalance(effect.account, tokenAcct, value, true);
|
|
118449
118522
|
await modifyBalance(tokenAcct, tokenAcct, -1n * balanceChange, false);
|
|
118450
118523
|
} else {
|
|
118451
|
-
balanceChange = await modifyBalance(account, tokenAcct, value, false);
|
|
118524
|
+
balanceChange = await modifyBalance(effect.account, tokenAcct, value, false);
|
|
118452
118525
|
}
|
|
118453
118526
|
if (balanceUpdate.receivable) {
|
|
118454
118527
|
const otherAccountPubKey = otherAccount.publicKeyString.get();
|
|
@@ -118463,11 +118536,14 @@ async function client_computeLedgerEffect(options, effects, storageProvider, net
|
|
|
118463
118536
|
receivable[otherAccountPubKey][tokenPubKey] += balanceChange;
|
|
118464
118537
|
}
|
|
118465
118538
|
const isBaseToken = baseToken.comparePublicKey(tokenAcct);
|
|
118466
|
-
if (isBaseToken && client_canDelegate(account.keyType) && computeWeights) {
|
|
118539
|
+
if (isBaseToken && client_canDelegate(effect.account.keyType) && computeWeights) {
|
|
118467
118540
|
if (isDelegating) {
|
|
118541
|
+
if (!delegationField) {
|
|
118542
|
+
throw new Error('delegationField should be defined if isDelegating is true');
|
|
118543
|
+
}
|
|
118468
118544
|
await modifyWeight(delegationField.delegateTo, balanceChange);
|
|
118469
118545
|
} else {
|
|
118470
|
-
const currentRep = await getRep(account);
|
|
118546
|
+
const currentRep = await getRep(effect.account);
|
|
118471
118547
|
if (currentRep) {
|
|
118472
118548
|
await modifyWeight(currentRep, balanceChange);
|
|
118473
118549
|
}
|
|
@@ -118889,6 +118965,9 @@ function client_operationTypeToNumber(str) {
|
|
|
118889
118965
|
}
|
|
118890
118966
|
return type;
|
|
118891
118967
|
}
|
|
118968
|
+
const client_ModifyPermissionsPrincipalContextSpecificTagValues = {
|
|
118969
|
+
CERTIFICATE: 1
|
|
118970
|
+
};
|
|
118892
118971
|
function client_makeEncodeDecodePermission(emptyValue) {
|
|
118893
118972
|
return {
|
|
118894
118973
|
encode: data => {
|
|
@@ -118984,7 +119063,52 @@ const client_BlockOperationASN1SchemaBase = {
|
|
|
118984
119063
|
}],
|
|
118985
119064
|
'MODIFY_PERMISSIONS': [{
|
|
118986
119065
|
name: 'principal',
|
|
118987
|
-
schema:
|
|
119066
|
+
schema: {
|
|
119067
|
+
choice: [client_ValidateASN1.IsOctetString, {
|
|
119068
|
+
type: 'context',
|
|
119069
|
+
kind: 'explicit',
|
|
119070
|
+
value: client_ModifyPermissionsPrincipalContextSpecificTagValues.CERTIFICATE,
|
|
119071
|
+
contains: [/* Certificate Hash */
|
|
119072
|
+
client_ValidateASN1.IsOctetString, /* Certificate Issued To Account */
|
|
119073
|
+
client_ValidateASN1.IsOctetString]
|
|
119074
|
+
}]
|
|
119075
|
+
},
|
|
119076
|
+
encode(data) {
|
|
119077
|
+
if (client_lib_account.isInstance(data)) {
|
|
119078
|
+
return data.publicKeyAndType;
|
|
119079
|
+
} else if (data.usingCertificate) {
|
|
119080
|
+
return {
|
|
119081
|
+
type: 'context',
|
|
119082
|
+
kind: 'explicit',
|
|
119083
|
+
value: client_ModifyPermissionsPrincipalContextSpecificTagValues.CERTIFICATE,
|
|
119084
|
+
contains: [data.certificateHash.getBuffer(), data.certificateAccount.publicKeyAndType]
|
|
119085
|
+
};
|
|
119086
|
+
} else {
|
|
119087
|
+
throw new Error('Invalid principal type for MODIFY_PERMISSIONS operation');
|
|
119088
|
+
}
|
|
119089
|
+
},
|
|
119090
|
+
decode(data) {
|
|
119091
|
+
if (client_isBuffer(data)) {
|
|
119092
|
+
return client_lib_account.fromPublicKeyAndType(data);
|
|
119093
|
+
} else if (client_ASN1CheckUtilities.isASN1ContextTag(data, 'explicit')) {
|
|
119094
|
+
if (data.value === client_ModifyPermissionsPrincipalContextSpecificTagValues.CERTIFICATE) {
|
|
119095
|
+
if (!Array.isArray(data.contains) || data.contains.length !== 2) {
|
|
119096
|
+
throw new Error('Invalid principal data for MODIFY_PERMISSIONS operation');
|
|
119097
|
+
}
|
|
119098
|
+
const certificateHashData = data.contains[0];
|
|
119099
|
+
const certificateAccountData = data.contains[1];
|
|
119100
|
+
if (!client_isBuffer(certificateHashData) || !client_isBuffer(certificateAccountData)) {
|
|
119101
|
+
throw new Error('Invalid certificate hash data for MODIFY_PERMISSIONS operation');
|
|
119102
|
+
}
|
|
119103
|
+
return {
|
|
119104
|
+
usingCertificate: true,
|
|
119105
|
+
certificateHash: new src_client_CertificateHash(client_bufferToArrayBuffer(certificateHashData)),
|
|
119106
|
+
certificateAccount: client_lib_account.fromPublicKeyAndType(certificateAccountData)
|
|
119107
|
+
};
|
|
119108
|
+
}
|
|
119109
|
+
}
|
|
119110
|
+
throw new Error('Invalid principal data for MODIFY_PERMISSIONS operation');
|
|
119111
|
+
}
|
|
118988
119112
|
}, {
|
|
118989
119113
|
name: 'method',
|
|
118990
119114
|
schema: client_ValidateASN1.IsInteger
|
|
@@ -119724,10 +119848,6 @@ class src_client_BlockOperationSET_INFO extends src_client_BlockOperation {
|
|
|
119724
119848
|
return client_toJSONSerializable(val);
|
|
119725
119849
|
}
|
|
119726
119850
|
}
|
|
119727
|
-
|
|
119728
|
-
/**
|
|
119729
|
-
* Set Permissions Operation
|
|
119730
|
-
*/
|
|
119731
119851
|
client_BlockOperationSET_INFO = src_client_BlockOperationSET_INFO;
|
|
119732
119852
|
function client_validateNameDesc(field, value, network) {
|
|
119733
119853
|
const {
|
|
@@ -119746,6 +119866,9 @@ function client_validateNameDesc(field, value, network) {
|
|
|
119746
119866
|
return;
|
|
119747
119867
|
}
|
|
119748
119868
|
client_operations_defineProperty(src_client_BlockOperationSET_INFO, "isInstance", client_checkableGenerator(client_BlockOperationSET_INFO));
|
|
119869
|
+
/**
|
|
119870
|
+
* Set Permissions Operation
|
|
119871
|
+
*/
|
|
119749
119872
|
var client_principal = /*#__PURE__*/new WeakMap();
|
|
119750
119873
|
var client_target = /*#__PURE__*/new WeakMap();
|
|
119751
119874
|
var client_method2 = /*#__PURE__*/new WeakMap();
|
|
@@ -119763,7 +119886,7 @@ class src_client_BlockOperationMODIFY_PERMISSIONS extends src_client_BlockOperat
|
|
|
119763
119886
|
if (input.type !== client_OperationType.MODIFY_PERMISSIONS) {
|
|
119764
119887
|
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_TYPE', 'Invalid construction of BlockJSONOperationMODIFY_PERMISSIONS');
|
|
119765
119888
|
}
|
|
119766
|
-
client_operations_classPrivateFieldSet(client_principal, this, this.
|
|
119889
|
+
client_operations_classPrivateFieldSet(client_principal, this, client_operations_assertClassBrand(client_BlockOperationMODIFY_PERMISSIONS_brand, this, client_computePrincipal).call(this, input.principal));
|
|
119767
119890
|
client_operations_classPrivateFieldSet(client_target, this, client_lib_account.toAccount(input.target));
|
|
119768
119891
|
client_operations_classPrivateFieldSet(client_method2, this, client_toAdjustMethod(input.method));
|
|
119769
119892
|
client_operations_classPrivateFieldSet(client_permissions, this, client_operations_assertClassBrand(client_BlockOperationMODIFY_PERMISSIONS_brand, this, client_computePermissions).call(this, input.permissions));
|
|
@@ -119811,8 +119934,15 @@ class src_client_BlockOperationMODIFY_PERMISSIONS extends src_client_BlockOperat
|
|
|
119811
119934
|
base
|
|
119812
119935
|
} = this.permissions;
|
|
119813
119936
|
const baseFlagsString = `[${base.flags.join(',')}]`;
|
|
119814
|
-
if (
|
|
119815
|
-
|
|
119937
|
+
if (client_lib_account.isInstance(this.principal)) {
|
|
119938
|
+
if (!base.checkAccountMatchesGroup('principal', this.principal)) {
|
|
119939
|
+
throw new src_client_KeetaNetBlockError('BLOCK_PERMISSIONS_INVALID_PRINCIPAL', `Incorrect principal for flags ${baseFlagsString}`);
|
|
119940
|
+
}
|
|
119941
|
+
} else {
|
|
119942
|
+
// If the principal is not an account, we only allow default permissions to be issued by a certificate principal
|
|
119943
|
+
if (!base.isValidForDefault) {
|
|
119944
|
+
throw new src_client_KeetaNetBlockError('BLOCK_PERMISSIONS_INVALID_DEFAULT', 'Invalid permissions, cannot use certificate principal with non-default permissions');
|
|
119945
|
+
}
|
|
119816
119946
|
}
|
|
119817
119947
|
if (this.target && !base.checkAccountMatchesGroup('target', this.target)) {
|
|
119818
119948
|
throw new src_client_KeetaNetBlockError('BLOCK_PERMISSIONS_INVALID_TARGET', `Incorrect target for flags ${baseFlagsString}`);
|
|
@@ -119840,7 +119970,12 @@ class src_client_BlockOperationMODIFY_PERMISSIONS extends src_client_BlockOperat
|
|
|
119840
119970
|
target,
|
|
119841
119971
|
method
|
|
119842
119972
|
} = operation;
|
|
119843
|
-
|
|
119973
|
+
let principalKey;
|
|
119974
|
+
if (client_lib_account.isInstance(principal)) {
|
|
119975
|
+
principalKey = principal.publicKeyString.get();
|
|
119976
|
+
} else {
|
|
119977
|
+
principalKey = `cert:${principal.certificateHash.get()}:${principal.certificateAccount.publicKeyString.get()}`;
|
|
119978
|
+
}
|
|
119844
119979
|
const targetKey = (target !== null && target !== void 0 ? target : block.account).publicKeyString.get();
|
|
119845
119980
|
if (!foundPrevious[principalKey]) {
|
|
119846
119981
|
foundPrevious[principalKey] = {};
|
|
@@ -119870,6 +120005,26 @@ class src_client_BlockOperationMODIFY_PERMISSIONS extends src_client_BlockOperat
|
|
|
119870
120005
|
* Token Supply operation
|
|
119871
120006
|
*/
|
|
119872
120007
|
client_BlockOperationMODIFY_PERMISSIONS = src_client_BlockOperationMODIFY_PERMISSIONS;
|
|
120008
|
+
function client_computePrincipal(principal) {
|
|
120009
|
+
if (typeof principal === 'string' || client_lib_account.isInstance(principal)) {
|
|
120010
|
+
return this.computeTo(principal);
|
|
120011
|
+
} else if (principal.usingCertificate) {
|
|
120012
|
+
const certificateAccount = client_lib_account.toAccount(principal.certificateAccount);
|
|
120013
|
+
let certificateHash;
|
|
120014
|
+
if (src_client_CertificateHash.isInstance(principal.certificateHash)) {
|
|
120015
|
+
certificateHash = principal.certificateHash;
|
|
120016
|
+
} else {
|
|
120017
|
+
certificateHash = new src_client_CertificateHash(principal.certificateHash);
|
|
120018
|
+
}
|
|
120019
|
+
return {
|
|
120020
|
+
usingCertificate: true,
|
|
120021
|
+
certificateHash,
|
|
120022
|
+
certificateAccount
|
|
120023
|
+
};
|
|
120024
|
+
} else {
|
|
120025
|
+
throw new src_client_KeetaNetBlockError('BLOCK_INVALID_PRINCIPAL', 'Invalid principal for MODIFY_PERMISSIONS');
|
|
120026
|
+
}
|
|
120027
|
+
}
|
|
119873
120028
|
function client_computePermissions(permissions) {
|
|
119874
120029
|
if (!permissions) {
|
|
119875
120030
|
return null;
|
|
@@ -124018,34 +124173,53 @@ function client_addOrCombineRequirements(existing, addition, alwaysCombine) {
|
|
|
124018
124173
|
resp.push(addition);
|
|
124019
124174
|
return resp;
|
|
124020
124175
|
}
|
|
124021
|
-
function
|
|
124022
|
-
|
|
124023
|
-
|
|
124024
|
-
|
|
124176
|
+
function client_touchStateFields(state, toTouch) {
|
|
124177
|
+
let entityKey;
|
|
124178
|
+
let defaultValue;
|
|
124179
|
+
if (client_lib_account.isInstance(toTouch)) {
|
|
124180
|
+
entityKey = toTouch.publicKeyString.get();
|
|
124181
|
+
defaultValue = {
|
|
124182
|
+
type: 'ACCOUNT',
|
|
124183
|
+
fields: {},
|
|
124184
|
+
account: toTouch
|
|
124185
|
+
};
|
|
124186
|
+
} else if (toTouch.usingCertificate) {
|
|
124187
|
+
entityKey = `${toTouch.certificate.toString()}:${toTouch.certificateAccount.publicKeyString.get()}`;
|
|
124188
|
+
defaultValue = {
|
|
124189
|
+
type: 'CERTIFICATE',
|
|
124025
124190
|
fields: {},
|
|
124026
|
-
|
|
124191
|
+
certificateHash: toTouch.certificate,
|
|
124192
|
+
certificateAccount: toTouch.certificateAccount
|
|
124027
124193
|
};
|
|
124194
|
+
} else {
|
|
124195
|
+
throw new Error('Invalid principal type in touchStateFields');
|
|
124028
124196
|
}
|
|
124029
|
-
|
|
124030
|
-
|
|
124197
|
+
let value = state.accounts[entityKey];
|
|
124198
|
+
if (value === undefined) {
|
|
124199
|
+
state.accounts[entityKey] = defaultValue;
|
|
124200
|
+
value = state.accounts[entityKey];
|
|
124031
124201
|
}
|
|
124032
|
-
|
|
124033
|
-
|
|
124202
|
+
return {
|
|
124203
|
+
value,
|
|
124204
|
+
entityKey
|
|
124205
|
+
};
|
|
124206
|
+
}
|
|
124207
|
+
function client_addPermission(state, addition) {
|
|
124208
|
+
const {
|
|
124209
|
+
value
|
|
124210
|
+
} = client_touchStateFields(state, addition.principal);
|
|
124211
|
+
if (value.fields.permissions === undefined) {
|
|
124212
|
+
value.fields.permissions = [];
|
|
124034
124213
|
}
|
|
124035
|
-
const existing =
|
|
124036
|
-
|
|
124214
|
+
const existing = value.fields.permissions || [];
|
|
124215
|
+
value.fields.permissions = client_addOrCombineRequirements(existing, addition);
|
|
124037
124216
|
}
|
|
124038
124217
|
function client_addPermissionRequirement(state, requirement) {
|
|
124039
|
-
var
|
|
124040
|
-
const
|
|
124041
|
-
|
|
124042
|
-
|
|
124043
|
-
|
|
124044
|
-
account: requirement.principal,
|
|
124045
|
-
fields: {}
|
|
124046
|
-
};
|
|
124047
|
-
}
|
|
124048
|
-
const alreadyAdded = (_state$accounts$princ = state.accounts[principalPubKey].fields.permissions) !== null && _state$accounts$princ !== void 0 ? _state$accounts$princ : [];
|
|
124218
|
+
var _principalFields$fiel, _principalFields$fiel2;
|
|
124219
|
+
const {
|
|
124220
|
+
value: principalFields
|
|
124221
|
+
} = client_touchStateFields(state, requirement.principal);
|
|
124222
|
+
const alreadyAdded = (_principalFields$fiel = principalFields.fields.permissions) !== null && _principalFields$fiel !== void 0 ? _principalFields$fiel : [];
|
|
124049
124223
|
const foundAddedMatch = alreadyAdded.find(function (_ref) {
|
|
124050
124224
|
let {
|
|
124051
124225
|
permissions
|
|
@@ -124058,6 +124232,7 @@ function client_addPermissionRequirement(state, requirement) {
|
|
|
124058
124232
|
if (foundAddedMatch !== undefined) {
|
|
124059
124233
|
return;
|
|
124060
124234
|
}
|
|
124235
|
+
const entityPubKey = requirement.entity.publicKeyString.get();
|
|
124061
124236
|
if (state.accounts[entityPubKey] !== undefined) {
|
|
124062
124237
|
const entityInfo = state.accounts[entityPubKey].fields.info;
|
|
124063
124238
|
if (entityInfo !== undefined && 'defaultPermission' in entityInfo) {
|
|
@@ -124069,13 +124244,14 @@ function client_addPermissionRequirement(state, requirement) {
|
|
|
124069
124244
|
}
|
|
124070
124245
|
}
|
|
124071
124246
|
}
|
|
124072
|
-
const existing = (
|
|
124073
|
-
|
|
124247
|
+
const existing = (_principalFields$fiel2 = principalFields.fields.permissionRequirements) !== null && _principalFields$fiel2 !== void 0 ? _principalFields$fiel2 : [];
|
|
124248
|
+
principalFields.fields.permissionRequirements = client_addOrCombineRequirements(existing, requirement, true);
|
|
124074
124249
|
}
|
|
124075
124250
|
function client_updateMinSignerSetLength(state, multisigAccount, count) {
|
|
124076
124251
|
const multisigPublicKey = multisigAccount.publicKeyString.get();
|
|
124077
124252
|
if (state.accounts[multisigPublicKey] === undefined) {
|
|
124078
124253
|
state.accounts[multisigPublicKey] = {
|
|
124254
|
+
type: 'ACCOUNT',
|
|
124079
124255
|
account: multisigAccount,
|
|
124080
124256
|
fields: {}
|
|
124081
124257
|
};
|
|
@@ -124099,6 +124275,7 @@ function client_modifyBalanceInState(balanceState) {
|
|
|
124099
124275
|
const tokenPubKey = token.publicKeyString.get();
|
|
124100
124276
|
if (state.accounts[accountPubKey] === undefined) {
|
|
124101
124277
|
state.accounts[accountPubKey] = {
|
|
124278
|
+
type: 'ACCOUNT',
|
|
124102
124279
|
account: client_lib_account.fromPublicKeyString(accountPubKey),
|
|
124103
124280
|
fields: {}
|
|
124104
124281
|
};
|
|
@@ -124164,6 +124341,7 @@ function client_updateAccountInfoInState(state, account, info) {
|
|
|
124164
124341
|
}
|
|
124165
124342
|
if (!state.accounts[accountPubKey]) {
|
|
124166
124343
|
state.accounts[accountPubKey] = {
|
|
124344
|
+
type: 'ACCOUNT',
|
|
124167
124345
|
account: account,
|
|
124168
124346
|
fields: {}
|
|
124169
124347
|
};
|
|
@@ -124321,6 +124499,7 @@ function client_computeEffectOfOperationCREATE_IDENTIFIER(state, block, operatio
|
|
|
124321
124499
|
for (const multisigSigner of operation.createArguments.signers) {
|
|
124322
124500
|
state.possibleNewAccounts.add(multisigSigner);
|
|
124323
124501
|
client_addPermission(state, {
|
|
124502
|
+
principalType: 'ACCOUNT',
|
|
124324
124503
|
principal: multisigSigner,
|
|
124325
124504
|
entity: operation.identifier,
|
|
124326
124505
|
method: src_client_Block.AdjustMethod.SET,
|
|
@@ -124329,6 +124508,7 @@ function client_computeEffectOfOperationCREATE_IDENTIFIER(state, block, operatio
|
|
|
124329
124508
|
}
|
|
124330
124509
|
} else {
|
|
124331
124510
|
client_addPermission(state, {
|
|
124511
|
+
principalType: 'ACCOUNT',
|
|
124332
124512
|
principal: block.account,
|
|
124333
124513
|
entity: operation.identifier,
|
|
124334
124514
|
method: src_client_Block.AdjustMethod.SET,
|
|
@@ -124345,17 +124525,41 @@ function client_computeEffectOfOperationSET_INFO(state, block, operation) {
|
|
|
124345
124525
|
});
|
|
124346
124526
|
}
|
|
124347
124527
|
function client_computeEffectOfOperationMODIFY_PERMISSIONS(state, block, operation) {
|
|
124348
|
-
|
|
124528
|
+
if (client_lib_account.isInstance(operation.principal)) {
|
|
124529
|
+
state.possibleNewAccounts.add(operation.principal);
|
|
124530
|
+
} else if (operation.principal.usingCertificate) {
|
|
124531
|
+
state.possibleNewAccounts.add(operation.principal.certificateAccount);
|
|
124532
|
+
} else {
|
|
124533
|
+
throw new Error('Invalid principal in MODIFY_PERMISSIONS operation');
|
|
124534
|
+
}
|
|
124349
124535
|
if (operation.target) {
|
|
124350
124536
|
state.possibleNewAccounts.add(operation.target);
|
|
124351
124537
|
}
|
|
124352
|
-
|
|
124353
|
-
principal: operation.principal,
|
|
124538
|
+
const shared = {
|
|
124354
124539
|
entity: block.account,
|
|
124355
124540
|
permissions: operation.permissions,
|
|
124356
124541
|
method: operation.method,
|
|
124357
124542
|
target: operation.target
|
|
124358
|
-
}
|
|
124543
|
+
};
|
|
124544
|
+
if (client_lib_account.isInstance(operation.principal)) {
|
|
124545
|
+
client_addPermission(state, {
|
|
124546
|
+
principalType: 'ACCOUNT',
|
|
124547
|
+
principal: operation.principal,
|
|
124548
|
+
...shared
|
|
124549
|
+
});
|
|
124550
|
+
} else if (operation.principal.usingCertificate) {
|
|
124551
|
+
client_addPermission(state, {
|
|
124552
|
+
principalType: 'CERTIFICATE',
|
|
124553
|
+
principal: {
|
|
124554
|
+
usingCertificate: true,
|
|
124555
|
+
certificate: operation.principal.certificateHash,
|
|
124556
|
+
certificateAccount: operation.principal.certificateAccount
|
|
124557
|
+
},
|
|
124558
|
+
...shared
|
|
124559
|
+
});
|
|
124560
|
+
} else {
|
|
124561
|
+
throw new Error('Invalid principal in MODIFY_PERMISSIONS operation');
|
|
124562
|
+
}
|
|
124359
124563
|
}
|
|
124360
124564
|
function client_computeEffectOfOperationTOKEN_ADMIN_SUPPLY(state, block, operation) {
|
|
124361
124565
|
var _state$accounts$token;
|
|
@@ -124436,14 +124640,19 @@ function client_computeEffectOfOperationMANAGE_CERTIFICATE(state, block, operati
|
|
|
124436
124640
|
const client_operationHandlers = {
|
|
124437
124641
|
[src_client_Block.OperationType.SEND]: {
|
|
124438
124642
|
effectGenerator: client_computeEffectOfOperationSEND,
|
|
124439
|
-
accountPermissionACL: (block, operation
|
|
124440
|
-
|
|
124441
|
-
|
|
124442
|
-
|
|
124643
|
+
accountPermissionACL: (block, operation) => {
|
|
124644
|
+
// Require both the sender and the recipient to have ['ACCESS'] on the token
|
|
124645
|
+
const baseEffect = [{
|
|
124646
|
+
principal: block.account,
|
|
124647
|
+
entity: operation.token
|
|
124648
|
+
}, {
|
|
124649
|
+
principal: operation.to,
|
|
124650
|
+
entity: operation.token
|
|
124651
|
+
}];
|
|
124443
124652
|
if (operation.to.keyType !== client_AccountKeyAlgorithm.STORAGE) {
|
|
124444
124653
|
return baseEffect;
|
|
124445
124654
|
}
|
|
124446
|
-
return [baseEffect,
|
|
124655
|
+
return [...baseEffect,
|
|
124447
124656
|
// Require that the token identifier was granted access by storage account for it to be able to hold
|
|
124448
124657
|
{
|
|
124449
124658
|
entity: operation.to,
|
|
@@ -124541,9 +124750,16 @@ const client_operationHandlers = {
|
|
|
124541
124750
|
delegateMethodNeeded = 'PERMISSION_DELEGATE_ADD';
|
|
124542
124751
|
break;
|
|
124543
124752
|
}
|
|
124753
|
+
let target;
|
|
124754
|
+
if (client_lib_account.isInstance(operation.principal)) {
|
|
124755
|
+
target = operation.principal;
|
|
124756
|
+
} else {
|
|
124757
|
+
// Currently, we do not have a way to specify a target for certificate principals, so we will not include a target in this case
|
|
124758
|
+
target = undefined;
|
|
124759
|
+
}
|
|
124544
124760
|
necessary.push({
|
|
124545
124761
|
permissions: new client_permissions_Permissions([delegateMethodNeeded]),
|
|
124546
|
-
target:
|
|
124762
|
+
target: target
|
|
124547
124763
|
});
|
|
124548
124764
|
return necessary;
|
|
124549
124765
|
}
|
|
@@ -124691,6 +124907,7 @@ function client_computeEffectOfBlocks(blocks, ledger) {
|
|
|
124691
124907
|
}
|
|
124692
124908
|
if (accumulatedEffects.accounts[blockAccountPubKey] === undefined) {
|
|
124693
124909
|
accumulatedEffects.accounts[blockAccountPubKey] = {
|
|
124910
|
+
type: 'ACCOUNT',
|
|
124694
124911
|
account: block.account,
|
|
124695
124912
|
fields: {}
|
|
124696
124913
|
};
|
|
@@ -124747,6 +124964,9 @@ function client_computeEffectOfBlocks(blocks, ledger) {
|
|
|
124747
124964
|
}
|
|
124748
124965
|
}
|
|
124749
124966
|
for (const effect of Object.values(accumulatedEffects.accounts)) {
|
|
124967
|
+
if (effect.type !== 'ACCOUNT') {
|
|
124968
|
+
continue;
|
|
124969
|
+
}
|
|
124750
124970
|
accumulatedEffects.touched.add(effect.account);
|
|
124751
124971
|
if (effect.fields.balance) {
|
|
124752
124972
|
let hasDebit = false;
|
|
@@ -126739,6 +126959,8 @@ const src_client_Testing = {
|
|
|
126739
126959
|
feeExtensionSchema: client_feeExtensionSchema
|
|
126740
126960
|
};
|
|
126741
126961
|
;// ./src/lib/ledger/types.ts
|
|
126962
|
+
|
|
126963
|
+
|
|
126742
126964
|
/**
|
|
126743
126965
|
* Account info entry
|
|
126744
126966
|
*/
|
|
@@ -126769,19 +126991,33 @@ function client_isKeyPairAccountInfo(info) {
|
|
|
126769
126991
|
function client_isAccountInfoOfType(info, type) {
|
|
126770
126992
|
return info.account.isKeyType(type);
|
|
126771
126993
|
}
|
|
126994
|
+
const client_aclPrincipalType = (/* unused pure expression or super */ null && (['ACCOUNT', 'CERTIFICATE']));
|
|
126995
|
+
function client_isACLPrincipalType(type) {
|
|
126996
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
126997
|
+
return client_aclPrincipalType.includes(type);
|
|
126998
|
+
}
|
|
126999
|
+
function client_assertACLPrincipalType(type) {
|
|
127000
|
+
if (!client_isACLPrincipalType(type)) {
|
|
127001
|
+
throw new KeetaNetLedgerError('LEDGER_INVALID_ACL_ROW_TYPE', `Invalid ACL Row Type: ${type}`);
|
|
127002
|
+
}
|
|
127003
|
+
}
|
|
127004
|
+
function client_asACLPrincipalType(type) {
|
|
127005
|
+
client_assertACLPrincipalType(type);
|
|
127006
|
+
return type;
|
|
127007
|
+
}
|
|
126772
127008
|
|
|
126773
127009
|
/**
|
|
126774
127010
|
* Permissions types
|
|
126775
127011
|
*/
|
|
126776
127012
|
|
|
126777
127013
|
/**
|
|
126778
|
-
*
|
|
126779
|
-
* @expandType
|
|
127014
|
+
* A permission requirement for ledger effects
|
|
127015
|
+
* @expandType AccountACLRow
|
|
126780
127016
|
*/
|
|
126781
127017
|
|
|
126782
127018
|
/**
|
|
126783
127019
|
* Update an ACL for an account
|
|
126784
|
-
* @expandType
|
|
127020
|
+
* @expandType ACLRow
|
|
126785
127021
|
*/
|
|
126786
127022
|
|
|
126787
127023
|
/**
|
|
@@ -128102,6 +128338,7 @@ function client_lib_ledger_toPrimitive(t, r) { if ("object" != typeof t || !t) r
|
|
|
128102
128338
|
|
|
128103
128339
|
|
|
128104
128340
|
|
|
128341
|
+
|
|
128105
128342
|
/**
|
|
128106
128343
|
* Kind of ledger
|
|
128107
128344
|
*/
|
|
@@ -128131,6 +128368,10 @@ let client_LedgerKind = /*#__PURE__*/function (LedgerKind) {
|
|
|
128131
128368
|
* Options for "getVotesAfter"
|
|
128132
128369
|
*/
|
|
128133
128370
|
|
|
128371
|
+
/**
|
|
128372
|
+
* Filters for listing ACLs by entity
|
|
128373
|
+
*/
|
|
128374
|
+
|
|
128134
128375
|
/**
|
|
128135
128376
|
* Idempotent Key
|
|
128136
128377
|
*/
|
|
@@ -128716,9 +128957,9 @@ class client_LedgerAtomicInterface {
|
|
|
128716
128957
|
const permissions = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).listACLsByPrincipal(transaction, principal, entityList);
|
|
128717
128958
|
return permissions;
|
|
128718
128959
|
}
|
|
128719
|
-
async listACLsByEntity(entity) {
|
|
128960
|
+
async listACLsByEntity(entity, options) {
|
|
128720
128961
|
const transaction = client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
|
|
128721
|
-
const permissions = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).listACLsByEntity(transaction, entity);
|
|
128962
|
+
const permissions = await client_ledger_classPrivateFieldGet(client_ledger_storage, this).listACLsByEntity(transaction, entity, options);
|
|
128722
128963
|
return permissions;
|
|
128723
128964
|
}
|
|
128724
128965
|
async votingPower(rep) {
|
|
@@ -129065,6 +129306,71 @@ async function client_listAccountInfo(accounts) {
|
|
|
129065
129306
|
await Promise.all(permissionPromises);
|
|
129066
129307
|
return accountInfo;
|
|
129067
129308
|
}
|
|
129309
|
+
async function client_fetchSatisfiedCertificateACLs(account, requirement) {
|
|
129310
|
+
const entityCertificateACLs = await this.listACLsByEntity(requirement.entity, {
|
|
129311
|
+
principalType: 'CERTIFICATE'
|
|
129312
|
+
});
|
|
129313
|
+
if (entityCertificateACLs.length === 0) {
|
|
129314
|
+
return null;
|
|
129315
|
+
}
|
|
129316
|
+
const entityACLsWithValuesResponse = await Promise.all(entityCertificateACLs.map(async acl => {
|
|
129317
|
+
if (acl.principalType !== 'CERTIFICATE') {
|
|
129318
|
+
throw new Error('Expected certificate ACL row');
|
|
129319
|
+
}
|
|
129320
|
+
const certificate = await this.getAccountCertificateByHash(acl.principal.certificateAccount, acl.principal.certificate);
|
|
129321
|
+
if (certificate === null) {
|
|
129322
|
+
return null;
|
|
129323
|
+
}
|
|
129324
|
+
return {
|
|
129325
|
+
acl,
|
|
129326
|
+
certificate
|
|
129327
|
+
};
|
|
129328
|
+
}));
|
|
129329
|
+
|
|
129330
|
+
// XXX:TODO does this need to be paginated
|
|
129331
|
+
const userCertificates = await this.getAccountCertificates(account);
|
|
129332
|
+
const matchedCertificateACLs = [];
|
|
129333
|
+
for (const aclWithCertificate of entityACLsWithValuesResponse) {
|
|
129334
|
+
if (!aclWithCertificate) {
|
|
129335
|
+
continue;
|
|
129336
|
+
}
|
|
129337
|
+
const {
|
|
129338
|
+
certificate: aclCertificate,
|
|
129339
|
+
acl
|
|
129340
|
+
} = aclWithCertificate;
|
|
129341
|
+
const issuerCertificate = new src_client_Certificate(aclCertificate.certificate, {
|
|
129342
|
+
isTrustedRoot: true
|
|
129343
|
+
});
|
|
129344
|
+
if (!issuerCertificate.checkValid()) {
|
|
129345
|
+
continue;
|
|
129346
|
+
}
|
|
129347
|
+
for (const userCertificate of userCertificates) {
|
|
129348
|
+
var _aclCertificate$inter, _aclCertificate$inter2, _userCertificate$inte, _userCertificate$inte2;
|
|
129349
|
+
if (!userCertificate.certificate.checkValid()) {
|
|
129350
|
+
continue;
|
|
129351
|
+
}
|
|
129352
|
+
const foundChain = userCertificate.certificate.verifyChain({
|
|
129353
|
+
root: new Set([issuerCertificate]),
|
|
129354
|
+
intermediate: new Set([...((_aclCertificate$inter = (_aclCertificate$inter2 = aclCertificate.intermediates) === null || _aclCertificate$inter2 === void 0 ? void 0 : _aclCertificate$inter2.getCertificates()) !== null && _aclCertificate$inter !== void 0 ? _aclCertificate$inter : []), ...((_userCertificate$inte = (_userCertificate$inte2 = userCertificate.intermediates) === null || _userCertificate$inte2 === void 0 ? void 0 : _userCertificate$inte2.getCertificates()) !== null && _userCertificate$inte !== void 0 ? _userCertificate$inte : [])])
|
|
129355
|
+
});
|
|
129356
|
+
if (foundChain === null) {
|
|
129357
|
+
continue;
|
|
129358
|
+
}
|
|
129359
|
+
let foundRootInChain = false;
|
|
129360
|
+
for (const certInChain of foundChain) {
|
|
129361
|
+
if (certInChain.hash().compareHexString(issuerCertificate.hash())) {
|
|
129362
|
+
foundRootInChain = true;
|
|
129363
|
+
break;
|
|
129364
|
+
}
|
|
129365
|
+
}
|
|
129366
|
+
if (!foundRootInChain) {
|
|
129367
|
+
throw new Error('Internal error: issuer certificate not found in verified chain');
|
|
129368
|
+
}
|
|
129369
|
+
matchedCertificateACLs.push(acl);
|
|
129370
|
+
}
|
|
129371
|
+
}
|
|
129372
|
+
return matchedCertificateACLs;
|
|
129373
|
+
}
|
|
129068
129374
|
async function client_checkSingleAccountPermissions(account, requirements, accountInfos) {
|
|
129069
129375
|
client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_assertTransaction).call(this);
|
|
129070
129376
|
|
|
@@ -129073,6 +129379,9 @@ async function client_checkSingleAccountPermissions(account, requirements, accou
|
|
|
129073
129379
|
const entityAccounts = new client_lib_account.Set(unfilteredEntity).toArray();
|
|
129074
129380
|
const gotPermissions = await this.listACLsByPrincipal(account, entityAccounts);
|
|
129075
129381
|
for (const requirement of requirements) {
|
|
129382
|
+
if (!requirement.permissions) {
|
|
129383
|
+
throw new Error('Unexpected null permissions in requirement');
|
|
129384
|
+
}
|
|
129076
129385
|
const reqEntityKey = requirement.entity.publicKeyString.get();
|
|
129077
129386
|
const foundACLRow = client_findPermissionMatch(requirement, gotPermissions);
|
|
129078
129387
|
const foundAccountInfo = accountInfos[reqEntityKey];
|
|
@@ -129084,10 +129393,19 @@ async function client_checkSingleAccountPermissions(account, requirements, accou
|
|
|
129084
129393
|
} else {
|
|
129085
129394
|
foundPermission = new client_permissions_Permissions();
|
|
129086
129395
|
}
|
|
129087
|
-
|
|
129088
|
-
|
|
129396
|
+
let hasPermissions = foundPermission.has(requirement.permissions);
|
|
129397
|
+
if (!hasPermissions && account.isAccount()) {
|
|
129398
|
+
const found = await client_ledger_assertClassBrand(client_LedgerAtomicInterface_brand, this, client_fetchSatisfiedCertificateACLs).call(this, account, requirement);
|
|
129399
|
+
if (found) {
|
|
129400
|
+
for (const row of found) {
|
|
129401
|
+
const certificateRowHasPermissions = row.permissions.has(requirement.permissions);
|
|
129402
|
+
if (certificateRowHasPermissions) {
|
|
129403
|
+
hasPermissions = true;
|
|
129404
|
+
break;
|
|
129405
|
+
}
|
|
129406
|
+
}
|
|
129407
|
+
}
|
|
129089
129408
|
}
|
|
129090
|
-
const hasPermissions = foundPermission.has(requirement.permissions);
|
|
129091
129409
|
if (!hasPermissions) {
|
|
129092
129410
|
var _requirement$target;
|
|
129093
129411
|
const accountPubKey = account.publicKeyString.get();
|
|
@@ -129105,19 +129423,22 @@ async function client_checkPermissionRequirements(effects) {
|
|
|
129105
129423
|
const needToGetAccountInfoFor = new client_lib_account.Set();
|
|
129106
129424
|
const allAccountsChanges = Object.values(effects);
|
|
129107
129425
|
const foundMultisigSignerLengths = [];
|
|
129108
|
-
for (const {
|
|
129109
|
-
|
|
129110
|
-
|
|
129111
|
-
|
|
129112
|
-
if (account.isMultisig()) {
|
|
129426
|
+
for (const accountChanges of allAccountsChanges) {
|
|
129427
|
+
const {
|
|
129428
|
+
fields
|
|
129429
|
+
} = accountChanges;
|
|
129430
|
+
if (accountChanges.type === 'ACCOUNT' && accountChanges.account.isMultisig()) {
|
|
129113
129431
|
if (fields.minSignerSetLength !== undefined) {
|
|
129114
|
-
needToGetAccountInfoFor.add(account);
|
|
129115
|
-
foundMultisigSignerLengths.push([account, fields.minSignerSetLength]);
|
|
129432
|
+
needToGetAccountInfoFor.add(accountChanges.account);
|
|
129433
|
+
foundMultisigSignerLengths.push([accountChanges.account, fields.minSignerSetLength]);
|
|
129116
129434
|
}
|
|
129117
129435
|
}
|
|
129118
129436
|
for (const singleRequirement of (_fields$permissionReq = fields.permissionRequirements) !== null && _fields$permissionReq !== void 0 ? _fields$permissionReq : []) {
|
|
129119
129437
|
var _fields$permissionReq;
|
|
129120
129438
|
const principal = singleRequirement.principal;
|
|
129439
|
+
if (!client_lib_account.isInstance(principal)) {
|
|
129440
|
+
throw new Error('Principal in permission requirement is not an account');
|
|
129441
|
+
}
|
|
129121
129442
|
const principalPubKey = principal.publicKeyString.get();
|
|
129122
129443
|
if (!requirementsByPrincipal[principalPubKey]) {
|
|
129123
129444
|
requirementsByPrincipal[principalPubKey] = [];
|
|
@@ -129261,6 +129582,9 @@ async function client_validateLedgerOutcome(blocks) {
|
|
|
129261
129582
|
}
|
|
129262
129583
|
for (const accountChanges of allAccountsChanges) {
|
|
129263
129584
|
var _fields$createRequest, _fields$permissions;
|
|
129585
|
+
if (accountChanges.type === 'CERTIFICATE') {
|
|
129586
|
+
continue;
|
|
129587
|
+
}
|
|
129264
129588
|
const {
|
|
129265
129589
|
account,
|
|
129266
129590
|
fields = {}
|
|
@@ -129279,6 +129603,10 @@ async function client_validateLedgerOutcome(blocks) {
|
|
|
129279
129603
|
*/
|
|
129280
129604
|
const addedPermissions = (_fields$permissions = fields.permissions) !== null && _fields$permissions !== void 0 ? _fields$permissions : [];
|
|
129281
129605
|
for (const newPerm of addedPermissions) {
|
|
129606
|
+
// We only care about permissions that include ownership, and non-accounts (ex: certificate principals) cannot be owners
|
|
129607
|
+
if (newPerm.principalType === 'CERTIFICATE') {
|
|
129608
|
+
continue;
|
|
129609
|
+
}
|
|
129282
129610
|
let method = 'ADD';
|
|
129283
129611
|
if (newPerm.permissions === null || !newPerm.permissions.has(['OWNER'])) {
|
|
129284
129612
|
method = 'REMOVE';
|
|
@@ -129904,7 +130232,7 @@ client_lib_ledger_defineProperty(src_client_Ledger, "isInstance", client_checkab
|
|
|
129904
130232
|
// EXTERNAL MODULE: ws (ignored)
|
|
129905
130233
|
var client_ws_ignored_ = __webpack_require__(4708);
|
|
129906
130234
|
;// ./src/version.ts
|
|
129907
|
-
const client_version = '0.
|
|
130235
|
+
const client_version = '0.18.0+g5417d9af948be899fcebb75694edb492ff971891';
|
|
129908
130236
|
/* harmony default export */ const client_src_version = ((/* unused pure expression or super */ null && (client_version)));
|
|
129909
130237
|
;// ./src/lib/p2p.ts
|
|
129910
130238
|
/* provided dependency */ var client_p2p_Buffer = __webpack_require__(8287)["Buffer"];
|
|
@@ -133639,6 +133967,7 @@ function client_client_assertClassBrand(e, t, n) { if ("function" == typeof e ?
|
|
|
133639
133967
|
|
|
133640
133968
|
|
|
133641
133969
|
|
|
133970
|
+
|
|
133642
133971
|
|
|
133643
133972
|
|
|
133644
133973
|
/*
|
|
@@ -135558,12 +135887,31 @@ function client_parseAccountInfo(account, accountInfo) {
|
|
|
135558
135887
|
}
|
|
135559
135888
|
function client_parsePermissionEntries(entries) {
|
|
135560
135889
|
return entries.map(entry => {
|
|
135561
|
-
|
|
135562
|
-
principal: client_src_lib.Account.fromPublicKeyString(entry.principal),
|
|
135890
|
+
const shared = {
|
|
135563
135891
|
entity: client_src_lib.Account.fromPublicKeyString(entry.entity),
|
|
135564
135892
|
permissions: client_client_assertClassBrand(client_Client_brand, this, client_parseResponsePermissions).call(this, entry.permissions),
|
|
135565
135893
|
target: client_src_lib.Account.fromPublicKeyString(entry.target)
|
|
135566
135894
|
};
|
|
135895
|
+
if (entry.principalType === 'ACCOUNT') {
|
|
135896
|
+
return {
|
|
135897
|
+
principalType: 'ACCOUNT',
|
|
135898
|
+
principal: client_src_lib.Account.fromPublicKeyString(entry.principal),
|
|
135899
|
+
...shared
|
|
135900
|
+
};
|
|
135901
|
+
} else if (entry.principalType === 'CERTIFICATE') {
|
|
135902
|
+
return {
|
|
135903
|
+
principalType: 'CERTIFICATE',
|
|
135904
|
+
principal: {
|
|
135905
|
+
usingCertificate: true,
|
|
135906
|
+
certificate: new src_client_Certificate.Hash(entry.principal.certificate),
|
|
135907
|
+
certificateAccount: client_src_lib.Account.fromPublicKeyString(entry.principal.certificateAccount)
|
|
135908
|
+
},
|
|
135909
|
+
...shared
|
|
135910
|
+
};
|
|
135911
|
+
} else {
|
|
135912
|
+
client_assertNever(entry);
|
|
135913
|
+
}
|
|
135914
|
+
throw new Error('Unknown ACL Entry Type');
|
|
135567
135915
|
});
|
|
135568
135916
|
}
|
|
135569
135917
|
function client_mapCertificateWithBundleResult(input) {
|
|
@@ -135908,7 +136256,9 @@ class src_client_UserClient {
|
|
|
135908
136256
|
principals.push(operation.to);
|
|
135909
136257
|
break;
|
|
135910
136258
|
case client_OperationType.MODIFY_PERMISSIONS:
|
|
135911
|
-
|
|
136259
|
+
if (client_lib_account.isInstance(operation.principal)) {
|
|
136260
|
+
principals.push(operation.principal);
|
|
136261
|
+
}
|
|
135912
136262
|
break;
|
|
135913
136263
|
case client_OperationType.CREATE_IDENTIFIER:
|
|
135914
136264
|
principals.push(operation.identifier);
|