import { JwtConfig, LedgerHandle, LedgerPublic } from "../../types/src"; import { AdviceClient } from './advice/advice-client'; import { AnchorClient } from './anchor/anchor-client'; import { BridgeClient } from './bridge/bridge-client'; import { CircleClient } from './circle/circle-client'; import { ProofVerificationClient } from './common/services/proof-verification-client'; import { DomainClient } from './domain/domain-client'; import { EffectClient } from './effect/effect-client'; import { IntentClient } from './intent/intent-client'; import { LedgerClient } from './ledger/ledger-client'; import { PolicyClient } from './policy/policy-client'; import { ReportClient } from './report/report-client'; import { RequestClient } from './request/request-client'; import { SchemaClient } from './schema/schema-client'; import { ServerAccessClient } from './server/server-access-client'; import { SignerClient } from './signer/signer-client'; import { SymbolClient } from './symbol/symbol-client'; import { WalletClient } from './wallet/wallet-client'; /** * Supported configuration options that can be * supplied when initiating a new SDK instance. */ export type SdkOptions = { /** * Default values for auth composition */ secure?: JwtConfig; /** * Base ledger REST API URL. */ server: string; /** * Active ledger */ ledger?: string; /** * Custom request timeout. Defaults to 15 sec. */ timeout?: number; /** * Ledger signer to verify ledger responses */ signer?: LedgerPublic; /** * Automatically verify proofs of incoming ledger responses */ verifyResponseProofs?: boolean; /** * Custom headers */ headers?: { [key: string]: string; }; }; /** * Handle Helper object for the Ledger SDK. */ export type HandleHelper = { /** * Method to generate unique handle * @returns the generated handle */ unique: () => LedgerHandle; }; /** * A lightweight wrapper on top of axios to simplify * making requests to the Minka Ledger API. */ export declare class LedgerSdk { /** * Active ledger * @see {Ledger} */ private activeLedger; /** * Allows querying the ledger status. * * @see {LedgerStatus} */ private statusClient; /** * Allows querying and managing ledger instances. * * @see {Ledger} */ ledger: LedgerClient; /** * Allows querying and managing symbols. * * @see {LedgerSymbol} */ symbol: SymbolClient; /** * Allows querying and managing schemas. * * @see {LedgerSchema} */ schema: SchemaClient; /** * Allows querying and managing bridges. * * @see {LedgerBridge} */ bridge: BridgeClient; /** * Allows querying and managing circles. * * @see {LedgerCircle} */ circle: CircleClient; /** * Allows querying and managing wallets. * * @see {LedgerWallet} */ wallet: WalletClient; /** * Allows querying and managing intents. * * @see {LedgerIntent} */ intent: IntentClient; /** * Allows querying and managing intents. * * @see {LedgerPolicy} */ policy: PolicyClient; /** * Allows querying and managing signers. * * @see {LedgerSigner} */ signer: SignerClient; /** * Allows querying and managing effects. * * @see {LedgerEffect} */ effect: EffectClient; /** * Allows querying of requests. * * @see {LedgerRequest} */ request: RequestClient; /** * Allows querying and managing anchors. * * @see {LedgerAnchor} */ anchor: AnchorClient; /** * Allows querying and managing domains. * * @see {LedgerDomain} */ domain: DomainClient; /** * Allows querying and managing access. * * @see {AccessDomain} */ access: ServerAccessClient; /** * Allows querying and managing report. * * @see {LedgerReport} */ report: ReportClient; /** * Allows executing advices. * * @see {AdviceAliasResolveResult} */ advice: AdviceClient; /** * Allows handle generation by using the * unique method. */ handle: HandleHelper; /** * Property containing the available SDK options * of the current instance. */ private options; /** * List of multi tenant clients managed in the SDK. */ private multiTenantClients; /** * List of single tenant clients managed in the SDK. */ private singleTenantClients; /** * List of clients managed in the SDK. */ private clients; constructor(options: SdkOptions); /** * Sets authentication parameters on all clients. * * @param authParams authentication parameters */ setAuthParams(authParams: Partial): void; /** * Sets headers on clients * * @param key * @param value */ setHeader(key: string, value: string): void; /** * Sets active ledger on all multi-tenant clients. * * @param handle ledger handle */ setActiveLedger(handle: string): void; /** * Gets active ledger * * @returns active ledger handle */ getActiveLedger(): string; /** * Returns the basic info about a ledger instance. This request * can be used to validate ledger URLs and to check if an instance * is up and running. * * @see {LedgerStatus} * @returns the ledger status info */ status(): Promise; /** * Sets the public signer used to verify signatures of * the ledger responses * @param signer the ledger signer */ setSigner(signer: LedgerPublic): this; /** * Get a new instance of the proof verification client * which can be used to verify proofs of ledger records. * `expect`, `ledger` and `length` methods can be used to * add additional assertions to the `verify` method. * By default the verification client has only one assertion * to verify that the record has at least 1 proof. * @returns the proof verification client */ get proofs(): ProofVerificationClient; }