@keetanetwork/keetanet-client 0.12.2 → 0.14.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 -2
- package/api/node.d.ts +7 -1
- package/api/p2p.d.ts +13 -0
- package/api/vote.d.ts +10 -0
- package/benchmarking/test.d.ts +4 -0
- package/client/builder.d.ts +6 -4
- package/client/client_common_tests.d.ts +18 -0
- package/client/index-browser.d.ts +42 -14
- package/client/index-browser.js +2068 -640
- package/client/index.d.ts +42 -14
- package/client/index.js +1964 -550
- package/config/index.d.ts +2 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +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.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.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.PublishOptions.html +5 -0
- 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.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 +3 -3
- 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.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_helper.html +1 -1
- package/docs/modules/KeetaNetSDK.html +2 -2
- 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.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/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/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 +2 -2
- package/lib/ledger/db_postgres.d.ts +1 -1
- package/lib/ledger/db_spanner.d.ts +1 -1
- package/lib/ledger/db_spanner_helper.d.ts +28 -5
- package/lib/ledger/db_sqlite.d.ts +1 -1
- package/lib/ledger/effects.d.ts +10 -9
- package/lib/ledger/index.d.ts +17 -8
- 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/utils/asn1.d.ts +4 -4
- package/lib/utils/certificate.d.ts +38 -1
- package/lib/utils/helper.d.ts +2 -1
- 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/types/KeetaNetSDK.Referenced.CreateIdentifierRequest.html +0 -6
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';
|
|
@@ -31,6 +31,10 @@ export interface LedgerConfig {
|
|
|
31
31
|
* Private key for the ledger if it is acting as a representative
|
|
32
32
|
*/
|
|
33
33
|
privateKey?: Account;
|
|
34
|
+
/**
|
|
35
|
+
* Provided function to compute fees for a given set of Blocks and computed effects
|
|
36
|
+
*/
|
|
37
|
+
computeFeeFromBlocks: (ledger: Ledger, blocks: Block[], effects: ComputedEffectOfBlocks) => FeeAmountAndToken | null;
|
|
34
38
|
/**
|
|
35
39
|
* Storage mechanism
|
|
36
40
|
*/
|
|
@@ -208,9 +212,9 @@ export interface LedgerStorageAPI {
|
|
|
208
212
|
*/
|
|
209
213
|
getVoteStaples: (transaction: any, voteBlockHashes: VoteBlockHash[], from: LedgerSelector) => Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
210
214
|
/**
|
|
211
|
-
* Get the history for a specific account
|
|
215
|
+
* Get the history for a specific account or all accounts if account is null
|
|
212
216
|
*/
|
|
213
|
-
getHistory: (transaction: any, account: GenericAccount, start: VoteBlockHash | null, limit?: number) => Promise<VoteBlockHash[]>;
|
|
217
|
+
getHistory: (transaction: any, account: GenericAccount | null, start: VoteBlockHash | null, limit?: number) => Promise<VoteBlockHash[]>;
|
|
214
218
|
/**
|
|
215
219
|
* Get multiple head blocks at the same time for a set of accounts
|
|
216
220
|
*/
|
|
@@ -250,7 +254,7 @@ export interface LedgerStorageAPI {
|
|
|
250
254
|
/**
|
|
251
255
|
* Perform Garbage Collection
|
|
252
256
|
*/
|
|
253
|
-
gc: (transaction: any) => Promise<boolean>;
|
|
257
|
+
gc: (transaction: any, timeLimitMS?: number) => Promise<boolean>;
|
|
254
258
|
/**
|
|
255
259
|
* Get the next serial number for a representative
|
|
256
260
|
*/
|
|
@@ -276,7 +280,8 @@ declare class LedgerAtomicInterface {
|
|
|
276
280
|
constructor(transaction: LedgerStorageTransactionBase, storage: LedgerStorageAPI, config: LedgerConfig, ledger: Ledger);
|
|
277
281
|
commit(): Promise<void>;
|
|
278
282
|
abort(): Promise<void>;
|
|
279
|
-
vote(blocks: Block[], otherVotes?: Vote[]): Promise<Vote>;
|
|
283
|
+
vote(blocks: Block[], otherVotes?: Vote[], quote?: VoteQuote): Promise<Vote>;
|
|
284
|
+
quote(blocks: Block[]): Promise<VoteQuote>;
|
|
280
285
|
add(votesAndBlocks: VoteStaple, from?: 'bootstrap' | string): Promise<VoteStaple[]>;
|
|
281
286
|
getBalance(account: GenericAccount, token: TokenAddress): Promise<bigint>;
|
|
282
287
|
getAllBalances(account: GenericAccount): Promise<GetAllBalancesResponse>;
|
|
@@ -299,10 +304,11 @@ declare class LedgerAtomicInterface {
|
|
|
299
304
|
getBlock(blockhash: BlockHash, from?: LedgerSelector): Promise<Block | null>;
|
|
300
305
|
getVoteStaple(stapleBlockHash: VoteBlockHash, from?: LedgerSelector): Promise<VoteStaple | null>;
|
|
301
306
|
getVoteStaples(stapleBlockHashes: VoteBlockHash[], from?: LedgerSelector): Promise<VoteBlockHashMap<VoteStaple | null>>;
|
|
302
|
-
getHistory(account: GenericAccount, start: VoteBlockHash | null, limit?: number): Promise<VoteStaple[]>;
|
|
307
|
+
getHistory(account: GenericAccount | null, start: VoteBlockHash | null, limit?: number): Promise<VoteStaple[]>;
|
|
303
308
|
getStaplesFromBlockHashes(hashes: BlockHash[]): Promise<VoteStaple[]>;
|
|
304
309
|
getVoteStaplesAfter(moment: Date, limit?: number, options?: GetVotesAfterOptions): Promise<VoteStaple[]>;
|
|
305
|
-
gc(): Promise<boolean>;
|
|
310
|
+
gc(timeLimitMS?: number): Promise<boolean>;
|
|
311
|
+
getFee(blocks: Block[], effectsInput?: ComputedEffectOfBlocks): Promise<FeeAmountAndToken | null>;
|
|
306
312
|
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
307
313
|
}
|
|
308
314
|
/**
|
|
@@ -319,6 +325,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
319
325
|
constructor(config: LedgerConfig, node?: Node, existingStorage?: LedgerStorageAPI);
|
|
320
326
|
get ledgerWriteMode(): NonNullable<LedgerConfig['ledgerWriteMode']>;
|
|
321
327
|
copy(newNode: Node): Ledger;
|
|
328
|
+
getFeePayToAndToken(accounts?: (Account | StorageAddress)[], token?: TokenAddress): Partial<FeeAmountAndToken>;
|
|
322
329
|
/**
|
|
323
330
|
* Execute some code with a transaction held, if the code fails the
|
|
324
331
|
* transaction is aborted, otherwise it is committed
|
|
@@ -330,6 +337,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
330
337
|
runReadOnly<T>(identifier: string, code: (transaction: LedgerAtomicInterface) => Promise<T>): ReturnType<typeof code>;
|
|
331
338
|
beginTransaction(identifier: string, readOnly?: boolean): Promise<LedgerAtomicInterface>;
|
|
332
339
|
vote(...args: Parameters<LedgerAtomicInterface['vote']>): ReturnType<LedgerAtomicInterface['vote']>;
|
|
340
|
+
quote(...args: Parameters<LedgerAtomicInterface['quote']>): ReturnType<LedgerAtomicInterface['quote']>;
|
|
333
341
|
add(...args: Parameters<LedgerAtomicInterface['add']>): ReturnType<LedgerAtomicInterface['add']>;
|
|
334
342
|
listACLsByPrincipal(...args: Parameters<LedgerAtomicInterface['listACLsByPrincipal']>): ReturnType<LedgerAtomicInterface['listACLsByPrincipal']>;
|
|
335
343
|
listACLsByEntity(...args: Parameters<LedgerAtomicInterface['listACLsByEntity']>): ReturnType<LedgerAtomicInterface['listACLsByEntity']>;
|
|
@@ -352,6 +360,7 @@ export declare class Ledger implements Omit<LedgerAtomicInterface, 'commit' | 'a
|
|
|
352
360
|
getStaplesFromBlockHashes(...args: Parameters<LedgerAtomicInterface['getStaplesFromBlockHashes']>): ReturnType<LedgerAtomicInterface['getStaplesFromBlockHashes']>;
|
|
353
361
|
getVoteStaplesAfter(...args: Parameters<LedgerAtomicInterface['getVoteStaplesAfter']>): ReturnType<LedgerAtomicInterface['getVoteStaplesAfter']>;
|
|
354
362
|
gc(...args: Parameters<LedgerAtomicInterface['gc']>): ReturnType<LedgerAtomicInterface['gc']>;
|
|
363
|
+
getFee(...args: Parameters<LedgerAtomicInterface['getFee']>): ReturnType<LedgerAtomicInterface['getFee']>;
|
|
355
364
|
stats(): Promise<LedgerStatistics>;
|
|
356
365
|
_testingRunStorageFunction<T>(code: (storage: LedgerStorageAPI, transaction: LedgerStorageTransactionBase) => Promise<T>): Promise<T>;
|
|
357
366
|
}
|
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/utils/asn1.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ declare function jsASN1toJS(input: ArrayBuffer): ASN1AnyJS;
|
|
|
59
59
|
declare const ASN1toJS: typeof jsASN1toJS, JStoASN1: typeof jsJStoASN1, ASN1IntegerToBigInt: typeof jsIntegerToBigInt, ASN1BigIntToBuffer: typeof jsBigIntToBuffer;
|
|
60
60
|
export declare namespace ValidateASN1 {
|
|
61
61
|
export type Schema = keyof BasicSchemaMap | {
|
|
62
|
-
choice: Schema[];
|
|
62
|
+
choice: Schema[] | readonly Schema[];
|
|
63
63
|
} | {
|
|
64
64
|
sequenceOf: Schema;
|
|
65
65
|
} | {
|
|
@@ -87,7 +87,7 @@ export declare namespace ValidateASN1 {
|
|
|
87
87
|
} | {
|
|
88
88
|
type: 'date';
|
|
89
89
|
kind: 'general';
|
|
90
|
-
} | readonly [Schema, ...Schema[]];
|
|
90
|
+
} | readonly [Schema, ...Schema[]] | (() => Schema);
|
|
91
91
|
type BasicSchemaMap = {
|
|
92
92
|
[ValidateASN1.IsAny]: ASN1AnyJS;
|
|
93
93
|
[ValidateASN1.IsUnknown]: unknown;
|
|
@@ -103,7 +103,7 @@ export declare namespace ValidateASN1 {
|
|
|
103
103
|
[ValidateASN1.IsSet]: ASN1Set;
|
|
104
104
|
[ValidateASN1.IsNull]: null;
|
|
105
105
|
};
|
|
106
|
-
export type SchemaMap<T extends Schema> = T extends keyof BasicSchemaMap ? BasicSchemaMap[T] : T extends {
|
|
106
|
+
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
107
|
choice: Schema[];
|
|
108
108
|
} ? SchemaMap<T['choice'][number]> : T extends {
|
|
109
109
|
choice: readonly Schema[];
|
|
@@ -163,7 +163,7 @@ export declare class ValidateASN1<T extends ValidateASN1.Schema> {
|
|
|
163
163
|
* Given a schema, validate the ASN.1 object against it and return the
|
|
164
164
|
* object as the validated type
|
|
165
165
|
*/
|
|
166
|
-
static againstSchema<T extends ValidateASN1.Schema>(input: ASN1AnyJS,
|
|
166
|
+
static againstSchema<T extends ValidateASN1.Schema>(input: ASN1AnyJS, schemaIn: T): ValidateASN1.SchemaMap<T>;
|
|
167
167
|
constructor(schema: T);
|
|
168
168
|
validate(input: ASN1AnyJS): ValidateASN1.SchemaMap<T>;
|
|
169
169
|
}
|
|
@@ -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: {
|
package/lib/vote.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Block, BlockHash } from './block';
|
|
2
|
-
import type { BlockJSON, BlockJSONOutput } from './block';
|
|
2
|
+
import type { BlockJSON, BlockJSONOutput, BlockJSONOutputSerialized } from './block';
|
|
3
3
|
import Account, { AccountKeyAlgorithm, type StorageAddress, type TokenAddress } from './account';
|
|
4
4
|
import type { ASN1Date } from './utils/asn1';
|
|
5
5
|
import { type ToJSONSerializableOptions, type ToJSONSerializable } from './utils/conversion';
|
|
@@ -28,14 +28,15 @@ export interface VoteJSON {
|
|
|
28
28
|
validityTo: string | Date;
|
|
29
29
|
signature: string | ArrayBuffer;
|
|
30
30
|
fee?: FeeAmountAndTokenJSON;
|
|
31
|
+
quote?: boolean;
|
|
31
32
|
}
|
|
32
33
|
type VoteJSONOutput = ToJSONSerializable<ReturnType<Vote['toJSON']>>;
|
|
33
34
|
export interface VoteStapleJSON {
|
|
34
|
-
blocks: BlockJSON[] | BlockJSONOutput[];
|
|
35
|
+
blocks: BlockJSON[] | BlockJSONOutput[] | BlockJSONOutputSerialized[];
|
|
35
36
|
votes: VoteJSON[] | VoteJSONOutput[];
|
|
36
37
|
}
|
|
37
38
|
declare class VoteHash extends BufferStorage {
|
|
38
|
-
static isInstance: (obj: any, strict?: boolean) => obj is VoteHash;
|
|
39
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteHash;
|
|
39
40
|
readonly storageKind = "VoteHash";
|
|
40
41
|
constructor(blockhash: ConstructorParameters<typeof BufferStorage>[0]);
|
|
41
42
|
}
|
|
@@ -64,6 +65,7 @@ type CertificatePublicKeyInfo = [CertificateOID[], {
|
|
|
64
65
|
value: Buffer;
|
|
65
66
|
}];
|
|
66
67
|
export type CertificateExtensionFeeEntry = [
|
|
68
|
+
quote: boolean,
|
|
67
69
|
amount: bigint,
|
|
68
70
|
payTo?: {
|
|
69
71
|
type: 'context';
|
|
@@ -127,7 +129,7 @@ export declare class VoteBlockHashMap<ValueType = unknown> implements Map<VoteBl
|
|
|
127
129
|
* VoteBlockHash.
|
|
128
130
|
*/
|
|
129
131
|
export declare class VoteBlockHash extends BufferStorage {
|
|
130
|
-
static isInstance: (obj: any, strict?: boolean) => obj is VoteBlockHash;
|
|
132
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteBlockHash;
|
|
131
133
|
static readonly Map: typeof VoteBlockHashMap;
|
|
132
134
|
readonly storageKind = "VoteBlockHash";
|
|
133
135
|
get hashFunctionName(): string;
|
|
@@ -154,7 +156,7 @@ type VoteBuilderOptions = {
|
|
|
154
156
|
*/
|
|
155
157
|
fee?: FeeAmountAndToken;
|
|
156
158
|
};
|
|
157
|
-
|
|
159
|
+
declare class VoteLikeBase {
|
|
158
160
|
#private;
|
|
159
161
|
readonly issuer: Account;
|
|
160
162
|
readonly serial: bigint;
|
|
@@ -163,6 +165,8 @@ export declare class PossiblyExpiredVote {
|
|
|
163
165
|
readonly validityTo: Date;
|
|
164
166
|
readonly signature: ArrayBuffer;
|
|
165
167
|
readonly fee: FeeAmountAndToken | undefined;
|
|
168
|
+
readonly quote: boolean | undefined;
|
|
169
|
+
protected static expectedQuoteValue: boolean;
|
|
166
170
|
readonly $trusted: boolean;
|
|
167
171
|
readonly $permanent: boolean;
|
|
168
172
|
readonly $uid: string;
|
|
@@ -170,12 +174,14 @@ export declare class PossiblyExpiredVote {
|
|
|
170
174
|
protected static allowedSlop: number;
|
|
171
175
|
protected static permanentVoteThreshold: number;
|
|
172
176
|
static Staple: typeof VoteStaple;
|
|
173
|
-
static Builder: typeof
|
|
177
|
+
static Builder: typeof BaseVoteBuilder;
|
|
174
178
|
static readonly VoteBlocksHash: typeof VoteBlockHash;
|
|
175
|
-
static
|
|
179
|
+
static Quote: typeof VoteQuote;
|
|
180
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteLikeBase;
|
|
181
|
+
protected getClass<T extends typeof VoteLikeBase>(): T;
|
|
176
182
|
static isValidJSON(voteJSON: VoteJSON | VoteJSONOutput): voteJSON is VoteJSON | VoteJSONOutput;
|
|
177
|
-
static fromJSON(voteJSON: VoteJSON | VoteJSONOutput, options?: VoteOptions):
|
|
178
|
-
constructor(vote: Buffer | ArrayBuffer |
|
|
183
|
+
static fromJSON<T extends typeof VoteLikeBase = typeof VoteLikeBase>(this: T, voteJSON: VoteJSON | VoteJSONOutput, options?: VoteOptions): InstanceType<T>;
|
|
184
|
+
constructor(vote: Buffer | ArrayBuffer | VoteLikeBase | Uint8Array | string | VoteJSON | VoteJSONOutput, options?: VoteOptions);
|
|
179
185
|
toBytes(): ArrayBuffer;
|
|
180
186
|
get hash(): VoteHash;
|
|
181
187
|
get blocksHash(): VoteBlockHash;
|
|
@@ -183,6 +189,7 @@ export declare class PossiblyExpiredVote {
|
|
|
183
189
|
toJSON(options?: ToJSONSerializableOptions): {
|
|
184
190
|
$binary?: string;
|
|
185
191
|
fee?: FeeAmountAndTokenJSON;
|
|
192
|
+
quote?: boolean;
|
|
186
193
|
issuer: Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
|
|
187
194
|
serial: bigint;
|
|
188
195
|
blocks: BlockHash[];
|
|
@@ -197,21 +204,36 @@ export declare class PossiblyExpiredVote {
|
|
|
197
204
|
protected expirationCheckMoment(): number;
|
|
198
205
|
get expired(): boolean;
|
|
199
206
|
}
|
|
207
|
+
export declare class PossiblyExpiredVote extends VoteLikeBase {
|
|
208
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is PossiblyExpiredVote;
|
|
209
|
+
constructor(vote: Buffer | ArrayBuffer | VoteLikeBase | string | VoteJSON | VoteJSONOutput, options?: VoteOptions);
|
|
210
|
+
}
|
|
200
211
|
/**
|
|
201
212
|
* A vote is a certificate issued indicating that the issuer "vouches" for the
|
|
202
213
|
* blocks specified will fit into the ledger of the operator/issuer.
|
|
203
214
|
*/
|
|
204
215
|
export declare class Vote extends PossiblyExpiredVote {
|
|
216
|
+
static Builder: typeof VoteBuilder;
|
|
205
217
|
readonly possiblyExpired = false;
|
|
206
|
-
static isInstance: (obj: any, strict?: boolean) => obj is Vote;
|
|
207
|
-
constructor(vote: Buffer | ArrayBuffer |
|
|
218
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is Vote;
|
|
219
|
+
constructor(vote: Buffer | ArrayBuffer | VoteLikeBase | string | VoteJSON | VoteJSONOutput, options?: VoteOptions);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* A VoteQuote is a certificate issued indicating what the issuer will charge for fees
|
|
223
|
+
*/
|
|
224
|
+
export declare class VoteQuote extends VoteLikeBase {
|
|
225
|
+
static Builder: typeof VoteQuoteBuilder;
|
|
226
|
+
protected static expectedQuoteValue: boolean;
|
|
227
|
+
readonly isVoteQuote = true;
|
|
228
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteQuote;
|
|
229
|
+
constructor(vote: Buffer | ArrayBuffer | VoteLikeBase | string | VoteJSON | VoteJSONOutput, options?: VoteOptions);
|
|
208
230
|
}
|
|
209
231
|
/**
|
|
210
232
|
* A vote staple is a distributable block consisting of one or more blocks
|
|
211
233
|
* and one or more votes.
|
|
212
234
|
*/
|
|
213
235
|
declare class VoteStapleHash extends BufferStorage {
|
|
214
|
-
static isInstance: (obj: any, strict?: boolean) => obj is VoteStapleHash;
|
|
236
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteStapleHash;
|
|
215
237
|
readonly storageKind = "VoteStapleHash";
|
|
216
238
|
get hashFunctionName(): string;
|
|
217
239
|
constructor(stapleHash: ConstructorParameters<typeof BufferStorage>[0]);
|
|
@@ -230,7 +252,7 @@ export declare class VoteBlockBundle {
|
|
|
230
252
|
readonly votes: Vote[];
|
|
231
253
|
readonly blocks: Block[];
|
|
232
254
|
static readonly VoteBlockHash: typeof VoteBlockHash;
|
|
233
|
-
static isInstance: (obj: any, strict?: boolean) => obj is VoteBlockBundle;
|
|
255
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteBlockBundle;
|
|
234
256
|
/**
|
|
235
257
|
* Construct a new vote bundle from votes and blocks
|
|
236
258
|
*/
|
|
@@ -283,6 +305,7 @@ export declare class VoteBlockBundle {
|
|
|
283
305
|
votes: {
|
|
284
306
|
$binary?: string;
|
|
285
307
|
fee?: FeeAmountAndTokenJSON;
|
|
308
|
+
quote?: boolean;
|
|
286
309
|
issuer: Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
|
|
287
310
|
serial: bigint;
|
|
288
311
|
blocks: BlockHash[];
|
|
@@ -296,12 +319,14 @@ export declare class VoteBlockBundle {
|
|
|
296
319
|
}[];
|
|
297
320
|
blocks: {
|
|
298
321
|
$binary?: string;
|
|
299
|
-
|
|
322
|
+
signature?: string;
|
|
323
|
+
signatures?: string[];
|
|
324
|
+
version: 1 | 2;
|
|
300
325
|
date: Date;
|
|
301
326
|
previous: BlockHash;
|
|
302
327
|
account: import("./account").GenericAccount;
|
|
303
|
-
|
|
304
|
-
|
|
328
|
+
purpose: import("./block").BlockPurpose;
|
|
329
|
+
signer: Account | [import("./account").MultisigAddress, any[]];
|
|
305
330
|
network: bigint;
|
|
306
331
|
subnet: bigint | undefined;
|
|
307
332
|
operations: import("./block/operations").ExportedJSONOperation[];
|
|
@@ -311,12 +336,13 @@ export declare class VoteBlockBundle {
|
|
|
311
336
|
};
|
|
312
337
|
}
|
|
313
338
|
export declare class VoteStaple extends VoteBlockBundle {
|
|
314
|
-
static isInstance: (obj: any, strict?: boolean) => obj is VoteStaple;
|
|
339
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteStaple;
|
|
315
340
|
constructor(votesStapled: ArrayBuffer | Buffer | VoteStapleJSON | string, voteOptions?: VoteOptions);
|
|
316
341
|
}
|
|
317
|
-
export declare class
|
|
342
|
+
export declare class BaseVoteBuilder {
|
|
318
343
|
#private;
|
|
319
|
-
|
|
344
|
+
protected quote: boolean;
|
|
345
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is BaseVoteBuilder;
|
|
320
346
|
constructor(account: Account, blocks?: (Block | BlockHash)[], options?: VoteBuilderOptions);
|
|
321
347
|
addBlocks(blocks: (Block | BlockHash | string)[]): void;
|
|
322
348
|
addBlock(block: Block | BlockHash | string): void;
|
|
@@ -326,7 +352,16 @@ export declare class VoteBuilder {
|
|
|
326
352
|
tbsCertificate: CertificateSchema;
|
|
327
353
|
signatureInfo: CertificateOID[];
|
|
328
354
|
};
|
|
329
|
-
createVote(voteData: ArrayBuffer, tbsCertificate: CertificateSchema, signatureInfo: CertificateOID[], signature: BufferStorage
|
|
355
|
+
createVote(voteData: ArrayBuffer, tbsCertificate: CertificateSchema, signatureInfo: CertificateOID[], signature: BufferStorage): ArrayBuffer;
|
|
356
|
+
protected generate(serial: bigint, validTo: Date | null, validFrom?: Date): Promise<ArrayBuffer>;
|
|
357
|
+
}
|
|
358
|
+
export declare class VoteBuilder extends BaseVoteBuilder {
|
|
359
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteBuilder;
|
|
330
360
|
seal(serial: bigint, validTo: Date | null, validFrom?: Date, voteOptions?: VoteOptions): Promise<Vote>;
|
|
331
361
|
}
|
|
362
|
+
export declare class VoteQuoteBuilder extends BaseVoteBuilder {
|
|
363
|
+
static readonly isInstance: (obj: any, strict?: boolean) => obj is VoteQuoteBuilder;
|
|
364
|
+
protected quote: boolean;
|
|
365
|
+
seal(serial: bigint, validTo: Date | null, validFrom?: Date, voteOptions?: VoteOptions): Promise<VoteQuote>;
|
|
366
|
+
}
|
|
332
367
|
export default Vote;
|
package/package.json
CHANGED
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "0.
|
|
1
|
+
export declare const version = "0.14.0+g8b0bdc16c0cba85135437a9ffb3a8cea2dae170d";
|
|
2
2
|
export default version;
|