### Install KeetaNet Client SDK Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Installs the KeetaNet Client SDK using npm. This is the primary method for integrating the SDK into your JavaScript or TypeScript project. ```bash npm install @keetanetwork/keetanet-client ``` -------------------------------- ### Initialize KeetaNet Client in Browser Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Shows how to load and use the KeetaNet SDK in a web browser. It includes setting up the client with an account and network, and making a call to the chain. ```html ``` -------------------------------- ### Set KeetaNet Default Permissions Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Sets default permissions for resources on the KeetaNet network. This is managed using the UserClient.setInfo method. ```Java UserClient.setInfo(resource, permissions) ``` -------------------------------- ### Initialize KeetaNet Client in NodeJS Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Demonstrates how to initialize the KeetaNet SDK's UserClient in a NodeJS environment. It covers generating an account from a seed and connecting to a test network. ```javascript import * as KeetaNet from '@keetanetwork/keetanet-client'; const seed = KeetaNet.lib.Account.generateRandomSeed({ asString: true }); const account = KeetaNet.lib.Account.fromSeed(seed, 0); const client = KeetaNet.UserClient.fromNetwork('test', account); async function main() { console.debug(await client.chain()); } main().then(function() { process.exit(0); }, function(error) { console.error(error); process.exit(1); }); ``` -------------------------------- ### Retrieve KeetaNet Chain Blocks Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Retrieves a list of blocks applied to the ledger for a given account. This only includes blocks issued by the account. ```Java UserClient.chain(accountId) ``` -------------------------------- ### Include KeetaNet SDK in Browser Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Shows how to include the KeetaNet SDK in a web browser using a script tag. This makes the SDK available globally as the `KeetaNet` variable, enabling client-side interactions with the KeetaNet network. ```html ``` -------------------------------- ### Generate KeetaNet Identifier Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED This method is recommended for creating new tokens or identifiers within KeetaNet. It is part of the UserClientBuilder class. ```Java UserClientBuilder.generateIdentifier() ``` -------------------------------- ### Import KeetaNet SDK in NodeJS Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Demonstrates how to import the KeetaNet SDK package in a NodeJS environment for use in JavaScript applications. This allows access to core functionalities like account management and network interaction. ```javascript import * as KeetaNet from '@keetanetwork/keetanet-client'; ``` -------------------------------- ### Filter KeetaNet Vote Staples Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Filters a list of vote staples to include only operations relevant to a specific account, making it easier to track account-specific changes. ```Java UserClient.filterVoteStaples(voteStaples, accountId) ``` -------------------------------- ### Retrieve KeetaNet Account History Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Fetches a list of vote staples that have affected a specific account. This includes operations not necessarily issued by the account itself. ```Java UserClient.history(accountId) ``` -------------------------------- ### Update KeetaNet Account Permissions Source: https://static.test.keeta.com/docs/documents/GETTING-STARTED Updates the specific permissions applied to a given account within KeetaNet. This method is used to manage granular access control for accounts. ```Java UserClient.updatePermissions(accountId, permissions) ``` -------------------------------- ### Get Account Chain Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Fetches the chain for a given account, with options to specify depth, start, and end blocks. Returns an array of blocks. Dependencies include optional query parameters for filtering. ```typescript chain( query?: { depth?: number; endBlock?: string | BlockHash; startBlock?: string | BlockHash; }, options?: UserClientOptionsReadOnly, ): Promise ``` -------------------------------- ### Get Account History Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Fetches the transaction history for a specified account. Supports querying by depth or starting block hash. Returns a promise with computed effects and vote staples. ```typescript history( query?: { depth?: number; startBlocksHash?: string | VoteBlockHash }, options?: UserClientOptionsReadOnly, ): Promise<{ effects: ComputedEffectOfBlocks; voteStaple: VoteStaple }[]> ``` -------------------------------- ### Get All Balances Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Method to retrieve all token balances for a given account, with optional request parameters. It returns a promise resolving to `GetAllBalancesResponse`. ```TypeScript allBalances(options?: UserClientOptions): Promise ``` -------------------------------- ### Get UserClient Config Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Provides the accessor for retrieving the `UserClientConfig` object associated with the UserClient instance. ```TypeScript get config(): UserClientConfig ``` -------------------------------- ### Get Certificates Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves certificates for an account. Can fetch a single certificate by hash or all certificates if no hash is provided. Returns a certificate, an array of certificates, or null. ```typescript getCertificates( certificateHash: string | CertificateHash, options?: UserClientOptions, ): Promise ``` ```typescript getCertificates( certificateHash?: undefined, options?: UserClientOptions, ): Promise ``` ```typescript getCertificates( certificateHash?: string | CertificateHash, options?: UserClientOptions, ): Promise< | null | CertificateWithIntermediatesResponse | CertificateWithIntermediatesResponse[], > ``` -------------------------------- ### Get UserClient Configuration from Network Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves the default configuration for a UserClient based on the network alias and optional settings. This helper method provides necessary configuration details without creating a full client instance. ```typescript getConfigFromNetwork( network: "production" | "staging" | "beta" | "test" | "test2" | "dev", options?: UserClientOptions ): Omit ``` -------------------------------- ### Get UserClient Client Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Provides the accessor for retrieving the low-level client instance used by the UserClient. This allows for more granular control over network interactions. ```TypeScript get client(): Client ``` -------------------------------- ### Get UserClient Signer Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Provides the accessor for the signer account, which is used to sign transactions. Returns null if the client is in readonly mode. ```TypeScript get signer(): null | Account ``` -------------------------------- ### Get Account State Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves the current live state of the account. This function accepts optional read-only user client options and returns a promise that resolves to the formatted account state. ```typescript state( options?: UserClientOptionsReadOnly, ): Promise ``` -------------------------------- ### Get UserClient Account Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Provides the accessor for retrieving the `GenericAccount` associated with the UserClient instance. This account is used for operations that affect blocks and transactions. ```TypeScript get account(): GenericAccount ``` -------------------------------- ### Get Block by Hash Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves a specific block from the network using its hash. Returns the block if found, otherwise null. Requires a block hash as input. ```typescript block(blockhash: string | BlockHash): Promise ``` -------------------------------- ### Get Specific Token Balance Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Method to retrieve the balance for a specific token of a given account. It accepts a token identifier (string or `TokenAddress`) and optional request parameters, returning a promise that resolves to the balance as a bigint. ```TypeScript balance( token: string | TokenAddress, options?: UserClientOptions, ): Promise ``` -------------------------------- ### Get Head Block Hash Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves the current head block hash for a given account. Returns null if the account has no blocks. Accepts optional user client options. ```typescript head(options?: UserClientOptions): Promise ``` -------------------------------- ### Get Pending Block Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Retrieves the pending block associated with the account. It returns the side-ledger block for the account or null if no pending block exists. Optional read-only user options can be provided. ```typescript pendingBlock(options?: UserClientOptionsReadOnly): Promise ``` -------------------------------- ### Initialize and Query UserClient Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Demonstrates how to initialize the UserClient from a network and fetch chain data. It requires importing necessary classes from the SDK and setting up an account with a seed. ```JavaScript import { UserClient } from '@keetanetwork/keetanet-client'; import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client'; const seed = '...'; // 64 character hex seed const account = KeetaNetLib.Account.fromSeed(seed, 0); const client = UserClient.fromNetwork('test'); const blocks = await client.chain(); ``` -------------------------------- ### UserClient Constructor Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Explains the constructor for the UserClient class, which takes a configuration object. It notes that using `fromNetwork` is the recommended way to create instances and that instances should be cleaned up using the `destroy` method. ```TypeScript new UserClient(config: UserClientConfig): UserClient ``` -------------------------------- ### Instantiate CertificateBuilder Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate Demonstrates how to create a new instance of the CertificateBuilder class. It can be initialized with optional parameters. ```typescript new CertificateBuilder( params?: Partial ): CertificateBuilder ``` -------------------------------- ### Initialize Network Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Generates and publishes blocks to initialize a new network. Requires supply amount and optionally a delegate account and vote serial. Returns the generated vote staple and publish status. ```typescript initializeNetwork( initOpts: { addSupplyAmount: bigint; delegateTo?: Account; voteSerial?: bigint; }, options?: UserClientOptions, ): Promise<{ from: "direct"; publish: boolean; voteStaple: VoteStaple }> ``` -------------------------------- ### Get UserClient Network ID Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Provides the accessor for retrieving the network ID (as a bigint) that the UserClient instance is connected to. ```TypeScript get network(): bigint ``` -------------------------------- ### Build Certificate Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate Illustrates the build method for constructing a complete certificate. It accepts optional parameters and options, returning a Promise that resolves to a Certificate object. ```typescript build( params?: Partial, options?: CertificateOptions ): Promise ``` -------------------------------- ### Create UserClient from Network Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Constructs a new UserClient instance using a specified network. It supports various network environments and allows for optional configuration, including a signer account and custom fee block generation. The instance should be destroyed when no longer needed. ```typescript fromNetwork( network: "production" | "staging" | "beta" | "test" | "test2" | "dev", signer: null | Account, options?: UserClientOptions ): UserClient ``` -------------------------------- ### Initialize User Client Builder Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Creates a new UserClientBuilder instance for constructing operations. This builder is used to group operations before converting them into blocks. Accepts optional user client options. ```typescript initBuilder(options?: UserClientOptions): UserClientBuilder ``` -------------------------------- ### Get VoteQuote Hash Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced Calculates and returns the VoteHash for the VoteQuote. This accessor provides a unique hash identifier for the entire vote quote. ```typescript get hash(): VoteHash ``` -------------------------------- ### Create UserClient from Single Representative Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Initializes a UserClient instance using a specific representative's hostname and details. This method is primarily for testing and development, allowing connection to a network via a single known node. ```typescript fromSimpleSingleRep( hostname: string, ssl: boolean, repKey: string | Account, networkID: bigint, networkAlias: "production" | "staging" | "beta" | "test" | "test2" | "dev", signer: null | Account, options?: UserClientOptions ): UserClient ``` -------------------------------- ### Set Account Information Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Sets the metadata for an account and publishes the changes to the network. It takes account information and optional user client options, returning a promise that resolves to the publish outcome. ```typescript setInfo( info: AccountInfo, options?: UserClientOptions, ): Promise< | { from: "direct"; publish: boolean; voteStaple: VoteStaple } | { blocks: Block[]; from: "publish-aid"; publish: boolean }, > ``` -------------------------------- ### Get VoteQuote Blocks Hash Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced Retrieves the VoteBlockHash associated with the VoteQuote. This accessor provides a specific hash representation of the blocks included in the vote. ```typescript get blocksHash(): VoteBlockHash ``` -------------------------------- ### Publish User Client Builder Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Computes and publishes blocks for a given UserClientBuilder to the network. It's generally recommended to use the UserClient.publish method instead. This function takes a builder and optional publish options, returning a promise that resolves to the publish outcome. ```typescript publishBuilder( builder: UserClientBuilder, options?: PublishOptions, ): Promise< | { from: "direct"; publish: boolean; voteStaple: VoteStaple } | { blocks: Block[]; from: "publish-aid"; publish: boolean }, > ``` -------------------------------- ### Get Quotes for Blocks Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Obtains cost quotes from representatives for a given set of blocks. Requires an array of Block objects as input and returns an array of VoteQuote. ```typescript getQuotes(blocks: Block[]): Promise ``` -------------------------------- ### BufferStorage Constructor Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Initializes a new BufferStorage instance with a key, length, and optional storage kind. The key can be a string, bigint, or ArrayBuffer. ```JavaScript new BufferStorage( key: string | bigint | ArrayBuffer, length: number, ): BufferStorage ``` -------------------------------- ### List ACLs by Principal with Info Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Lists ACLs that other accounts have set for the given account. Returns a promise with principal ACL information. Accepts optional read-only user client options. ```typescript listACLsByPrincipalWithInfo( options?: UserClientOptionsReadOnly, ): Promise ``` -------------------------------- ### Create Cipher IV Source: https://static.test.keeta.com/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper Provides methods to create ciphers for encryption using different algorithms like CCM, OCB, and GCM. It requires specifying the algorithm, key, initialization vector (IV), and optional configuration options. ```typescript createCipheriv: { (algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM; (algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB; (algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM; (algorithm: string, key: CipherKey, iv: null | BinaryLike, options?: TransformOptions): Cipher; } ``` -------------------------------- ### KeetaNet Client Library Structure Source: https://static.test.keeta.com/docs/variables/KeetaNetSDK Defines the structure of the KeetaNet client library, exposing core modules and utility functions. This includes types for Account, Block, Error, Ledger, Node, P2P, Permissions, Stats, and Vote, along with various utility functions for ASN1, Bloom, Buffer, Certificate, Conversion, Hash, Helper, and Initial operations. ```typescript import { Account, Block, KeetaNetError, Ledger, Node, P2PSwitch, Permissions, Stats, Utils, Vote } from "@keetanetwork/keetanet-client"; const KeetaNet = { Account: Account, Block: Block, Error: KeetaNetError, Ledger: Ledger, Node: Node, P2P: P2PSwitch, Permissions: Permissions, Stats: Stats, Utils: { ASN1: Utils.ASN1, Bloom: Utils.Bloom, Buffer: Utils.Buffer, Certificate: Utils.Certificate, Conversion: Utils.Conversion, Hash: Utils.Hash, Helper: Utils.Helper, Initial: Utils.Initial }, Vote: Vote }; const lib = { Account: typeof Account, Block: typeof Block, Error: typeof KeetaNetError, Ledger: typeof Ledger, Node: typeof Node, P2P: typeof P2PSwitch, Permissions: typeof Permissions, Stats: typeof Stats, Utils: { ASN1: "src/lib/utils/asn1", Bloom: "src/lib/utils/bloom", Buffer: "src/lib/utils/buffer", Certificate: "src/lib/utils/certificate", Conversion: "src/lib/utils/conversion", Hash: "src/lib/utils/hash", Helper: "src/lib/utils/helper", Initial: "src/lib/utils/initial" }, Vote: typeof Vote }; // Utilities needed for working with KeetaNet ``` -------------------------------- ### Generate Initial Vote Staple with Add Supply Source: https://static.test.keeta.com/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_initial This function generates an initial vote staple, including additional supply information. It requires an `InitialConfigSupply` object as input and returns a promise resolving to `InitialGenResponse`. ```typescript generateInitialVoteStaple( options: InitialConfigSupply ): Promise>; ``` -------------------------------- ### Create Certificate Extension Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate Demonstrates the static extension method for creating a single certificate extension. It requires an OID, value, and an optional critical flag. ```typescript extension( oid: string, value: Readonly, critical?: boolean ): | [{ oid: string; type: "oid" }, value: Buffer] | [{ oid: string; type: "oid" }, critical: boolean, value: Buffer] ``` -------------------------------- ### Add Certificate Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Adds a certificate to an account. This method requires the certificate details and optionally accepts intermediate certificates and user options. It returns a promise that resolves with information about the vote staple and its publication status. ```typescript modifyCertificate( method: ADD, certificate: Certificate, intermediates?: null | CertificateBundle, options?: UserClientOptions, ): Promise< | { from: "direct"; publish: boolean; voteStaple: VoteStaple } | { blocks: Block[]; from: "publish-aid"; publish: boolean }, > ``` -------------------------------- ### InstanceSetConstructor Constructor Source: https://static.test.keeta.com/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper Details the constructor for InstanceSetConstructor, specifying its parameters and return type. The constructor is optional and takes an iterable of instances. ```TypeScript new InstanceSetConstructor( data?: Iterable ): InstanceSet ``` -------------------------------- ### Compute Builder Blocks Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Computes the necessary blocks to publish a given builder, updating its state. Deprecated in favor of UserClientBuilder.computeBlocks. Returns a ComputeBlocksResponse. ```typescript computeBuilderBlocks(builder: UserClientBuilder): Promise ``` -------------------------------- ### Build Certificate in DER Format Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate Explains how to use the buildDER method to create a certificate specifically in DER format. This method returns a Promise resolving to an ArrayBuffer. ```typescript buildDER(params?: Partial): Promise ``` -------------------------------- ### Add Extensions to Certificate Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_certificate Shows how to use the addExtensions method to add extensions to a certificate being built. This method takes CertificateBuilderParams and returns a promise with the certificate extensions. ```typescript addExtensions( params: CertificateBuilderParams ): Promise< ( | [{ oid: string; type: "oid" }, value: Buffer] | [{ oid: string; type: "oid" }, critical: boolean, value: Buffer] )[], > ``` -------------------------------- ### Generate Initial Vote Staple with Always Return Blocks Source: https://static.test.keeta.com/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_initial This function generates an initial vote staple, ensuring blocks are always returned. It takes a `BaseGenerationConfig` object and returns a promise that resolves to `InitialGenResponse`. ```typescript generateInitialVoteStaple( options: BaseGenerationConfig ): Promise>; ``` -------------------------------- ### Modify Certificate Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Adds a certificate for an account. Requires a method (ADD), the certificate, and optional intermediate certificates. Returns a promise indicating publish status or block details. ```typescript modifyCertificate( method: ADD, certificate: Certificate, intermediates: null | CertificateBundle, options?: UserClientOptions, ): Promise< | { from: "direct"; publish: boolean; voteStaple: VoteStaple } | { blocks: Block[]; from: "publish-aid"; publish: boolean }, > ``` -------------------------------- ### List ACLs by Principal Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Lists ACLs related to specified entities for the given account. Returns a promise with ACL rows. Accepts an optional array of entities and read-only user client options. ```typescript listACLsByPrincipal( entities?: (string | GenericAccount)[], options?: UserClientOptionsReadOnly, ): Promise ``` -------------------------------- ### List ACLs by Entity Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Lists Access Control Lists (ACLs) set by the given account. Returns a promise containing an array of ACL rows. Accepts optional read-only user client options. ```typescript listACLsByEntity(options?: UserClientOptionsReadOnly): Promise ``` -------------------------------- ### BufferStorage Properties Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Provides access to the storageKind and a static isInstance method for checking BufferStorage object types. ```JavaScript storageKind: string = 'GenericBuffer' isInstance: (obj: any, strict?: boolean) => obj is BufferStorage ``` -------------------------------- ### BufferStorage Comparison Methods Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Compares the current BufferStorage instance with another BufferStorage instance or a hex string representation. ```JavaScript compare(compareWith: undefined | null | BufferStorage): boolean compareHexString( compareWith: undefined | null | string | BufferStorage, ): boolean ``` -------------------------------- ### Async Dispose UserClient Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Implements the `[asyncDispose]` method, enabling the use of `using` for automatic cleanup of the UserClient instance by calling its `destroy` method when out of scope. ```TypeScript "[asyncDispose]"(): Promise ``` -------------------------------- ### Generate Identifier Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Generates a new identifier for a specified type (NETWORK, TOKEN, STORAGE, MULTISIG) and publishes the corresponding blocks. Returns a PendingAccount object. ```typescript generateIdentifier( type: NETWORK | TOKEN | STORAGE | MULTISIG, options?: UserClientOptions, ): Promise> ``` -------------------------------- ### Create Decipher IV Source: https://static.test.keeta.com/docs/variables/KeetaNetSDK.Referenced.src_lib_utils_helper Enables the creation of decipher objects for decryption, supporting algorithms such as CCM, OCB, and GCM. This function requires the algorithm, key, IV, and relevant options for secure decryption. ```typescript createDecipheriv: { (algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM; (algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB; (algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM; (algorithm: string, key: CipherKey, iv: null | BinaryLike, options?: TransformOptions): Decipher; } ``` -------------------------------- ### Create VoteQuote Instance Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced Constructs a new VoteQuote instance with provided vote data and optional configuration. The vote data can be in various formats including strings, buffers, or structured objects. ```typescript new VoteQuote( vote: string | Buffer | ArrayBuffer | VoteJSON | VoteLikeBase | { $binary?: string; $id: string; $permanent: boolean; $trusted: boolean; $uid: string; blocks: BlockHashString[]; fee?: { amount: string; payTo?: string; token?: string }; issuer: Secp256K1PublicKeyString | Secp256R1PublicKeyString | ED25519PublicKeyString; quote?: boolean; serial: string; signature: string; validityFrom: string; validityTo: string; }, options?: VoteOptions ): VoteQuote ``` -------------------------------- ### Update Account Permissions Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Updates the permissions for a given account and publishes the changes. It allows specifying the principal, permissions, and optionally a target account and adjustment method, returning the publish outcome. ```typescript updatePermissions( principal: string | GenericAccount, permissions: AcceptedPermissionTypes, target?: string | GenericAccount, method?: AdjustMethod, options?: UserClientOptions, ): Promise< | { from: "direct"; publish: boolean; voteStaple: VoteStaple } | { blocks: Block[]; from: "publish-aid"; publish: boolean }, > ``` -------------------------------- ### Instantiate ValidateASN1 Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_asn1 Creates a new instance of the ValidateASN1 class, which is used to validate ASN.1 data against a provided schema. The constructor takes the schema as an argument. ```TypeScript new ValidateASN1(schema: T): ValidateASN1 ``` -------------------------------- ### Hash Data with KeetaNet SDK Source: https://static.test.keeta.com/docs/functions/KeetaNetSDK.Referenced.src_lib_utils_hash The Hash function takes a Buffer and an optional length to hash data. It returns the hashed data as an ArrayBuffer. This function is part of the KeetaNet SDK utilities. ```javascript function Hash(data: Buffer, len?: number): ArrayBuffer ``` -------------------------------- ### Recover Account Artifacts Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Recovers unpublished or half-published account artifacts. It can optionally publish the recovered staple to the network. The function accepts an optional publish flag and user client options, returning a promise that resolves to the recovered VoteStaple or null. ```typescript recover( publish?: boolean, options?: UserClientOptions, ): Promise ``` -------------------------------- ### Debug Printable Object Utility Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `debugPrintableObject` function formats an object for debugging purposes, ensuring it can be safely printed. It handles circular references and complex data types. ```TypeScript function debugPrintableObject(obj: any): string ``` -------------------------------- ### Interface ToJSONSerializableOptions Source: https://static.test.keeta.com/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_conversion Defines options for serializing data to JSON, including whether to add binary data and a debug flag. This interface is generic and can accept a boolean type parameter for addBinary. ```typescript interface ToJSONSerializableOptions { addBinary?: AddBinary; debugUnsafe?: boolean; } ``` -------------------------------- ### InstanceSetConstructor Interface Definition Source: https://static.test.keeta.com/docs/interfaces/KeetaNetSDK.Referenced.src_lib_utils_helper Defines the constructor signature for the InstanceSetConstructor, used to create InstanceSet objects. It accepts an optional iterable of instances. ```TypeScript interface InstanceSetConstructor { new InstanceSetConstructor( data?: Iterable ): InstanceSet; } ``` -------------------------------- ### Buffer to BigInt Conversion Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `bufferToBigInt` function converts a Buffer into a BigInt. This is essential for handling large numbers that exceed the standard JavaScript Number type's limits. ```TypeScript function bufferToBigInt(buffer: Buffer): bigint ``` -------------------------------- ### Boolean Environment Variable Reader Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `booleanEnv` function reads a boolean value from an environment variable. It handles parsing common string representations of true/false values. ```TypeScript function booleanEnv(name: string, defaultValue?: boolean): boolean ``` -------------------------------- ### Checkable Generator Function Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `checkableGenerator` function creates a generator that can be checked for completion. It wraps a standard generator, adding a `checkable` property. ```TypeScript function checkableGenerator(generator: Generator): Generator & { checkable: boolean } ``` -------------------------------- ### Object to Buffer Conversion Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `objectToBuffer` function serializes a JavaScript object into a Buffer. This is typically used for sending data over networks or storing it. ```TypeScript function objectToBuffer(obj: any): Buffer ``` -------------------------------- ### Destroy Keeta Instance Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK Cleans up all resources associated with the Keeta instance. This function returns a void promise, indicating completion. ```typescript destroy(): Promise ``` -------------------------------- ### BufferStorage Length Accessor Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Returns the length of the buffer managed by the BufferStorage instance. ```JavaScript get length(): number ``` -------------------------------- ### Promise Generator Function Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `promiseGenerator` function creates a generator that yields Promises. This pattern is useful for managing asynchronous iteration. ```TypeScript function promiseGenerator(generator: Generator>): Generator ``` -------------------------------- ### BufferStorage Conversion Methods Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Converts the buffer data to a BigInt or a string representation with specified encoding (hex, base64, or base32). ```JavaScript toBigInt(): bigint toString(encoding?: "base64" | "hex" | "base32"): string ``` -------------------------------- ### Define ValidationConfig Interface Source: https://static.test.keeta.com/docs/interfaces/KeetaNetSDK.Referenced.src_config Defines the ValidationConfig interface, specifying validation rules for account information fields, block operations, and permissions within the KeetaNet SDK. ```TypeScript interface ValidationConfig { accountInfoFieldRules: { blockSignerCount: Omit; blockSignerDepth: Omit; description: TextValidationRule; metadata: TextValidationRule; name: TextValidationRule; supply: Omit; }; blockOperations: { external: TextValidationRule }; permissions: { maxExternalOffset: number }; } ``` -------------------------------- ### Internal Logger Function Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `internalLogger` function provides a private logging mechanism for internal use within the SDK. It's designed for development and debugging. ```TypeScript function internalLogger(message: string, level?: 'info' | 'warn' | 'error'): void ``` -------------------------------- ### BufferStorage Data Retrieval Source: https://static.test.keeta.com/docs/classes/KeetaNetSDK.Referenced.src_lib_utils_buffer Retrieves the buffer data as an ArrayBuffer or a Buffer object. ```JavaScript get(): ArrayBuffer getBuffer(): Buffer ``` -------------------------------- ### Array Repetition Utility Source: https://static.test.keeta.com/docs/modules/KeetaNetSDK.Referenced The `arrayRepeat` function is used to create a new array by repeating a given array a specified number of times. It's a utility for generating repetitive data structures. ```TypeScript function arrayRepeat(arr: T[], count: number): T[] ```