@keetanetwork/keetanet-client 0.10.5 → 0.12.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/api/index.d.ts +23 -7
- package/api/node.d.ts +27 -2
- package/api/vote.d.ts +4 -6
- package/client/builder.d.ts +17 -0
- package/client/client_common_tests.d.ts +1 -1
- package/client/index-browser.d.ts +112 -3
- package/client/index-browser.js +18234 -29816
- package/client/index.d.ts +112 -3
- package/client/index.js +4070 -6581
- package/config/index.d.ts +6 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +31 -11
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +31 -21
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +2 -4
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +4 -5
- 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 +12 -0
- 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.src_lib_utils_certificate.Certificate.html → KeetaNetSDK.Referenced.Certificate.html} +31 -14
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +8 -0
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +16 -0
- 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.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.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 +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
- package/docs/classes/KeetaNetSDK.Referenced.LedgerRequestCache.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Permissions.html +2 -3
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +5 -3
- package/docs/classes/KeetaNetSDK.Referenced.RequestTiming.html +16 -2
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +5 -5
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +35 -0
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHashMap.html +9 -8
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +2 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +23 -29
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.BufferStorageASN1.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.UserClient.html +57 -15
- package/docs/documents/GETTING-STARTED.html +5 -2
- package/docs/enums/KeetaNetSDK.Referenced.AccountKeyAlgorithm.html +2 -1
- package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
- package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +2 -1
- package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +2 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getDefaultConfig.html +2 -2
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getNetworkAlias.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.getValidation.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_config.isNetwork.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_asn1.isASN1Object.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibDeflateAsync.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.ZlibInflateAsync.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.objectToBuffer.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.booleanEnv.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.nonNullable.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.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockCanonical.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +2 -2
- 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 +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +5 -0
- 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 +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediates.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.CertificateWithIntermediatesResponse.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ComputedBlocksEffectFields.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +7 -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 +5 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.FeeAmountAndTokenJSON.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.IdentifierCreateRequest.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +13 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +2 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.KVStorageProviderAPI.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +4 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStatistics.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +15 -7
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValidationRule.html +3 -0
- 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 +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStringMapping.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.RequestTokenReceiveEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.TokenNumericEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientListenerOptions.html +2 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
- 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_conversion.ToJSONSerializableOptions.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_conversion.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHex.html +8 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexReverse.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AccountKeyAlgorithmHexToType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.AddBinaryIfIncluded.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockHashString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateErrorCode.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensionData.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateExtensions.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.CertificateHashString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateOptions.html +4 -4
- package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +3 -2
- package/docs/types/KeetaNetSDK.Referenced.DbStats.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.ErrorCode.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.MultisigPublicKeyString.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NodeLike-1.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.NodeLike.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.PublicKeyAndTypeStringHex.html +3 -0
- package/docs/types/{KeetaNetSDK.Referenced.VoteJSONOutput.html → KeetaNetSDK.Referenced.StorageAddress.html} +1 -1
- package/docs/types/KeetaNetSDK.Referenced.TimingData.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
- package/docs/types/KeetaNetSDK.Referenced.VoteBuilderOptions.html +4 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -0
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
- package/docs/{types/KeetaNetSDK.Referenced.JSONUnsupportedTypes.html → variables/KeetaNetSDK.Referenced.CertificateErrorType.html} +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.ClientErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.KVErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.Operation.html +2 -2
- package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.identifierKeyTypes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_config.networksArray.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.AsyncDisposableStack.html +2 -0
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper.crypto.html +1 -0
- package/lib/account.d.ts +68 -29
- package/lib/block/index.d.ts +53 -23
- package/lib/block/operations.d.ts +78 -33
- package/lib/error/block.d.ts +1 -1
- package/lib/error/certificate.d.ts +9 -0
- package/lib/error/client.d.ts +1 -1
- package/lib/error/index.d.ts +2 -1
- package/lib/error/kv.d.ts +1 -1
- package/lib/error/vote.d.ts +1 -1
- package/lib/kv/index.d.ts +15 -8
- package/lib/kv/kv_redis.d.ts +18 -8
- package/lib/ledger/common.d.ts +13 -5
- package/lib/ledger/db_dynamodb.d.ts +22 -16
- package/lib/ledger/db_postgres.d.ts +10 -10
- package/lib/ledger/db_spanner.d.ts +26 -14
- package/lib/ledger/db_spanner_helper.d.ts +94 -109
- package/lib/ledger/db_sqlite.d.ts +10 -10
- package/lib/ledger/effects.d.ts +19 -4
- package/lib/ledger/index.d.ts +57 -12
- package/lib/ledger/types.d.ts +7 -1
- package/lib/node/local.d.ts +10 -1
- package/lib/node/timing.d.ts +44 -5
- package/lib/p2p.d.ts +6 -3
- package/lib/permissions.d.ts +3 -3
- package/lib/pubsub/index.d.ts +1 -1
- package/lib/pubsub/providers.d.ts +2 -0
- package/lib/pubsub/ps_gcp.d.ts +14 -0
- package/lib/stats.d.ts +5 -0
- package/lib/utils/asn1.d.ts +4 -3
- package/lib/utils/buffer.d.ts +4 -0
- package/lib/utils/certificate.d.ts +107 -6
- package/lib/utils/conversion.d.ts +13 -35
- package/lib/utils/helper.d.ts +26 -8
- package/lib/utils/helper_testing.d.ts +1 -1
- package/lib/vote.d.ts +122 -63
- package/package.json +2 -3
- package/version.d.ts +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.HTTPAgentManager.html +0 -4
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.RegisterSerializable.html +0 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOutput.html +0 -5
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSONOutput.html +0 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.WithConversionClass.html +0 -6
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSet.html +0 -10
- package/docs/types/KeetaNetSDK.Referenced.JSONSupportedObject.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.JSONSupportedValue.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.Vote.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.JSONSupported.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializableOptions.html +0 -3
- package/docs/variables/KeetaNetSDK.Referenced.default.html +0 -3
|
@@ -4,8 +4,9 @@ import type { GenericAccount, IdentifierAddress, TokenAddress, TokenPublicKeyStr
|
|
|
4
4
|
import Account from '../account';
|
|
5
5
|
import type { AcceptedPermissionTypes } from '../permissions';
|
|
6
6
|
import { Permissions } from '../permissions';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ToJSONSerializable } from '../utils/conversion';
|
|
8
8
|
import Block, { AdjustMethod } from '.';
|
|
9
|
+
import { Certificate, CertificateBundle, CertificateHash } from '../utils/certificate';
|
|
9
10
|
/**
|
|
10
11
|
* All supported operations
|
|
11
12
|
*/
|
|
@@ -17,7 +18,8 @@ export declare enum OperationType {
|
|
|
17
18
|
CREATE_IDENTIFIER = 4,
|
|
18
19
|
TOKEN_ADMIN_SUPPLY = 5,
|
|
19
20
|
TOKEN_ADMIN_MODIFY_BALANCE = 6,
|
|
20
|
-
RECEIVE = 7
|
|
21
|
+
RECEIVE = 7,
|
|
22
|
+
MANAGE_CERTIFICATE = 8
|
|
21
23
|
}
|
|
22
24
|
export type BlockOperationTypes = keyof typeof OperationType;
|
|
23
25
|
/**
|
|
@@ -126,6 +128,22 @@ declare const BlockOperationASN1SchemaBase: {
|
|
|
126
128
|
readonly name: "method";
|
|
127
129
|
readonly schema: typeof ValidateASN1.IsInteger;
|
|
128
130
|
}];
|
|
131
|
+
readonly MANAGE_CERTIFICATE: [{
|
|
132
|
+
readonly name: "method";
|
|
133
|
+
readonly schema: typeof ValidateASN1.IsInteger;
|
|
134
|
+
}, {
|
|
135
|
+
readonly name: "certificateOrHash";
|
|
136
|
+
readonly schema: typeof ValidateASN1.IsOctetString;
|
|
137
|
+
}, {
|
|
138
|
+
readonly name: "intermediateCertificates";
|
|
139
|
+
readonly schema: {
|
|
140
|
+
readonly optional: {
|
|
141
|
+
readonly choice: [typeof ValidateASN1.IsNull, {
|
|
142
|
+
readonly sequenceOf: typeof ValidateASN1.IsOctetString;
|
|
143
|
+
}];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
}];
|
|
129
147
|
};
|
|
130
148
|
type ExtractSchemaFromBase<T extends {
|
|
131
149
|
name: string;
|
|
@@ -142,15 +160,8 @@ export declare const BlockOperationASN1Schema: { [T in BlockOperationTypes]: {
|
|
|
142
160
|
value: (typeof OperationType)[T];
|
|
143
161
|
contains: DeepMutable<ExtractSchemaFromBase<(typeof BlockOperationASN1SchemaBase)[T]>>;
|
|
144
162
|
}; };
|
|
145
|
-
/**
|
|
146
|
-
* Keys of the operations which we will serialize/deserialize
|
|
147
|
-
*/
|
|
148
|
-
export declare const BlockOperationKeys: BlockOperationKeysType;
|
|
149
163
|
export type BlockOperationASN1SchemaType<T extends BlockOperationTypes = BlockOperationTypes> = typeof BlockOperationASN1Schema[T];
|
|
150
|
-
|
|
151
|
-
[Property in BlockOperationTypes as `${Property}`]: string[];
|
|
152
|
-
};
|
|
153
|
-
interface BlockJSONOperation {
|
|
164
|
+
export interface BlockJSONOperation {
|
|
154
165
|
type: OperationType;
|
|
155
166
|
}
|
|
156
167
|
interface BlockOperationValidateContext {
|
|
@@ -165,7 +176,7 @@ declare class BlockOperation {
|
|
|
165
176
|
protected computeTo(to: string | GenericAccount, isIdentifier?: undefined): GenericAccount;
|
|
166
177
|
protected computeAmount(amount: string | bigint): bigint;
|
|
167
178
|
}
|
|
168
|
-
interface BlockJSONOperationSEND extends BlockJSONOperation {
|
|
179
|
+
export interface BlockJSONOperationSEND extends BlockJSONOperation {
|
|
169
180
|
type: OperationType.SEND;
|
|
170
181
|
to: string | GenericAccount;
|
|
171
182
|
amount: string | bigint;
|
|
@@ -185,9 +196,9 @@ declare class BlockOperationSEND extends BlockOperation implements BlockJSONOper
|
|
|
185
196
|
set amount(amount: string | bigint);
|
|
186
197
|
get amount(): bigint;
|
|
187
198
|
validate(context: BlockOperationValidateContext): void;
|
|
188
|
-
toJSON():
|
|
199
|
+
toJSON(): BlockJSONOperationSEND;
|
|
189
200
|
}
|
|
190
|
-
interface BlockJSONOperationRECEIVE extends BlockJSONOperation {
|
|
201
|
+
export interface BlockJSONOperationRECEIVE extends BlockJSONOperation {
|
|
191
202
|
type: OperationType.RECEIVE;
|
|
192
203
|
amount: string | bigint;
|
|
193
204
|
token: TokenPublicKeyString | TokenAddress;
|
|
@@ -211,9 +222,9 @@ declare class BlockOperationRECEIVE extends BlockOperation implements BlockJSONO
|
|
|
211
222
|
set amount(amount: string | bigint);
|
|
212
223
|
get amount(): bigint;
|
|
213
224
|
validate(context: BlockOperationValidateContext): void;
|
|
214
|
-
toJSON():
|
|
225
|
+
toJSON(): BlockJSONOperationRECEIVE;
|
|
215
226
|
}
|
|
216
|
-
interface BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockJSONOperation {
|
|
227
|
+
export interface BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockJSONOperation {
|
|
217
228
|
type: OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
|
|
218
229
|
token: TokenPublicKeyString | TokenAddress;
|
|
219
230
|
amount: string | bigint;
|
|
@@ -231,12 +242,12 @@ declare class BlockOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockOperation im
|
|
|
231
242
|
set amount(amount: string | bigint);
|
|
232
243
|
get amount(): bigint;
|
|
233
244
|
validate(context: BlockOperationValidateContext): void;
|
|
234
|
-
toJSON():
|
|
245
|
+
toJSON(): BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE;
|
|
235
246
|
}
|
|
236
247
|
/**
|
|
237
248
|
* SetRep operation
|
|
238
249
|
*/
|
|
239
|
-
interface BlockJSONOperationSET_REP extends BlockJSONOperation {
|
|
250
|
+
export interface BlockJSONOperationSET_REP extends BlockJSONOperation {
|
|
240
251
|
type: OperationType.SET_REP;
|
|
241
252
|
to: string | GenericAccount;
|
|
242
253
|
}
|
|
@@ -248,12 +259,12 @@ declare class BlockOperationSET_REP extends BlockOperation implements BlockJSONO
|
|
|
248
259
|
set to(to: string | Account);
|
|
249
260
|
get to(): Account;
|
|
250
261
|
validate(context: BlockOperationValidateContext): void;
|
|
251
|
-
toJSON():
|
|
262
|
+
toJSON(): BlockJSONOperationSET_REP;
|
|
252
263
|
}
|
|
253
264
|
/**
|
|
254
265
|
* TokenCreate Operation
|
|
255
266
|
*/
|
|
256
|
-
interface BlockJSONOperationCREATE_IDENTIFIER extends BlockJSONOperation {
|
|
267
|
+
export interface BlockJSONOperationCREATE_IDENTIFIER extends BlockJSONOperation {
|
|
257
268
|
type: OperationType.CREATE_IDENTIFIER;
|
|
258
269
|
identifier: IdentifierAddress | string;
|
|
259
270
|
}
|
|
@@ -265,12 +276,12 @@ declare class BlockOperationCREATE_IDENTIFIER extends BlockOperation implements
|
|
|
265
276
|
set identifier(identifier: string | IdentifierAddress);
|
|
266
277
|
get identifier(): IdentifierAddress;
|
|
267
278
|
validate(context: BlockOperationValidateContext): void;
|
|
268
|
-
toJSON():
|
|
279
|
+
toJSON(): BlockJSONOperationCREATE_IDENTIFIER;
|
|
269
280
|
}
|
|
270
281
|
/**
|
|
271
282
|
* SetInfo operation
|
|
272
283
|
*/
|
|
273
|
-
interface BlockJSONOperationSET_INFO extends BlockJSONOperation {
|
|
284
|
+
export interface BlockJSONOperationSET_INFO extends BlockJSONOperation {
|
|
274
285
|
type: OperationType.SET_INFO;
|
|
275
286
|
name: string;
|
|
276
287
|
description: string;
|
|
@@ -291,12 +302,12 @@ declare class BlockOperationSET_INFO extends BlockOperation implements BlockJSON
|
|
|
291
302
|
set defaultPermission(newPerms: Permissions | undefined);
|
|
292
303
|
get defaultPermission(): Permissions | undefined;
|
|
293
304
|
validate(context: BlockOperationValidateContext): void;
|
|
294
|
-
toJSON():
|
|
305
|
+
toJSON(): BlockJSONOperationSET_INFO;
|
|
295
306
|
}
|
|
296
307
|
/**
|
|
297
308
|
* Set Permissions Operation
|
|
298
309
|
*/
|
|
299
|
-
interface BlockJSONOperationMODIFY_PERMISSIONS extends BlockJSONOperation {
|
|
310
|
+
export interface BlockJSONOperationMODIFY_PERMISSIONS extends BlockJSONOperation {
|
|
300
311
|
type: OperationType.MODIFY_PERMISSIONS;
|
|
301
312
|
principal: string | GenericAccount;
|
|
302
313
|
method: AdjustMethod;
|
|
@@ -317,15 +328,15 @@ declare class BlockOperationMODIFY_PERMISSIONS extends BlockOperation implements
|
|
|
317
328
|
set method(method: AdjustMethod);
|
|
318
329
|
get method(): AdjustMethod;
|
|
319
330
|
validate(context: BlockOperationValidateContext): void;
|
|
320
|
-
toJSON():
|
|
331
|
+
toJSON(): BlockJSONOperationMODIFY_PERMISSIONS;
|
|
321
332
|
}
|
|
322
333
|
/**
|
|
323
334
|
* Token Supply operation
|
|
324
335
|
*/
|
|
325
|
-
interface BlockJSONOperationTOKEN_ADMIN_SUPPLY extends BlockJSONOperation {
|
|
336
|
+
export interface BlockJSONOperationTOKEN_ADMIN_SUPPLY extends BlockJSONOperation {
|
|
326
337
|
type: OperationType.TOKEN_ADMIN_SUPPLY;
|
|
327
338
|
amount: bigint | string;
|
|
328
|
-
method:
|
|
339
|
+
method: AdjustMethod.ADD | AdjustMethod.SUBTRACT;
|
|
329
340
|
}
|
|
330
341
|
declare class BlockOperationTOKEN_ADMIN_SUPPLY extends BlockOperation implements BlockJSONOperationTOKEN_ADMIN_SUPPLY {
|
|
331
342
|
#private;
|
|
@@ -334,10 +345,36 @@ declare class BlockOperationTOKEN_ADMIN_SUPPLY extends BlockOperation implements
|
|
|
334
345
|
constructor(input: BlockJSONOperationTOKEN_ADMIN_SUPPLY);
|
|
335
346
|
set amount(amount: string | bigint);
|
|
336
347
|
get amount(): bigint;
|
|
337
|
-
set method(shouldAdd:
|
|
338
|
-
get method():
|
|
348
|
+
set method(shouldAdd: BlockJSONOperationTOKEN_ADMIN_SUPPLY['method']);
|
|
349
|
+
get method(): BlockJSONOperationTOKEN_ADMIN_SUPPLY['method'];
|
|
339
350
|
validate(context: BlockOperationValidateContext): void;
|
|
340
|
-
toJSON():
|
|
351
|
+
toJSON(): BlockJSONOperationTOKEN_ADMIN_SUPPLY;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* X.509 Certificate operations
|
|
355
|
+
*/
|
|
356
|
+
export interface BlockJSONOperationMANAGE_CERTIFICATE extends BlockJSONOperation {
|
|
357
|
+
type: OperationType.MANAGE_CERTIFICATE;
|
|
358
|
+
certificateOrHash: string | Certificate | Buffer | CertificateHash;
|
|
359
|
+
intermediateCertificates?: string | CertificateBundle | Buffer | null;
|
|
360
|
+
method: Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
361
|
+
}
|
|
362
|
+
export interface BlockJSONOperationMANAGE_CERTIFICATESerializable extends Omit<BlockJSONOperationMANAGE_CERTIFICATE, 'certificateOrHash' | 'intermediateCertificates'> {
|
|
363
|
+
certificateOrHash: string | Buffer;
|
|
364
|
+
intermediateCertificates?: string | Buffer | null;
|
|
365
|
+
}
|
|
366
|
+
declare class BlockOperationMANAGE_CERTIFICATE extends BlockOperation implements BlockJSONOperationMANAGE_CERTIFICATE {
|
|
367
|
+
#private;
|
|
368
|
+
type: OperationType.MANAGE_CERTIFICATE;
|
|
369
|
+
constructor(input: BlockJSONOperationMANAGE_CERTIFICATE);
|
|
370
|
+
get intermediateCertificates(): CertificateBundle | null | undefined;
|
|
371
|
+
set intermediateCertificates(bundle: ConstructorParameters<typeof CertificateBundle>[0] | null | undefined);
|
|
372
|
+
get certificateOrHash(): Certificate | CertificateHash;
|
|
373
|
+
set certificateOrHash(certificate: string | Certificate | CertificateHash | Buffer);
|
|
374
|
+
set method(shouldAdd: Exclude<AdjustMethod, AdjustMethod.SET>);
|
|
375
|
+
get method(): Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
376
|
+
validate(context: BlockOperationValidateContext): void;
|
|
377
|
+
toJSON(): BlockJSONOperationMANAGE_CERTIFICATESerializable;
|
|
341
378
|
}
|
|
342
379
|
/**
|
|
343
380
|
* Aggregate set of operations
|
|
@@ -351,18 +388,22 @@ export declare const Operation: {
|
|
|
351
388
|
TOKEN_ADMIN_SUPPLY: typeof BlockOperationTOKEN_ADMIN_SUPPLY;
|
|
352
389
|
TOKEN_ADMIN_MODIFY_BALANCE: typeof BlockOperationTOKEN_ADMIN_MODIFY_BALANCE;
|
|
353
390
|
RECEIVE: typeof BlockOperationRECEIVE;
|
|
391
|
+
MANAGE_CERTIFICATE: typeof BlockOperationMANAGE_CERTIFICATE;
|
|
354
392
|
};
|
|
355
|
-
export type { BlockOperationSEND, BlockOperationSET_REP, BlockOperationSET_INFO, BlockOperationMODIFY_PERMISSIONS, BlockOperationCREATE_IDENTIFIER, BlockOperationTOKEN_ADMIN_SUPPLY, BlockOperationTOKEN_ADMIN_MODIFY_BALANCE, BlockOperationRECEIVE };
|
|
393
|
+
export type { BlockOperationSEND, BlockOperationSET_REP, BlockOperationSET_INFO, BlockOperationMODIFY_PERMISSIONS, BlockOperationCREATE_IDENTIFIER, BlockOperationTOKEN_ADMIN_SUPPLY, BlockOperationTOKEN_ADMIN_MODIFY_BALANCE, BlockOperationRECEIVE, BlockOperationMANAGE_CERTIFICATE };
|
|
356
394
|
export type BlockOperations = InstanceType<typeof Operation[keyof typeof OperationType]>;
|
|
357
395
|
export type BlockJSONOperations = ConstructorParameters<typeof Operation[keyof typeof OperationType]>[0];
|
|
358
|
-
export declare function createBlockOperation(input: BlockJSONOperations): BlockOperationSEND |
|
|
396
|
+
export declare function createBlockOperation(input: BlockJSONOperations | ToJSONSerializable<BlockJSONOperations>): BlockOperationSEND | BlockOperationSET_REP | BlockOperationSET_INFO | BlockOperationMODIFY_PERMISSIONS | BlockOperationCREATE_IDENTIFIER | BlockOperationTOKEN_ADMIN_SUPPLY | BlockOperationTOKEN_ADMIN_MODIFY_BALANCE | BlockOperationRECEIVE | BlockOperationMANAGE_CERTIFICATE;
|
|
359
397
|
export declare function isBlockOperation(input: any): input is BlockOperations;
|
|
398
|
+
export type ExportedJSONOperation = {
|
|
399
|
+
[K in keyof typeof Operation]: ToJSONSerializable<ReturnType<InstanceType<typeof Operation[K]>['toJSON']>>;
|
|
400
|
+
}[keyof typeof Operation];
|
|
360
401
|
/**
|
|
361
402
|
* Export the "operations" mapping as something compatible with being
|
|
362
403
|
* serialized to JSON
|
|
363
404
|
*/
|
|
364
|
-
export declare function ExportOperationsJSON(operations: BlockOperations[]):
|
|
365
|
-
export declare function ImportOperationsJSON(operations: BlockOperations
|
|
405
|
+
export declare function ExportOperationsJSON(operations: BlockOperations[]): ExportedJSONOperation[];
|
|
406
|
+
export declare function ImportOperationsJSON(operations: (BlockOperations | BlockJSONOperations)[]): BlockOperations[];
|
|
366
407
|
export declare function ExportBlockOperations(operations: BlockOperations[]): ((Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
|
|
367
408
|
contains: [bigint, bigint];
|
|
368
409
|
value: OperationType.TOKEN_ADMIN_SUPPLY;
|
|
@@ -371,6 +412,10 @@ export declare function ExportBlockOperations(operations: BlockOperations[]): ((
|
|
|
371
412
|
contains: [Buffer, bigint, bigint];
|
|
372
413
|
value: OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
|
|
373
414
|
kind: "explicit";
|
|
415
|
+
}) | (Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
|
|
416
|
+
contains: [bigint, Buffer, Buffer[] | null | undefined];
|
|
417
|
+
value: OperationType.MANAGE_CERTIFICATE;
|
|
418
|
+
kind: "explicit";
|
|
374
419
|
}) | (Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
|
|
375
420
|
contains: [Buffer, bigint, Buffer, (Omit<import("../utils/asn1").ASN1String, "kind"> & {
|
|
376
421
|
kind: "utf8";
|
package/lib/error/block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeetaNetError } from '.';
|
|
2
2
|
declare const BlockErrorType: "BLOCK";
|
|
3
|
-
declare const BlockErrorCodes: readonly ["INVALID_TYPE", "NO_MULTIPLE_SET_REP", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "CANNOT_SEND_NON_TOKEN", "TOKEN_RECEIVE_DIFFERS", "ONLY_TOKEN_OP", "ONLY_IDENTIFIER_OP", "NO_TOKEN_OP", "NO_IDENTIFIER_OP", "IDENTIFIER_INVALID", "GENERAL_FIELD_INVALID", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "INVALID_ACCOUNT_TYPE", "NO_ADMIN_ON_TARGET", "PREVIOUS_SELF", "NO_DELEGATE_ADMIN", "NO_MODIFY_PERMISSION_DUPE", "CANNOT_FORWARD_TO_SELF", "EXACT_TRUE_WHEN_FORWARDING", "EXTERNAL_TOO_LONG", "EXTERNAL_INVALID", "EXTERNAL_MISSING"];
|
|
3
|
+
declare const BlockErrorCodes: readonly ["INVALID_TYPE", "INVALID_VERSION", "NO_MULTIPLE_SET_REP", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "CANNOT_SEND_NON_TOKEN", "TOKEN_RECEIVE_DIFFERS", "ONLY_TOKEN_OP", "ONLY_IDENTIFIER_OP", "NO_TOKEN_OP", "NO_IDENTIFIER_OP", "NO_MULTISIG_OP", "IDENTIFIER_INVALID", "GENERAL_FIELD_INVALID", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "INVALID_ACCOUNT_TYPE", "NO_ADMIN_ON_TARGET", "PREVIOUS_SELF", "NO_DELEGATE_ADMIN", "NO_MODIFY_PERMISSION_DUPE", "CANNOT_FORWARD_TO_SELF", "EXACT_TRUE_WHEN_FORWARDING", "CERTIFICATE_SUBJECT_MISMATCH", "NO_DUPLICATE_CERTIFICATE_OPERATION", "INTERMEDIATE_CERTIFICATES_ONLY_ADD", "INVALID_CERTIFICATE_VALUE", "EXTERNAL_TOO_LONG", "EXTERNAL_INVALID", "EXTERNAL_MISSING", "SUPPLY_INVALID"];
|
|
4
4
|
export type BlockErrorCode = `${typeof BlockErrorType}_${typeof BlockErrorCodes[number]}`;
|
|
5
5
|
export default class KeetaNetBlockError extends KeetaNetError {
|
|
6
6
|
static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetBlockError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KeetaNetError } from '.';
|
|
2
|
+
declare const CertificateErrorType: "CERTIFICATE";
|
|
3
|
+
declare const BlockErrorCodes: readonly ["DUPLICATE_INCLUDED", "ORPHAN_FOUND", "CYCLE_FOUND", "SECONDARY_GRAPH"];
|
|
4
|
+
export type CertificateErrorCode = `${typeof CertificateErrorType}_${typeof BlockErrorCodes[number]}`;
|
|
5
|
+
export default class KeetaNetCertificateError extends KeetaNetError {
|
|
6
|
+
static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetCertificateError;
|
|
7
|
+
constructor(code: CertificateErrorCode, message: string);
|
|
8
|
+
}
|
|
9
|
+
export {};
|
package/lib/error/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeetaNetError } from '.';
|
|
2
2
|
declare const ClientErrorType: "CLIENT";
|
|
3
|
-
declare const ClientErrorCodes: readonly ["BUILDER_AMOUNT_IS_ZERO", "BUILDER_CANNOT_READ_BEFORE_RENDER", "BUILDER_REQUIRES_PRIVATE_KEY", "BUILDER_USER_CLIENT_REQUIRED", "PUBLISH_AID_NOT_AVAILABLE"];
|
|
3
|
+
declare const ClientErrorCodes: readonly ["BUILDER_AMOUNT_IS_ZERO", "BUILDER_CANNOT_READ_BEFORE_RENDER", "BUILDER_REQUIRES_PRIVATE_KEY", "BUILDER_USER_CLIENT_REQUIRED", "PUBLISH_AID_NOT_AVAILABLE", "SIGNER_REQUIRES_PRIVATE_KEY"];
|
|
4
4
|
export type ClientErrorCode = `${typeof ClientErrorType}_${typeof ClientErrorCodes[number]}`;
|
|
5
5
|
export default class KeetaNetClientError extends KeetaNetError {
|
|
6
6
|
static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetClientError;
|
package/lib/error/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import type { LedgerErrorCode } from './ledger';
|
|
|
5
5
|
import type { VoteErrorCode } from './vote';
|
|
6
6
|
import type { KVErrorCode } from './kv';
|
|
7
7
|
import type { PermissionsErrorCode } from './permissions';
|
|
8
|
-
|
|
8
|
+
import type { CertificateErrorCode } from './certificate';
|
|
9
|
+
export type ErrorCode = BlockErrorCode | LedgerErrorCode | AccountErrorCode | ClientErrorCode | VoteErrorCode | PermissionsErrorCode | KVErrorCode | CertificateErrorCode;
|
|
9
10
|
export declare function ExpectErrorCode(code: ErrorCode, test: () => any): Promise<void>;
|
|
10
11
|
interface ValidationOptions {
|
|
11
12
|
type: string;
|
package/lib/error/kv.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeetaNetError } from '.';
|
|
2
2
|
declare const KVErrorType: "KV";
|
|
3
|
-
declare const KVErrorCodes: readonly ["TTL_NOT_SUPPORTED"];
|
|
3
|
+
declare const KVErrorCodes: readonly ["TTL_NOT_SUPPORTED", "KEY_ALREADY_EXISTS"];
|
|
4
4
|
export type KVErrorCode = `${typeof KVErrorType}_${typeof KVErrorCodes[number]}`;
|
|
5
5
|
export default class KeetaNetKVError extends KeetaNetError {
|
|
6
6
|
static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetKVError;
|
package/lib/error/vote.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeetaNetError } from '.';
|
|
2
2
|
declare const VoteErrorType: "VOTE";
|
|
3
|
-
declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "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", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "
|
|
3
|
+
declare const VoteErrorCodes: readonly ["SERIAL_MISMATCH", "INVALID_VERSION", "INVALID_CONSTRUCTION", "INVALID_CONSTRUCTION_JSON", "SIGNATURE_INVALID", "EXPIRED", "INVALID_VALIDITY", "MOMENT_BEFORE_VALIDITY_FROM", "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", "BUILDER_INVALID_CONSTRUCTION", "BUILDER_INVALID_BLOCK_TYPE", "BUILDER_INVALID_SERIAL", "BUILDER_INVALID_VALID_TO_FROM", "MALFORMED_WRAPPER", "MALFORMED_VOTE_WRAPPER", "MALFORMED_VOTE_CONTENT", "MALFORMED_VOTE_CONTENT_EXTRA_DATA", "MALFORMED_VOTE_VERSION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_SIGNATURE_INFORMATION", "MALFORMED_VOTE_ISSUER_INFORMATION", "MALFORMED_VOTE_SUBJECT_INFORMATION", "MALFORMED_VOTE_VALIDITY_INFORMATION", "MALFORMED_VOTE_SERIAL", "MALFORMED_VOTE_EXTENSIONS", "MALFORMED_VOTE_EXTENSIONS_DATA", "MALFORMED_VOTE_EXTENSIONS_VALUE", "MALFORMED_VOTE_EXTENSIONS_VALUE_OID", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL", "MALFORMED_VOTE_EXTENSIONS_VALUE_CRITICAL_TYPE", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_ISSUER", "MALFORMED_VOTE_SIGNATURE_SCHEME_DOES_NOT_MATCH_WRAPPER", "MALFORMED_VOTE_SIGNATURE_SCHEME_ECDSA_INVALID_CURVE", "MALFORMED_VOTE_SIGNATURE_UNSUPPORTED_SCHEME", "MALFORMED_VOTE_SUBJECT_PUBLIC_KEY_INFORMATION", "MALFORMED_VOTE_SIGNATURE_VALUE", "MALFORMED_VOTE_NO_BLOCKS_FOUND", "MALFORMED_STAPLE", "MALFORMED_STAPLE_BLOCKS", "MALFORMED_STAPLE_BLOCKS_AT_LEAST_ONE", "MALFORMED_STAPLE_VOTES", "MALFORMED_STAPLE_VOTES_AT_LEAST_ONE", "MALFORMED_FIND_RDN_INVALID_TYPE", "MALFORMED_FIND_RDN_MUST_HAVE_ONE", "MALFORMED_FIND_RDN_PART_WELL_FORMED", "MALFORMED_FIND_RDN_MUST_BE_SET", "MALFORMED_FIND_RDN_TYPE_MUST_BE_OID", "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", "MALFORMED_FEES_AMOUNT", "MALFORMED_FEES_FROM_VOTE_INVALID_INPUT", "MALFORMED_FEES_IN_PERMANENT_VOTE", "MALFORMED_FEES_PAY_TO_INVALID", "MALFORMED_FEES_TOKEN_NOT_TOKEN"];
|
|
4
4
|
export type VoteErrorCode = `${typeof VoteErrorType}_${typeof VoteErrorCodes[number]}`;
|
|
5
5
|
export default class KeetaNetVoteError extends KeetaNetError {
|
|
6
6
|
static isInstance: (obj: any, strict?: boolean) => obj is KeetaNetVoteError;
|
package/lib/kv/index.d.ts
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
1
|
import type { BufferStorage } from '../utils/buffer';
|
|
2
2
|
import type { JSONSerializable } from '../utils/conversion';
|
|
3
|
-
|
|
3
|
+
import type { Node } from '../node';
|
|
4
|
+
type NodeLike = Pick<Node, 'timing'>;
|
|
5
|
+
export interface KVGenericOptionsType {
|
|
6
|
+
node?: NodeLike;
|
|
7
|
+
}
|
|
8
|
+
export interface KVSetOptionsType extends KVGenericOptionsType {
|
|
4
9
|
exclusiveCreate?: boolean;
|
|
5
10
|
ttl?: number;
|
|
6
11
|
}
|
|
7
12
|
export interface KVStorageProviderAPI {
|
|
8
13
|
set(arena: string, key: string, value: JSONSerializable | undefined, options?: KVSetOptionsType): Promise<void>;
|
|
9
|
-
get(arena: string | null, key: string): Promise<JSONSerializable | undefined>;
|
|
10
|
-
getAll(arena: string): Promise<{
|
|
14
|
+
get(arena: string | null, key: string, options?: KVGenericOptionsType): Promise<JSONSerializable | undefined>;
|
|
15
|
+
getAll(arena: string, options?: KVGenericOptionsType): Promise<{
|
|
11
16
|
[key: string]: JSONSerializable;
|
|
12
17
|
}>;
|
|
13
|
-
list(arena: string): Promise<string[]>;
|
|
14
|
-
incr(arena: string, key: string, change: number): Promise<bigint>;
|
|
15
|
-
xor(arena: null, key: string, change: BufferStorage): Promise<void>;
|
|
16
|
-
destroy?: () => Promise<void>;
|
|
18
|
+
list(arena: string, options?: KVGenericOptionsType): Promise<string[]>;
|
|
19
|
+
incr(arena: string, key: string, change: number, options?: KVGenericOptionsType): Promise<bigint>;
|
|
20
|
+
xor(arena: null, key: string, change: BufferStorage, options?: KVGenericOptionsType): Promise<void>;
|
|
21
|
+
destroy?: (options?: KVGenericOptionsType) => Promise<void>;
|
|
17
22
|
}
|
|
18
23
|
export type KVStorageProvider = KVStorageProviderAPI;
|
|
19
24
|
export declare class KVStorageProviderBase {
|
|
20
|
-
|
|
25
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
26
|
+
xor(_ignored_arena: null, key: string, _ignored_change: BufferStorage, _ignored_options?: KVGenericOptionsType): Promise<void>;
|
|
21
27
|
}
|
|
28
|
+
export {};
|
package/lib/kv/kv_redis.d.ts
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
|
-
import type { KVStorageProviderAPI, KVSetOptionsType } from './';
|
|
1
|
+
import type { KVStorageProviderAPI, KVSetOptionsType, KVGenericOptionsType } from './';
|
|
2
2
|
import { KVStorageProviderBase } from './';
|
|
3
3
|
import type { JSONSerializable } from '../utils/conversion';
|
|
4
4
|
import type { BufferStorage } from '../utils/buffer';
|
|
5
|
+
export type KVStorageProviderRedisConfig = {
|
|
6
|
+
host: string;
|
|
7
|
+
password: string;
|
|
8
|
+
port?: number;
|
|
9
|
+
log?: typeof KVStorageProviderRedis['defaultLogger'];
|
|
10
|
+
node?: KVGenericOptionsType['node'];
|
|
11
|
+
};
|
|
5
12
|
export declare class KVStorageProviderRedis extends KVStorageProviderBase implements KVStorageProviderAPI {
|
|
6
13
|
#private;
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
static defaultLogger: Pick<typeof console, 'debug' | 'error'>;
|
|
15
|
+
log: Pick<Console, "debug" | "error">;
|
|
16
|
+
constructor(config: KVStorageProviderRedisConfig);
|
|
17
|
+
private node;
|
|
18
|
+
destroy(options?: KVGenericOptionsType): Promise<void>;
|
|
9
19
|
set(arena: string, key: string, value: JSONSerializable | undefined, opt?: KVSetOptionsType): Promise<void>;
|
|
10
|
-
get(arena: string | null, key: string): Promise<JSONSerializable | undefined>;
|
|
11
|
-
getAll(arena: string): Promise<{
|
|
20
|
+
get(arena: string | null, key: string, options?: KVGenericOptionsType): Promise<JSONSerializable | undefined>;
|
|
21
|
+
getAll(arena: string, options?: KVGenericOptionsType): Promise<{
|
|
12
22
|
[key: string]: JSONSerializable;
|
|
13
23
|
}>;
|
|
14
|
-
list(arena: string): Promise<string[]>;
|
|
15
|
-
incr(arena: string, key: string, change: number): Promise<bigint>;
|
|
16
|
-
xor(arena: null, key: string, change: BufferStorage): Promise<void>;
|
|
24
|
+
list(arena: string, options?: KVGenericOptionsType): Promise<string[]>;
|
|
25
|
+
incr(arena: string, key: string, change: number, options?: KVGenericOptionsType): Promise<bigint>;
|
|
26
|
+
xor(arena: null, key: string, change: BufferStorage, options?: KVGenericOptionsType): Promise<void>;
|
|
17
27
|
}
|
|
18
28
|
export default KVStorageProviderRedis;
|
package/lib/ledger/common.d.ts
CHANGED
|
@@ -53,13 +53,14 @@ interface ComputeLedgerEffectOptions<T extends boolean, P extends boolean, W ext
|
|
|
53
53
|
getFinalNumericValues?: T;
|
|
54
54
|
computePermissions?: P;
|
|
55
55
|
computeWeights?: W;
|
|
56
|
-
|
|
56
|
+
checkRangeConstraints?: boolean;
|
|
57
57
|
baseToken: TokenAddress;
|
|
58
58
|
}
|
|
59
|
+
export declare function validateSupply(amount: bigint, network: bigint): void;
|
|
59
60
|
/**
|
|
60
61
|
* Compute effects on the ledger from block effects
|
|
61
62
|
*/
|
|
62
|
-
export declare function computeLedgerEffect<T extends boolean, P extends boolean, W extends boolean>(options: ComputeLedgerEffectOptions<T, P, W>, effects: ComputedEffectOfBlocksByAccount, storageProvider: computeLedgerEffectStorageProvider, transaction?: any): Promise<BalanceSupplyChangeResp<T, P, W>>;
|
|
63
|
+
export declare function computeLedgerEffect<T extends boolean, P extends boolean, W extends boolean>(options: ComputeLedgerEffectOptions<T, P, W>, effects: ComputedEffectOfBlocksByAccount, storageProvider: computeLedgerEffectStorageProvider, network: bigint, transaction?: any): Promise<BalanceSupplyChangeResp<T, P, W>>;
|
|
63
64
|
/**
|
|
64
65
|
* A partial LedgerStorageAPI which just has the methods for "addTimeStatistics"
|
|
65
66
|
*/
|
|
@@ -94,12 +95,19 @@ export declare abstract class LedgerStorageBase {
|
|
|
94
95
|
protected config: LedgerConfig | null;
|
|
95
96
|
constructor();
|
|
96
97
|
protected abstract adjustDefer(transaction: any, input: VoteStaple): Promise<void>;
|
|
97
|
-
abstract getBlockHeight(transaction: any, blockHash: BlockHash, account: GenericAccount): Promise<
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
abstract getBlockHeight(transaction: any, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
99
|
+
getBlockHeights(transaction: any, toFetch: {
|
|
100
|
+
blockHash: BlockHash;
|
|
101
|
+
account: GenericAccount;
|
|
102
|
+
}[]): Promise<{
|
|
103
|
+
[blockHash: string]: bigint | null;
|
|
104
|
+
}>;
|
|
100
105
|
abstract getHeadBlocks(transaction: any, accounts: GenericAccount[], from: LedgerSelector): Promise<{
|
|
101
106
|
[account: string]: Block | null;
|
|
102
107
|
}>;
|
|
108
|
+
getHeadBlockHashes(transaction: any, accounts: InstanceType<typeof Account.Set>): Promise<{
|
|
109
|
+
[account: string]: BlockHash | null;
|
|
110
|
+
}>;
|
|
103
111
|
abstract getVotesFromMultiplePrevious(transaction: any, prevBlocks: BlockHash[], from: LedgerSelector, issuer?: Account): Promise<{
|
|
104
112
|
[hash: string]: Vote[] | null;
|
|
105
113
|
}>;
|
|
@@ -3,11 +3,13 @@ import { Block, BlockHash } from '../block';
|
|
|
3
3
|
import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
|
|
4
4
|
import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
|
|
5
5
|
import Account from '../account';
|
|
6
|
-
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions } from '../ledger';
|
|
7
|
-
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics } from './types';
|
|
6
|
+
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBase } from '../ledger';
|
|
7
|
+
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
8
8
|
import { LedgerStorageBase } from './common';
|
|
9
9
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
10
|
-
|
|
10
|
+
import type Node from '../node';
|
|
11
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
12
|
+
declare const dynamoDBTableNames: readonly ["votes", "voteUIDs", "permissions", "accountInfo", "accountOwners", "accountCertificates", "blocks", "balances", "weight", "heapBlocks", "heapStorage", "chain", "delegation", "serial", "kv"];
|
|
11
13
|
declare const optionalDynamoDbTables: readonly ["kv"];
|
|
12
14
|
type TableName = typeof dynamoDBTableNames[number];
|
|
13
15
|
type OptionalTableName = typeof optionalDynamoDbTables[number];
|
|
@@ -20,22 +22,23 @@ export interface DynamoDBConfig {
|
|
|
20
22
|
transactionSize?: number;
|
|
21
23
|
batchUpdateSize?: number;
|
|
22
24
|
}
|
|
23
|
-
declare class DynamoDBTransaction {
|
|
25
|
+
declare class DynamoDBTransaction implements LedgerStorageTransactionBase {
|
|
24
26
|
#private;
|
|
27
|
+
readonly node: Node | undefined;
|
|
25
28
|
readonly moment: Date;
|
|
26
|
-
|
|
29
|
+
readonly identifier: string;
|
|
30
|
+
readonly readOnly: boolean;
|
|
31
|
+
constructor(config: DynamoDBConfig, ledger: Ledger, log: LedgerConfig['log'], dbDynamoDB: DBDynamoDB, transactionBase: LedgerStorageTransactionBase);
|
|
27
32
|
commit(): Promise<void>;
|
|
28
33
|
abort(): Promise<void>;
|
|
29
|
-
delegatedWeight(rep?: Account): Promise<bigint>;
|
|
34
|
+
delegatedWeight(rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
|
|
30
35
|
getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
31
36
|
getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
32
37
|
adjustDefer(input: VoteStaple): Promise<void>;
|
|
33
|
-
adjust(input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<
|
|
38
|
+
adjust(input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
|
|
34
39
|
addPendingVote(blocksAndVotes: VoteStaple): Promise<void>;
|
|
35
40
|
getBlock(block: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
36
|
-
getBlockHeight(blockHash: BlockHash, account: GenericAccount): Promise<
|
|
37
|
-
blockHeight: string | null;
|
|
38
|
-
} | null>;
|
|
41
|
+
getBlockHeight(blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
39
42
|
getVotes(block: BlockHash, from: LedgerSelector, issuer?: Account, transactionAlreadyVerifiedActiveByCaller?: boolean): Promise<Vote[] | null>;
|
|
40
43
|
getVoteStaple(stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
41
44
|
getHistory(account: GenericAccount, start: VoteBlockHash | null, limit: number): Promise<VoteBlockHash[]>;
|
|
@@ -57,29 +60,30 @@ declare class DynamoDBTransaction {
|
|
|
57
60
|
listACLsByEntity(entity: GenericAccount): Promise<ACLRow[]>;
|
|
58
61
|
listACLsByPrincipal(principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
59
62
|
getVotesAfter(moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
|
|
63
|
+
getAccountCertificates(account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
64
|
+
getAccountCertificateByHash(account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
60
65
|
gcBatch(): Promise<boolean>;
|
|
61
66
|
}
|
|
62
67
|
export declare class DBDynamoDB extends LedgerStorageBase implements LedgerStorageAPI {
|
|
63
68
|
#private;
|
|
69
|
+
ledgerConfig: LedgerConfig | null;
|
|
64
70
|
static Testing: {
|
|
65
71
|
deleteTables: (config: DynamoDBConfig) => Promise<void>;
|
|
66
72
|
createTables: (config: DynamoDBConfig) => Promise<void>;
|
|
67
73
|
};
|
|
68
74
|
init(config: LedgerConfig, ledger: Ledger): void;
|
|
69
|
-
beginTransaction(): Promise<DynamoDBTransaction>;
|
|
75
|
+
beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<DynamoDBTransaction>;
|
|
70
76
|
commitTransaction(transaction: DynamoDBTransaction): Promise<void>;
|
|
71
77
|
abortTransaction(transaction: DynamoDBTransaction): Promise<void>;
|
|
72
78
|
evaluateError(error: any): Promise<any>;
|
|
73
|
-
delegatedWeight(transaction: DynamoDBTransaction, rep?: Account): Promise<bigint>;
|
|
79
|
+
delegatedWeight(transaction: DynamoDBTransaction, rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
|
|
74
80
|
getBalance(transaction: DynamoDBTransaction, account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
75
81
|
getAllBalances(transaction: DynamoDBTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
76
82
|
protected adjustDefer(transaction: DynamoDBTransaction, input: VoteStaple): Promise<void>;
|
|
77
|
-
adjust(transaction: DynamoDBTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<
|
|
83
|
+
adjust(transaction: DynamoDBTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<VoteStaple[]>;
|
|
78
84
|
addPendingVote(transaction: DynamoDBTransaction, blocksAndVote: VoteStaple): Promise<void>;
|
|
79
85
|
getBlock(transaction: DynamoDBTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
80
|
-
getBlockHeight(transaction: DynamoDBTransaction, blockHash: BlockHash, account: GenericAccount): Promise<
|
|
81
|
-
blockHeight: string | null;
|
|
82
|
-
} | null>;
|
|
86
|
+
getBlockHeight(transaction: DynamoDBTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
83
87
|
getVotes(transaction: DynamoDBTransaction, block: BlockHash, from: LedgerSelector): Promise<Vote[] | null>;
|
|
84
88
|
getVoteStaples(transaction: DynamoDBTransaction, stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
85
89
|
getHistory(transaction: DynamoDBTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
@@ -96,6 +100,8 @@ export declare class DBDynamoDB extends LedgerStorageBase implements LedgerStora
|
|
|
96
100
|
listACLsByPrincipal(transaction: DynamoDBTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
97
101
|
listACLsByEntity(transaction: DynamoDBTransaction, entity: GenericAccount): Promise<ACLRow[]>;
|
|
98
102
|
getVotesAfter(transaction: DynamoDBTransaction, moment: Date, startKey?: string): Promise<PaginatedVotes>;
|
|
103
|
+
getAccountCertificates(transaction: DynamoDBTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
104
|
+
getAccountCertificateByHash(transaction: DynamoDBTransaction, account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
99
105
|
getNextSerialNumber(): Promise<bigint>;
|
|
100
106
|
gcBatch(transaction: DynamoDBTransaction): Promise<boolean>;
|
|
101
107
|
stats(): Promise<LedgerStatistics>;
|
|
@@ -3,16 +3,16 @@ import { Block, BlockHash } from '../block';
|
|
|
3
3
|
import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
|
|
4
4
|
import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
|
|
5
5
|
import Account, { AccountKeyAlgorithm } from '../account';
|
|
6
|
-
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions } from '../ledger';
|
|
7
|
-
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics } from './types';
|
|
6
|
+
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBase } from '../ledger';
|
|
7
|
+
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
8
8
|
import { LedgerStorageBase } from './common';
|
|
9
9
|
import type { PoolClient as PostgresPoolClient } from 'pg';
|
|
10
10
|
import { Pool as PostgresPool } from 'pg';
|
|
11
11
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
12
12
|
import LedgerRequestCache from './cache';
|
|
13
|
-
|
|
13
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
14
|
+
interface PostgresTransaction extends LedgerStorageTransactionBase {
|
|
14
15
|
client: PostgresPoolClient;
|
|
15
|
-
moment: Date;
|
|
16
16
|
cache: LedgerRequestCache;
|
|
17
17
|
}
|
|
18
18
|
interface PostgresSelectOptions {
|
|
@@ -24,12 +24,12 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
|
|
|
24
24
|
constructor();
|
|
25
25
|
init(config: LedgerConfig, ledger: Ledger): void;
|
|
26
26
|
destroy(): Promise<void>;
|
|
27
|
-
beginTransaction(): Promise<PostgresTransaction>;
|
|
27
|
+
beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<PostgresTransaction>;
|
|
28
28
|
commitTransaction(transaction: PostgresTransaction): Promise<void>;
|
|
29
29
|
abortTransaction(transaction: PostgresTransaction): Promise<void>;
|
|
30
30
|
cache(transaction: PostgresTransaction): LedgerRequestCache;
|
|
31
31
|
evaluateError(error: any): Promise<any>;
|
|
32
|
-
delegatedWeight(transaction: PostgresTransaction, rep?: Account
|
|
32
|
+
delegatedWeight(transaction: PostgresTransaction, rep?: Account | InstanceType<typeof Account.Set>, options?: PostgresSelectOptions): Promise<bigint>;
|
|
33
33
|
getBalance(transaction: PostgresTransaction, account: GenericAccount, token: TokenAddress, options?: PostgresSelectOptions): Promise<bigint>;
|
|
34
34
|
getAllBalances(transaction: PostgresTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
35
35
|
addPendingVote(transaction: PostgresTransaction, votesAndBlocks: VoteStaple): Promise<void>;
|
|
@@ -42,11 +42,9 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
|
|
|
42
42
|
listACLsByEntity(transaction: PostgresTransaction, entity: GenericAccount): Promise<ACLRow[]>;
|
|
43
43
|
listACLsByPrincipal(transaction: PostgresTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
44
44
|
getAccountInfo(transaction: PostgresTransaction, account: GenericAccount | string): Promise<AccountInfo>;
|
|
45
|
-
adjust(transaction: PostgresTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<
|
|
45
|
+
adjust(transaction: PostgresTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
|
|
46
46
|
getBlock(transaction: PostgresTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
47
|
-
getBlockHeight(transaction: PostgresTransaction, blockHash: BlockHash, account: GenericAccount): Promise<
|
|
48
|
-
blockHeight: string | null;
|
|
49
|
-
} | null>;
|
|
47
|
+
getBlockHeight(transaction: PostgresTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
50
48
|
getVotes(transaction: PostgresTransaction, block: BlockHash, from: LedgerSelector, issuer?: GenericAccount): Promise<Vote[] | null>;
|
|
51
49
|
getVoteStaples(transaction: PostgresTransaction, stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
52
50
|
getHistory(transaction: PostgresTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
@@ -59,6 +57,8 @@ export declare class DBPostgres extends LedgerStorageBase implements LedgerStora
|
|
|
59
57
|
}>;
|
|
60
58
|
getVoteStaplesFromBlockHash(transaction: PostgresTransaction, blocks: BlockHash[], onLedger: LedgerSelector): Promise<VoteStaple[]>;
|
|
61
59
|
getVotesAfter(transaction: PostgresTransaction, moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
|
|
60
|
+
getAccountCertificates(transaction: PostgresTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
61
|
+
getAccountCertificateByHash(transaction: PostgresTransaction, account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
62
62
|
protected gcBatch(transaction: PostgresTransaction): Promise<boolean>;
|
|
63
63
|
getNextSerialNumber(): Promise<bigint>;
|
|
64
64
|
stats(): Promise<LedgerStatistics>;
|