@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
|
@@ -5,6 +5,7 @@ import Block, { BlockHash } from '../block';
|
|
|
5
5
|
import Vote, { PossiblyExpiredVote, VoteBlockHash } from '../vote';
|
|
6
6
|
import type { BaseSet, ExternalSet } from '../permissions';
|
|
7
7
|
import type { SpannerTransaction } from './db_spanner';
|
|
8
|
+
import { Certificate, CertificateBundle, CertificateHash } from '../utils/certificate';
|
|
8
9
|
declare const ColumnTypes: {
|
|
9
10
|
readonly LEDGER: {
|
|
10
11
|
readonly dbType: "STRING";
|
|
@@ -15,7 +16,7 @@ declare const ColumnTypes: {
|
|
|
15
16
|
};
|
|
16
17
|
readonly ACCOUNT: {
|
|
17
18
|
readonly fromSpanner: (pubKey: string) => Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
|
|
18
|
-
readonly toSpanner: (account: Account) => import("../account").Secp256K1PublicKeyString | import("../account").
|
|
19
|
+
readonly toSpanner: (account: Account) => import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
19
20
|
readonly dbType: string;
|
|
20
21
|
readonly dbSize: number;
|
|
21
22
|
readonly toComparable: (account: string | Account) => string;
|
|
@@ -42,7 +43,7 @@ declare const ColumnTypes: {
|
|
|
42
43
|
readonly toComparable: (str: string) => string;
|
|
43
44
|
};
|
|
44
45
|
readonly INFO_METADATA: {
|
|
45
|
-
readonly dbSize:
|
|
46
|
+
readonly dbSize: 5464;
|
|
46
47
|
readonly dbType: string;
|
|
47
48
|
readonly fromSpanner: (str: string) => string;
|
|
48
49
|
readonly toSpanner: (str: string) => string;
|
|
@@ -84,18 +85,25 @@ declare const ColumnTypes: {
|
|
|
84
85
|
readonly dbSize: undefined;
|
|
85
86
|
};
|
|
86
87
|
readonly BLOCKHASH: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
fromSpanner: (hash: string) => BlockHash;
|
|
89
|
+
toSpanner: (constructedInput: BlockHash) => string;
|
|
90
|
+
toComparable: (input: string | BlockHash) => string;
|
|
91
|
+
dbType: string;
|
|
92
|
+
dbSize: number;
|
|
93
|
+
};
|
|
94
|
+
readonly CERTIFICATE_HASH: {
|
|
95
|
+
fromSpanner: (hash: string) => CertificateHash;
|
|
96
|
+
toSpanner: (constructedInput: CertificateHash) => string;
|
|
97
|
+
toComparable: (input: string | CertificateHash) => string;
|
|
98
|
+
dbType: string;
|
|
99
|
+
dbSize: number;
|
|
92
100
|
};
|
|
93
101
|
readonly VOTEBLOCKHASH: {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
fromSpanner: (hash: string) => VoteBlockHash;
|
|
103
|
+
toSpanner: (constructedInput: VoteBlockHash) => string;
|
|
104
|
+
toComparable: (input: string | VoteBlockHash) => string;
|
|
105
|
+
dbType: string;
|
|
106
|
+
dbSize: number;
|
|
99
107
|
};
|
|
100
108
|
readonly VOTE_UID: {
|
|
101
109
|
readonly dbSize: 150;
|
|
@@ -104,6 +112,22 @@ declare const ColumnTypes: {
|
|
|
104
112
|
readonly toSpanner: (str: string) => string;
|
|
105
113
|
readonly toComparable: (str: string) => string;
|
|
106
114
|
};
|
|
115
|
+
readonly CERTIFICATE: {
|
|
116
|
+
readonly fromSpanner: (certificate: Buffer) => Certificate;
|
|
117
|
+
readonly toSpanner: (certificate: Certificate) => Buffer;
|
|
118
|
+
readonly toComparable: (input: Certificate | Buffer) => string & {
|
|
119
|
+
readonly __certificateHash: never;
|
|
120
|
+
};
|
|
121
|
+
readonly dbType: string;
|
|
122
|
+
readonly dbSize: string;
|
|
123
|
+
};
|
|
124
|
+
readonly CERTIFICATE_BUNDLE: {
|
|
125
|
+
readonly fromSpanner: (bundle: Buffer) => CertificateBundle;
|
|
126
|
+
readonly toSpanner: (bundle: CertificateBundle) => Buffer;
|
|
127
|
+
readonly toComparable: (input: CertificateBundle | Buffer) => string;
|
|
128
|
+
readonly dbType: string;
|
|
129
|
+
readonly dbSize: string;
|
|
130
|
+
};
|
|
107
131
|
readonly BUFFER: {
|
|
108
132
|
dbType: string;
|
|
109
133
|
dbSize: string;
|
|
@@ -158,7 +182,7 @@ declare const ColumnTypes: {
|
|
|
158
182
|
dbSize: number;
|
|
159
183
|
toComparable: (account: string | Account) => string;
|
|
160
184
|
fromSpanner: (pubKey: string) => GenericAccount;
|
|
161
|
-
toSpanner: (account: GenericAccount) => import("../account").
|
|
185
|
+
toSpanner: (account: GenericAccount) => import("../account").TokenPublicKeyString | import("../account").NetworkPublicKeyString | import("../account").StoragePublicKeyString | import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
162
186
|
};
|
|
163
187
|
readonly BUFFER_BIGINT: {
|
|
164
188
|
dbType: string;
|
|
@@ -171,11 +195,12 @@ declare const ColumnTypes: {
|
|
|
171
195
|
type ColumnTypeName = keyof typeof ColumnTypes;
|
|
172
196
|
type ColumnOutputTypeArg<T extends ColumnTypeName> = Parameters<typeof ColumnTypes[T]['fromSpanner']>[0];
|
|
173
197
|
type ColumnOutputTypeReturn<T extends ColumnTypeName> = ReturnType<typeof ColumnTypes[T]['fromSpanner']>;
|
|
174
|
-
type
|
|
198
|
+
type IfNullable<T, I> = I extends false ? T : (T | null);
|
|
199
|
+
type ColumnOutputTypeInfer<X> = X extends ColumnInterface<infer TR, infer Nullable> ? IfNullable<ColumnOutputTypeReturn<TR>, Nullable> : never;
|
|
175
200
|
type ColumnInputTypeArg<T extends ColumnTypeName> = Parameters<typeof ColumnTypes[T]['toSpanner']>[0];
|
|
176
201
|
type ColumnInputTypeReturn<T extends ColumnTypeName> = ReturnType<typeof ColumnTypes[T]['toSpanner']>;
|
|
177
|
-
interface ColumnInterface<T extends ColumnTypeName> {
|
|
178
|
-
nullable: (nullable:
|
|
202
|
+
interface ColumnInterface<T extends ColumnTypeName, Nullable extends boolean = boolean> {
|
|
203
|
+
nullable: <SetNullable extends boolean>(nullable: SetNullable) => ColumnInterface<T, SetNullable>;
|
|
179
204
|
fromSpanner: (value: ColumnOutputTypeArg<T>, transaction: SpannerTransaction) => ColumnOutputTypeReturn<T>;
|
|
180
205
|
toSpanner: (value: ColumnInputTypeArg<T>, transaction: SpannerTransaction) => ColumnInputTypeReturn<T>;
|
|
181
206
|
toComparable: (value: any, transaction: SpannerTransaction) => any;
|
|
@@ -201,24 +226,24 @@ declare const schema: {
|
|
|
201
226
|
readonly accountInfo: {
|
|
202
227
|
readonly type: "TABLE";
|
|
203
228
|
readonly columns: {
|
|
204
|
-
readonly account: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
205
|
-
readonly name: ColumnInterface<"INFO_NAME">;
|
|
206
|
-
readonly description: ColumnInterface<"INFO_DESCRIPTION">;
|
|
207
|
-
readonly metadata: ColumnInterface<"INFO_METADATA">;
|
|
208
|
-
readonly supply: ColumnInterface<"SUPPLY">;
|
|
209
|
-
readonly defaultBasePermission: ColumnInterface<"BASE_PERMISSION">;
|
|
210
|
-
readonly defaultExternalPermission: ColumnInterface<"EXTERNAL_PERMISSION">;
|
|
229
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
230
|
+
readonly name: ColumnInterface<"INFO_NAME", true>;
|
|
231
|
+
readonly description: ColumnInterface<"INFO_DESCRIPTION", true>;
|
|
232
|
+
readonly metadata: ColumnInterface<"INFO_METADATA", true>;
|
|
233
|
+
readonly supply: ColumnInterface<"SUPPLY", true>;
|
|
234
|
+
readonly defaultBasePermission: ColumnInterface<"BASE_PERMISSION", true>;
|
|
235
|
+
readonly defaultExternalPermission: ColumnInterface<"EXTERNAL_PERMISSION", true>;
|
|
211
236
|
};
|
|
212
237
|
readonly key: readonly [Key];
|
|
213
238
|
};
|
|
214
239
|
readonly permissions: {
|
|
215
240
|
readonly type: "TABLE";
|
|
216
241
|
readonly columns: {
|
|
217
|
-
readonly account: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
218
|
-
readonly entity: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
219
|
-
readonly target: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
220
|
-
readonly basePermission: ColumnInterface<"BASE_PERMISSION">;
|
|
221
|
-
readonly externalPermission: ColumnInterface<"EXTERNAL_PERMISSION">;
|
|
242
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
243
|
+
readonly entity: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
244
|
+
readonly target: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
245
|
+
readonly basePermission: ColumnInterface<"BASE_PERMISSION", false>;
|
|
246
|
+
readonly externalPermission: ColumnInterface<"EXTERNAL_PERMISSION", false>;
|
|
222
247
|
};
|
|
223
248
|
readonly key: readonly [Key, Key, Key];
|
|
224
249
|
readonly interleave: Interleave;
|
|
@@ -226,10 +251,10 @@ declare const schema: {
|
|
|
226
251
|
readonly ledger: {
|
|
227
252
|
readonly type: "TABLE";
|
|
228
253
|
readonly columns: {
|
|
229
|
-
readonly account: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
230
|
-
readonly token: ColumnInterface<"TOKEN_ACCOUNT">;
|
|
231
|
-
readonly onLedger: ColumnInterface<"LEDGER">;
|
|
232
|
-
readonly balance: ColumnInterface<"INT_AS_STRING">;
|
|
254
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
255
|
+
readonly token: ColumnInterface<"TOKEN_ACCOUNT", false>;
|
|
256
|
+
readonly onLedger: ColumnInterface<"LEDGER", false>;
|
|
257
|
+
readonly balance: ColumnInterface<"INT_AS_STRING", false>;
|
|
233
258
|
};
|
|
234
259
|
readonly key: readonly [Key, Key, Key];
|
|
235
260
|
readonly interleave: Interleave;
|
|
@@ -237,9 +262,9 @@ declare const schema: {
|
|
|
237
262
|
readonly chain: {
|
|
238
263
|
readonly type: "TABLE";
|
|
239
264
|
readonly columns: {
|
|
240
|
-
readonly account: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
241
|
-
readonly blockHeight: ColumnInterface<"BIGINT">;
|
|
242
|
-
readonly blockHash: ColumnInterface<"BLOCKHASH">;
|
|
265
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
266
|
+
readonly blockHeight: ColumnInterface<"BIGINT", false>;
|
|
267
|
+
readonly blockHash: ColumnInterface<"BLOCKHASH", false>;
|
|
243
268
|
};
|
|
244
269
|
readonly key: readonly [Key, Key];
|
|
245
270
|
readonly interleave: Interleave;
|
|
@@ -247,9 +272,9 @@ declare const schema: {
|
|
|
247
272
|
readonly history: {
|
|
248
273
|
readonly type: "TABLE";
|
|
249
274
|
readonly columns: {
|
|
250
|
-
readonly account: ColumnInterface<"GENERIC_ACCOUNT">;
|
|
251
|
-
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH">;
|
|
252
|
-
readonly orderIndex: ColumnInterface<"BUFFER_BIGINT">;
|
|
275
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
276
|
+
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH", false>;
|
|
277
|
+
readonly orderIndex: ColumnInterface<"BUFFER_BIGINT", false>;
|
|
253
278
|
};
|
|
254
279
|
readonly key: readonly [Key, Key];
|
|
255
280
|
readonly interleave: Interleave;
|
|
@@ -257,8 +282,8 @@ declare const schema: {
|
|
|
257
282
|
readonly delegation: {
|
|
258
283
|
readonly type: "TABLE";
|
|
259
284
|
readonly columns: {
|
|
260
|
-
readonly account: ColumnInterface<"ACCOUNT">;
|
|
261
|
-
readonly delegatedToRep: ColumnInterface<"ACCOUNT">;
|
|
285
|
+
readonly account: ColumnInterface<"ACCOUNT", false>;
|
|
286
|
+
readonly delegatedToRep: ColumnInterface<"ACCOUNT", false>;
|
|
262
287
|
};
|
|
263
288
|
readonly key: readonly [Key];
|
|
264
289
|
readonly interleave: Interleave;
|
|
@@ -266,31 +291,31 @@ declare const schema: {
|
|
|
266
291
|
readonly votes: {
|
|
267
292
|
readonly type: "TABLE";
|
|
268
293
|
readonly columns: {
|
|
269
|
-
readonly voteUID: ColumnInterface<"VOTE_UID">;
|
|
270
|
-
readonly onLedger: ColumnInterface<"LEDGER">;
|
|
271
|
-
readonly vote: ColumnInterface<"VOTE">;
|
|
272
|
-
readonly timestamp: ColumnInterface<"TIMESTAMP">;
|
|
273
|
-
readonly expires: ColumnInterface<"TIMESTAMP">;
|
|
274
|
-
readonly issuer: ColumnInterface<"ACCOUNT">;
|
|
275
|
-
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH">;
|
|
294
|
+
readonly voteUID: ColumnInterface<"VOTE_UID", false>;
|
|
295
|
+
readonly onLedger: ColumnInterface<"LEDGER", false>;
|
|
296
|
+
readonly vote: ColumnInterface<"VOTE", false>;
|
|
297
|
+
readonly timestamp: ColumnInterface<"TIMESTAMP", false>;
|
|
298
|
+
readonly expires: ColumnInterface<"TIMESTAMP", false>;
|
|
299
|
+
readonly issuer: ColumnInterface<"ACCOUNT", false>;
|
|
300
|
+
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH", false>;
|
|
276
301
|
};
|
|
277
302
|
readonly key: readonly [Key, Key];
|
|
278
303
|
};
|
|
279
304
|
readonly blocks: {
|
|
280
305
|
readonly type: "TABLE";
|
|
281
306
|
readonly columns: {
|
|
282
|
-
readonly blockHash: ColumnInterface<"BLOCKHASH">;
|
|
283
|
-
readonly onLedger: ColumnInterface<"LEDGER">;
|
|
284
|
-
readonly block: ColumnInterface<"BLOCK">;
|
|
285
|
-
readonly prevBlockHash: ColumnInterface<"BLOCKHASH">;
|
|
307
|
+
readonly blockHash: ColumnInterface<"BLOCKHASH", false>;
|
|
308
|
+
readonly onLedger: ColumnInterface<"LEDGER", false>;
|
|
309
|
+
readonly block: ColumnInterface<"BLOCK", false>;
|
|
310
|
+
readonly prevBlockHash: ColumnInterface<"BLOCKHASH", false>;
|
|
286
311
|
};
|
|
287
312
|
readonly key: readonly [Key];
|
|
288
313
|
};
|
|
289
314
|
readonly voteBlocks: {
|
|
290
315
|
readonly type: "TABLE";
|
|
291
316
|
readonly columns: {
|
|
292
|
-
readonly blockHash: ColumnInterface<"BLOCKHASH">;
|
|
293
|
-
readonly voteUID: ColumnInterface<"VOTE_UID">;
|
|
317
|
+
readonly blockHash: ColumnInterface<"BLOCKHASH", false>;
|
|
318
|
+
readonly voteUID: ColumnInterface<"VOTE_UID", false>;
|
|
294
319
|
};
|
|
295
320
|
readonly key: readonly [Key, Key];
|
|
296
321
|
readonly interleave: Interleave;
|
|
@@ -298,38 +323,36 @@ declare const schema: {
|
|
|
298
323
|
readonly weight: {
|
|
299
324
|
readonly type: "TABLE";
|
|
300
325
|
readonly columns: {
|
|
301
|
-
readonly repAccount: ColumnInterface<"ACCOUNT">;
|
|
302
|
-
readonly weight: ColumnInterface<"INT_AS_STRING">;
|
|
326
|
+
readonly repAccount: ColumnInterface<"ACCOUNT", false>;
|
|
327
|
+
readonly weight: ColumnInterface<"INT_AS_STRING", false>;
|
|
303
328
|
};
|
|
304
329
|
readonly key: readonly [Key];
|
|
305
330
|
};
|
|
306
331
|
readonly heapBlocks: {
|
|
307
332
|
readonly type: "TABLE";
|
|
308
333
|
readonly columns: {
|
|
309
|
-
readonly prevBlockHash: ColumnInterface<"BLOCKHASH">;
|
|
310
|
-
readonly storageHash: ColumnInterface<"HASH">;
|
|
334
|
+
readonly prevBlockHash: ColumnInterface<"BLOCKHASH", false>;
|
|
335
|
+
readonly storageHash: ColumnInterface<"HASH", false>;
|
|
311
336
|
};
|
|
312
337
|
readonly key: readonly [Key];
|
|
313
338
|
};
|
|
314
339
|
readonly heapStorage: {
|
|
315
340
|
readonly type: "TABLE";
|
|
316
341
|
readonly columns: {
|
|
317
|
-
readonly storageHash: ColumnInterface<"HASH">;
|
|
318
|
-
readonly data: ColumnInterface<"BUFFER">;
|
|
342
|
+
readonly storageHash: ColumnInterface<"HASH", false>;
|
|
343
|
+
readonly data: ColumnInterface<"BUFFER", false>;
|
|
319
344
|
};
|
|
320
345
|
readonly key: readonly [Key];
|
|
321
346
|
};
|
|
322
|
-
readonly
|
|
323
|
-
readonly type: "
|
|
324
|
-
readonly
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
readonly table: "permissions";
|
|
347
|
+
readonly accountCertificates: {
|
|
348
|
+
readonly type: "TABLE";
|
|
349
|
+
readonly columns: {
|
|
350
|
+
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
351
|
+
readonly certificateHash: ColumnInterface<"CERTIFICATE_HASH", false>;
|
|
352
|
+
readonly certificate: ColumnInterface<"CERTIFICATE", false>;
|
|
353
|
+
readonly intermediates: ColumnInterface<"CERTIFICATE_BUNDLE", true>;
|
|
354
|
+
};
|
|
331
355
|
readonly key: readonly [Key, Key];
|
|
332
|
-
readonly storing: readonly [Key, Key];
|
|
333
356
|
};
|
|
334
357
|
readonly permissionsEntity: {
|
|
335
358
|
readonly type: "INDEX";
|
|
@@ -342,30 +365,11 @@ declare const schema: {
|
|
|
342
365
|
readonly table: "permissions";
|
|
343
366
|
readonly key: readonly [Key, Key];
|
|
344
367
|
};
|
|
345
|
-
readonly historyAccount: {
|
|
346
|
-
readonly type: "INDEX";
|
|
347
|
-
readonly table: "history";
|
|
348
|
-
readonly key: readonly [Key];
|
|
349
|
-
readonly storing: readonly [Key];
|
|
350
|
-
};
|
|
351
368
|
readonly historyVoteBlockHash: {
|
|
352
369
|
readonly type: "INDEX";
|
|
353
370
|
readonly table: "history";
|
|
354
371
|
readonly key: readonly [Key, Key];
|
|
355
372
|
};
|
|
356
|
-
readonly historyAccountOrderIndex: {
|
|
357
|
-
readonly type: "INDEX";
|
|
358
|
-
readonly table: "history";
|
|
359
|
-
readonly key: readonly [Key, Key];
|
|
360
|
-
readonly storing: readonly [Key];
|
|
361
|
-
};
|
|
362
|
-
readonly chainAccount: {
|
|
363
|
-
readonly type: "INDEX";
|
|
364
|
-
readonly table: "chain";
|
|
365
|
-
readonly key: readonly [Key];
|
|
366
|
-
readonly interleave: Interleave;
|
|
367
|
-
readonly storing: readonly [Key];
|
|
368
|
-
};
|
|
369
373
|
readonly chainAccountHash: {
|
|
370
374
|
readonly type: "INDEX";
|
|
371
375
|
readonly table: "chain";
|
|
@@ -377,13 +381,7 @@ declare const schema: {
|
|
|
377
381
|
readonly type: "INDEX";
|
|
378
382
|
readonly table: "blocks";
|
|
379
383
|
readonly key: readonly [Key];
|
|
380
|
-
readonly storing: readonly [Key
|
|
381
|
-
};
|
|
382
|
-
readonly voteBlocksBlockhash: {
|
|
383
|
-
readonly type: "INDEX";
|
|
384
|
-
readonly table: "voteBlocks";
|
|
385
|
-
readonly key: readonly [Key];
|
|
386
|
-
readonly interleave: Interleave;
|
|
384
|
+
readonly storing: readonly [Key];
|
|
387
385
|
};
|
|
388
386
|
readonly votesTimestamp: {
|
|
389
387
|
readonly type: "INDEX";
|
|
@@ -403,25 +401,12 @@ declare const schema: {
|
|
|
403
401
|
readonly key: readonly [Key, Key];
|
|
404
402
|
readonly storing: readonly [Key];
|
|
405
403
|
};
|
|
406
|
-
readonly votesUid: {
|
|
407
|
-
readonly type: "INDEX";
|
|
408
|
-
readonly table: "votes";
|
|
409
|
-
readonly key: readonly [Key];
|
|
410
|
-
readonly storing: readonly [Key];
|
|
411
|
-
};
|
|
412
404
|
readonly votesBlockHash: {
|
|
413
405
|
readonly type: "INDEX";
|
|
414
406
|
readonly table: "votes";
|
|
415
407
|
readonly key: readonly [Key];
|
|
416
408
|
readonly storing: readonly [Key];
|
|
417
409
|
};
|
|
418
|
-
readonly ledgerBalanceByAccount: {
|
|
419
|
-
readonly type: "INDEX";
|
|
420
|
-
readonly table: "ledger";
|
|
421
|
-
readonly key: readonly [Key];
|
|
422
|
-
readonly storing: readonly [Key];
|
|
423
|
-
readonly interleave: Interleave;
|
|
424
|
-
};
|
|
425
410
|
};
|
|
426
411
|
type SchemaEntriesFilter<T extends SchemaType> = keyof {
|
|
427
412
|
[K in (keyof typeof schema) as typeof schema[K]['type'] extends T ? K : never]: true;
|
|
@@ -458,7 +443,7 @@ export declare class Helper {
|
|
|
458
443
|
static getPrimaryKeyNames<X extends TableIndexName>(table: X): string[];
|
|
459
444
|
static getNameFromType(filterType: 'INDEX'): IndexName[];
|
|
460
445
|
static getNameFromType(filterType: 'TABLE'): TableName[];
|
|
461
|
-
static getAllTables(): ("
|
|
446
|
+
static getAllTables(): ("blocks" | "permissions" | "votes" | "ledger" | "chain" | "history" | "weight" | "accountInfo" | "accountCertificates" | "heapBlocks" | "heapStorage" | "delegation" | "voteBlocks")[];
|
|
462
447
|
static IsTable(name: TableIndexName): name is TableName;
|
|
463
448
|
static IsIndex(name: TableIndexName): name is IndexName;
|
|
464
449
|
static getIndexParent(index: IndexName): TableName;
|
|
@@ -4,14 +4,14 @@ import type { BlockHash } from '../block';
|
|
|
4
4
|
import { Block } from '../block';
|
|
5
5
|
import type { GenericAccount, IdentifierAddress, TokenAddress } from '../account';
|
|
6
6
|
import Account, { AccountKeyAlgorithm } 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 { LedgerStorageBase } from './common';
|
|
10
10
|
import * as sqlite from 'sqlite';
|
|
11
11
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
12
|
-
|
|
12
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
13
|
+
interface DBSqliteTransaction extends LedgerStorageTransactionBase {
|
|
13
14
|
sql: Awaited<ReturnType<typeof sqlite['open']>>;
|
|
14
|
-
moment: Date;
|
|
15
15
|
release: null | ((value: null | number) => void);
|
|
16
16
|
lock: null | Promise<null | number>;
|
|
17
17
|
}
|
|
@@ -24,11 +24,11 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
|
|
|
24
24
|
constructor();
|
|
25
25
|
init(config: LedgerConfig, ledger: Ledger): void;
|
|
26
26
|
destroy(): Promise<void>;
|
|
27
|
-
beginTransaction(): Promise<DBSqliteTransaction>;
|
|
27
|
+
beginTransaction(transactionBase: LedgerStorageTransactionBase): Promise<DBSqliteTransaction>;
|
|
28
28
|
commitTransaction(transaction: DBSqliteTransaction): Promise<void>;
|
|
29
29
|
abortTransaction(transaction: DBSqliteTransaction): Promise<void>;
|
|
30
30
|
evaluateError(error: any): Promise<any>;
|
|
31
|
-
delegatedWeight(transaction: DBSqliteTransaction, rep?: Account): Promise<bigint>;
|
|
31
|
+
delegatedWeight(transaction: DBSqliteTransaction, rep?: Account | InstanceType<typeof Account.Set>): Promise<bigint>;
|
|
32
32
|
getBalance(transaction: DBSqliteTransaction, account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
33
33
|
getAllBalances(transaction: DBSqliteTransaction, account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
34
34
|
addPendingVote(transaction: DBSqliteTransaction, votesAndBlocks: VoteStaple): Promise<void>;
|
|
@@ -41,11 +41,9 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
|
|
|
41
41
|
listACLsByEntity(transaction: DBSqliteTransaction, entity: GenericAccount): Promise<ACLRow[]>;
|
|
42
42
|
listACLsByPrincipal(transaction: DBSqliteTransaction, principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
43
43
|
getAccountInfo(transaction: DBSqliteTransaction, account: GenericAccount | string): Promise<AccountInfo>;
|
|
44
|
-
adjust(transaction: DBSqliteTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean): Promise<
|
|
44
|
+
adjust(transaction: DBSqliteTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
|
|
45
45
|
getBlock(transaction: DBSqliteTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
46
|
-
getBlockHeight(transaction: DBSqliteTransaction, blockHash: BlockHash, account: GenericAccount): Promise<
|
|
47
|
-
blockHeight: string | null;
|
|
48
|
-
} | null>;
|
|
46
|
+
getBlockHeight(transaction: DBSqliteTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
49
47
|
getVotes(transaction: DBSqliteTransaction, block: BlockHash, from: LedgerSelector): Promise<Vote[] | null>;
|
|
50
48
|
getVoteStaples(transaction: DBSqliteTransaction, voteBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
51
49
|
getHistory(transaction: DBSqliteTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
@@ -57,6 +55,8 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
|
|
|
57
55
|
[publicKey: string]: Block | null;
|
|
58
56
|
}>;
|
|
59
57
|
getVotesAfter(transaction: DBSqliteTransaction, moment: Date, startKey?: string, options?: GetVotesAfterOptions): Promise<PaginatedVotes>;
|
|
58
|
+
getAccountCertificates(transaction: DBSqliteTransaction, account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
59
|
+
getAccountCertificateByHash(transaction: DBSqliteTransaction, account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
60
60
|
protected gcBatch(transaction: DBSqliteTransaction): Promise<boolean>;
|
|
61
61
|
getNextSerialNumber(transaction: DBSqliteTransaction): Promise<bigint>;
|
|
62
62
|
stats(): Promise<LedgerStatistics>;
|
package/lib/ledger/effects.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { GenericAccount, IdentifierAddress, NetworkAddress, TokenAddress } from '../account';
|
|
2
2
|
import Account from '../account';
|
|
3
|
-
import type { BlockHash } from '../block';
|
|
3
|
+
import type { AdjustMethod, BlockHash } from '../block';
|
|
4
4
|
import { Block } from '../block';
|
|
5
5
|
import type { AccountInfo, ACLEntry, ACLUpdate } from '../ledger/types';
|
|
6
|
-
import type {
|
|
6
|
+
import type { Certificate, CertificateBundle } from '../utils/certificate';
|
|
7
|
+
import { CertificateHash } from '../utils/certificate';
|
|
7
8
|
interface NumericValueEntry {
|
|
8
9
|
value: bigint;
|
|
9
10
|
}
|
|
@@ -21,6 +22,18 @@ interface ModifyTokenBalanceEntry extends TokenNumericEntry {
|
|
|
21
22
|
set: boolean;
|
|
22
23
|
receivable: boolean;
|
|
23
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Change of certificate indication
|
|
27
|
+
*/
|
|
28
|
+
export type CertificateUpdate = {
|
|
29
|
+
method: AdjustMethod.ADD;
|
|
30
|
+
certificateHash: CertificateHash;
|
|
31
|
+
certificate: Certificate;
|
|
32
|
+
intermediateCertificates: CertificateBundle | null;
|
|
33
|
+
} | {
|
|
34
|
+
method: AdjustMethod.SUBTRACT;
|
|
35
|
+
certificateHash: CertificateHash;
|
|
36
|
+
};
|
|
24
37
|
type TokenEntry = ModifyTokenBalanceEntry | RequestTokenReceiveEntry;
|
|
25
38
|
interface ComputedBlocksEffectTokenChangesField {
|
|
26
39
|
[tokenPubKey: string]: TokenEntry[];
|
|
@@ -45,6 +58,7 @@ interface ComputedBlocksEffectFields {
|
|
|
45
58
|
permissionRequirements?: ACLEntry[];
|
|
46
59
|
createRequests?: CreateIdentifierRequest[];
|
|
47
60
|
delegation?: DelegationUpdate;
|
|
61
|
+
certificate?: CertificateUpdate[];
|
|
48
62
|
}
|
|
49
63
|
/**
|
|
50
64
|
* Which accounts and fields are affected by a set of block
|
|
@@ -61,7 +75,8 @@ export type ComputedEffectOfBlocksByAccount = {
|
|
|
61
75
|
};
|
|
62
76
|
export type ComputedEffectOfBlocks = {
|
|
63
77
|
accounts: ComputedEffectOfBlocksByAccount;
|
|
64
|
-
touched:
|
|
78
|
+
touched: InstanceType<typeof Account.Set>;
|
|
79
|
+
possibleNewAccounts: InstanceType<typeof Account.Set>;
|
|
65
80
|
metadata: {
|
|
66
81
|
operationCount: number;
|
|
67
82
|
blockCount: number;
|
|
@@ -72,7 +87,7 @@ type LedgerOptions = {
|
|
|
72
87
|
baseToken: TokenAddress;
|
|
73
88
|
networkAddress: NetworkAddress;
|
|
74
89
|
};
|
|
75
|
-
type OnlyTouchedEffects = Pick<ComputedEffectOfBlocks, 'touched'>;
|
|
90
|
+
type OnlyTouchedEffects = Pick<ComputedEffectOfBlocks, 'touched' | 'possibleNewAccounts'>;
|
|
76
91
|
export declare function computeEffectOfBlocks(blocks: Block[], ledger?: undefined): OnlyTouchedEffects;
|
|
77
92
|
export declare function computeEffectOfBlocks(blocks: Block[], ledger: LedgerOptions): ComputedEffectOfBlocks;
|
|
78
93
|
export {};
|
package/lib/ledger/index.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import Account from '../account';
|
|
|
6
6
|
import type Node from '../node';
|
|
7
7
|
import type { BloomFilter } from '../utils/bloom';
|
|
8
8
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
9
|
-
import type { ACLRow, AccountInfo, GetAllBalancesResponse, LedgerStatistics } from './types';
|
|
9
|
+
import type { ACLRow, AccountInfo, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
10
10
|
import LedgerRequestCache from './cache';
|
|
11
|
+
import type { CertificateHash } from '../utils/certificate';
|
|
11
12
|
/**
|
|
12
13
|
* Kind of ledger
|
|
13
14
|
*/
|
|
@@ -47,6 +48,16 @@ export interface LedgerConfig {
|
|
|
47
48
|
* no-voting: Normal mode (read-write enabled), but no voting
|
|
48
49
|
*/
|
|
49
50
|
ledgerWriteMode?: 'bootstrap-only' | 'read-only' | 'read-write' | 'no-voting';
|
|
51
|
+
/**
|
|
52
|
+
* Timeout for storage operations
|
|
53
|
+
*/
|
|
54
|
+
transactionRetries?: ({
|
|
55
|
+
timeout?: number;
|
|
56
|
+
maxRetries?: never;
|
|
57
|
+
} | {
|
|
58
|
+
timeout?: never;
|
|
59
|
+
maxRetries?: number;
|
|
60
|
+
});
|
|
50
61
|
/**
|
|
51
62
|
* Logging method
|
|
52
63
|
*/
|
|
@@ -84,6 +95,15 @@ export type GetVotesAfterOptions = {
|
|
|
84
95
|
*/
|
|
85
96
|
timeout?: number;
|
|
86
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Each transaction can contain the node object making the request to access things like timing information
|
|
100
|
+
*/
|
|
101
|
+
export interface LedgerStorageTransactionBase {
|
|
102
|
+
node?: Node;
|
|
103
|
+
moment: Date;
|
|
104
|
+
identifier: string;
|
|
105
|
+
readOnly: boolean;
|
|
106
|
+
}
|
|
87
107
|
/**
|
|
88
108
|
* Each Ledger Storage backend must implement this interface
|
|
89
109
|
*/
|
|
@@ -99,7 +119,7 @@ export interface LedgerStorageAPI {
|
|
|
99
119
|
/**
|
|
100
120
|
* Begin a transaction
|
|
101
121
|
*/
|
|
102
|
-
beginTransaction: (
|
|
122
|
+
beginTransaction: (transactionBase: LedgerStorageTransactionBase) => Promise<LedgerStorageTransactionBase>;
|
|
103
123
|
/**
|
|
104
124
|
* Commit an active transaction
|
|
105
125
|
*/
|
|
@@ -115,9 +135,9 @@ export interface LedgerStorageAPI {
|
|
|
115
135
|
evaluateError: (error: any) => Promise<any>;
|
|
116
136
|
/**
|
|
117
137
|
* Get the amount of delegated weight for an account,
|
|
118
|
-
* if "rep" is not supplied get the total delegated weight
|
|
138
|
+
* if "rep" is not supplied get the total delegated weight, if "rep" is of type Account.Set, return the sum of the weights for the provided account(s)
|
|
119
139
|
*/
|
|
120
|
-
delegatedWeight: (transaction: any, rep?: Account) => Promise<bigint>;
|
|
140
|
+
delegatedWeight: (transaction: any, rep?: Account | InstanceType<typeof Account.Set>) => Promise<bigint>;
|
|
121
141
|
/**
|
|
122
142
|
* Get the balance of an account or token
|
|
123
143
|
*/
|
|
@@ -147,7 +167,7 @@ export interface LedgerStorageAPI {
|
|
|
147
167
|
/**
|
|
148
168
|
* Adjust the ledger by performing a set of changes based on some blocks and votes
|
|
149
169
|
*/
|
|
150
|
-
adjust: (transaction: any, input: VoteStaple, changes: ComputedEffectOfBlocks) => Promise<
|
|
170
|
+
adjust: (transaction: any, input: VoteStaple, changes: ComputedEffectOfBlocks) => Promise<VoteStaple[]>;
|
|
151
171
|
/**
|
|
152
172
|
* Add a transitional vote (to the side-ledger)
|
|
153
173
|
*/
|
|
@@ -159,9 +179,16 @@ export interface LedgerStorageAPI {
|
|
|
159
179
|
/**
|
|
160
180
|
* Get the block height from a given block hash
|
|
161
181
|
*/
|
|
162
|
-
getBlockHeight: (transaction: any, blockHash: BlockHash, account: GenericAccount) => Promise<
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
getBlockHeight: (transaction: any, blockHash: BlockHash, account: GenericAccount) => Promise<bigint | null>;
|
|
183
|
+
/**
|
|
184
|
+
* Get multiple block heights for a given set of block hashes and chains.
|
|
185
|
+
*/
|
|
186
|
+
getBlockHeights: (transaction: any, toFetch: {
|
|
187
|
+
blockHash: BlockHash;
|
|
188
|
+
account: GenericAccount;
|
|
189
|
+
}[]) => Promise<{
|
|
190
|
+
[blockHash: string]: bigint | null;
|
|
191
|
+
}>;
|
|
165
192
|
/**
|
|
166
193
|
* Get the votes for a given block
|
|
167
194
|
*/
|
|
@@ -190,6 +217,12 @@ export interface LedgerStorageAPI {
|
|
|
190
217
|
getHeadBlocks: (transaction: any, accounts: GenericAccount[], from: LedgerSelector) => Promise<{
|
|
191
218
|
[account: string]: Block | null;
|
|
192
219
|
}>;
|
|
220
|
+
/**
|
|
221
|
+
* Get multiple head block hashes at the same time for a set of accounts
|
|
222
|
+
*/
|
|
223
|
+
getHeadBlockHashes: (transaction: any, accounts: InstanceType<typeof Account.Set>) => Promise<{
|
|
224
|
+
[account: string]: BlockHash | null;
|
|
225
|
+
}>;
|
|
193
226
|
/**
|
|
194
227
|
* Get the HEAD block for an account (implemented by LedgerStorageBase using getHeadBlocks())
|
|
195
228
|
*/
|
|
@@ -222,6 +255,14 @@ export interface LedgerStorageAPI {
|
|
|
222
255
|
* Get the next serial number for a representative
|
|
223
256
|
*/
|
|
224
257
|
getNextSerialNumber: (transaction?: any) => Promise<bigint>;
|
|
258
|
+
/**
|
|
259
|
+
* Get the X.509 Certificates associated with an account
|
|
260
|
+
*/
|
|
261
|
+
getAccountCertificates: (transaction: any, account: GenericAccount) => Promise<CertificateWithIntermediates[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Get the X.509 Certificate associated with an account using the certificate hash
|
|
264
|
+
*/
|
|
265
|
+
getAccountCertificateByHash: (transaction: any, account: GenericAccount, hash: CertificateHash) => Promise<CertificateWithIntermediates | null>;
|
|
225
266
|
/**
|
|
226
267
|
* Get ledger statistics
|
|
227
268
|
*/
|
|
@@ -232,13 +273,15 @@ export interface LedgerStorageAPI {
|
|
|
232
273
|
*/
|
|
233
274
|
declare class LedgerAtomicInterface {
|
|
234
275
|
#private;
|
|
235
|
-
constructor(transaction:
|
|
276
|
+
constructor(transaction: LedgerStorageTransactionBase, storage: LedgerStorageAPI, config: LedgerConfig, ledger: Ledger);
|
|
236
277
|
commit(): Promise<void>;
|
|
237
278
|
abort(): Promise<void>;
|
|
238
279
|
vote(blocks: Block[], otherVotes?: Vote[]): Promise<Vote>;
|
|
239
|
-
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<
|
|
280
|
+
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<VoteStaple[]>;
|
|
240
281
|
getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
241
282
|
getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
283
|
+
getAccountCertificates(account: GenericAccount): Promise<CertificateWithIntermediates[]>;
|
|
284
|
+
getAccountCertificateByHash(account: GenericAccount, hash: CertificateHash): Promise<CertificateWithIntermediates | null>;
|
|
242
285
|
listACLsByPrincipal(principal: GenericAccount, entityList?: GenericAccount[]): Promise<ACLRow[]>;
|
|
243
286
|
listACLsByEntity(entity: GenericAccount): Promise<ACLRow[]>;
|
|
244
287
|
votingPower(rep?: Account): Promise<bigint>;
|
|
@@ -260,7 +303,7 @@ declare class LedgerAtomicInterface {
|
|
|
260
303
|
getStaplesFromBlockHashes(hashes: BlockHash[]): Promise<VoteStaple[]>;
|
|
261
304
|
getVoteStaplesAfter(moment: Date, limit?: number, options?: GetVotesAfterOptions): Promise<VoteStaple[]>;
|
|
262
305
|
gc(): Promise<boolean>;
|
|
263
|
-
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction:
|
|
306
|
+
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
264
307
|
}
|
|
265
308
|
/**
|
|
266
309
|
* The core Ledger components
|
|
@@ -292,6 +335,8 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
292
335
|
listACLsByEntity(...args: Parameters<LedgerAtomicInterface['listACLsByEntity']>): ReturnType<LedgerAtomicInterface['listACLsByEntity']>;
|
|
293
336
|
getBalance(...args: Parameters<LedgerAtomicInterface['getBalance']>): ReturnType<LedgerAtomicInterface['getBalance']>;
|
|
294
337
|
getAllBalances(...args: Parameters<LedgerAtomicInterface['getAllBalances']>): ReturnType<LedgerAtomicInterface['getAllBalances']>;
|
|
338
|
+
getAccountCertificates(...args: Parameters<LedgerAtomicInterface['getAccountCertificates']>): ReturnType<LedgerAtomicInterface['getAccountCertificates']>;
|
|
339
|
+
getAccountCertificateByHash(...args: Parameters<LedgerAtomicInterface['getAccountCertificateByHash']>): ReturnType<LedgerAtomicInterface['getAccountCertificateByHash']>;
|
|
295
340
|
votingPower(...args: Parameters<LedgerAtomicInterface['votingPower']>): ReturnType<LedgerAtomicInterface['votingPower']>;
|
|
296
341
|
getVotes(...args: Parameters<LedgerAtomicInterface['getVotes']>): ReturnType<LedgerAtomicInterface['getVotes']>;
|
|
297
342
|
getVotesFromMultiplePrevious(...args: Parameters<LedgerAtomicInterface['getVotesFromMultiplePrevious']>): ReturnType<LedgerAtomicInterface['getVotesFromMultiplePrevious']>;
|
|
@@ -308,6 +353,6 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
308
353
|
getVoteStaplesAfter(...args: Parameters<LedgerAtomicInterface['getVoteStaplesAfter']>): ReturnType<LedgerAtomicInterface['getVoteStaplesAfter']>;
|
|
309
354
|
gc(...args: Parameters<LedgerAtomicInterface['gc']>): ReturnType<LedgerAtomicInterface['gc']>;
|
|
310
355
|
stats(): Promise<LedgerStatistics>;
|
|
311
|
-
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction:
|
|
356
|
+
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
312
357
|
}
|
|
313
358
|
export default Ledger;
|