UNPKG

@cashu/cashu-ts

Version:

cashu library for communicating with a cashu mint

1,690 lines (1,491 loc) 72.7 kB
## API Report File for "@cashu/cashu-ts" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { WeierstrassPoint } from '@noble/curves/abstract/weierstrass.js'; // @public export class Amount { // (undocumented) add(other: AmountLike): Amount; ceilPercent(numerator: number, denominator?: number): Amount; clamp(min: AmountLike, max: AmountLike): Amount; compareTo(other: AmountLike): -1 | 0 | 1; // (undocumented) divideBy(divisor: AmountLike): Amount; // (undocumented) equals(other: AmountLike): boolean; floorPercent(numerator: number, denominator?: number): Amount; static from(input: AmountLike): Amount; // (undocumented) greaterThan(other: AmountLike): boolean; // (undocumented) greaterThanOrEqual(other: AmountLike): boolean; inRange(min: AmountLike, max: AmountLike): boolean; isSafeNumber(): boolean; // (undocumented) isZero(): boolean; // (undocumented) lessThan(other: AmountLike): boolean; // (undocumented) lessThanOrEqual(other: AmountLike): boolean; // (undocumented) static max(a: AmountLike, b: AmountLike): Amount; // (undocumented) static min(a: AmountLike, b: AmountLike): Amount; // (undocumented) modulo(divisor: AmountLike): Amount; // (undocumented) multiplyBy(factor: AmountLike): Amount; // (undocumented) static one(): Amount; scaledBy(numerator: AmountLike, denominator: AmountLike): Amount; // (undocumented) subtract(other: AmountLike): Amount; // (undocumented) static sum(values: Iterable<AmountLike>): Amount; toBigInt(): bigint; toJSON(): string; toNumber(): number; toNumberUnsafe(): number; toString(): string; withUnit(unit: string): AmountWithUnit; // (undocumented) static zero(): Amount; } // @public (undocumented) export class AmountError extends CTSError { constructor(message: string); } // @public export type AmountLike = number | bigint | string | Amount; // @public export class AmountWithUnit { constructor(amount: Amount, unit: string); // (undocumented) add(other: AmountWithUnit): AmountWithUnit; // (undocumented) ceilPercent(numerator: number, denominator?: number): AmountWithUnit; // (undocumented) clamp(min: AmountWithUnit, max: AmountWithUnit): AmountWithUnit; // (undocumented) compareTo(other: AmountWithUnit): -1 | 0 | 1; // (undocumented) divideBy(divisor: AmountLike): AmountWithUnit; // (undocumented) equals(other: AmountWithUnit): boolean; // (undocumented) floorPercent(numerator: number, denominator?: number): AmountWithUnit; // (undocumented) static from(value: AmountLike, unit: string): AmountWithUnit; // (undocumented) greaterThan(other: AmountWithUnit): boolean; // (undocumented) greaterThanOrEqual(other: AmountWithUnit): boolean; // (undocumented) inRange(min: AmountWithUnit, max: AmountWithUnit): boolean; // (undocumented) isSafeNumber(): boolean; // (undocumented) isZero(): boolean; // (undocumented) lessThan(other: AmountWithUnit): boolean; // (undocumented) lessThanOrEqual(other: AmountWithUnit): boolean; // (undocumented) static max(a: AmountWithUnit, b: AmountWithUnit): AmountWithUnit; // (undocumented) static min(a: AmountWithUnit, b: AmountWithUnit): AmountWithUnit; // (undocumented) modulo(divisor: AmountLike): AmountWithUnit; // (undocumented) multiplyBy(factor: AmountLike): AmountWithUnit; // (undocumented) static one(unit: string): AmountWithUnit; // (undocumented) scaledBy(numerator: AmountLike, denominator: AmountLike): AmountWithUnit; // (undocumented) subtract(other: AmountWithUnit): AmountWithUnit; static sum(values: Iterable<AmountWithUnit>, unit?: string): AmountWithUnit; toAmount(): Amount; // (undocumented) toBigInt(): bigint; // (undocumented) toJSON(): { amount: string; unit: string; }; // (undocumented) toNumber(): number; toString(): string; // (undocumented) readonly unit: string; // (undocumented) static zero(unit: string): AmountWithUnit; } // @public (undocumented) export class AmountWithUnitError extends CTSError { constructor(message: string); } // @public export function assertSecretKind(allowed: SecretKind | SecretKind[], secret: Secret | string): Secret; // @public export class AuthManager implements AuthProvider { constructor(mintUrl: string, opts?: AuthManagerOptions); // (undocumented) get activeAuthKeysetId(): string | undefined; attachOIDC(oidc: OIDCAuth): this; ensure(minTokens: number): Promise<void>; ensureCAT(minValidSecs?: number): Promise<string | undefined>; exportPool(): Proof[]; getBlindAuthToken(input: { method: 'GET' | 'POST'; path: string; }): Promise<string>; // (undocumented) getCAT(): string | undefined; // (undocumented) get hasCAT(): boolean; importPool(proofs: Proof[], mode?: 'replace' | 'merge'): void; // (undocumented) get poolSize(): number; // (undocumented) get poolTarget(): number; // (undocumented) setCAT(cat: string | undefined): void; } // @public (undocumented) export type AuthManagerOptions = { maxPerMint?: number; desiredPoolSize?: number; request?: RequestFn; logger?: Logger; }; // @public (undocumented) export interface AuthProvider { // (undocumented) ensure?(minTokens: number): Promise<void>; ensureCAT?(minValiditySec?: number): Promise<string | undefined>; // (undocumented) getBlindAuthToken(input: { method: 'GET' | 'POST'; path: string; }): Promise<string>; // (undocumented) getCAT(): string | undefined; // (undocumented) setCAT(cat: string | undefined): void; } // @public export interface BatchMintPreview<TQuote extends Pick<MintQuoteBaseResponse, 'quote' | 'pubkey'> = MintQuoteBaseResponse> { keysetId: string; // (undocumented) method: string; outputData: OutputDataLike[]; payload: BatchMintRequest; quotes: TQuote[]; } // @public export type BatchMintRequest = { quotes: string[]; quote_amounts: Amount[]; outputs: SerializedBlindedMessage[]; signatures?: Array<string | null>; }; // @public export function blindMessage(secret: Uint8Array, r?: bigint): RawBlindedMessage; // @public (undocumented) export type BlindSignature = { C_: WeierstrassPoint<bigint>; id: string; }; // @public (undocumented) export type CancellerLike = SubscriptionCanceller | Promise<SubscriptionCanceller>; // @public export const CheckStateEnum: { readonly UNSPENT: "UNSPENT"; readonly PENDING: "PENDING"; readonly SPENT: "SPENT"; }; // @public (undocumented) export type CheckStateEnum = (typeof CheckStateEnum)[keyof typeof CheckStateEnum]; // @public export type CheckStatePayload = { Ys: string[]; }; // @public export type CheckStateResponse = { states: ProofState[]; }; // @public (undocumented) export type CompleteMeltOptions = { preferAsync?: boolean; extraPayload?: Record<string, unknown>; }; // @public export function computeMessageDigest(message: string): Uint8Array; // @public (undocumented) export function computeMessageDigest(message: string, asHex: false): Uint8Array; // @public (undocumented) export function computeMessageDigest(message: string, asHex: true): string; // @public export class ConsoleLogger implements Logger { constructor(minLevel?: LogLevel); // (undocumented) debug(msg: string, ctx?: Record<string, unknown>): void; // (undocumented) error(msg: string, ctx?: Record<string, unknown>): void; // (undocumented) info(msg: string, ctx?: Record<string, unknown>): void; // (undocumented) log(level: LogLevel, message: string, context?: Record<string, unknown>): void; // (undocumented) trace(msg: string, ctx?: Record<string, unknown>): void; // (undocumented) warn(msg: string, ctx?: Record<string, unknown>): void; } // @public (undocumented) export function constructUnblindedSignature(blindSig: BlindSignature, r: bigint, secret: Uint8Array, key: WeierstrassPoint<bigint>): UnblindedSignature; // @public export interface CounterRange { // (undocumented) count: number; // (undocumented) start: number; } // @public (undocumented) export interface CounterSource { advanceToAtLeast(keysetId: string, minNext: number): Promise<void>; reserve(keysetId: string, n: number): Promise<CounterRange>; setNext?(keysetId: string, next: number): Promise<void>; snapshot?(): Promise<Record<string, number>>; } // @public export function createAuthWallet(mintUrl: string, options?: { authPool?: number; oidc?: OIDCAuthOptions; logger?: Logger; }): Promise<{ mint: Mint; auth: AuthManager; oidc: OIDCAuth; wallet: Wallet; }>; // @public (undocumented) export function createBlindSignature(B_: WeierstrassPoint<bigint>, privateKey: Uint8Array, id: string): BlindSignature; // @public export const createDLEQProof: (B_: WeierstrassPoint<bigint>, a: Uint8Array) => DLEQ; // @public export function createEphemeralCounterSource(initial?: Record<string, number>): CounterSource; // @public export function createHTLCHash(preimage?: string): { hash: string; preimage: string; }; // @public export function createHTLCsecret(hash: string, tags?: string[][]): string; // @public export function createNewMintKeys(pow2height: IntRange<0, 65>, seed?: Uint8Array, options?: { expiry?: number; input_fee_ppk?: number; unit?: string; versionByte?: number; }): KeysetPair; // @public export function createP2PKsecret(pubkey: string, tags?: string[][]): string; // @public export function createRandomRawBlindedMessage(): RawBlindedMessage; // @public (undocumented) export function createRandomSecretKey(): Uint8Array<ArrayBufferLike>; // @public export function createSecret(kind: SecretKind, data: string, tags?: string[][]): string; // @public export class CTSError extends Error { constructor(message: string, options?: { cause?: unknown; }); // (undocumented) readonly cause?: unknown; } // @public export function decodePaymentRequest(paymentRequest: string): PaymentRequest_2; // @public @deprecated (undocumented) export const deriveBlindingFactor: (seed: Uint8Array, keysetId: string, counter: number) => Uint8Array; // @public export function deriveKeysetId(keys: Keys, options?: DeriveKeysetIdOptions): string; // @public (undocumented) export type DeriveKeysetIdOptions = { expiry?: number; input_fee_ppk?: number; unit?: string; versionByte?: number; isDeprecatedBase64?: boolean; }; // @public export function deriveP2BKBlindedPubkeys(pubkeys: string[], eBytes?: Uint8Array): { blinded: string[]; Ehex: string; }; // @public export function deriveP2BKSecretKey(privkey: string | bigint, rBlind: string | bigint, blindPubkey?: Uint8Array, naturalPub?: Uint8Array): string | null; // @public export function deriveP2BKSecretKeys(Ehex: string, privateKey: string | string[], blindPubKey: string | string[]): string[]; // @public @deprecated (undocumented) export const deriveSecret: (seed: Uint8Array, keysetId: string, counter: number) => Uint8Array; // @public export function deriveSecretAndBlindingFactor(seed: Uint8Array, keysetId: string, counter: number): { blindingFactor: Uint8Array; secret: Uint8Array; }; // @public (undocumented) export function deserializeMintKeys(serializedMintKeys: SerializedMintKeys): RawMintKeys; // @public export function deserializeProofs(json: string | string[] | ProofLike[]): Proof[]; // @public (undocumented) export type DeviceStartResponse = { device_code: string; user_code: string; verification_uri: string; verification_uri_complete?: string; interval?: number; expires_in?: number; }; // @public (undocumented) export type DigestInput = Uint8Array | string; // @public (undocumented) export type DLEQ = { s: Uint8Array; e: Uint8Array; r?: bigint; }; // @public (undocumented) export type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc['length']]>; // @public export function findSigningKey(pubkey: string, privkeys: string | string[]): string; // @public export function getDataField(secret: Secret | string): string; // @public export function getDecodedToken(tokenString: string, keysetIds: readonly string[]): Token; // @public export function getDecodedTokenBinary(bytes: Uint8Array): Token; // @public export function getEncodedToken(token: Token, opts?: { removeDleq?: boolean; }): string; // @public export function getEncodedTokenBinary(token: Token): Uint8Array; // @public export function getHTLCWitnessPreimage(witness: Proof['witness']): string | undefined; // @public export type GetInfoResponse = { name: string; pubkey: string; version: string; description?: string; description_long?: string; icon_url?: string; contact: MintContactInfo[]; nuts: { '4': { methods: SwapMethod[]; disabled: boolean; }; '5': { methods: SwapMethod[]; disabled: boolean; }; '7'?: { supported: boolean; }; '8'?: { supported: boolean; }; '9'?: { supported: boolean; }; '10'?: { supported: boolean; }; '11'?: { supported: boolean; }; '12'?: { supported: boolean; }; '14'?: { supported: boolean; }; '15'?: { methods: MPPMethod[]; }; '17'?: { supported: WebSocketSupport[]; }; '19'?: { ttl: number | null; cached_endpoints: Array<{ method: 'GET' | 'POST'; path: string; }>; }; '20'?: { supported: boolean; }; '21'?: { openid_discovery: string; client_id: string; protected_endpoints?: Array<{ method: 'GET' | 'POST'; path: string; }>; }; '22'?: { bat_max_mint: number; protected_endpoints: Array<{ method: 'GET' | 'POST'; path: string; }>; }; '29'?: Nut29Info; }; motd?: string; }; // @public export function getKeysetAmounts(keyset: Keys, order?: 'asc' | 'desc'): Amount[]; // @public (undocumented) export const getKeysetIdInt: (keysetId: string) => bigint; // @public export type GetKeysetsResponse = { keysets: MintKeyset[]; }; // @public export type GetKeysResponse = { keysets: MintKeys[]; }; // @public export function getP2PKExpectedWitnessPubkeys(secretStr: string | Secret): string[]; // @public export function getP2PKSigFlag(secretStr: string | Secret): SigFlag; // @public export function getP2PKWitnessSignatures(witness: Proof['witness']): string[]; // @public (undocumented) export function getPubKeyFromPrivKey(privKey: Uint8Array): Uint8Array<ArrayBufferLike>; // @public export function getSecretData(secret: Secret | string): SecretData; // @public export function getSecretKind(secret: Secret | string): SecretKind; // @public export function getTag(secret: Secret | string, key: string): string[] | undefined; // @public export function getTagInt(secret: Secret | string, key: string): number | undefined; // @public export function getTags(secret: Secret | string): string[][]; // @public export function getTagScalar(secret: Secret | string, key: string): string | undefined; // @public export function getTokenMetadata(token: string): TokenMetadata; // @public export function getValidSigners(signatures: string[], message: string, pubkeys: string[]): string[]; // @public export function hasCorrespondingKey(amount: AmountLike, keyset: Keys): boolean; // @public (undocumented) export function hash_e(pubkeys: Array<WeierstrassPoint<bigint>>): Uint8Array; // @public (undocumented) export function hashToCurve(secret: Uint8Array): WeierstrassPoint<bigint>; // @public export type HasKeysetId = { id: string; }; // @public export type HasKeysetKeys = { id: string; keys: Keys; }; // @public export function hasP2PKSignedProof(pubkey: string, proof: Proof, message?: string): boolean; // @public export function hasTag(secret: Secret | string, key: string): boolean; // @public export function hasValidDleq(proof: Proof, keyset: HasKeysetKeys, opts?: { require?: boolean; }): boolean; // @public export type HTLCWitness = { preimage: string; signatures?: string[]; }; // @public export class HttpResponseError extends CTSError { constructor(message: string, status: number, options?: { cause?: unknown; }); // (undocumented) status: number; } // @public (undocumented) export function injectWebSocketImpl(ws: typeof WebSocket): void; // @public (undocumented) export type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>; // @public export function isHTLCSpendAuthorised(proof: Proof, logger?: Logger, message?: string): boolean; // @public export function isP2PKSpendAuthorised(proof: Proof, logger?: Logger, message?: string): boolean; // @public export const JSONInt: JSONIntApi; // @public (undocumented) export interface JSONIntApi { parse(source: string, reviver?: (this: unknown, key: string, value: unknown) => unknown, options?: { strict?: boolean; fallbackTo?: 'number' | 'string' | 'error'; }): unknown; stringify(value: unknown, replacer?: ((this: unknown, key: string, value: unknown) => unknown) | ReadonlyArray<string | number>, space?: string | number): string | undefined; } // @public (undocumented) export type JsonRpcReqParams = { kind: RpcSubKinds; filters: string[]; subId: string; }; // @public export class KeyChain { constructor(mint: string | Mint, unit: string); get cache(): KeyChainCache; static cacheToMintDTO(cache: KeyChainCache): { keysets: MintKeyset[]; keys: MintKeys[]; }; ensureKeysetKeys(id: string): Promise<Keyset>; static fromCache(mint: string | Mint, unit: string, cache: KeyChainCache): KeyChain; getAllKeys(): MintKeys[]; getAllKeysetIds(): string[]; getCheapestKeyset(): Keyset; getKeyset(id?: string): Keyset; getKeysets(): Keyset[]; init(forceRefresh?: boolean): Promise<void>; loadFromCache(cache: KeyChainCache): void; static mintToCacheDTO(mintUrl: string, allKeysets: MintKeyset[], allKeys: MintKeys[]): KeyChainCache; } // @public export type KeyChainCache = { keysets: KeysetCache[]; mintUrl: string; savedAt?: number; }; // @public export type Keys = { [amount: string]: string; }; // @public (undocumented) export class Keyset { constructor(id: string, unit: string, active: boolean, input_fee_ppk?: number, final_expiry?: number); // (undocumented) get expiry(): number | undefined; // (undocumented) get fee(): number; static fromMintApi(meta: MintKeyset, keys?: MintKeys): Keyset; // (undocumented) get hasHexId(): boolean; // (undocumented) get hasKeys(): boolean; // (undocumented) get id(): string; // (undocumented) get isActive(): boolean; // (undocumented) get keys(): Record<number, string>; set keys(keys: Record<number, string>); toMintKeys(): MintKeys | null; toMintKeyset(): MintKeyset; // (undocumented) get unit(): string; verify(): boolean; static verifyKeysetId(keys: MintKeys): boolean; } // @public export type KeysetCache = MintKeyset & { keys?: Keys; }; // @public (undocumented) export type KeysetPair = { keysetId: string; pubKeys: RawMintKeys; privKeys: RawMintKeys; }; // @public (undocumented) export type LockState = 'PERMANENT' | 'ACTIVE' | 'EXPIRED'; // @public (undocumented) export interface Logger { // (undocumented) debug(message: string, context?: Record<string, unknown>): void; // (undocumented) error(message: string, context?: Record<string, unknown>): void; // (undocumented) info(message: string, context?: Record<string, unknown>): void; // (undocumented) log(level: LogLevel, message: string, context?: Record<string, unknown>): void; // (undocumented) trace(message: string, context?: Record<string, unknown>): void; // (undocumented) warn(message: string, context?: Record<string, unknown>): void; } // @public export type LogLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace'; // @public export function maybeDeriveP2BKPrivateKeys(privateKey: string | string[], proof: Proof): string[]; // @public export const meetsSignerThreshold: (signatures: string[], message: string, pubkeys: string[], threshold?: number) => boolean; // @public export class MeltBuilder<TQuote extends Pick<MeltQuoteBaseResponse, 'amount' | 'quote'> = MeltQuoteBolt11Response> { constructor(wallet: Wallet, method: string, quote: TQuote, proofs: ProofLike[]); asCustom(data: OutputDataLike[]): this; asDeterministic(counter?: number, denoms?: AmountLike[]): this; asFactory(factory: OutputDataFactory, denoms?: AmountLike[]): this; asP2PK(options: P2PKOptions, denoms?: AmountLike[]): this; asRandom(denoms?: AmountLike[]): this; keyset(id: string): this; onCountersReserved(cb: OnCountersReserved): this; prepare(): Promise<MeltPreview<TQuote>>; privkey(k: string | string[]): this; run(): Promise<MeltProofsResponse<TQuote>>; } // @public export class MeltOnchainBuilder { constructor(wallet: Wallet, quote: MeltQuoteOnchainResponse, proofs: ProofLike[]); feeIndex(index: number): this; keyset(id: string): this; privkey(k: string | string[]): this; run(): Promise<MeltProofsResponse<MeltQuoteOnchainResponse>>; } // @public export interface MeltPreview<TQuote extends Pick<MeltQuoteBaseResponse, 'quote'> = MeltQuoteBaseResponse> { inputs: Proof[]; keysetId: string; // (undocumented) method: string; outputData: OutputDataLike[]; quote: TQuote; } // @public export type MeltProofsConfig = { keysetId?: string; privkey?: string | string[]; onCountersReserved?: OnCountersReserved; }; // @public export type MeltProofsResponse<TQuote extends Pick<MeltQuoteBaseResponse, 'quote'> = MeltQuoteBaseResponse> = { quote: TQuote; change: Proof[]; outputData: OutputDataLike[]; }; // @public export type MeltQuoteBaseRequest = { unit: string; request: string; }; // @public export type MeltQuoteBaseResponse = { quote: string; amount: Amount; unit: string; state: MeltQuoteState; expiry: number; change?: SerializedBlindedSignature[]; }; // @public export type MeltQuoteBolt11Request = MeltQuoteBaseRequest & { options?: { amountless?: { amount_msat: AmountLike; }; mpp?: { amount: AmountLike; }; }; }; // @public export type MeltQuoteBolt11Response = MeltQuoteBaseResponse & { request: string; fee_reserve: Amount; payment_preimage: string | null; }; // @public export type MeltQuoteBolt12Request = MeltQuoteBaseRequest & { options?: { amountless?: { amount_msat: AmountLike; }; }; }; // @public export type MeltQuoteBolt12Response = MeltQuoteBolt11Response; // @public export type MeltQuoteOnchainFeeOption = { fee_index: number; fee_reserve: Amount; estimated_blocks: number; }; // @public export type MeltQuoteOnchainRequest = MeltQuoteBaseRequest & { amount: AmountLike; }; // @public export type MeltQuoteOnchainResponse = MeltQuoteBaseResponse & { request: string; fee_options: MeltQuoteOnchainFeeOption[]; selected_fee_index: number | null; outpoint: string | null; }; // @public (undocumented) export const MeltQuoteState: { readonly UNPAID: "UNPAID"; readonly PENDING: "PENDING"; readonly PAID: "PAID"; }; // @public (undocumented) export type MeltQuoteState = (typeof MeltQuoteState)[keyof typeof MeltQuoteState]; // @public export type MeltRequest = { quote: string; inputs: Proof[]; outputs?: SerializedBlindedMessage[]; prefer_async?: boolean; } & Record<string, unknown>; // @public export class Mint { constructor(mintUrl: string, options?: { customRequest?: RequestFn; authProvider?: AuthProvider; logger?: Logger; }); check(checkPayload: CheckStatePayload, customRequest?: RequestFn): Promise<CheckStateResponse>; checkMeltQuote<TRes extends MeltQuoteBaseResponse = MeltQuoteBaseResponse>(method: string, quote: string, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => TRes; }): Promise<TRes>; checkMeltQuoteBolt11(quote: string, customRequest?: RequestFn): Promise<MeltQuoteBolt11Response>; checkMeltQuoteBolt12(quote: string, customRequest?: RequestFn): Promise<MeltQuoteBolt12Response>; checkMeltQuoteOnchain(quote: string, customRequest?: RequestFn): Promise<MeltQuoteOnchainResponse>; checkMintQuote<TRes extends MintQuoteBaseResponse = MintQuoteBaseResponse>(method: string, quote: string, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => TRes; }): Promise<TRes>; checkMintQuoteBolt11(quote: string, customRequest?: RequestFn): Promise<MintQuoteBolt11Response>; checkMintQuoteBolt12(quote: string, customRequest?: RequestFn): Promise<MintQuoteBolt12Response>; checkMintQuoteOnchain(quote: string, customRequest?: RequestFn): Promise<MintQuoteOnchainResponse>; connectWebSocket(): Promise<void>; createMeltQuote<TRes extends MeltQuoteBaseResponse = MeltQuoteBaseResponse>(method: string, payload: Record<string, unknown>, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => TRes; }): Promise<TRes>; createMeltQuoteBolt11(meltQuotePayload: MeltQuoteBolt11Request, customRequest?: RequestFn): Promise<MeltQuoteBolt11Response>; createMeltQuoteBolt12(meltQuotePayload: MeltQuoteBolt12Request, customRequest?: RequestFn): Promise<MeltQuoteBolt12Response>; createMeltQuoteOnchain(meltQuotePayload: MeltQuoteOnchainRequest, customRequest?: RequestFn): Promise<MeltQuoteOnchainResponse>; createMintQuote<TRes extends MintQuoteBaseResponse = MintQuoteBaseResponse>(method: string, payload: Record<string, unknown>, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => TRes; }): Promise<TRes>; createMintQuoteBolt11(mintQuotePayload: MintQuoteBolt11Request, customRequest?: RequestFn): Promise<MintQuoteBolt11Response>; createMintQuoteBolt12(mintQuotePayload: MintQuoteBolt12Request, customRequest?: RequestFn): Promise<MintQuoteBolt12Response>; createMintQuoteOnchain(mintQuotePayload: MintQuoteOnchainRequest, customRequest?: RequestFn): Promise<MintQuoteOnchainResponse>; disconnectWebSocket(): void; getInfo(customRequest?: RequestFn): Promise<GetInfoResponse>; getKeys(keysetId?: string, mintUrl?: string, customRequest?: RequestFn): Promise<GetKeysResponse>; getKeySets(customRequest?: RequestFn): Promise<GetKeysetsResponse>; getLazyMintInfo(customRequest?: RequestFn): Promise<MintInfo>; get lastResponseMetadata(): ResponseMeta | undefined; melt<TRes extends Record<string, unknown> = Record<string, unknown>>(method: string, meltPayload: MeltRequest, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => MeltQuoteBaseResponse & TRes; }): Promise<MeltQuoteBaseResponse & TRes>; meltBolt11(meltPayload: MeltRequest, options?: { customRequest?: RequestFn; }): Promise<MeltQuoteBolt11Response>; meltBolt12(meltPayload: MeltRequest, options?: { customRequest?: RequestFn; }): Promise<MeltQuoteBolt12Response>; meltOnchain(meltPayload: MeltRequest, options?: { customRequest?: RequestFn; }): Promise<MeltQuoteOnchainResponse>; mint<TRes extends Record<string, unknown> = Record<string, unknown>>(method: string, mintPayload: MintRequest, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => MintResponse & TRes; }): Promise<MintResponse & TRes>; mintBatch<TRes extends Record<string, unknown> = Record<string, unknown>>(method: string, mintPayload: BatchMintRequest, options?: { customRequest?: RequestFn; normalize?: (raw: Record<string, unknown>) => MintResponse & TRes; }): Promise<MintResponse & TRes>; mintBatchBolt11(mintPayload: BatchMintRequest, customRequest?: RequestFn): Promise<MintResponse>; mintBatchBolt12(mintPayload: BatchMintRequest, customRequest?: RequestFn): Promise<MintResponse>; mintBolt11(mintPayload: MintRequest, customRequest?: RequestFn): Promise<MintResponse>; mintBolt12(mintPayload: MintRequest, customRequest?: RequestFn): Promise<MintResponse>; mintOnchain(mintPayload: MintRequest, customRequest?: RequestFn): Promise<MintResponse>; // (undocumented) get mintUrl(): string; oidcAuth(opts?: OIDCAuthOptions): Promise<OIDCAuth>; restore(restorePayload: PostRestorePayload, customRequest?: RequestFn): Promise<PostRestoreResponse>; setMintInfo(mintInfo: MintInfo | GetInfoResponse): void; swap(swapPayload: SwapRequest, customRequest?: RequestFn): Promise<SwapResponse>; // (undocumented) get webSocketConnection(): WSConnection | undefined; } // @public export class MintBuilder<M extends MintMethod, HasPrivKey extends boolean = M extends 'bolt12' | 'onchain' ? false : true> { constructor(wallet: Wallet, method: M, amount: AmountLike, quote: MintQuoteFor<M>); asCustom(data: OutputDataLike[]): this; asDeterministic(counter?: number, denoms?: AmountLike[]): this; asFactory(factory: OutputDataFactory, denoms?: AmountLike[]): this; asP2PK(options: P2PKOptions, denoms?: AmountLike[]): this; asRandom(denoms?: AmountLike[]): this; keyset(id: string): this; onCountersReserved(cb: OnCountersReserved): this; prepare(this: MintBuilder<M, true>): Promise<M extends 'bolt11' ? MintPreview<MintQuoteBolt11Response> : M extends 'bolt12' ? MintPreview<MintQuoteBolt12Response> : MintPreview<MintQuoteOnchainResponse>>; privkey(k: string): MintBuilder<M, true>; proofsWeHave(p: Array<Pick<ProofLike, 'amount'>>): this; run(this: MintBuilder<M, true>): Promise<Proof[]>; } // @public (undocumented) export type MintContactInfo = { method: string; info: string; }; // @public (undocumented) export class MintInfo { constructor(info: GetInfoResponse, logger?: Logger); // (undocumented) get cache(): GetInfoResponse; // (undocumented) get contact(): MintContactInfo[]; // (undocumented) get description(): string | undefined; // (undocumented) get description_long(): string | undefined; // (undocumented) isSupported(num: 4 | 5): { disabled: boolean; params: SwapMethod[]; }; // (undocumented) isSupported(num: 7 | 8 | 9 | 10 | 11 | 12 | 14 | 20): { supported: boolean; }; // (undocumented) isSupported(num: 17): { supported: boolean; params?: WebSocketSupport[]; }; // (undocumented) isSupported(num: 15): { supported: boolean; params?: MPPMethod[]; }; // (undocumented) isSupported(num: 19): { supported: boolean; params?: Nut19Policy; }; // (undocumented) isSupported(num: 29): { supported: boolean; params?: Nut29Info; }; // (undocumented) get motd(): string | undefined; // (undocumented) get name(): string; // (undocumented) static normalizeInfo(info: GetInfoResponse, logger?: Logger): GetInfoResponse; // (undocumented) get nuts(): { '4': { methods: SwapMethod[]; disabled: boolean; }; '5': { methods: SwapMethod[]; disabled: boolean; }; '7'?: { supported: boolean; }; '8'?: { supported: boolean; }; '9'?: { supported: boolean; }; '10'?: { supported: boolean; }; '11'?: { supported: boolean; }; '12'?: { supported: boolean; }; '14'?: { supported: boolean; }; '15'?: { methods: MPPMethod[]; }; '17'?: { supported: WebSocketSupport[]; }; '19'?: { ttl: number | null; cached_endpoints: Array<{ method: "GET" | "POST"; path: string; }>; }; '20'?: { supported: boolean; }; '21'?: { openid_discovery: string; client_id: string; protected_endpoints?: Array<{ method: "GET" | "POST"; path: string; }>; }; '22'?: { bat_max_mint: number; protected_endpoints: Array<{ method: "GET" | "POST"; path: string; }>; }; '29'?: Nut29Info; }; // (undocumented) get pubkey(): string; // (undocumented) requiresBlindAuthToken(method: 'GET' | 'POST', path: string): boolean; // (undocumented) requiresClearAuthToken(method: 'GET' | 'POST', path: string): boolean; // (undocumented) supportsAmountless(method?: string, unit?: string): boolean; supportsMintMeltMethod(op: 'mint' | 'melt', method: string, unit: string): boolean; supportsNut04Description(method: 'bolt11' | 'bolt12', unit?: string): boolean; // (undocumented) get version(): string; } // @public export type MintKeys = { id: string; unit: string; active?: boolean; input_fee_ppk?: number; final_expiry?: number; keys: Keys; }; // @public export type MintKeyset = { id: string; unit: string; active: boolean; input_fee_ppk?: number; final_expiry?: number; }; // @public (undocumented) export type MintMethod = 'bolt11' | 'bolt12' | 'onchain'; // @public export class MintOperationError extends HttpResponseError { constructor(code: number, detail: string); // (undocumented) code: number; } // @public export interface MintPreview<TQuote extends Pick<MintQuoteBaseResponse, 'quote'> = MintQuoteBaseResponse> { keysetId: string; // (undocumented) method: string; outputData: OutputDataLike[]; payload: MintRequest; quote: TQuote; } // @public export type MintProofsConfig = { keysetId?: string; privkey?: string | string[]; proofsWeHave?: Array<Pick<ProofLike, 'amount'>>; onCountersReserved?: OnCountersReserved; }; // @public export type MintQuoteBaseRequest = { unit: string; pubkey?: string; }; // @public export type MintQuoteBaseResponse = { quote: string; request: string; unit: string; pubkey?: string; }; // @public export type MintQuoteBolt11Request = MintQuoteBaseRequest & { amount: AmountLike; description?: string; }; // @public export type MintQuoteBolt11Response = MintQuoteBaseResponse & { amount: Amount; state: MintQuoteState; expiry: number | null; }; // @public export type MintQuoteBolt12Request = MintQuoteBaseRequest & { amount?: AmountLike; description?: string; }; // @public export type MintQuoteBolt12Response = MintQuoteBaseResponse & { amount: Amount | null; expiry: number | null; pubkey: string; amount_paid: Amount; amount_issued: Amount; }; // @public (undocumented) export type MintQuoteFor<M extends MintMethod> = M extends 'bolt11' ? string | MintQuoteBolt11Response : M extends 'bolt12' ? MintQuoteBolt12Response : MintQuoteOnchainResponse; // @public export type MintQuoteOnchainRequest = MintQuoteBaseRequest & { pubkey: string; }; // @public export type MintQuoteOnchainResponse = MintQuoteBaseResponse & { expiry: number | null; pubkey: string; amount_paid: Amount; amount_issued: Amount; }; // @public (undocumented) export const MintQuoteState: { readonly UNPAID: "UNPAID"; readonly PAID: "PAID"; readonly ISSUED: "ISSUED"; }; // @public (undocumented) export type MintQuoteState = (typeof MintQuoteState)[keyof typeof MintQuoteState]; // @public export type MintRequest = { quote: string; outputs: SerializedBlindedMessage[]; signature?: string; }; // @public export type MintResponse = { signatures: SerializedBlindedSignature[]; }; // @public export type MPPMethod = { method: string; unit: string; }; // @public export class NetworkError extends CTSError { constructor(message: string, options?: { cause?: unknown; }); } // @public export function normalizeProofAmounts(raw: ProofLike[]): Proof[]; // @public export type NUT10Option = { kind: string; data: string; tags: string[][]; }; // @public (undocumented) export type Nut19Policy = { ttl: number; cached_endpoints: Array<{ method: 'GET' | 'POST'; path: string; }>; }; // @public export type Nut29Info = { methods?: string[]; max_batch_size?: number; }; // @public (undocumented) export class OIDCAuth { constructor(discoveryUrl: string, opts?: OIDCAuthOptions); addTokenListener(fn: (t: TokenResponse) => void | Promise<void>): void; buildAuthCodeUrl(input: { redirectUri: string; codeChallenge: string; codeChallengeMethod?: 'S256' | 'plain'; state?: string; scope?: string; }): Promise<string>; // (undocumented) devicePoll(device_code: string, intervalSec?: number): Promise<TokenResponse>; // (undocumented) deviceStart(): Promise<DeviceStartResponse>; exchangeAuthCode(input: { code: string; redirectUri: string; codeVerifier: string; }): Promise<TokenResponse>; // (undocumented) static fromMintInfo(info: { nuts: GetInfoResponse['nuts']; }, opts?: OIDCAuthOptions): OIDCAuth; generatePKCE(): { verifier: string; challenge: string; }; // (undocumented) loadConfig(): Promise<OIDCConfig>; // (undocumented) passwordGrant(username: string, password: string): Promise<TokenResponse>; // (undocumented) refresh(refresh_token: string): Promise<TokenResponse>; // (undocumented) setClient(id: string): void; // (undocumented) setScope(scope?: string): void; startDeviceAuth(intervalSec?: number): Promise<DeviceStartResponse & { poll: () => Promise<TokenResponse>; cancel: () => void; }>; } // @public (undocumented) export type OIDCAuthOptions = { clientId?: string; scope?: string; logger?: Logger; onTokens?: (t: TokenResponse) => void | Promise<void>; }; // @public (undocumented) export type OIDCConfig = { issuer: string; authorization_endpoint?: string; token_endpoint: string; device_authorization_endpoint?: string; }; // @public (undocumented) export type OnCountersReserved = (info: OperationCounters) => void; // @public export type OperationCounters = { keysetId: string; start: number; count: number; next: number; }; // @public export interface OutputConfig { // (undocumented) keep?: OutputType; // (undocumented) send: OutputType; } // @public (undocumented) export class OutputData implements OutputDataLike { constructor(blindedMessage: SerializedBlindedMessage, blindingFactor: bigint, secret: Uint8Array, ephemeralE?: string); // (undocumented) blindedMessage: SerializedBlindedMessage; // (undocumented) blindingFactor: bigint; // (undocumented) static createDeterministicData(amount: AmountLike, seed: Uint8Array, counter: number, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputData[]; // (undocumented) static createP2PKData(p2pk: P2PKOptions, amount: AmountLike, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputData[]; // (undocumented) static createRandomData(amount: AmountLike, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputData[]; // (undocumented) static createSingleDeterministicData(amount: AmountLike, seed: Uint8Array, counter: number, keysetId: string): OutputData; // (undocumented) static createSingleP2PKData(p2pk: P2PKOptions, amount: AmountLike, keysetId: string): OutputData; // (undocumented) static createSingleRandomData(amount: AmountLike, keysetId: string): OutputData; static deserialize(serialized: SerializedOutputData): OutputData; // (undocumented) ephemeralE?: string; // (undocumented) secret: Uint8Array; static serialize(output: OutputDataLike): SerializedOutputData; static sumOutputAmounts(outputs: OutputDataLike[]): Amount; // (undocumented) toProof(sig: SerializedBlindedSignature, keyset: HasKeysetKeys): Proof; } // @public export interface OutputDataCreator { // (undocumented) createDeterministicData(amount: AmountLike, seed: Uint8Array, counter: number, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputDataLike[]; // (undocumented) createP2PKData(p2pk: P2PKOptions, amount: AmountLike, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputDataLike[]; // (undocumented) createRandomData(amount: AmountLike, keyset: HasKeysetKeys, customSplit?: AmountLike[]): OutputDataLike[]; // (undocumented) createSingleDeterministicData(amount: AmountLike, seed: Uint8Array, counter: number, keysetId: string): OutputDataLike; // (undocumented) createSingleP2PKData(p2pk: P2PKOptions, amount: AmountLike, keysetId: string): OutputDataLike; // (undocumented) createSingleRandomData(amount: AmountLike, keysetId: string): OutputDataLike; } // @public export type OutputDataFactory = (amount: AmountLike, keys: HasKeysetKeys) => OutputDataLike; // @public export interface OutputDataLike { // (undocumented) blindedMessage: SerializedBlindedMessage; // (undocumented) blindingFactor: bigint; // (undocumented) ephemeralE?: string; // (undocumented) secret: Uint8Array; // (undocumented) toProof: (signature: SerializedBlindedSignature, keyset: HasKeysetKeys) => Proof; } // @public export type OutputType = ({ type: 'random'; } & SharedOutputTypeProps) | ({ type: 'deterministic'; counter: number; } & SharedOutputTypeProps) | ({ type: 'p2pk'; options: P2PKOptions; } & SharedOutputTypeProps) | ({ type: 'factory'; factory: OutputDataFactory; } & SharedOutputTypeProps) | { type: 'custom'; data: OutputDataLike[]; }; // @public export const P2BK_DST: Uint8Array<ArrayBufferLike>; // @public (undocumented) export class P2PKBuilder { addHashlock(hashlock: string): this; // (undocumented) addLockPubkey(pk: string | string[]): this; // (undocumented) addRefundPubkey(pk: string | string[]): this; // (undocumented) addTag(key: string, values?: string[] | string): this; // (undocumented) addTags(tags: P2PKTag[]): this; // (undocumented) blindKeys(): this; // (undocumented) static fromOptions(opts: P2PKOptions): P2PKBuilder; // (undocumented) lockUntil(when: Date | number): this; // (undocumented) requireLockSignatures(n: number): this; // (undocumented) requireRefundSignatures(n: number): this; // (undocumented) sigAll(): this; // (undocumented) toOptions(): P2PKOptions; } // @public export type P2PKOptions = { pubkey: string | string[]; locktime?: number; refundKeys?: string[]; requiredSignatures?: number; requiredRefundSignatures?: number; additionalTags?: P2PKTag[]; blindKeys?: boolean; sigFlag?: SigFlag; hashlock?: string; }; // @public export interface P2PKPathInfo { pubkeys: string[]; receivedSigners: string[]; requiredSigners: number; } // @public (undocumented) export type P2PKSpendingPath = 'MAIN' | 'REFUND' | 'UNLOCKED' | 'FAILED'; // @public export type P2PKTag = [key: string, ...values: string[]]; // @public (undocumented) export interface P2PKVerificationResult { lockState: LockState; locktime: number; main: P2PKPathInfo; path: P2PKSpendingPath; refund: P2PKPathInfo; success: boolean; } // @public export type P2PKWitness = { signatures?: string[]; }; // @public export function parseHTLCSecret(secret: string | Secret): Secret; // @public export function parseP2PKSecret(secret: string | Secret): Secret; // @public export function parseSecret(secret: string | Secret): Secret; // @public (undocumented) class PaymentRequest_2 { constructor(transport?: PaymentRequestTransport[] | undefined, id?: string | undefined, amount?: AmountLike, unit?: string | undefined, mints?: string[] | undefined, description?: string | undefined, singleUse?: boolean, nut10?: NUT10Option | undefined); // (undocumented) amount?: Amount; // (undocumented) description?: string | undefined; // (undocumented) static fromEncodedRequest(encodedRequest: string): PaymentRequest_2; static fromRawRequest(rawPaymentRequest: RawPaymentRequest): PaymentRequest_2; // (undocumented) getTransport(type: PaymentRequestTransportType): PaymentRequestTransport | undefined; // (undocumented) id?: string | undefined; // (undocumented) mints?: string[] | undefined; // (undocumented) nut10?: NUT10Option | undefined; // (undocumented) singleUse: boolean; toEncodedCreqA(): string; toEncodedCreqB(): string; // (undocumented) toEncodedRequest(): string; // (undocumented) toRawRequest(): RawPaymentRequest; // (undocumented) transport?: PaymentRequestTransport[] | undefined; // (undocumented) unit?: string | undefined; } export { PaymentRequest_2 as PaymentRequest } // @public (undocumented) export type PaymentRequestPayload = { id?: string; memo?: string; unit: string; mint: string; proofs: Proof[]; }; // @public (undocumented) export type PaymentRequestTransport = { type: PaymentRequestTransportType; target: string; tags?: string[][]; }; // @public (undocumented) export enum PaymentRequestTransportType { // (undocumented) NOSTR = "nostr", // (undocumented) POST = "post" } // @public (undocumented) export function pointFromBytes(bytes: Uint8Array): WeierstrassPoint<bigint>; // @public (undocumented) export function pointFromHex(hex: string): WeierstrassPoint<bigint>; // @public export type PostRestorePayload = { outputs: SerializedBlindedMessage[]; }; // @public export type PostRestoreResponse = { outputs: SerializedBlindedMessage[]; signatures: SerializedBlindedSignature[]; }; // @public (undocumented) export type PrepareMeltConfig = MeltProofsConfig & { nut08Change?: boolean; }; // @public export type PrivKey = Uint8Array | string; // @public export type Proof = { id: string; amount: Amount; secret: string; C: string; dleq?: SerializedDLEQ; p2pk_e?: string; witness?: string | P2PKWitness | HTLCWitness; }; // @public export type ProofLike = Omit<Proof, 'amount'> & { amount: AmountLike; }; // @public export type ProofState = { Y: string; state: CheckStateEnum; witness: string | null; }; // @public export class RateLimitError extends HttpResponseError { constructor(message: string, retryAfterMs?: number | undefined); // (undocumented) readonly retryAfterMs?: number | undefined; } // @public (undocumented) export type RawBlindedMessage = { B_: WeierstrassPoint<bigint>; r: bigint; secret: Uint8Array; }; // @public (undocumented) export type RawMintKeys = { [k: string]: Uint8Array; }; // @public (undocumented) export type RawNUT10Option = { k: string; d: string; t: string[][]; }; // @public (undocumented) export type RawPaymentRequest = { i?: string; a?: number | bigint; u?: string; s?: boolean; m?: string[]; d?: string; t?: RawTransport[]; nut10?: RawNUT10Option; }; // @public (undocumented) export type RawTransport = { t: PaymentRequestTransportType; a: string; g?: string[][]; }; // @public export class ReceiveBuilder { constructor(wallet: Wallet, token: Token | string | ProofLike[]); asCustom(data: OutputDataLike[]): this; asDeterministic(counter?: number, denoms?: AmountLike[]): this; asFactory(factory: OutputDataFactory, denoms?: AmountLike[]): this; asP2PK(options: P2PKOptions, denoms?: AmountLike[]): this; asRandom(denoms?: AmountLike[]): this; keyset(id: string): this; onCountersReserved(cb: OnCountersReserved): this; prepare(): Promise<SwapPreview>; privkey(k: string | string[]): this; proofsWeHave(p: Array<Pick<ProofLike, 'amount'>>): this; requireDleq(on?: boolean): this; run(): Promise<Proof[]>; } // @public export type ReceiveConfig = { keysetId?: string; privkey?: string | string[]; requireDleq?: boolean; proofsWeHave?: Array<Pick<ProofLike, 'amount'>>; onCountersReserved?: OnCountersReserved; }; // @public (undocumented) export type RequestArgs = { endpoint: string; requestBody?: Record<string, unknown>; headers?: Record<string, string>; logger?: Logger; }; //