@keetanetwork/keetanet-client 0.10.4 → 0.12.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/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 +28 -1
- package/client/index-browser.d.ts +129 -7
- package/client/index-browser.js +25383 -37128
- package/client/index.d.ts +129 -7
- package/client/index.js +3828 -6498
- 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 +42 -13
- 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} +12 -9
- 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 +4 -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 +4 -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.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.default.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 +60 -18
- 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_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.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.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_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.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.ClientRepresentative.html +1 -1
- 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.TimingData.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.TimingSectionHandle.html +6 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +3 -3
- 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.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/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/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 +3 -3
- package/lib/utils/certificate.d.ts +75 -4
- package/lib/utils/conversion.d.ts +13 -35
- package/lib/utils/helper.d.ts +19 -8
- package/lib/utils/helper_testing.d.ts +1 -1
- package/lib/vote.d.ts +73 -55
- package/package.json +2 -3
- package/version.d.ts +1 -1
- 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.VoteJSONOutput.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
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>;
|
|
@@ -4,15 +4,16 @@ import { BlockHash } from '../block';
|
|
|
4
4
|
import type { VoteBlockHash, VoteBlockHashMap } from '../vote';
|
|
5
5
|
import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
|
|
6
6
|
import Account from '../account';
|
|
7
|
-
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions } from '../ledger';
|
|
8
|
-
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics } from './types';
|
|
7
|
+
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBase } from '../ledger';
|
|
8
|
+
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
9
9
|
import type { KVStorageProviderAPI } from '../kv';
|
|
10
10
|
import { LedgerStorageBase } from './common';
|
|
11
11
|
import Stats from '../stats';
|
|
12
|
-
import { KeetaNetLedgerError } from '../error/ledger';
|
|
13
12
|
import type { Database as GoogleSpannerDatabase } from '@google-cloud/spanner';
|
|
14
13
|
import type { TableColumn, FilteredResponseRow, IndexName, TableName, QueryRow as HelperQueryRow, QueryRows } from './db_spanner_helper';
|
|
15
14
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
15
|
+
import type Node from '../node';
|
|
16
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
16
17
|
type QueryRow<T extends TableName> = HelperQueryRow<T> | QueryRows<T>;
|
|
17
18
|
type ReadOptions = {
|
|
18
19
|
limit?: number;
|
|
@@ -30,16 +31,18 @@ type SpannerReadResponse<T extends TableName, C extends TableColumn<T>[]> = {
|
|
|
30
31
|
moment: Date;
|
|
31
32
|
};
|
|
32
33
|
interface SpannerTransactionOptions {
|
|
33
|
-
readOnly?: boolean;
|
|
34
34
|
strongRead?: boolean;
|
|
35
35
|
}
|
|
36
|
-
export declare class SpannerTransaction {
|
|
36
|
+
export declare class SpannerTransaction implements LedgerStorageTransactionBase {
|
|
37
37
|
#private;
|
|
38
|
+
readonly node: Node | undefined;
|
|
38
39
|
readonly moment: Date;
|
|
40
|
+
readonly identifier: string;
|
|
41
|
+
readonly readOnly: boolean;
|
|
39
42
|
readonly options: SpannerTransactionOptions;
|
|
40
43
|
readonly statsChanges: Parameters<Stats['incr']>[];
|
|
41
|
-
constructor(database: GoogleSpannerDatabase, options
|
|
42
|
-
evaluateError(error: any):
|
|
44
|
+
constructor(database: GoogleSpannerDatabase, options: SpannerTransactionOptions, transactionBase: LedgerStorageTransactionBase);
|
|
45
|
+
evaluateError(error: any): any;
|
|
43
46
|
beginTransaction(identifier: string, strongRead?: boolean): Promise<void>;
|
|
44
47
|
endTransaction(mode: 'COMMIT' | 'ROLLBACK'): Promise<void>;
|
|
45
48
|
insert<T extends TableName, R extends QueryRow<T>>(table: T, query: R): void;
|
|
@@ -66,11 +69,11 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
|
|
|
66
69
|
constructor();
|
|
67
70
|
init(config: LedgerConfig, ledger: Ledger): void;
|
|
68
71
|
destroy(): Promise<void>;
|
|
69
|
-
beginTransaction(
|
|
72
|
+
beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<SpannerTransaction>;
|
|
70
73
|
commitTransaction(transaction: SpannerTransaction): Promise<void>;
|
|
71
74
|
abortTransaction(transaction: SpannerTransaction): Promise<void>;
|
|
72
|
-
evaluateError(error: any): Promise<
|
|
73
|
-
delegatedWeight(transaction: SpannerTransaction, rep?: Account): Promise<bigint>;
|
|
75
|
+
evaluateError(error: any): Promise<any>;
|
|
76
|
+
delegatedWeight(transaction: SpannerTransaction, rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
|
|
74
77
|
getBalance(transaction: SpannerTransaction, account: GenericAccount | string, token: TokenAddress | string): Promise<bigint>;
|
|
75
78
|
getAllBalances(transaction: SpannerTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
76
79
|
addPendingVote(transaction: SpannerTransaction, votesAndBlocks: VoteStaple): Promise<void>;
|
|
@@ -79,11 +82,15 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
|
|
|
79
82
|
* If an adjustment cannot be made right now, defer it for follow-up
|
|
80
83
|
*/
|
|
81
84
|
protected adjustDefer(transaction: SpannerTransaction, input: VoteStaple): Promise<void>;
|
|
82
|
-
adjust(transaction: SpannerTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<
|
|
85
|
+
adjust(transaction: SpannerTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
|
|
83
86
|
getBlock(transaction: SpannerTransaction, blockHash: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
getBlockHeights(transaction: any, toFetch: {
|
|
88
|
+
blockHash: BlockHash;
|
|
89
|
+
account: GenericAccount;
|
|
90
|
+
}[]): Promise<{
|
|
91
|
+
[blockHash: string]: bigint | null;
|
|
92
|
+
}>;
|
|
93
|
+
getBlockHeight(transaction: SpannerTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
87
94
|
getVotes(transaction: SpannerTransaction, blockHash: BlockHash, from: LedgerSelector): Promise<Vote[] | null>;
|
|
88
95
|
getVoteStaples(transaction: SpannerTransaction, stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
89
96
|
getHistory(transaction: SpannerTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
@@ -91,6 +98,9 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
|
|
|
91
98
|
getVotesFromMultiplePrevious(transaction: SpannerTransaction, prevBlocks: BlockHash[], from: LedgerSelector, issuer?: Account): Promise<{
|
|
92
99
|
[hash: string]: Vote[] | null;
|
|
93
100
|
}>;
|
|
101
|
+
getHeadBlockHashes(transaction: any, accounts: InstanceType<typeof Account.Set>): Promise<{
|
|
102
|
+
[account: string]: BlockHash | null;
|
|
103
|
+
}>;
|
|
94
104
|
getHeadBlocks(transaction: SpannerTransaction, accounts: GenericAccount[], from: LedgerSelector): Promise<{
|
|
95
105
|
[publicKey: string]: Block | null;
|
|
96
106
|
}>;
|
|
@@ -102,6 +112,8 @@ export declare class DBSpanner extends LedgerStorageBase implements LedgerStorag
|
|
|
102
112
|
getVotesAfter(transaction: SpannerTransaction, moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
|
|
103
113
|
protected gcBatch(transaction: SpannerTransaction): Promise<boolean>;
|
|
104
114
|
getNextSerialNumber(): Promise<bigint>;
|
|
115
|
+
getAccountCertificates(transaction: SpannerTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
116
|
+
getAccountCertificateByHash(transaction: SpannerTransaction, account: GenericAccount, certificateHash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
105
117
|
stats(): Promise<LedgerStatistics>;
|
|
106
118
|
}
|
|
107
119
|
export declare const Testing: {
|