@keetanetwork/keetanet-client 0.12.2 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/index.d.ts +23 -2
- package/api/node.d.ts +7 -1
- package/api/p2p.d.ts +13 -0
- package/api/vote.d.ts +10 -0
- package/client/builder.d.ts +13 -6
- package/client/client_common_tests.d.ts +18 -0
- package/client/index-browser.d.ts +42 -14
- package/client/index-browser.js +2899 -1382
- package/client/index.d.ts +42 -14
- package/client/index.js +2138 -655
- package/config/index.d.ts +2 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +14 -10
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +10 -0
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +9 -5
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +4 -4
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +6 -2
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSAKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- 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 +5 -2
- package/docs/classes/KeetaNetSDK.Referenced.LedgerAtomicInterface.html +3 -1
- package/docs/classes/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +8 -0
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +6 -2
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +31 -27
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +10 -4
- package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +10 -0
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +4 -3
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +7 -3
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +10 -8
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +32 -0
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +34 -0
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +11 -0
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +3 -3
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +1 -1
- package/docs/classes/KeetaNetSDK.UserClient.html +7 -2
- package/docs/enums/KeetaNetSDK.Referenced.BaseFlag.html +2 -1
- package/docs/enums/KeetaNetSDK.Referenced.BasePermissionGroup.html +3 -1
- package/docs/enums/KeetaNetSDK.Referenced.BlockPurpose.html +3 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_helper.bufferToBigInt.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.AccountInfo.html +4 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +3 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +1 -1
- package/docs/interfaces/{KeetaNetSDK.Referenced.BlockCanonical.html → KeetaNetSDK.Referenced.BlockV1Canonical.html} +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1JSON.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1UnsignedCanonical.html +11 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +11 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2JSON.html +12 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2UnsignedCanonical.html +11 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.BuilderBlockOptions.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.CreateIdentifierRequest.html +4 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.DisposableTimingHandle.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsNoEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ExternalKeyPairFunctionsSupportsEncryption.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InitialConfigSupply.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.InstanceSet.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVGenericOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.KVSetOptionsType.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerConfig.html +5 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageAPI.html +4 -4
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBaseOptions.html +6 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +5 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +3 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PConfig.html +4 -2
- 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 +4 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PrincipalACLWithInfoParsed.html +1 -0
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.html +5 -0
- 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 +5 -3
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +4 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteJSON.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteStapleJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.WithIsInstance.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_config.ValidationConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1BitString.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Date.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1OID.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1Set.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1String.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper.InstanceSetConstructor.html +2 -2
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_asn1.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_helper.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.BlockASN1SchemaWithoutSignature.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockJSON.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockJSONIncomplete.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.BlockOperationASN1SchemaType.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockOperationTypes.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockSignature.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockSignatureField.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockSignerField.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockSignerFieldJSON.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV1ASN1WithoutSignature.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV2ASN1WithoutSignature.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateBuilderParams.html +8 -3
- package/docs/types/KeetaNetSDK.Referenced.ComputedEffectOfBlocks.html +2 -2
- package/docs/types/KeetaNetSDK.Referenced.GetAccountStateAPIResponseFormatted.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.HashNames.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.MultisigAddress.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerField.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerFieldJSON.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.OmitLastArrayValue.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.P2PUpdateOptions.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.UserEditableAccountInfo.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.Schema.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_asn1.ValidateASN1.SchemaMap.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes-1.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockOperationASN1Schema.html +2 -0
- package/docs/variables/KeetaNetSDK.Referenced.LedgerErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.VoteErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_asn1.ASN1CheckUtilities.html +1 -0
- package/lib/block/index.d.ts +104 -36
- package/lib/block/operations.d.ts +31 -3
- package/lib/error/block.d.ts +1 -1
- package/lib/error/certificate.d.ts +1 -1
- package/lib/error/ledger.d.ts +1 -1
- package/lib/error/vote.d.ts +1 -1
- package/lib/ledger/common.d.ts +14 -1
- package/lib/ledger/db_dynamodb.d.ts +7 -11
- package/lib/ledger/db_postgres.d.ts +12 -4
- package/lib/ledger/db_spanner.d.ts +6 -13
- package/lib/ledger/db_spanner_helper.d.ts +29 -6
- package/lib/ledger/db_sqlite.d.ts +12 -4
- package/lib/ledger/effects.d.ts +10 -9
- package/lib/ledger/index.d.ts +28 -10
- package/lib/ledger/types.d.ts +10 -1
- package/lib/node/utils.d.ts +5 -0
- package/lib/p2p.d.ts +32 -0
- package/lib/permissions.d.ts +5 -2
- package/lib/stats.d.ts +22 -3
- package/lib/utils/asn1.d.ts +22 -5
- package/lib/utils/certificate.d.ts +38 -1
- package/lib/utils/helper.d.ts +2 -1
- package/lib/utils/static-types.d.ts +11 -0
- package/lib/vote.d.ts +55 -20
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSON.html +0 -11
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockUnsignedCanonical.html +0 -11
- package/docs/interfaces/KeetaNetSDK.Referenced.LedgerStorageTransactionBase.html +0 -6
- package/docs/types/KeetaNetSDK.Referenced.CreateIdentifierRequest.html +0 -6
|
@@ -184,7 +184,21 @@ declare const ColumnTypes: {
|
|
|
184
184
|
fromSpanner: (pubKey: string) => GenericAccount;
|
|
185
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;
|
|
186
186
|
};
|
|
187
|
-
readonly
|
|
187
|
+
readonly BUFFER_BIGINT_39: {
|
|
188
|
+
dbType: string;
|
|
189
|
+
dbSize: string;
|
|
190
|
+
toSpanner: (buf: bigint) => Buffer;
|
|
191
|
+
fromSpanner: (value: Buffer) => bigint;
|
|
192
|
+
toComparable: (val: Buffer | bigint | string) => bigint;
|
|
193
|
+
};
|
|
194
|
+
readonly BUFFER_BIGINT_16: {
|
|
195
|
+
dbType: string;
|
|
196
|
+
dbSize: string;
|
|
197
|
+
toSpanner: (buf: bigint) => Buffer;
|
|
198
|
+
fromSpanner: (value: Buffer) => bigint;
|
|
199
|
+
toComparable: (val: Buffer | bigint | string) => bigint;
|
|
200
|
+
};
|
|
201
|
+
readonly BUFFER_BIGINT_8: {
|
|
188
202
|
dbType: string;
|
|
189
203
|
dbSize: string;
|
|
190
204
|
toSpanner: (buf: bigint) => Buffer;
|
|
@@ -231,6 +245,7 @@ declare const schema: {
|
|
|
231
245
|
readonly description: ColumnInterface<"INFO_DESCRIPTION", true>;
|
|
232
246
|
readonly metadata: ColumnInterface<"INFO_METADATA", true>;
|
|
233
247
|
readonly supply: ColumnInterface<"SUPPLY", true>;
|
|
248
|
+
readonly multisigQuorum: ColumnInterface<"BIGINT", true>;
|
|
234
249
|
readonly defaultBasePermission: ColumnInterface<"BASE_PERMISSION", true>;
|
|
235
250
|
readonly defaultExternalPermission: ColumnInterface<"EXTERNAL_PERMISSION", true>;
|
|
236
251
|
};
|
|
@@ -274,7 +289,7 @@ declare const schema: {
|
|
|
274
289
|
readonly columns: {
|
|
275
290
|
readonly account: ColumnInterface<"GENERIC_ACCOUNT", false>;
|
|
276
291
|
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH", false>;
|
|
277
|
-
readonly orderIndex: ColumnInterface<"
|
|
292
|
+
readonly orderIndex: ColumnInterface<"BUFFER_BIGINT_39", false>;
|
|
278
293
|
};
|
|
279
294
|
readonly key: readonly [Key, Key];
|
|
280
295
|
readonly interleave: Interleave;
|
|
@@ -295,9 +310,10 @@ declare const schema: {
|
|
|
295
310
|
readonly onLedger: ColumnInterface<"LEDGER", false>;
|
|
296
311
|
readonly vote: ColumnInterface<"VOTE", false>;
|
|
297
312
|
readonly timestamp: ColumnInterface<"TIMESTAMP", false>;
|
|
298
|
-
readonly expires: ColumnInterface<"TIMESTAMP", false>;
|
|
299
313
|
readonly issuer: ColumnInterface<"ACCOUNT", false>;
|
|
300
314
|
readonly voteBlockHash: ColumnInterface<"VOTEBLOCKHASH", false>;
|
|
315
|
+
readonly orderIndex: ColumnInterface<"BUFFER_BIGINT_16", false>;
|
|
316
|
+
readonly expiresIndex: ColumnInterface<"BUFFER_BIGINT_8", true>;
|
|
301
317
|
};
|
|
302
318
|
readonly key: readonly [Key, Key];
|
|
303
319
|
};
|
|
@@ -365,11 +381,17 @@ declare const schema: {
|
|
|
365
381
|
readonly table: "permissions";
|
|
366
382
|
readonly key: readonly [Key, Key];
|
|
367
383
|
};
|
|
368
|
-
readonly
|
|
384
|
+
readonly historyVoteBlockHashAccount: {
|
|
369
385
|
readonly type: "INDEX";
|
|
370
386
|
readonly table: "history";
|
|
371
387
|
readonly key: readonly [Key, Key];
|
|
372
388
|
};
|
|
389
|
+
readonly historyOrdered: {
|
|
390
|
+
readonly type: "INDEX";
|
|
391
|
+
readonly table: "history";
|
|
392
|
+
readonly key: readonly [Key];
|
|
393
|
+
readonly storing: readonly [Key];
|
|
394
|
+
};
|
|
373
395
|
readonly chainAccountHash: {
|
|
374
396
|
readonly type: "INDEX";
|
|
375
397
|
readonly table: "chain";
|
|
@@ -383,15 +405,16 @@ declare const schema: {
|
|
|
383
405
|
readonly key: readonly [Key];
|
|
384
406
|
readonly storing: readonly [Key];
|
|
385
407
|
};
|
|
386
|
-
readonly
|
|
408
|
+
readonly votesOrderIndex: {
|
|
387
409
|
readonly type: "INDEX";
|
|
388
410
|
readonly table: "votes";
|
|
389
411
|
readonly key: readonly [Key, Key];
|
|
390
412
|
readonly storing: readonly [Key];
|
|
391
413
|
};
|
|
392
|
-
readonly
|
|
414
|
+
readonly votesExpiredIndex: {
|
|
393
415
|
readonly type: "INDEX";
|
|
394
416
|
readonly table: "votes";
|
|
417
|
+
readonly nullFiltered: true;
|
|
395
418
|
readonly key: readonly [Key, Key];
|
|
396
419
|
readonly storing: readonly [Key];
|
|
397
420
|
};
|
|
@@ -4,16 +4,18 @@ 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,
|
|
7
|
+
import type { Ledger, LedgerConfig, LedgerStorageAPI, LedgerSelector, PaginatedVotes, GetVotesAfterOptions, LedgerStorageTransactionBaseOptions } from '../ledger';
|
|
8
|
+
import { LedgerStorageTransactionBase } from '../ledger';
|
|
8
9
|
import type { AccountInfo, ACLRow, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
9
10
|
import { LedgerStorageBase } from './common';
|
|
10
11
|
import * as sqlite from 'sqlite';
|
|
11
12
|
import type { ComputedEffectOfBlocks } from './effects';
|
|
12
13
|
import type { CertificateHash } from '../utils/certificate';
|
|
13
|
-
|
|
14
|
+
declare class DBSqliteTransaction extends LedgerStorageTransactionBase {
|
|
14
15
|
sql: Awaited<ReturnType<typeof sqlite['open']>>;
|
|
15
16
|
release: null | ((value: null | number) => void);
|
|
16
17
|
lock: null | Promise<null | number>;
|
|
18
|
+
constructor(baseTransaction: LedgerStorageTransactionBaseOptions, db: Awaited<ReturnType<typeof sqlite['open']>>);
|
|
17
19
|
}
|
|
18
20
|
export interface DBSqliteConfig {
|
|
19
21
|
filename: string;
|
|
@@ -24,7 +26,7 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
|
|
|
24
26
|
constructor();
|
|
25
27
|
init(config: LedgerConfig, ledger: Ledger): void;
|
|
26
28
|
destroy(): Promise<void>;
|
|
27
|
-
beginTransaction(transactionBase:
|
|
29
|
+
beginTransaction(transactionBase: LedgerStorageTransactionBaseOptions): Promise<DBSqliteTransaction>;
|
|
28
30
|
commitTransaction(transaction: DBSqliteTransaction): Promise<void>;
|
|
29
31
|
abortTransaction(transaction: DBSqliteTransaction): Promise<void>;
|
|
30
32
|
evaluateError(error: any): Promise<any>;
|
|
@@ -44,9 +46,15 @@ export declare class DBSqlite extends LedgerStorageBase implements LedgerStorage
|
|
|
44
46
|
adjust(transaction: DBSqliteTransaction, input: VoteStaple, changes: ComputedEffectOfBlocks, mayDefer?: boolean, completedStaples?: Set<string>): Promise<VoteStaple[]>;
|
|
45
47
|
getBlock(transaction: DBSqliteTransaction, block: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
46
48
|
getBlockHeight(transaction: DBSqliteTransaction, blockHash: BlockHash, account: GenericAccount): Promise<bigint | null>;
|
|
49
|
+
getBlockHeights(transaction: DBSqliteTransaction, toFetch: {
|
|
50
|
+
blockHash: BlockHash;
|
|
51
|
+
account: GenericAccount;
|
|
52
|
+
}[]): Promise<{
|
|
53
|
+
[blockHash: string]: bigint | null;
|
|
54
|
+
}>;
|
|
47
55
|
getVotes(transaction: DBSqliteTransaction, block: BlockHash, from: LedgerSelector): Promise<Vote[] | null>;
|
|
48
56
|
getVoteStaples(transaction: DBSqliteTransaction, voteBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
49
|
-
getHistory(transaction: DBSqliteTransaction, account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
57
|
+
getHistory(transaction: DBSqliteTransaction, account: GenericAccount | null, start: VoteBlockHash | null, limit?: number): Promise<VoteBlockHash[]>;
|
|
50
58
|
getBlockFromPrevious(transaction: DBSqliteTransaction, prevBlock: BlockHash, from: LedgerSelector): Promise<Block | null>;
|
|
51
59
|
getVotesFromMultiplePrevious(transaction: DBSqliteTransaction, prevBlocks: BlockHash[], from: LedgerSelector, issuer?: GenericAccount): Promise<{
|
|
52
60
|
[hash: string]: Vote[] | null;
|
package/lib/ledger/effects.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { GenericAccount, IdentifierAddress, NetworkAddress, TokenAddress } from '../account';
|
|
2
2
|
import Account from '../account';
|
|
3
|
-
import type { AdjustMethod
|
|
3
|
+
import type { AdjustMethod } from '../block';
|
|
4
4
|
import { Block } from '../block';
|
|
5
|
-
import type
|
|
5
|
+
import type * as Operations from '../block/operations';
|
|
6
|
+
import type { UserEditableAccountInfo, ACLEntry, ACLUpdate } from '../ledger/types';
|
|
6
7
|
import type { Certificate, CertificateBundle } from '../utils/certificate';
|
|
7
8
|
import { CertificateHash } from '../utils/certificate';
|
|
8
9
|
interface NumericValueEntry {
|
|
@@ -41,24 +42,23 @@ interface ComputedBlocksEffectTokenChangesField {
|
|
|
41
42
|
/**
|
|
42
43
|
* Which fields may be affected by blocks
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
account: GenericAccount;
|
|
49
|
-
};
|
|
45
|
+
interface CreateIdentifierRequest {
|
|
46
|
+
createdIdentifier: IdentifierAddress;
|
|
47
|
+
createArguments?: Operations.IdentifierCreateArguments;
|
|
48
|
+
}
|
|
50
49
|
type DelegationUpdate = {
|
|
51
50
|
delegateTo: Account;
|
|
52
51
|
};
|
|
53
52
|
interface ComputedBlocksEffectFields {
|
|
54
53
|
balance?: ComputedBlocksEffectTokenChangesField;
|
|
55
54
|
supply?: NumericValueEntry[];
|
|
56
|
-
info?:
|
|
55
|
+
info?: Partial<UserEditableAccountInfo>;
|
|
57
56
|
permissions?: ACLUpdate[];
|
|
58
57
|
permissionRequirements?: ACLEntry[];
|
|
59
58
|
createRequests?: CreateIdentifierRequest[];
|
|
60
59
|
delegation?: DelegationUpdate;
|
|
61
60
|
certificate?: CertificateUpdate[];
|
|
61
|
+
minSignerSetLength?: bigint;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Which accounts and fields are affected by a set of block
|
|
@@ -80,6 +80,7 @@ export type ComputedEffectOfBlocks = {
|
|
|
80
80
|
metadata: {
|
|
81
81
|
operationCount: number;
|
|
82
82
|
blockCount: number;
|
|
83
|
+
feeUnits: bigint;
|
|
83
84
|
};
|
|
84
85
|
};
|
|
85
86
|
type LedgerOptions = {
|
package/lib/ledger/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VoteStaple, Vote, VoteBlockHashMap } from '../vote';
|
|
2
2
|
import { Block, BlockHash } from '../block';
|
|
3
|
-
import type { VoteBlockHash } from '../vote';
|
|
4
|
-
import type { GenericAccount, IdentifierAddress, NetworkAddress, TokenAddress } from '../account';
|
|
3
|
+
import type { FeeAmountAndToken, VoteBlockHash, VoteQuote } from '../vote';
|
|
4
|
+
import type { GenericAccount, IdentifierAddress, NetworkAddress, StorageAddress, TokenAddress } from '../account';
|
|
5
5
|
import Account from '../account';
|
|
6
6
|
import type Node from '../node';
|
|
7
7
|
import type { BloomFilter } from '../utils/bloom';
|
|
@@ -9,6 +9,7 @@ import type { ComputedEffectOfBlocks } from './effects';
|
|
|
9
9
|
import type { ACLRow, AccountInfo, GetAllBalancesResponse, LedgerStatistics, CertificateWithIntermediates } from './types';
|
|
10
10
|
import LedgerRequestCache from './cache';
|
|
11
11
|
import type { CertificateHash } from '../utils/certificate';
|
|
12
|
+
import { StatsPending } from '../stats';
|
|
12
13
|
/**
|
|
13
14
|
* Kind of ledger
|
|
14
15
|
*/
|
|
@@ -31,6 +32,10 @@ export interface LedgerConfig {
|
|
|
31
32
|
* Private key for the ledger if it is acting as a representative
|
|
32
33
|
*/
|
|
33
34
|
privateKey?: Account;
|
|
35
|
+
/**
|
|
36
|
+
* Provided function to compute fees for a given set of Blocks and computed effects
|
|
37
|
+
*/
|
|
38
|
+
computeFeeFromBlocks: (ledger: Ledger, blocks: Block[], effects: ComputedEffectOfBlocks) => FeeAmountAndToken | null;
|
|
34
39
|
/**
|
|
35
40
|
* Storage mechanism
|
|
36
41
|
*/
|
|
@@ -98,11 +103,19 @@ export type GetVotesAfterOptions = {
|
|
|
98
103
|
/**
|
|
99
104
|
* Each transaction can contain the node object making the request to access things like timing information
|
|
100
105
|
*/
|
|
101
|
-
export interface
|
|
106
|
+
export interface LedgerStorageTransactionBaseOptions {
|
|
107
|
+
node?: Node;
|
|
108
|
+
moment?: Date;
|
|
109
|
+
identifier: string;
|
|
110
|
+
readOnly?: boolean;
|
|
111
|
+
}
|
|
112
|
+
export declare class LedgerStorageTransactionBase implements LedgerStorageTransactionBaseOptions {
|
|
102
113
|
node?: Node;
|
|
103
114
|
moment: Date;
|
|
104
115
|
identifier: string;
|
|
105
116
|
readOnly: boolean;
|
|
117
|
+
statsPending: StatsPending;
|
|
118
|
+
constructor(options: LedgerStorageTransactionBaseOptions);
|
|
106
119
|
}
|
|
107
120
|
/**
|
|
108
121
|
* Each Ledger Storage backend must implement this interface
|
|
@@ -119,7 +132,7 @@ export interface LedgerStorageAPI {
|
|
|
119
132
|
/**
|
|
120
133
|
* Begin a transaction
|
|
121
134
|
*/
|
|
122
|
-
beginTransaction: (transactionBase:
|
|
135
|
+
beginTransaction: (transactionBase: LedgerStorageTransactionBaseOptions) => Promise<LedgerStorageTransactionBase>;
|
|
123
136
|
/**
|
|
124
137
|
* Commit an active transaction
|
|
125
138
|
*/
|
|
@@ -208,9 +221,9 @@ export interface LedgerStorageAPI {
|
|
|
208
221
|
*/
|
|
209
222
|
getVoteStaples: (transaction: any, voteBlockHashes: VoteBlockHash[], from: LedgerSelector) => Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
210
223
|
/**
|
|
211
|
-
* Get the history for a specific account
|
|
224
|
+
* Get the history for a specific account or all accounts if account is null
|
|
212
225
|
*/
|
|
213
|
-
getHistory: (transaction: any, account: GenericAccount, start: VoteBlockHash | null, limit?: number) => Promise<VoteBlockHash[]>;
|
|
226
|
+
getHistory: (transaction: any, account: GenericAccount | null, start: VoteBlockHash | null, limit?: number) => Promise<VoteBlockHash[]>;
|
|
214
227
|
/**
|
|
215
228
|
* Get multiple head blocks at the same time for a set of accounts
|
|
216
229
|
*/
|
|
@@ -250,7 +263,7 @@ export interface LedgerStorageAPI {
|
|
|
250
263
|
/**
|
|
251
264
|
* Perform Garbage Collection
|
|
252
265
|
*/
|
|
253
|
-
gc: (transaction: any) => Promise<boolean>;
|
|
266
|
+
gc: (transaction: any, timeLimitMS?: number) => Promise<boolean>;
|
|
254
267
|
/**
|
|
255
268
|
* Get the next serial number for a representative
|
|
256
269
|
*/
|
|
@@ -276,7 +289,8 @@ declare class LedgerAtomicInterface {
|
|
|
276
289
|
constructor(transaction: LedgerStorageTransactionBase, storage: LedgerStorageAPI, config: LedgerConfig, ledger: Ledger);
|
|
277
290
|
commit(): Promise<void>;
|
|
278
291
|
abort(): Promise<void>;
|
|
279
|
-
vote(blocks: Block[], otherVotes?: Vote[]): Promise<Vote>;
|
|
292
|
+
vote(blocks: Block[], otherVotes?: Vote[], quote?: VoteQuote): Promise<Vote>;
|
|
293
|
+
quote(blocks: Block[]): Promise<VoteQuote>;
|
|
280
294
|
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<VoteStaple[]>;
|
|
281
295
|
getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
282
296
|
getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
@@ -299,10 +313,11 @@ declare class LedgerAtomicInterface {
|
|
|
299
313
|
getBlock(blockhash: BlockHash, from?: LedgerSelector): Promise<Block | null>;
|
|
300
314
|
getVoteStaple(stapleBlockHash: VoteBlockHash, from?: LedgerSelector): Promise<VoteStaple | null>;
|
|
301
315
|
getVoteStaples(stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
302
|
-
getHistory(account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteStaple[]>;
|
|
316
|
+
getHistory(account: GenericAccount | null, start: VoteBlockHash | null, limit?: number): Promise<VoteStaple[]>;
|
|
303
317
|
getStaplesFromBlockHashes(hashes: BlockHash[]): Promise<VoteStaple[]>;
|
|
304
318
|
getVoteStaplesAfter(moment: Date, limit?: number, options?: GetVotesAfterOptions): Promise<VoteStaple[]>;
|
|
305
|
-
gc(): Promise<boolean>;
|
|
319
|
+
gc(timeLimitMS?: number): Promise<boolean>;
|
|
320
|
+
getFee(blocks: Block[], effectsInput?: ComputedEffectOfBlocks): Promise<FeeAmountAndToken | null>;
|
|
306
321
|
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
307
322
|
}
|
|
308
323
|
/**
|
|
@@ -319,6 +334,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
319
334
|
constructor(config: LedgerConfig, node?: Node, existingStorage?: LedgerStorageAPI);
|
|
320
335
|
get ledgerWriteMode(): NonNullable<LedgerConfig['ledgerWriteMode']>;
|
|
321
336
|
copy(newNode: Node): Ledger;
|
|
337
|
+
getFeePayToAndToken(accounts?: (Account | StorageAddress)[], token?: TokenAddress): Partial<FeeAmountAndToken>;
|
|
322
338
|
/**
|
|
323
339
|
* Execute some code with a transaction held, if the code fails the
|
|
324
340
|
* transaction is aborted, otherwise it is committed
|
|
@@ -330,6 +346,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
330
346
|
runReadOnly<T>(identifier: string, code: (transaction: LedgerAtomicInterface) => Promise<T>): ReturnType<typeof code>;
|
|
331
347
|
beginTransaction(identifier: string, readOnly?: boolean): Promise<LedgerAtomicInterface>;
|
|
332
348
|
vote(...args: Parameters<LedgerAtomicInterface['vote']>): ReturnType<LedgerAtomicInterface['vote']>;
|
|
349
|
+
quote(...args: Parameters<LedgerAtomicInterface['quote']>): ReturnType<LedgerAtomicInterface['quote']>;
|
|
333
350
|
add(...args: Parameters<LedgerAtomicInterface['add']>): ReturnType<LedgerAtomicInterface['add']>;
|
|
334
351
|
listACLsByPrincipal(...args: Parameters<LedgerAtomicInterface['listACLsByPrincipal']>): ReturnType<LedgerAtomicInterface['listACLsByPrincipal']>;
|
|
335
352
|
listACLsByEntity(...args: Parameters<LedgerAtomicInterface['listACLsByEntity']>): ReturnType<LedgerAtomicInterface['listACLsByEntity']>;
|
|
@@ -352,6 +369,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
352
369
|
getStaplesFromBlockHashes(...args: Parameters<LedgerAtomicInterface['getStaplesFromBlockHashes']>): ReturnType<LedgerAtomicInterface['getStaplesFromBlockHashes']>;
|
|
353
370
|
getVoteStaplesAfter(...args: Parameters<LedgerAtomicInterface['getVoteStaplesAfter']>): ReturnType<LedgerAtomicInterface['getVoteStaplesAfter']>;
|
|
354
371
|
gc(...args: Parameters<LedgerAtomicInterface['gc']>): ReturnType<LedgerAtomicInterface['gc']>;
|
|
372
|
+
getFee(...args: Parameters<LedgerAtomicInterface['getFee']>): ReturnType<LedgerAtomicInterface['getFee']>;
|
|
355
373
|
stats(): Promise<LedgerStatistics>;
|
|
356
374
|
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
357
375
|
}
|
package/lib/ledger/types.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { GenericAccount, TokenAddress } from '../account';
|
|
1
|
+
import type { Account, GenericAccount, MultisigAddress, TokenAddress } from '../account';
|
|
2
2
|
import type { AdjustMethod } from '../block';
|
|
3
3
|
import type { Permissions } from '../permissions';
|
|
4
4
|
import type { DbStats, TimeStats } from '../stats';
|
|
5
5
|
import type { Certificate, CertificateBundle } from '../utils/certificate';
|
|
6
|
+
export interface MultisigConfig {
|
|
7
|
+
signers: (Account | MultisigAddress)[];
|
|
8
|
+
quorum: bigint;
|
|
9
|
+
}
|
|
6
10
|
/**
|
|
7
11
|
* Account info entry
|
|
8
12
|
*/
|
|
@@ -27,7 +31,12 @@ export interface AccountInfo {
|
|
|
27
31
|
* The default permissions for the account
|
|
28
32
|
*/
|
|
29
33
|
defaultPermission?: Permissions;
|
|
34
|
+
/**
|
|
35
|
+
* If this is a multisig account, the number of signers required
|
|
36
|
+
*/
|
|
37
|
+
multisigQuorum?: bigint;
|
|
30
38
|
}
|
|
39
|
+
export type UserEditableAccountInfo = Omit<AccountInfo, 'supply'>;
|
|
31
40
|
/**
|
|
32
41
|
* Permissions types
|
|
33
42
|
*/
|
package/lib/node/utils.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import Account, { type StorageAddress, type TokenAddress } from '../account';
|
|
1
2
|
import type { NodeConfig } from '.';
|
|
2
3
|
export declare function getConfigFromEnv(type: 'local' | 'lambda'): Partial<Omit<NodeConfig, 'ledger'> & {
|
|
3
4
|
ledger: Partial<NodeConfig['ledger']>;
|
|
4
5
|
}>;
|
|
6
|
+
export declare function getFeeConfigFromEnv(type: 'local' | 'lambda'): {
|
|
7
|
+
feeAccounts: (Account | StorageAddress)[];
|
|
8
|
+
feeToken: TokenAddress | undefined;
|
|
9
|
+
};
|
package/lib/p2p.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export interface P2PConfig {
|
|
|
48
48
|
* Forget about seen message ids after this many milliseconds
|
|
49
49
|
*/
|
|
50
50
|
seenMessageTTL?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to republish over http or p2p websockets
|
|
53
|
+
*/
|
|
54
|
+
useHTTPRepublish?: boolean;
|
|
51
55
|
}
|
|
52
56
|
/**
|
|
53
57
|
* Shape of statistics
|
|
@@ -66,6 +70,7 @@ export interface P2PSwitchStatistics {
|
|
|
66
70
|
interface P2PPeerBase {
|
|
67
71
|
kind: NodeKind;
|
|
68
72
|
}
|
|
73
|
+
export type P2PUpdateOptions = 'http' | 'websocket';
|
|
69
74
|
/**
|
|
70
75
|
* Peering information for a Representative (Basic, unsigned information)
|
|
71
76
|
*/
|
|
@@ -82,6 +87,10 @@ interface P2PPeerRepBase extends P2PPeerBase {
|
|
|
82
87
|
* Public key of the representative (used as the ID)
|
|
83
88
|
*/
|
|
84
89
|
key: Account;
|
|
90
|
+
/**
|
|
91
|
+
* Prefer to receive updates over http or websocket
|
|
92
|
+
*/
|
|
93
|
+
preferUpdates: P2PUpdateOptions;
|
|
85
94
|
}
|
|
86
95
|
/**
|
|
87
96
|
* Peering information for a Representative
|
|
@@ -200,6 +209,23 @@ type JSONMessage = {
|
|
|
200
209
|
};
|
|
201
210
|
export declare function randomizeReps(reps: Representative[]): Representative[];
|
|
202
211
|
export declare function formatRepEndpoints(peers: P2PPeer[]): Representative[];
|
|
212
|
+
export declare class P2PHttpConnection implements P2PConnection {
|
|
213
|
+
#private;
|
|
214
|
+
abort: boolean;
|
|
215
|
+
peer: P2PPeer;
|
|
216
|
+
validatedPeer: P2PPeer | null;
|
|
217
|
+
timeout: number;
|
|
218
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is P2PHttpConnection;
|
|
219
|
+
/**
|
|
220
|
+
* Initiate an outbound http connection and attach it to the specified switch
|
|
221
|
+
*/
|
|
222
|
+
static initiate(peer: P2PPeer, p2pSwitch: P2PSwitch): Promise<P2PHttpConnection | null>;
|
|
223
|
+
constructor(peer: P2PPeer, p2pSwitch: P2PSwitch);
|
|
224
|
+
get connString(): string;
|
|
225
|
+
get peerString(): string | null;
|
|
226
|
+
send(messageBuffer: Buffer): Promise<boolean>;
|
|
227
|
+
close(): Promise<void>;
|
|
228
|
+
}
|
|
203
229
|
/**
|
|
204
230
|
* A P2PConnection using the "ws" package
|
|
205
231
|
*/
|
|
@@ -275,6 +301,7 @@ export declare class P2PSwitch {
|
|
|
275
301
|
* Our own peer information
|
|
276
302
|
*/
|
|
277
303
|
selfPeer(): Promise<P2PPeer | null>;
|
|
304
|
+
getOutgoingGreetingInfo(): Promise<JSONSerializableObject>;
|
|
278
305
|
/**
|
|
279
306
|
* Receive a message from a connection
|
|
280
307
|
*
|
|
@@ -299,5 +326,10 @@ export declare class P2PSwitch {
|
|
|
299
326
|
* @returns If the message could be delivered to at least one peer
|
|
300
327
|
*/
|
|
301
328
|
sendMessage(to: P2PConnection | Account | P2PPeer | null, id: string, type: string, data: any, ttl?: number, exclude?: (string | P2PConnection)[], skipConnectToPeers?: boolean): Promise<boolean>;
|
|
329
|
+
/**
|
|
330
|
+
* TODO - make this private after refactoring websockets to handle higher load
|
|
331
|
+
* https://github.com/KeetaNetwork/node/issues/785
|
|
332
|
+
*/
|
|
333
|
+
haveAnyFilter(data: any): Promise<boolean>;
|
|
302
334
|
}
|
|
303
335
|
export default P2PSwitch;
|
package/lib/permissions.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ declare enum BaseFlag {
|
|
|
18
18
|
TOKEN_ADMIN_MODIFY_BALANCE = 7,/* 0x0080 */
|
|
19
19
|
PERMISSION_DELEGATE_ADD = 11,/* 0x0800 */
|
|
20
20
|
PERMISSION_DELEGATE_REMOVE = 12,/* 0x1000 */
|
|
21
|
-
MANAGE_CERTIFICATE = 13
|
|
21
|
+
MANAGE_CERTIFICATE = 13,/* 0x2000 */
|
|
22
|
+
MULTISIG_SIGNER = 14
|
|
22
23
|
}
|
|
23
24
|
type ExternalFlagName = `${typeof externalFlagPrefix}${string}`;
|
|
24
25
|
export type BaseFlagName = keyof typeof BaseFlag;
|
|
@@ -42,7 +43,9 @@ declare enum BasePermissionGroup {
|
|
|
42
43
|
NONIDENTIFIER = 2,
|
|
43
44
|
NETWORK = 3,
|
|
44
45
|
TOKEN = 4,
|
|
45
|
-
STORAGE = 5
|
|
46
|
+
STORAGE = 5,
|
|
47
|
+
NONIDENTIFIER_OR_MULTISIG = 6,
|
|
48
|
+
MULTISIG = 7
|
|
46
49
|
}
|
|
47
50
|
interface BaseFlagRule {
|
|
48
51
|
canBeDefault: boolean;
|
package/lib/stats.d.ts
CHANGED
|
@@ -37,15 +37,34 @@ export type TimeStats = {
|
|
|
37
37
|
export type DbStats = {
|
|
38
38
|
retries: number;
|
|
39
39
|
};
|
|
40
|
-
export declare class
|
|
40
|
+
export declare class StatsPending {
|
|
41
|
+
protected localDBIncr: {
|
|
42
|
+
[key: string]: number;
|
|
43
|
+
};
|
|
44
|
+
protected localDBXOR: {
|
|
45
|
+
[key: string]: bigint;
|
|
46
|
+
};
|
|
47
|
+
protected consume(): {
|
|
48
|
+
incrChanges: {
|
|
49
|
+
[key: string]: number;
|
|
50
|
+
};
|
|
51
|
+
xorChanges: {
|
|
52
|
+
[key: string]: bigint;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
protected compoundKey(arena: string, key: string): string;
|
|
56
|
+
protected incrCompoundKey(compoundKey: string, change: number): void;
|
|
57
|
+
incr(arena: string, key: string, change?: number): void;
|
|
58
|
+
xor(key: string, change: BlockHash | BufferStorage | bigint): void;
|
|
59
|
+
merge(pending: StatsPending): void;
|
|
60
|
+
}
|
|
61
|
+
export declare class Stats extends StatsPending {
|
|
41
62
|
#private;
|
|
42
63
|
constructor(config: StatsConfig);
|
|
43
64
|
static durationBreakdownList(): DurationBreakdowns[];
|
|
44
65
|
static assertDurationBreakdown(duration: string): asserts duration is DurationBreakdowns;
|
|
45
66
|
static durationBreakdown(duration: number): DurationBreakdowns;
|
|
46
67
|
static placeholderTimingData(): TimeStats;
|
|
47
|
-
incr(arena: string, key: string, change?: number): void;
|
|
48
|
-
xor(key: string, change: BlockHash | BufferStorage): void;
|
|
49
68
|
getXor(key: string): Promise<BufferStorage>;
|
|
50
69
|
addTimingPoint(arena: string, category: string, duration: number, returnOnly?: boolean): Parameters<Stats['incr']>;
|
|
51
70
|
addRequestTiming(arena: string, timing: RequestTiming, returnOnly?: boolean): Parameters<Stats['incr']>[];
|
package/lib/utils/asn1.d.ts
CHANGED
|
@@ -45,6 +45,23 @@ export interface ASN1String extends ASN1Object {
|
|
|
45
45
|
value: string;
|
|
46
46
|
}
|
|
47
47
|
export declare function isASN1Object(input: unknown): input is ASN1Object;
|
|
48
|
+
declare function isASN1OID(input: unknown): input is ASN1OID;
|
|
49
|
+
declare function isASN1String(input: unknown): input is ASN1String;
|
|
50
|
+
declare function isASN1Set(input: unknown): input is ASN1Set;
|
|
51
|
+
declare function isASN1ContextTag<T extends ASN1ContextTag['kind']>(input: unknown, tagKind?: T): input is Extract<ASN1ContextTag, {
|
|
52
|
+
kind: T;
|
|
53
|
+
}>;
|
|
54
|
+
declare function isASN1BitString(input: unknown): input is ASN1BitString;
|
|
55
|
+
declare function isASN1Date(input: unknown): input is ASN1Date;
|
|
56
|
+
export declare const ASN1CheckUtilities: {
|
|
57
|
+
isASN1Object: typeof isASN1Object;
|
|
58
|
+
isASN1OID: typeof isASN1OID;
|
|
59
|
+
isASN1String: typeof isASN1String;
|
|
60
|
+
isASN1Set: typeof isASN1Set;
|
|
61
|
+
isASN1ContextTag: typeof isASN1ContextTag;
|
|
62
|
+
isASN1BitString: typeof isASN1BitString;
|
|
63
|
+
isASN1Date: typeof isASN1Date;
|
|
64
|
+
};
|
|
48
65
|
/**
|
|
49
66
|
* Validation function for {@link isValidSequenceSchema}
|
|
50
67
|
*/
|
|
@@ -59,7 +76,7 @@ declare function jsASN1toJS(input: ArrayBuffer): ASN1AnyJS;
|
|
|
59
76
|
declare const ASN1toJS: typeof jsASN1toJS, JStoASN1: typeof jsJStoASN1, ASN1IntegerToBigInt: typeof jsIntegerToBigInt, ASN1BigIntToBuffer: typeof jsBigIntToBuffer;
|
|
60
77
|
export declare namespace ValidateASN1 {
|
|
61
78
|
export type Schema = keyof BasicSchemaMap | {
|
|
62
|
-
choice: Schema[];
|
|
79
|
+
choice: Schema[] | readonly Schema[];
|
|
63
80
|
} | {
|
|
64
81
|
sequenceOf: Schema;
|
|
65
82
|
} | {
|
|
@@ -87,7 +104,7 @@ export declare namespace ValidateASN1 {
|
|
|
87
104
|
} | {
|
|
88
105
|
type: 'date';
|
|
89
106
|
kind: 'general';
|
|
90
|
-
} | readonly [Schema, ...Schema[]];
|
|
107
|
+
} | readonly [Schema, ...Schema[]] | (() => Schema);
|
|
91
108
|
type BasicSchemaMap = {
|
|
92
109
|
[ValidateASN1.IsAny]: ASN1AnyJS;
|
|
93
110
|
[ValidateASN1.IsUnknown]: unknown;
|
|
@@ -103,7 +120,7 @@ export declare namespace ValidateASN1 {
|
|
|
103
120
|
[ValidateASN1.IsSet]: ASN1Set;
|
|
104
121
|
[ValidateASN1.IsNull]: null;
|
|
105
122
|
};
|
|
106
|
-
export type SchemaMap<T extends Schema> = T extends keyof BasicSchemaMap ? BasicSchemaMap[T] : T extends {
|
|
123
|
+
export type SchemaMap<T extends Schema> = T extends () => infer U ? U extends Schema ? SchemaMap<U> : never : T extends keyof BasicSchemaMap ? BasicSchemaMap[T] : T extends {
|
|
107
124
|
choice: Schema[];
|
|
108
125
|
} ? SchemaMap<T['choice'][number]> : T extends {
|
|
109
126
|
choice: readonly Schema[];
|
|
@@ -113,7 +130,7 @@ export declare namespace ValidateASN1 {
|
|
|
113
130
|
optional: Schema;
|
|
114
131
|
} ? SchemaMap<T['optional']> | undefined : T extends bigint ? T : T extends {
|
|
115
132
|
type: 'context';
|
|
116
|
-
kind: infer U extends '
|
|
133
|
+
kind: infer U extends ASN1ContextTag['kind'];
|
|
117
134
|
value: number;
|
|
118
135
|
contains: Schema;
|
|
119
136
|
} ? Omit<ASN1ContextTag, 'contains' | 'value' | 'kind'> & {
|
|
@@ -163,7 +180,7 @@ export declare class ValidateASN1<T extends ValidateASN1.Schema> {
|
|
|
163
180
|
* Given a schema, validate the ASN.1 object against it and return the
|
|
164
181
|
* object as the validated type
|
|
165
182
|
*/
|
|
166
|
-
static againstSchema<T extends ValidateASN1.Schema>(input: ASN1AnyJS,
|
|
183
|
+
static againstSchema<T extends ValidateASN1.Schema>(input: ASN1AnyJS, schemaIn: T): ValidateASN1.SchemaMap<T>;
|
|
167
184
|
constructor(schema: T);
|
|
168
185
|
validate(input: ASN1AnyJS): ValidateASN1.SchemaMap<T>;
|
|
169
186
|
}
|
|
@@ -44,6 +44,7 @@ type CertificateSchema = [
|
|
|
44
44
|
signatureAlgorithm: ASN1.ASN1OID[],
|
|
45
45
|
signature: ASN1.ASN1BitString
|
|
46
46
|
];
|
|
47
|
+
type HashNames = 'sha256' | 'sha3-256';
|
|
47
48
|
type CertificateBuilderParams = {
|
|
48
49
|
/**
|
|
49
50
|
* Subject for the certificate, to store as the public key within the certificate
|
|
@@ -93,15 +94,45 @@ type CertificateBuilderParams = {
|
|
|
93
94
|
includeCommonExts?: boolean;
|
|
94
95
|
/**
|
|
95
96
|
* Hashing library to use
|
|
97
|
+
*
|
|
98
|
+
* Because several different things are hashed this is
|
|
99
|
+
* @deprecated Use `hashParams` instead
|
|
96
100
|
*/
|
|
97
|
-
hashLib
|
|
101
|
+
hashLib?: {
|
|
98
102
|
hash: (...args: Parameters<typeof HashLib.Hash>) => ReturnType<typeof HashLib.Hash>;
|
|
99
103
|
name: string;
|
|
100
104
|
};
|
|
105
|
+
/**
|
|
106
|
+
* This option lets you control the hashing method used for the
|
|
107
|
+
* certificate signature as well as provide alternative implementations
|
|
108
|
+
*/
|
|
109
|
+
hashParams: {
|
|
110
|
+
functions?: {
|
|
111
|
+
[name in HashNames]?: (...args: Parameters<typeof HashLib.Hash>) => ReturnType<typeof HashLib.Hash>;
|
|
112
|
+
};
|
|
113
|
+
defaults?: {
|
|
114
|
+
/**
|
|
115
|
+
* Default hashing function to use for the certificate signature
|
|
116
|
+
*/
|
|
117
|
+
signature?: HashNames;
|
|
118
|
+
/**
|
|
119
|
+
* Default hashing function to use for the Subject Key Identifier
|
|
120
|
+
*/
|
|
121
|
+
ski?: HashNames;
|
|
122
|
+
/**
|
|
123
|
+
* Default hashing function to use for the Authority Key Identifier
|
|
124
|
+
* (must match the issuer certificate's Subject Key Identifier
|
|
125
|
+
* hashing function)
|
|
126
|
+
*/
|
|
127
|
+
aki?: HashNames;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
101
130
|
};
|
|
102
131
|
export declare class CertificateBuilder {
|
|
103
132
|
#private;
|
|
104
133
|
constructor(params?: Partial<CertificateBuilderParams>);
|
|
134
|
+
private static hashName;
|
|
135
|
+
private static hash;
|
|
105
136
|
/**
|
|
106
137
|
* Construct an extension
|
|
107
138
|
*/
|
|
@@ -367,6 +398,12 @@ export declare class Certificate {
|
|
|
367
398
|
* Get the issuer account
|
|
368
399
|
*/
|
|
369
400
|
getIssuerAccount(): Account | null;
|
|
401
|
+
/**
|
|
402
|
+
* Get the extensions present in the certificate -- this is the raw
|
|
403
|
+
* extensions as they were parsed from the certificate, and may
|
|
404
|
+
* contain extensions that are not processed by this class.
|
|
405
|
+
*/
|
|
406
|
+
getExtensions(): NonNullable<CertificateSchema[0][7]>['contains'] | undefined;
|
|
370
407
|
private assertConstructed;
|
|
371
408
|
/**
|
|
372
409
|
* Compare the certificate with another certificate and return true if they
|
package/lib/utils/helper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import _crypto from 'crypto';
|
|
|
2
2
|
import type { JSONSerializable } from './conversion';
|
|
3
3
|
export type DistributiveOmit<T, P extends PropertyKey> = T extends T ? Omit<T, P> : never;
|
|
4
4
|
export declare function bufferToArrayBuffer(input: Buffer): ArrayBuffer;
|
|
5
|
+
export declare function bufferToBigInt(buffer: Buffer): bigint;
|
|
5
6
|
/**
|
|
6
7
|
* Check if a value is an integer or a bigint.
|
|
7
8
|
*/
|
|
@@ -73,7 +74,7 @@ interface InstanceSet<Instance, Encoded = string> extends Set<Instance> {
|
|
|
73
74
|
*/
|
|
74
75
|
export declare const AsyncDisposableStack: AsyncDisposableStackConstructor;
|
|
75
76
|
export interface InstanceSetConstructor<Instance, Encoded = string> {
|
|
76
|
-
new (data?: (Instance)
|
|
77
|
+
new (data?: Iterable<(Instance)>): InstanceSet<Instance, Encoded>;
|
|
77
78
|
}
|
|
78
79
|
export declare function setGenerator<P extends WithIsInstance<Instance>, E extends EncodeFunc<Instance, Encoded>, D extends DecodeFunc<Instance, Encoded>, Instance = InstanceType<P>, Encoded = ReturnType<E>>(parent: P, rawEncode: E, rawDecode: D): InstanceSetConstructor<Instance, Encoded>;
|
|
79
80
|
export declare const crypto: {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility types for static type checking
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Expects a type to be true, otherwise raises a type error.
|
|
6
|
+
*/
|
|
7
|
+
export type Expect<T extends true> = T;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if two types are equal.
|
|
10
|
+
*/
|
|
11
|
+
export type Equal<A, B> = A extends B ? (B extends A ? true : false) : false;
|