@keetanetwork/keetanet-client 0.14.13 → 0.16.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/client/builder.d.ts +29 -3
- package/client/index-browser.d.ts +24 -6
- package/client/index-browser.js +3426 -2704
- package/client/index.d.ts +24 -6
- package/client/index.js +1107 -501
- package/config/index.d.ts +3 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/KeetaNetSDK.Client.html +6 -5
- package/docs/classes/KeetaNetSDK.Referenced.Account.html +13 -13
- package/docs/classes/KeetaNetSDK.Referenced.BaseSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BaseVoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.Block.html +33 -30
- package/docs/classes/KeetaNetSDK.Referenced.BlockBuilder.html +2 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockHash.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperation.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationRECEIVE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSEND.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_INFO.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationSET_REP.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.BlockOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.Certificate.html +11 -5
- package/docs/classes/KeetaNetSDK.Referenced.CertificateBundle.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.CertificateHash.html +3 -2
- 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 +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256K1Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PrivateKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ECDSASECP256R1Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519KeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PrivateKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519PublicKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ED25519Signature.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.ExternalKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.ExternalSet.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.IdempotentKey.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKey.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.IdentifierKeyPair.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetError.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetErrorBase.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerIdempotentKeyError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeetaNetLedgerVoteError.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyInterface.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.KeyStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.Log.html +15 -3
- package/docs/classes/KeetaNetSDK.Referenced.LogTargetConsole.html +3 -2
- package/docs/classes/KeetaNetSDK.Referenced.Node.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.P2PSwitch.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.PendingAccount.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PermissionSetHolder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyExpiredVote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.PossiblyUnsignedBlock.html +38 -0
- package/docs/classes/KeetaNetSDK.Referenced.SignatureStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.Stats.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.StatsPending.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.UnsignedBlock.html +42 -0
- package/docs/classes/KeetaNetSDK.Referenced.UserClientBuilder.html +13 -1
- package/docs/classes/KeetaNetSDK.Referenced.Vote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockBundle.html +11 -9
- package/docs/classes/KeetaNetSDK.Referenced.VoteBlockHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteLikeBase.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuote.html +2 -2
- package/docs/classes/KeetaNetSDK.Referenced.VoteQuoteBuilder.html +1 -1
- package/docs/classes/KeetaNetSDK.Referenced.VoteStaple.html +10 -8
- package/docs/classes/KeetaNetSDK.Referenced.VoteStapleHash.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer.BufferStorage.html +4 -2
- package/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBuilder.html +4 -2
- package/docs/classes/KeetaNetSDK.UserClient.html +19 -11
- package/docs/documents/GETTING-STARTED.html +2 -2
- package/docs/enums/KeetaNetSDK.Referenced.AdjustMethod.html +4 -4
- package/docs/enums/KeetaNetSDK.Referenced.OperationType.html +10 -10
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase32.html +2 -2
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.DecodeBase64URL.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_buffer.EncodeBase64URL.html +1 -0
- package/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_conversion.toJSONSerializable.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ACLUpdate.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ExplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1ImplicitContextTag.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.ASN1Object.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseExternalKeyPairFunctions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseGenerationConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BaseIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperation.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationCREATE_IDENTIFIER.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMODIFY_PERMISSIONS.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationRECEIVE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSEND.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_INFO.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationSET_REP.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationTOKEN_ADMIN_SUPPLY.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockOperationValidateContext.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV1Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockV2Canonical.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.Constructor.html +1 -1
- 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.IdentifierCreateRequest.html +3 -2
- 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.LogTarget.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.ModifyTokenBalanceEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultiSigIdentifierCreateArguments.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.MultisigConfig.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.NodeConfig.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.NumericValueEntry.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerListener.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.P2PPeerRepBase.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperations.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PendingOperationsJSON.html +2 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublicKeyStorage.html +3 -2
- package/docs/interfaces/KeetaNetSDK.Referenced.PublishOptions.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 +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.UserClientOptions.html +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.VoteBundleConstructor.html +2 -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_asn1.ASN1Struct.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_buffer.html +1 -1
- package/docs/modules/KeetaNetSDK.Referenced.src_lib_utils_certificate.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.BlockJSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV1JSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.BlockV2JSONOptionalSigned.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.CertificateUpdate.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.IsTuple.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.JSONDepthLimit.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyUsage.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.KeyUsageBits.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.LogTargetConsoleConfig.html +3 -2
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerFieldJSON.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.VoteOptions.html +7 -3
- package/docs/types/KeetaNetSDK.Referenced.VoteStapleInputs.html +2 -0
- package/docs/types/KeetaNetSDK.Referenced.VoteStapleOptions.html +9 -0
- package/docs/types/KeetaNetSDK.Referenced.src_config.NetworkConfig.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateBundleJSONOutput.html +1 -0
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_certificate.CertificateJSONOutput.html +1 -1
- package/docs/types/KeetaNetSDK.Referenced.src_lib_utils_conversion.ToJSONSerializable.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.BlockOperationASN1Schema.html +2 -2
- package/docs/variables/KeetaNetSDK.Referenced.allFullErrorCodes.html +1 -1
- package/docs/variables/KeetaNetSDK.Referenced.keyUsageBits.html +1 -0
- package/lib/block/index.d.ts +341 -46
- package/lib/block/operations.d.ts +14 -21
- package/lib/error/block.d.ts +2 -2
- package/lib/error/index.d.ts +1 -1
- package/lib/ledger/common.d.ts +3 -0
- package/lib/ledger/db_spanner_helper.d.ts +1 -1
- package/lib/log/common.d.ts +3 -0
- package/lib/log/index.d.ts +20 -0
- package/lib/log/internal.d.ts +22 -0
- package/lib/log/target_console.d.ts +6 -0
- package/lib/log/target_gcp.d.ts +6 -0
- package/lib/log/target_gcp.js +259 -77
- package/lib/log/target_https.d.ts +28 -0
- package/lib/log/target_https.js +6055 -0
- package/lib/p2p.d.ts +6 -2
- package/lib/utils/buffer.d.ts +8 -2
- package/lib/utils/certificate.d.ts +41 -25
- package/lib/utils/conversion.d.ts +8 -4
- package/lib/utils/external-keys/passkey-prf.d.ts +156 -0
- package/lib/utils/external-keys/passkey-prf.js +391 -0
- package/lib/vote.d.ts +230 -35
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/version.d.ts +1 -1
- package/docs/interfaces/KeetaNetSDK.Referenced.BlockJSONOperationMANAGE_CERTIFICATESerializable.html +0 -5
- package/docs/types/KeetaNetSDK.Referenced.ExportedJSONOperation.html +0 -1
- package/docs/types/KeetaNetSDK.Referenced.MultisigSignerField.html +0 -1
package/lib/block/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GenericAccount, MultisigAddress } from '../account';
|
|
|
2
2
|
import Account, { AccountKeyAlgorithm } from '../account';
|
|
3
3
|
import { BufferStorage } from '../utils/buffer';
|
|
4
4
|
import * as ASN1 from '../utils/asn1';
|
|
5
|
-
import type
|
|
5
|
+
import { type ToJSONSerializable, type ToJSONSerializableOptions } from '../utils/conversion';
|
|
6
6
|
import * as Operations from './operations';
|
|
7
7
|
export declare enum BlockPurpose {
|
|
8
8
|
GENERIC = 0,
|
|
@@ -63,6 +63,9 @@ export interface BlockV1JSON {
|
|
|
63
63
|
purpose?: BlockPurpose.GENERIC;
|
|
64
64
|
}
|
|
65
65
|
export type BlockV1JSONIncomplete = Partial<BlockV1JSON>;
|
|
66
|
+
type BlockV1JSONOptionalSigned = Omit<BlockV1JSON, 'signature'> & {
|
|
67
|
+
signature?: BlockV1JSON['signature'];
|
|
68
|
+
};
|
|
66
69
|
/**
|
|
67
70
|
* Output of block suitable to JSON serialization
|
|
68
71
|
*/
|
|
@@ -83,12 +86,22 @@ export interface BlockV2JSON {
|
|
|
83
86
|
signatures: (string | BlockSignature)[];
|
|
84
87
|
}
|
|
85
88
|
export type BlockV2JSONIncomplete = Partial<BlockV2JSON>;
|
|
89
|
+
type BlockV2JSONOptionalSigned = Omit<BlockV2JSON, 'signatures'> & {
|
|
90
|
+
signatures?: BlockV2JSON['signatures'];
|
|
91
|
+
};
|
|
86
92
|
export type BlockJSONOutput = ReturnType<Block['toJSON']>;
|
|
87
93
|
export type BlockJSONOutputSerialized = ToJSONSerializable<BlockJSONOutput>;
|
|
88
94
|
export type BlockJSONOutputIncomplete = Partial<BlockJSONOutputSerialized>;
|
|
89
95
|
export type BlockJSON = (Omit<BlockV1JSON, 'version'> | Omit<BlockV2JSON, 'version'>) & {
|
|
90
96
|
version: number;
|
|
91
97
|
};
|
|
98
|
+
export type BlockJSONOptionalSigned = ((Omit<BlockV1JSON, 'version' | 'signature'> & {
|
|
99
|
+
signature?: BlockV1JSON['signature'];
|
|
100
|
+
}) | (Omit<BlockV2JSON, 'version' | 'signatures'> & {
|
|
101
|
+
signatures?: BlockV2JSON['signatures'];
|
|
102
|
+
})) & {
|
|
103
|
+
version: number;
|
|
104
|
+
};
|
|
92
105
|
export type BlockJSONIncomplete = Partial<BlockJSON>;
|
|
93
106
|
/**
|
|
94
107
|
* Map input to our values
|
|
@@ -127,7 +140,7 @@ interface BlockV2Canonical extends Omit<BlockV2UnsignedCanonical, 'signatures'>
|
|
|
127
140
|
type OmitLastArrayValue<T> = Required<T> extends [...infer Head, any] ? Head : never;
|
|
128
141
|
type BlockV1ASN1WithoutSignature = ASN1.ValidateASN1.SchemaMap<OmitLastArrayValue<typeof BlockV1ASN1Schema>>;
|
|
129
142
|
type BlockV2ASN1WithoutSignature = ASN1.ValidateASN1.SchemaMap<OmitLastArrayValue<typeof BlockV2ASN1Schema.contains>>;
|
|
130
|
-
type MultisigSignerFieldJSON = [MultisigAddress | string, (
|
|
143
|
+
type MultisigSignerFieldJSON = [MultisigAddress | string, (MultisigSignerFieldJSON | Account | string)[]];
|
|
131
144
|
type BlockSignerFieldJSON = Account | string | MultisigSignerFieldJSON;
|
|
132
145
|
type BlockASN1SchemaWithoutSignature = BlockV1ASN1WithoutSignature | {
|
|
133
146
|
type: 'context';
|
|
@@ -135,16 +148,14 @@ type BlockASN1SchemaWithoutSignature = BlockV1ASN1WithoutSignature | {
|
|
|
135
148
|
value: 1;
|
|
136
149
|
contains: BlockV2ASN1WithoutSignature;
|
|
137
150
|
};
|
|
138
|
-
type MultisigSignerField = [MultisigAddress, (MultisigSignerField | Account)[]];
|
|
139
151
|
type BlockSignerField = Account | [MultisigAddress, BlockSignerField[]];
|
|
140
152
|
type BlockSignatureField = [BlockSignature, ...BlockSignature[]];
|
|
141
153
|
/**
|
|
142
154
|
* Block: An item which contains a number of operations (transactions) which
|
|
143
155
|
* originated from an account at a particular instant
|
|
144
156
|
*/
|
|
145
|
-
|
|
157
|
+
declare abstract class PossiblyUnsignedBlock<HasSignature extends boolean> implements Omit<BlockV2Canonical, 'version' | 'signatures'> {
|
|
146
158
|
#private;
|
|
147
|
-
static isInstance: (obj: any, strict?: boolean) => obj is Block;
|
|
148
159
|
static readonly Hash: typeof BlockHash;
|
|
149
160
|
static readonly OperationType: typeof Operations.OperationType;
|
|
150
161
|
static readonly Operation: {
|
|
@@ -172,35 +183,176 @@ export declare class Block implements Omit<BlockV2Canonical, 'version'> {
|
|
|
172
183
|
readonly network: NetworkID;
|
|
173
184
|
readonly subnet: SubnetID | undefined;
|
|
174
185
|
readonly signer: BlockSignerField;
|
|
175
|
-
readonly signatures: BlockSignatureField;
|
|
176
|
-
get principal(): Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1
|
|
186
|
+
readonly signatures: HasSignature extends true ? BlockSignatureField : null;
|
|
187
|
+
get principal(): MultisigAddress | Account<AccountKeyAlgorithm.ECDSA_SECP256K1 | AccountKeyAlgorithm.ED25519 | AccountKeyAlgorithm.ECDSA_SECP256R1>;
|
|
188
|
+
protected static getSortedRequiredSigners(input: BlockSignerField): Account[];
|
|
177
189
|
readonly $opening: boolean;
|
|
178
|
-
static
|
|
179
|
-
static isValidJSON<Version extends 1 | 2>(block: unknown, version?: Version): block is ({
|
|
190
|
+
protected static isValidJSONSignedOrUnsigned<AssertSignatureField extends boolean, Version extends 1 | 2>(assertSignatureIncluded: AssertSignatureField, block: unknown, version?: Version): block is AssertSignatureField extends true ? ({
|
|
180
191
|
1: BlockV1JSON;
|
|
181
192
|
2: BlockV2JSON;
|
|
193
|
+
}[Version]) : ({
|
|
194
|
+
1: BlockV1JSONOptionalSigned;
|
|
195
|
+
2: BlockV2JSONOptionalSigned;
|
|
182
196
|
}[Version]);
|
|
183
|
-
constructor(input: Buffer | ArrayBuffer | BlockJSON | BlockJSONOutput | BlockJSONOutputSerialized | Block | string);
|
|
197
|
+
constructor(input: Buffer | ArrayBuffer | BlockJSON | BlockJSONOptionalSigned | BlockJSONOutput | BlockJSONOutputSerialized | UnsignedBlock | Block | string, hasSignature: HasSignature);
|
|
184
198
|
static getAccountOpeningHash(account: GenericAccount): BlockHash;
|
|
185
|
-
toBytes(includeSignatures?:
|
|
199
|
+
toBytes(includeSignatures?: HasSignature): ArrayBuffer;
|
|
186
200
|
protected static getV1ASN1ContainerWithoutSignature(input: BlockV1UnsignedCanonical | BlockV1Canonical): BlockV1ASN1WithoutSignature;
|
|
187
201
|
protected static getV2ASN1ContainerWithoutSignature(input: BlockV2UnsignedCanonical | BlockV2Canonical): BlockV2ASN1WithoutSignature;
|
|
188
|
-
protected static getASN1ContainerWithoutSignature(input: BlockV1UnsignedCanonical
|
|
202
|
+
protected static getASN1ContainerWithoutSignature(input: Omit<BlockV1UnsignedCanonical, 'signature'> | Omit<BlockV2UnsignedCanonical, 'signatures'>): BlockASN1SchemaWithoutSignature;
|
|
189
203
|
toJSON(options?: ToJSONSerializableOptions): {
|
|
190
|
-
$binary?: string;
|
|
191
|
-
signature?: string;
|
|
192
|
-
signatures?: string[];
|
|
204
|
+
$binary?: string | undefined;
|
|
205
|
+
signature?: string | undefined;
|
|
206
|
+
signatures?: string[] | undefined;
|
|
193
207
|
version: 1 | 2;
|
|
194
208
|
idempotent: string | undefined;
|
|
195
|
-
date:
|
|
196
|
-
previous:
|
|
197
|
-
account:
|
|
209
|
+
date: string;
|
|
210
|
+
previous: BlockHashString;
|
|
211
|
+
account: import("../account").TokenPublicKeyString | import("../account").NetworkPublicKeyString | import("../account").StoragePublicKeyString | import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
198
212
|
purpose: BlockPurpose;
|
|
199
|
-
signer:
|
|
200
|
-
network:
|
|
201
|
-
subnet:
|
|
202
|
-
operations:
|
|
203
|
-
|
|
213
|
+
signer: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | [import("../account").MultisigPublicKeyString, (import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | [import("../account").MultisigPublicKeyString, (import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | [import("../account").MultisigPublicKeyString, (import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | [import("../account").MultisigPublicKeyString, (import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | [never, never[]])[]])[]])[]])[]];
|
|
214
|
+
network: string;
|
|
215
|
+
subnet: string | undefined;
|
|
216
|
+
operations: ({
|
|
217
|
+
type: Operations.OperationType.SEND;
|
|
218
|
+
to: string;
|
|
219
|
+
amount: string;
|
|
220
|
+
token: import("../account").TokenPublicKeyString;
|
|
221
|
+
external?: string | undefined;
|
|
222
|
+
} | {
|
|
223
|
+
type: Operations.OperationType.SET_REP;
|
|
224
|
+
to: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: Operations.OperationType.SET_INFO;
|
|
227
|
+
name: string;
|
|
228
|
+
description: string;
|
|
229
|
+
metadata: string;
|
|
230
|
+
defaultPermission?: false | [string, number[]] | [string, string] | [number[] | import("../permissions").BaseFlagNames, number[]] | undefined;
|
|
231
|
+
} | {
|
|
232
|
+
type: Operations.OperationType.MODIFY_PERMISSIONS;
|
|
233
|
+
principal: string;
|
|
234
|
+
method: AdjustMethod;
|
|
235
|
+
permissions: false | [string, number[]] | [string, string] | [number[] | import("../permissions").BaseFlagNames, number[]] | null;
|
|
236
|
+
target?: string | undefined;
|
|
237
|
+
} | {
|
|
238
|
+
type: Operations.OperationType.CREATE_IDENTIFIER;
|
|
239
|
+
identifier: string;
|
|
240
|
+
createArguments?: {
|
|
241
|
+
type: AccountKeyAlgorithm.MULTISIG;
|
|
242
|
+
signers: (import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString)[];
|
|
243
|
+
quorum: string;
|
|
244
|
+
} | {
|
|
245
|
+
type: AccountKeyAlgorithm.MULTISIG;
|
|
246
|
+
signers: (import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString)[];
|
|
247
|
+
quorum: string;
|
|
248
|
+
} | undefined;
|
|
249
|
+
} | {
|
|
250
|
+
type: Operations.OperationType.TOKEN_ADMIN_SUPPLY;
|
|
251
|
+
amount: string;
|
|
252
|
+
method: AdjustMethod.ADD | AdjustMethod.SUBTRACT;
|
|
253
|
+
} | {
|
|
254
|
+
type: Operations.OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
|
|
255
|
+
token: import("../account").TokenPublicKeyString;
|
|
256
|
+
amount: string;
|
|
257
|
+
method: AdjustMethod;
|
|
258
|
+
} | {
|
|
259
|
+
type: Operations.OperationType.RECEIVE;
|
|
260
|
+
amount: string;
|
|
261
|
+
token: import("../account").TokenPublicKeyString;
|
|
262
|
+
from: string;
|
|
263
|
+
forward?: string | undefined;
|
|
264
|
+
exact?: boolean | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
type: Operations.OperationType.MANAGE_CERTIFICATE;
|
|
267
|
+
certificateOrHash: string | (string & {
|
|
268
|
+
readonly __certificateHash: never;
|
|
269
|
+
}) | {
|
|
270
|
+
$binary?: string | undefined;
|
|
271
|
+
$chain?: undefined;
|
|
272
|
+
serial: string;
|
|
273
|
+
notBefore: string;
|
|
274
|
+
notAfter: string;
|
|
275
|
+
subject: string;
|
|
276
|
+
issuer: string;
|
|
277
|
+
subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
278
|
+
baseExtensions: {
|
|
279
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
|
|
280
|
+
keyUsage?: {
|
|
281
|
+
digitalSignature?: boolean | undefined;
|
|
282
|
+
nonRepudiation?: boolean | undefined;
|
|
283
|
+
keyEncipherment?: boolean | undefined;
|
|
284
|
+
dataEncipherment?: boolean | undefined;
|
|
285
|
+
keyAgreement?: boolean | undefined;
|
|
286
|
+
keyCertSign?: boolean | undefined;
|
|
287
|
+
cRLSign?: boolean | undefined;
|
|
288
|
+
encipherOnly?: boolean | undefined;
|
|
289
|
+
decipherOnly?: boolean | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
subjectKeyIdentifier?: string | undefined;
|
|
292
|
+
authorityKeyIdentifier?: {
|
|
293
|
+
type: "context";
|
|
294
|
+
value: 0;
|
|
295
|
+
contains: string;
|
|
296
|
+
} | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
subjectDN: {
|
|
299
|
+
name: string;
|
|
300
|
+
value: string;
|
|
301
|
+
}[];
|
|
302
|
+
issuerDN: {
|
|
303
|
+
name: string;
|
|
304
|
+
value: string;
|
|
305
|
+
}[];
|
|
306
|
+
$hash: string & {
|
|
307
|
+
readonly __certificateHash: never;
|
|
308
|
+
};
|
|
309
|
+
} | {
|
|
310
|
+
$binary?: string | undefined;
|
|
311
|
+
$chain?: undefined;
|
|
312
|
+
serial: string;
|
|
313
|
+
notBefore: string;
|
|
314
|
+
notAfter: string;
|
|
315
|
+
subject: string;
|
|
316
|
+
issuer: string;
|
|
317
|
+
subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
318
|
+
baseExtensions: {
|
|
319
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
|
|
320
|
+
keyUsage?: {
|
|
321
|
+
digitalSignature?: boolean | undefined;
|
|
322
|
+
nonRepudiation?: boolean | undefined;
|
|
323
|
+
keyEncipherment?: boolean | undefined;
|
|
324
|
+
dataEncipherment?: boolean | undefined;
|
|
325
|
+
keyAgreement?: boolean | undefined;
|
|
326
|
+
keyCertSign?: boolean | undefined;
|
|
327
|
+
cRLSign?: boolean | undefined;
|
|
328
|
+
encipherOnly?: boolean | undefined;
|
|
329
|
+
decipherOnly?: boolean | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
subjectKeyIdentifier?: string | undefined;
|
|
332
|
+
authorityKeyIdentifier?: {
|
|
333
|
+
type: "context";
|
|
334
|
+
value: 0;
|
|
335
|
+
contains: string;
|
|
336
|
+
} | undefined;
|
|
337
|
+
} | undefined;
|
|
338
|
+
subjectDN: {
|
|
339
|
+
name: string;
|
|
340
|
+
value: string;
|
|
341
|
+
}[];
|
|
342
|
+
issuerDN: {
|
|
343
|
+
name: string;
|
|
344
|
+
value: string;
|
|
345
|
+
}[];
|
|
346
|
+
$hash: string & {
|
|
347
|
+
readonly __certificateHash: never;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
intermediateCertificates?: string | {
|
|
351
|
+
certificates: string[];
|
|
352
|
+
} | null | undefined;
|
|
353
|
+
method: Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
354
|
+
})[];
|
|
355
|
+
$hash: BlockHashString;
|
|
204
356
|
$opening: boolean;
|
|
205
357
|
};
|
|
206
358
|
/**
|
|
@@ -213,6 +365,26 @@ export declare class Block implements Omit<BlockV2Canonical, 'version'> {
|
|
|
213
365
|
*/
|
|
214
366
|
get hash(): BlockHash;
|
|
215
367
|
}
|
|
368
|
+
export declare class UnsignedBlock extends PossiblyUnsignedBlock<false> implements Omit<BlockV2Canonical, 'version' | 'signatures'> {
|
|
369
|
+
static isInstance: (obj: any, strict?: boolean) => obj is UnsignedBlock;
|
|
370
|
+
constructor(input: ConstructorParameters<typeof PossiblyUnsignedBlock>[0]);
|
|
371
|
+
static isValidJSON<Version extends 1 | 2>(block: unknown, version?: Version): block is ({
|
|
372
|
+
1: Omit<BlockV1JSON, 'signature'>;
|
|
373
|
+
2: Omit<BlockV2JSON, 'signatures'>;
|
|
374
|
+
}[Version]);
|
|
375
|
+
static fromUnsignedJSON(input: BlockV1UnsignedCanonical | BlockV2UnsignedCanonical): Promise<UnsignedBlock>;
|
|
376
|
+
seal(): Promise<Block>;
|
|
377
|
+
}
|
|
378
|
+
export declare class Block extends PossiblyUnsignedBlock<true> implements Omit<BlockV2Canonical, 'version'> {
|
|
379
|
+
static isInstance: (obj: any, strict?: boolean) => obj is Block;
|
|
380
|
+
constructor(input: ConstructorParameters<typeof PossiblyUnsignedBlock>[0]);
|
|
381
|
+
static isValidJSON<Version extends 1 | 2>(block: unknown, version?: Version): block is ({
|
|
382
|
+
1: BlockV1JSON;
|
|
383
|
+
2: BlockV2JSON;
|
|
384
|
+
}[Version]);
|
|
385
|
+
static fromUnsignedJSON(input: Omit<BlockV1UnsignedCanonical, 'signature'> | Omit<BlockV2UnsignedCanonical, 'signatures'>): Promise<Block>;
|
|
386
|
+
getUnsignedBlock(): UnsignedBlock;
|
|
387
|
+
}
|
|
216
388
|
export declare class BlockBuilder {
|
|
217
389
|
#private;
|
|
218
390
|
static isInstance: (obj: any, strict?: boolean) => obj is BlockBuilder;
|
|
@@ -235,34 +407,157 @@ export declare class BlockBuilder {
|
|
|
235
407
|
protected get currentWIP(): BlockJSONIncomplete;
|
|
236
408
|
protected get currentBlockSealed(): Block;
|
|
237
409
|
toJSON(opts?: ToJSONSerializableOptions): {
|
|
238
|
-
$binary?: string;
|
|
239
|
-
signature?: string;
|
|
240
|
-
signatures?: string[];
|
|
241
|
-
version: 1 | 2;
|
|
242
|
-
idempotent: string | undefined;
|
|
243
|
-
date: Date;
|
|
244
|
-
previous: BlockHash;
|
|
245
|
-
account: GenericAccount;
|
|
246
|
-
purpose: BlockPurpose;
|
|
247
|
-
signer: Account | [MultisigAddress, any[]];
|
|
248
|
-
network: bigint;
|
|
249
|
-
subnet: bigint | undefined;
|
|
250
|
-
operations: Operations.ExportedJSONOperation[];
|
|
251
|
-
$hash: BlockHash;
|
|
252
|
-
$opening: boolean;
|
|
253
|
-
} | {
|
|
254
410
|
version: number | undefined;
|
|
255
411
|
idempotent: string | undefined;
|
|
256
|
-
date:
|
|
257
|
-
previous:
|
|
258
|
-
account:
|
|
259
|
-
signer:
|
|
260
|
-
network:
|
|
261
|
-
subnet:
|
|
262
|
-
operations:
|
|
412
|
+
date: string | undefined;
|
|
413
|
+
previous: BlockHashString | undefined;
|
|
414
|
+
account: import("../account").TokenPublicKeyString | import("../account").NetworkPublicKeyString | import("../account").StoragePublicKeyString | import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString | undefined;
|
|
415
|
+
signer: string | [string, (string | [string, (string | [string, (string | [string, (string | [string, never[]])[]])[]])[]])[]] | undefined;
|
|
416
|
+
network: string | undefined;
|
|
417
|
+
subnet: string | undefined;
|
|
418
|
+
operations: ({
|
|
419
|
+
type: Operations.OperationType.SEND;
|
|
420
|
+
to: string;
|
|
421
|
+
amount: string;
|
|
422
|
+
token: import("../account").TokenPublicKeyString;
|
|
423
|
+
external?: string | undefined;
|
|
424
|
+
} | {
|
|
425
|
+
type: Operations.OperationType.SET_REP;
|
|
426
|
+
to: string;
|
|
427
|
+
} | {
|
|
428
|
+
type: Operations.OperationType.SET_INFO;
|
|
429
|
+
name: string;
|
|
430
|
+
description: string;
|
|
431
|
+
metadata: string;
|
|
432
|
+
defaultPermission?: false | [string, number[]] | [string, string] | [number[] | import("../permissions").BaseFlagNames, number[]] | undefined;
|
|
433
|
+
} | {
|
|
434
|
+
type: Operations.OperationType.MODIFY_PERMISSIONS;
|
|
435
|
+
principal: string;
|
|
436
|
+
method: AdjustMethod;
|
|
437
|
+
permissions: false | [string, number[]] | [string, string] | [number[] | import("../permissions").BaseFlagNames, number[]] | null;
|
|
438
|
+
target?: string | undefined;
|
|
439
|
+
} | {
|
|
440
|
+
type: Operations.OperationType.CREATE_IDENTIFIER;
|
|
441
|
+
identifier: string;
|
|
442
|
+
createArguments?: {
|
|
443
|
+
type: AccountKeyAlgorithm.MULTISIG;
|
|
444
|
+
signers: (import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString)[];
|
|
445
|
+
quorum: string;
|
|
446
|
+
} | {
|
|
447
|
+
type: AccountKeyAlgorithm.MULTISIG;
|
|
448
|
+
signers: (import("../account").MultisigPublicKeyString | import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString)[];
|
|
449
|
+
quorum: string;
|
|
450
|
+
} | undefined;
|
|
451
|
+
} | {
|
|
452
|
+
type: Operations.OperationType.TOKEN_ADMIN_SUPPLY;
|
|
453
|
+
amount: string;
|
|
454
|
+
method: AdjustMethod.ADD | AdjustMethod.SUBTRACT;
|
|
455
|
+
} | {
|
|
456
|
+
type: Operations.OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
|
|
457
|
+
token: import("../account").TokenPublicKeyString;
|
|
458
|
+
amount: string;
|
|
459
|
+
method: AdjustMethod;
|
|
460
|
+
} | {
|
|
461
|
+
type: Operations.OperationType.RECEIVE;
|
|
462
|
+
amount: string;
|
|
463
|
+
token: import("../account").TokenPublicKeyString;
|
|
464
|
+
from: string;
|
|
465
|
+
forward?: string | undefined;
|
|
466
|
+
exact?: boolean | undefined;
|
|
467
|
+
} | {
|
|
468
|
+
type: Operations.OperationType.MANAGE_CERTIFICATE;
|
|
469
|
+
certificateOrHash: string | (string & {
|
|
470
|
+
readonly __certificateHash: never;
|
|
471
|
+
}) | {
|
|
472
|
+
$binary?: string | undefined;
|
|
473
|
+
$chain?: undefined;
|
|
474
|
+
serial: string;
|
|
475
|
+
notBefore: string;
|
|
476
|
+
notAfter: string;
|
|
477
|
+
subject: string;
|
|
478
|
+
issuer: string;
|
|
479
|
+
subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
480
|
+
baseExtensions: {
|
|
481
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
|
|
482
|
+
keyUsage?: {
|
|
483
|
+
digitalSignature?: boolean | undefined;
|
|
484
|
+
nonRepudiation?: boolean | undefined;
|
|
485
|
+
keyEncipherment?: boolean | undefined;
|
|
486
|
+
dataEncipherment?: boolean | undefined;
|
|
487
|
+
keyAgreement?: boolean | undefined;
|
|
488
|
+
keyCertSign?: boolean | undefined;
|
|
489
|
+
cRLSign?: boolean | undefined;
|
|
490
|
+
encipherOnly?: boolean | undefined;
|
|
491
|
+
decipherOnly?: boolean | undefined;
|
|
492
|
+
} | undefined;
|
|
493
|
+
subjectKeyIdentifier?: string | undefined;
|
|
494
|
+
authorityKeyIdentifier?: {
|
|
495
|
+
type: "context";
|
|
496
|
+
value: 0;
|
|
497
|
+
contains: string;
|
|
498
|
+
} | undefined;
|
|
499
|
+
} | undefined;
|
|
500
|
+
subjectDN: {
|
|
501
|
+
name: string;
|
|
502
|
+
value: string;
|
|
503
|
+
}[];
|
|
504
|
+
issuerDN: {
|
|
505
|
+
name: string;
|
|
506
|
+
value: string;
|
|
507
|
+
}[];
|
|
508
|
+
$hash: string & {
|
|
509
|
+
readonly __certificateHash: never;
|
|
510
|
+
};
|
|
511
|
+
} | {
|
|
512
|
+
$binary?: string | undefined;
|
|
513
|
+
$chain?: undefined;
|
|
514
|
+
serial: string;
|
|
515
|
+
notBefore: string;
|
|
516
|
+
notAfter: string;
|
|
517
|
+
subject: string;
|
|
518
|
+
issuer: string;
|
|
519
|
+
subjectPublicKey: import("../account").Secp256K1PublicKeyString | import("../account").Secp256R1PublicKeyString | import("../account").ED25519PublicKeyString;
|
|
520
|
+
baseExtensions: {
|
|
521
|
+
basicConstraints?: [ca: boolean, pathLenConstraint?: string | undefined] | undefined;
|
|
522
|
+
keyUsage?: {
|
|
523
|
+
digitalSignature?: boolean | undefined;
|
|
524
|
+
nonRepudiation?: boolean | undefined;
|
|
525
|
+
keyEncipherment?: boolean | undefined;
|
|
526
|
+
dataEncipherment?: boolean | undefined;
|
|
527
|
+
keyAgreement?: boolean | undefined;
|
|
528
|
+
keyCertSign?: boolean | undefined;
|
|
529
|
+
cRLSign?: boolean | undefined;
|
|
530
|
+
encipherOnly?: boolean | undefined;
|
|
531
|
+
decipherOnly?: boolean | undefined;
|
|
532
|
+
} | undefined;
|
|
533
|
+
subjectKeyIdentifier?: string | undefined;
|
|
534
|
+
authorityKeyIdentifier?: {
|
|
535
|
+
type: "context";
|
|
536
|
+
value: 0;
|
|
537
|
+
contains: string;
|
|
538
|
+
} | undefined;
|
|
539
|
+
} | undefined;
|
|
540
|
+
subjectDN: {
|
|
541
|
+
name: string;
|
|
542
|
+
value: string;
|
|
543
|
+
}[];
|
|
544
|
+
issuerDN: {
|
|
545
|
+
name: string;
|
|
546
|
+
value: string;
|
|
547
|
+
}[];
|
|
548
|
+
$hash: string & {
|
|
549
|
+
readonly __certificateHash: never;
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
intermediateCertificates?: string | {
|
|
553
|
+
certificates: string[];
|
|
554
|
+
} | null | undefined;
|
|
555
|
+
method: Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
556
|
+
})[] | undefined;
|
|
263
557
|
purpose: BlockPurpose;
|
|
264
558
|
$opening: boolean | undefined;
|
|
265
559
|
};
|
|
560
|
+
getUnsignedBlock(): Promise<UnsignedBlock>;
|
|
266
561
|
seal(): Promise<Block>;
|
|
267
562
|
unseal(): BlockJSONIncomplete;
|
|
268
563
|
get sealed(): boolean;
|
|
@@ -6,7 +6,7 @@ import type { AcceptedPermissionTypes } from '../permissions';
|
|
|
6
6
|
import { Permissions } from '../permissions';
|
|
7
7
|
import type { ToJSONSerializable } from '../utils/conversion';
|
|
8
8
|
import Block, { AdjustMethod } from '.';
|
|
9
|
-
import { Certificate, CertificateBundle, CertificateHash } from '../utils/certificate';
|
|
9
|
+
import { Certificate, CertificateBundle, type CertificateBundleJSONOutput, CertificateHash } from '../utils/certificate';
|
|
10
10
|
import type { MultisigConfig } from '../ledger/types';
|
|
11
11
|
/**
|
|
12
12
|
* All supported operations
|
|
@@ -180,7 +180,7 @@ export interface BlockJSONOperation {
|
|
|
180
180
|
type: OperationType;
|
|
181
181
|
}
|
|
182
182
|
interface BlockOperationValidateContext {
|
|
183
|
-
block: Block
|
|
183
|
+
block: Pick<Block, 'network' | 'account' | 'signer' | 'operations' | 'previous' | 'date'>;
|
|
184
184
|
operationIndex: number;
|
|
185
185
|
}
|
|
186
186
|
declare class BlockOperation {
|
|
@@ -211,7 +211,7 @@ declare class BlockOperationSEND extends BlockOperation implements BlockJSONOper
|
|
|
211
211
|
set amount(amount: string | bigint);
|
|
212
212
|
get amount(): bigint;
|
|
213
213
|
validate(context: BlockOperationValidateContext): void;
|
|
214
|
-
toJSON(): BlockJSONOperationSEND
|
|
214
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationSEND>;
|
|
215
215
|
}
|
|
216
216
|
export interface BlockJSONOperationRECEIVE extends BlockJSONOperation {
|
|
217
217
|
type: OperationType.RECEIVE;
|
|
@@ -237,7 +237,7 @@ declare class BlockOperationRECEIVE extends BlockOperation implements BlockJSONO
|
|
|
237
237
|
set amount(amount: string | bigint);
|
|
238
238
|
get amount(): bigint;
|
|
239
239
|
validate(context: BlockOperationValidateContext): void;
|
|
240
|
-
toJSON(): BlockJSONOperationRECEIVE
|
|
240
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationRECEIVE>;
|
|
241
241
|
}
|
|
242
242
|
export interface BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockJSONOperation {
|
|
243
243
|
type: OperationType.TOKEN_ADMIN_MODIFY_BALANCE;
|
|
@@ -257,7 +257,7 @@ declare class BlockOperationTOKEN_ADMIN_MODIFY_BALANCE extends BlockOperation im
|
|
|
257
257
|
set amount(amount: string | bigint);
|
|
258
258
|
get amount(): bigint;
|
|
259
259
|
validate(context: BlockOperationValidateContext): void;
|
|
260
|
-
toJSON(): BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE
|
|
260
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationTOKEN_ADMIN_MODIFY_BALANCE>;
|
|
261
261
|
}
|
|
262
262
|
/**
|
|
263
263
|
* SetRep operation
|
|
@@ -274,7 +274,7 @@ declare class BlockOperationSET_REP extends BlockOperation implements BlockJSONO
|
|
|
274
274
|
set to(to: string | Account);
|
|
275
275
|
get to(): Account;
|
|
276
276
|
validate(context: BlockOperationValidateContext): void;
|
|
277
|
-
toJSON(): BlockJSONOperationSET_REP
|
|
277
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationSET_REP>;
|
|
278
278
|
}
|
|
279
279
|
/**
|
|
280
280
|
* TokenCreate Operation
|
|
@@ -300,7 +300,7 @@ declare class BlockOperationCREATE_IDENTIFIER extends BlockOperation implements
|
|
|
300
300
|
set createArguments(input: IdentifierCreateArguments | ToJSONSerializable<IdentifierCreateArguments> | undefined);
|
|
301
301
|
get createArguments(): IdentifierCreateArguments | undefined;
|
|
302
302
|
validate(context: BlockOperationValidateContext): void;
|
|
303
|
-
toJSON(): BlockJSONOperationCREATE_IDENTIFIER
|
|
303
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationCREATE_IDENTIFIER>;
|
|
304
304
|
}
|
|
305
305
|
/**
|
|
306
306
|
* SetInfo operation
|
|
@@ -326,7 +326,7 @@ declare class BlockOperationSET_INFO extends BlockOperation implements BlockJSON
|
|
|
326
326
|
set defaultPermission(newPerms: Permissions | undefined);
|
|
327
327
|
get defaultPermission(): Permissions | undefined;
|
|
328
328
|
validate(context: BlockOperationValidateContext): void;
|
|
329
|
-
toJSON(): BlockJSONOperationSET_INFO
|
|
329
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationSET_INFO>;
|
|
330
330
|
}
|
|
331
331
|
/**
|
|
332
332
|
* Set Permissions Operation
|
|
@@ -352,7 +352,7 @@ declare class BlockOperationMODIFY_PERMISSIONS extends BlockOperation implements
|
|
|
352
352
|
set method(method: AdjustMethod);
|
|
353
353
|
get method(): AdjustMethod;
|
|
354
354
|
validate(context: BlockOperationValidateContext): void;
|
|
355
|
-
toJSON(): BlockJSONOperationMODIFY_PERMISSIONS
|
|
355
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationMODIFY_PERMISSIONS>;
|
|
356
356
|
}
|
|
357
357
|
/**
|
|
358
358
|
* Token Supply operation
|
|
@@ -372,21 +372,17 @@ declare class BlockOperationTOKEN_ADMIN_SUPPLY extends BlockOperation implements
|
|
|
372
372
|
set method(shouldAdd: BlockJSONOperationTOKEN_ADMIN_SUPPLY['method']);
|
|
373
373
|
get method(): BlockJSONOperationTOKEN_ADMIN_SUPPLY['method'];
|
|
374
374
|
validate(context: BlockOperationValidateContext): void;
|
|
375
|
-
toJSON(): BlockJSONOperationTOKEN_ADMIN_SUPPLY
|
|
375
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationTOKEN_ADMIN_SUPPLY>;
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
378
|
* X.509 Certificate operations
|
|
379
379
|
*/
|
|
380
380
|
export interface BlockJSONOperationMANAGE_CERTIFICATE extends BlockJSONOperation {
|
|
381
381
|
type: OperationType.MANAGE_CERTIFICATE;
|
|
382
|
-
certificateOrHash: string |
|
|
383
|
-
intermediateCertificates?: string | CertificateBundle |
|
|
382
|
+
certificateOrHash: string | CertificateHash | ConstructorParameters<typeof Certificate>[0];
|
|
383
|
+
intermediateCertificates?: string | CertificateBundle | CertificateBundleJSONOutput | null;
|
|
384
384
|
method: Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
385
385
|
}
|
|
386
|
-
export interface BlockJSONOperationMANAGE_CERTIFICATESerializable extends Omit<BlockJSONOperationMANAGE_CERTIFICATE, 'certificateOrHash' | 'intermediateCertificates'> {
|
|
387
|
-
certificateOrHash: string | Buffer;
|
|
388
|
-
intermediateCertificates?: string | Buffer | null;
|
|
389
|
-
}
|
|
390
386
|
declare class BlockOperationMANAGE_CERTIFICATE extends BlockOperation implements BlockJSONOperationMANAGE_CERTIFICATE {
|
|
391
387
|
#private;
|
|
392
388
|
type: OperationType.MANAGE_CERTIFICATE;
|
|
@@ -398,7 +394,7 @@ declare class BlockOperationMANAGE_CERTIFICATE extends BlockOperation implements
|
|
|
398
394
|
set method(shouldAdd: Exclude<AdjustMethod, AdjustMethod.SET>);
|
|
399
395
|
get method(): Exclude<AdjustMethod, AdjustMethod.SET>;
|
|
400
396
|
validate(context: BlockOperationValidateContext): void;
|
|
401
|
-
toJSON():
|
|
397
|
+
toJSON(): ToJSONSerializable<BlockJSONOperationMANAGE_CERTIFICATE>;
|
|
402
398
|
}
|
|
403
399
|
/**
|
|
404
400
|
* Aggregate set of operations
|
|
@@ -419,14 +415,11 @@ export type BlockOperations = InstanceType<typeof Operation[keyof typeof Operati
|
|
|
419
415
|
export type BlockJSONOperations = ConstructorParameters<typeof Operation[keyof typeof OperationType]>[0];
|
|
420
416
|
export declare function createBlockOperation(input: BlockJSONOperations | ToJSONSerializable<BlockJSONOperations>): BlockOperationSEND | BlockOperationSET_REP | BlockOperationSET_INFO | BlockOperationMODIFY_PERMISSIONS | BlockOperationCREATE_IDENTIFIER | BlockOperationTOKEN_ADMIN_SUPPLY | BlockOperationTOKEN_ADMIN_MODIFY_BALANCE | BlockOperationRECEIVE | BlockOperationMANAGE_CERTIFICATE;
|
|
421
417
|
export declare function isBlockOperation(input: any): input is BlockOperations;
|
|
422
|
-
export type ExportedJSONOperation = {
|
|
423
|
-
[K in keyof typeof Operation]: ToJSONSerializable<ReturnType<InstanceType<typeof Operation[K]>['toJSON']>>;
|
|
424
|
-
}[keyof typeof Operation];
|
|
425
418
|
/**
|
|
426
419
|
* Export the "operations" mapping as something compatible with being
|
|
427
420
|
* serialized to JSON
|
|
428
421
|
*/
|
|
429
|
-
export declare function ExportOperationsJSON(operations: BlockOperations[]):
|
|
422
|
+
export declare function ExportOperationsJSON(operations: BlockOperations[]): ToJSONSerializable<BlockJSONOperations>[];
|
|
430
423
|
export declare function ImportOperationsJSON(operations: (BlockOperations | BlockJSONOperations)[]): BlockOperations[];
|
|
431
424
|
export declare function ExportBlockOperations(operations: BlockOperations[]): ((Omit<import("../utils/asn1").ASN1ContextTag, "kind" | "value" | "contains"> & {
|
|
432
425
|
contains: [bigint, bigint];
|
package/lib/error/block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KeetaNetErrorBase } from './base';
|
|
2
|
-
export declare const BlockErrorCodes: readonly ["AMOUNT_BELOW_ZERO", "CANNOT_FORWARD_TO_SELF", "CANNOT_SEND_NON_TOKEN", "CERTIFICATE_SUBJECT_MISMATCH", "EXACT_TRUE_WHEN_FORWARDING", "EXTERNAL_INVALID", "EXTERNAL_MISSING", "EXTERNAL_TOO_LONG", "GENERAL_FIELD_INVALID", "IDENTIFIER_INVALID", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "INTERMEDIATE_CERTIFICATES_ONLY_ADD", "INVALID_ACCOUNT_TYPE", "INVALID_CERTIFICATE_VALUE", "INVALID_CREATE_IDENTIFIER_ARGS", "INVALID_IDEMPOTENT_FORMAT", "INVALID_IDEMPOTENT_LENGTH", "INVALID_MULTISIG_QUORUM", "INVALID_MULTISIG_SIGNER_COUNT", "INVALID_MULTISIG_SIGNER_DEPTH", "INVALID_MULTISIG_SIGNER_DUPLICATE", "INVALID_PURPOSE_VALIDATION", "INVALID_SIGNATURE", "INVALID_SIGNER", "INVALID_TYPE", "INVALID_VERSION", "NO_ADMIN_ON_TARGET", "NO_DELEGATE_ADMIN", "NO_DUPLICATE_CERTIFICATE_OPERATION", "NO_IDENTIFIER_OP", "NO_MODIFY_PERMISSION_DUPE", "NO_MULTIPLE_SET_REP", "NO_MULTISIG_OP", "NO_TOKEN_OP", "ONLY_IDENTIFIER_OP", "ONLY_TOKEN_OP", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "PREVIOUS_SELF", "SUPPLY_INVALID", "TOKEN_RECEIVE_DIFFERS"];
|
|
3
|
-
export declare const FullBlockErrorCodes: ("BLOCK_AMOUNT_BELOW_ZERO" | "BLOCK_CANNOT_FORWARD_TO_SELF" | "BLOCK_CANNOT_SEND_NON_TOKEN" | "BLOCK_CERTIFICATE_SUBJECT_MISMATCH" | "BLOCK_EXACT_TRUE_WHEN_FORWARDING" | "BLOCK_EXTERNAL_INVALID" | "BLOCK_EXTERNAL_MISSING" | "BLOCK_EXTERNAL_TOO_LONG" | "BLOCK_GENERAL_FIELD_INVALID" | "BLOCK_IDENTIFIER_INVALID" | "BLOCK_IDENTIFIER_NEED_DEFAULT_PERMISSIONS" | "BLOCK_INTERMEDIATE_CERTIFICATES_ONLY_ADD" | "BLOCK_INVALID_ACCOUNT_TYPE" | "BLOCK_INVALID_CERTIFICATE_VALUE" | "BLOCK_INVALID_CREATE_IDENTIFIER_ARGS" | "BLOCK_INVALID_IDEMPOTENT_FORMAT" | "BLOCK_INVALID_IDEMPOTENT_LENGTH" | "BLOCK_INVALID_MULTISIG_QUORUM" | "BLOCK_INVALID_MULTISIG_SIGNER_COUNT" | "BLOCK_INVALID_MULTISIG_SIGNER_DEPTH" | "BLOCK_INVALID_MULTISIG_SIGNER_DUPLICATE" | "BLOCK_INVALID_PURPOSE_VALIDATION" | "BLOCK_INVALID_SIGNATURE" | "BLOCK_INVALID_SIGNER" | "BLOCK_INVALID_TYPE" | "BLOCK_INVALID_VERSION" | "BLOCK_NO_ADMIN_ON_TARGET" | "BLOCK_NO_DELEGATE_ADMIN" | "BLOCK_NO_DUPLICATE_CERTIFICATE_OPERATION" | "BLOCK_NO_IDENTIFIER_OP" | "BLOCK_NO_MODIFY_PERMISSION_DUPE" | "BLOCK_NO_MULTIPLE_SET_REP" | "BLOCK_NO_MULTISIG_OP" | "BLOCK_NO_TOKEN_OP" | "BLOCK_ONLY_IDENTIFIER_OP" | "BLOCK_ONLY_TOKEN_OP" | "BLOCK_PERMISSIONS_INVALID_DEFAULT" | "BLOCK_PERMISSIONS_INVALID_ENTITY" | "BLOCK_PERMISSIONS_INVALID_PRINCIPAL" | "BLOCK_PERMISSIONS_INVALID_TARGET" | "BLOCK_PREVIOUS_SELF" | "BLOCK_SUPPLY_INVALID" | "BLOCK_TOKEN_RECEIVE_DIFFERS")[];
|
|
2
|
+
export declare const BlockErrorCodes: readonly ["AMOUNT_BELOW_ZERO", "CANNOT_FORWARD_TO_SELF", "CANNOT_SEND_NON_TOKEN", "CERTIFICATE_SUBJECT_MISMATCH", "EXACT_TRUE_WHEN_FORWARDING", "EXTERNAL_INVALID", "EXTERNAL_MISSING", "EXTERNAL_TOO_LONG", "GENERAL_FIELD_INVALID", "IDENTIFIER_INVALID", "IDENTIFIER_NEED_DEFAULT_PERMISSIONS", "INTERMEDIATE_CERTIFICATES_ONLY_ADD", "INVALID_ACCOUNT_TYPE", "INVALID_CERTIFICATE_VALUE", "INVALID_CREATE_IDENTIFIER_ARGS", "INVALID_IDEMPOTENT_FORMAT", "INVALID_IDEMPOTENT_LENGTH", "INVALID_MULTISIG_QUORUM", "INVALID_MULTISIG_SIGNER_COUNT", "INVALID_MULTISIG_SIGNER_DEPTH", "INVALID_MULTISIG_SIGNER_DUPLICATE", "INVALID_PURPOSE_VALIDATION", "INVALID_SIGNATURE", "INVALID_SIGNER", "INVALID_TYPE", "INVALID_VERSION", "NO_ADMIN_ON_TARGET", "NO_DELEGATE_ADMIN", "NO_DUPLICATE_CERTIFICATE_OPERATION", "NO_IDENTIFIER_OP", "NO_MODIFY_PERMISSION_DUPE", "NO_MULTIPLE_SET_REP", "NO_MULTISIG_OP", "NO_TOKEN_OP", "ONLY_IDENTIFIER_OP", "ONLY_TOKEN_OP", "PERMISSIONS_INVALID_DEFAULT", "PERMISSIONS_INVALID_ENTITY", "PERMISSIONS_INVALID_PRINCIPAL", "PERMISSIONS_INVALID_TARGET", "PREVIOUS_SELF", "SUPPLY_INVALID", "TOKEN_RECEIVE_DIFFERS", "SIGNATURE_REQUIRED", "SIGNATURE_PARAMETER_DIFFERS"];
|
|
3
|
+
export declare const FullBlockErrorCodes: ("BLOCK_AMOUNT_BELOW_ZERO" | "BLOCK_CANNOT_FORWARD_TO_SELF" | "BLOCK_CANNOT_SEND_NON_TOKEN" | "BLOCK_CERTIFICATE_SUBJECT_MISMATCH" | "BLOCK_EXACT_TRUE_WHEN_FORWARDING" | "BLOCK_EXTERNAL_INVALID" | "BLOCK_EXTERNAL_MISSING" | "BLOCK_EXTERNAL_TOO_LONG" | "BLOCK_GENERAL_FIELD_INVALID" | "BLOCK_IDENTIFIER_INVALID" | "BLOCK_IDENTIFIER_NEED_DEFAULT_PERMISSIONS" | "BLOCK_INTERMEDIATE_CERTIFICATES_ONLY_ADD" | "BLOCK_INVALID_ACCOUNT_TYPE" | "BLOCK_INVALID_CERTIFICATE_VALUE" | "BLOCK_INVALID_CREATE_IDENTIFIER_ARGS" | "BLOCK_INVALID_IDEMPOTENT_FORMAT" | "BLOCK_INVALID_IDEMPOTENT_LENGTH" | "BLOCK_INVALID_MULTISIG_QUORUM" | "BLOCK_INVALID_MULTISIG_SIGNER_COUNT" | "BLOCK_INVALID_MULTISIG_SIGNER_DEPTH" | "BLOCK_INVALID_MULTISIG_SIGNER_DUPLICATE" | "BLOCK_INVALID_PURPOSE_VALIDATION" | "BLOCK_INVALID_SIGNATURE" | "BLOCK_INVALID_SIGNER" | "BLOCK_INVALID_TYPE" | "BLOCK_INVALID_VERSION" | "BLOCK_NO_ADMIN_ON_TARGET" | "BLOCK_NO_DELEGATE_ADMIN" | "BLOCK_NO_DUPLICATE_CERTIFICATE_OPERATION" | "BLOCK_NO_IDENTIFIER_OP" | "BLOCK_NO_MODIFY_PERMISSION_DUPE" | "BLOCK_NO_MULTIPLE_SET_REP" | "BLOCK_NO_MULTISIG_OP" | "BLOCK_NO_TOKEN_OP" | "BLOCK_ONLY_IDENTIFIER_OP" | "BLOCK_ONLY_TOKEN_OP" | "BLOCK_PERMISSIONS_INVALID_DEFAULT" | "BLOCK_PERMISSIONS_INVALID_ENTITY" | "BLOCK_PERMISSIONS_INVALID_PRINCIPAL" | "BLOCK_PERMISSIONS_INVALID_TARGET" | "BLOCK_PREVIOUS_SELF" | "BLOCK_SUPPLY_INVALID" | "BLOCK_TOKEN_RECEIVE_DIFFERS" | "BLOCK_SIGNATURE_REQUIRED" | "BLOCK_SIGNATURE_PARAMETER_DIFFERS")[];
|
|
4
4
|
export type BlockErrorCode = typeof FullBlockErrorCodes[number];
|
|
5
5
|
export default class KeetaNetBlockError extends KeetaNetErrorBase<BlockErrorCode> {
|
|
6
6
|
static readonly isInstance: (obj: any, strict?: boolean) => obj is KeetaNetBlockError;
|