UNPKG

@jagad/icsi

Version:

Internet Computer Subaccount Indexer Library - TypeScript SDK for ICP multi-token subaccount management, transaction tracking, and automated sweeping with webhook support

37 lines (36 loc) 2.13 kB
import { HttpAgent } from '@dfinity/agent'; import { Secp256k1KeyIdentity } from '@dfinity/identity-secp256k1'; /** * Checks if a value is not empty or throws an error. * @param value - The value to check. * @param errorMessage - The error message to throw if the value is empty. * @throws {Error} - Throws an error with the specified message if the value is empty. */ export declare function isNotEmptyOrError(variable: any, message?: string | undefined): void; /** * Generates a Secp256k1KeyIdentity from a seed phrase and an optional index. * @param {string} mnemonic - The mnemonic seed phrase. * @param {number} [index=0] - The index to use in the derivation path (default is 0). * @returns {Secp256k1KeyIdentity} - The generated Secp256k1KeyIdentity. */ export declare const getIdentityFromSeed: (mnemonic: string, index?: number) => Secp256k1KeyIdentity; /** * Generates a Secp256k1KeyIdentity from a private key in various formats. * @param {string} privateKey - The private key as hex string or EC PEM format. * @returns {Secp256k1KeyIdentity} - The generated Secp256k1KeyIdentity. */ export declare const getIdentityFromPrivateKey: (privateKey: string) => Secp256k1KeyIdentity; /** * Creates an HttpAgent with a Secp256k1KeyIdentity from a given seed phrase. * @param {string} seedPhrase - The seed phrase to generate the identity. * @param {string} [host="https://ic0.app"] - The host URL for the HttpAgent (default is the IC mainnet URL). * @returns {HttpAgent} - The initialized HttpAgent with the generated identity. */ export declare function createHostAgentAndIdentityFromSeed(seedPhrase: string, host?: string): HttpAgent; /** * Creates an HttpAgent with a Secp256k1KeyIdentity from a private key. * @param {string} privateKey - The private key in EC PEM format or as a hex string. * @param {string} [host="https://ic0.app"] - The host URL for the HttpAgent (default is the IC mainnet URL). * @returns {HttpAgent} - The initialized HttpAgent with the generated identity. */ export declare function createHostAgentAndIdentityFromPrivateKey(privateKey: string, host?: string): HttpAgent;